本文整理汇总了Python中boto.ec2.blockdevicemapping.BlockDeviceType.snapshot_id方法的典型用法代码示例。如果您正苦于以下问题:Python BlockDeviceType.snapshot_id方法的具体用法?Python BlockDeviceType.snapshot_id怎么用?Python BlockDeviceType.snapshot_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto.ec2.blockdevicemapping.BlockDeviceType
的用法示例。
在下文中一共展示了BlockDeviceType.snapshot_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register_snapshot_by_id
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def register_snapshot_by_id( self, snap_id, rdn="/dev/sda1", description="bfebs", windows=False, bdmdev=None, name=None, ramdisk=None, kernel=None, dot=True ):
'''
Register an image snapshot
snap_id (mandatory string) snapshot id
name (mandatory string) name of image to be registered
description (optional string) description of image to be registered
bdmdev (optional string) block-device-mapping device for image
rdn (optional string) root-device-name for image
dot (optional boolean) Delete On Terminate boolean
windows (optional boolean) Is windows image boolean
kernel (optional string) kernal (note for windows this name should be "windows"
'''
if (bdmdev is None):
bdmdev=rdn
if (name is None):
name="bfebs_"+ snap_id
if ( windows is True ) and ( kernel is not None):
kernel="windows"
bdmap = BlockDeviceMapping()
block_dev_type = BlockDeviceType()
block_dev_type.snapshot_id = snap_id
block_dev_type.delete_on_termination = dot
bdmap[bdmdev] = block_dev_type
self.debug("Register image with: snap_id:"+str(snap_id)+", rdn:"+str(rdn)+", desc:"+str(description)+", windows:"+str(windows)+", bdname:"+str(bdmdev)+", name:"+str(name)+", ramdisk:"+str(ramdisk)+", kernel:"+str(kernel))
image_id = self.ec2.register_image(name=name, description=description, kernel_id=kernel, ramdisk_id=ramdisk, block_device_map=bdmap, root_device_name=rdn)
self.debug("Image now registered as " + image_id)
return image_id
示例2: test_create_launch_configuration_with_block_device_mappings
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def test_create_launch_configuration_with_block_device_mappings():
block_device_mapping = BlockDeviceMapping()
ephemeral_drive = BlockDeviceType()
ephemeral_drive.ephemeral_name = 'ephemeral0'
block_device_mapping['/dev/xvdb'] = ephemeral_drive
snapshot_drive = BlockDeviceType()
snapshot_drive.snapshot_id = "snap-1234abcd"
snapshot_drive.volume_type = "standard"
block_device_mapping['/dev/xvdp'] = snapshot_drive
ebs_drive = BlockDeviceType()
ebs_drive.volume_type = "io1"
ebs_drive.size = 100
ebs_drive.iops = 1000
ebs_drive.delete_on_termination = False
block_device_mapping['/dev/xvdh'] = ebs_drive
conn = boto.connect_autoscale(use_block_device_types=True)
config = LaunchConfiguration(
name='tester',
image_id='ami-abcd1234',
instance_type='m1.small',
key_name='the_keys',
security_groups=["default", "default2"],
user_data="This is some user_data",
instance_monitoring=True,
instance_profile_name='arn:aws:iam::123456789012:instance-profile/testing',
spot_price=0.1,
block_device_mappings=[block_device_mapping]
)
conn.create_launch_configuration(config)
launch_config = conn.get_all_launch_configurations()[0]
launch_config.name.should.equal('tester')
launch_config.image_id.should.equal('ami-abcd1234')
launch_config.instance_type.should.equal('m1.small')
launch_config.key_name.should.equal('the_keys')
set(launch_config.security_groups).should.equal(set(['default', 'default2']))
launch_config.user_data.should.equal("This is some user_data")
launch_config.instance_monitoring.enabled.should.equal('true')
launch_config.instance_profile_name.should.equal('arn:aws:iam::123456789012:instance-profile/testing')
launch_config.spot_price.should.equal(0.1)
len(launch_config.block_device_mappings).should.equal(3)
returned_mapping = launch_config.block_device_mappings
set(returned_mapping.keys()).should.equal(set(['/dev/xvdb', '/dev/xvdp', '/dev/xvdh']))
returned_mapping['/dev/xvdh'].iops.should.equal(1000)
returned_mapping['/dev/xvdh'].size.should.equal(100)
returned_mapping['/dev/xvdh'].volume_type.should.equal("io1")
returned_mapping['/dev/xvdh'].delete_on_termination.should.be.false
returned_mapping['/dev/xvdp'].snapshot_id.should.equal("snap-1234abcd")
returned_mapping['/dev/xvdp'].volume_type.should.equal("standard")
returned_mapping['/dev/xvdb'].ephemeral_name.should.equal('ephemeral0')
示例3: _parse_block_device_mappings
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def _parse_block_device_mappings(user_input):
"""
Parse block device mappings per AWS CLI tools syntax (modified to add IOPS)
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html
Syntax:
/dev/xvd[a-z]=[snapshot-id|ephemeral]:[size in GB]:[Delete on Term]:[IOPS]
- Leave inapplicable fields blank
- Delete on Termination defaults to True
- IOPS limits are not validated
- EBS sizing is not validated
Mount an Ephemeral Drive:
/dev/xvdb1=ephemeral0
Mount multiple Ephemeral Drives:
/dev/xvdb1=ephemeral0,/dev/xvdb2=ephemeral1
Mount a Snapshot:
/dev/xvdp=snap-1234abcd
Mount a Snapshot to a 100GB drive:
/dev/xvdp=snap-1234abcd:100
Mount a Snapshot to a 100GB drive and do not delete on termination:
/dev/xvdp=snap-1234abcd:100:false
Mount a Fresh 100GB EBS device
/dev/xvdp=:100
Mount a Fresh 100GB EBS Device and do not delete on termination:
/dev/xvdp=:100:false
Mount a Fresh 100GB EBS Device with 1000 IOPS
/dev/xvdp=:100::1000
"""
block_device_map = BlockDeviceMapping()
mappings = user_input.split(",")
for mapping in mappings:
block_type = BlockDeviceType()
mount_point, drive_type, size, delete, iops = _parse_drive_mapping(mapping)
if 'ephemeral' in drive_type:
block_type.ephemeral_name = drive_type
elif 'snap' in drive_type:
block_type.snapshot_id = drive_type
block_type.volume_type = "standard"
else:
block_type.volume_type = "standard"
block_type.size = size
block_type.delete_on_termination = delete
if iops:
block_type.iops = iops
block_type.volume_type = "io1"
block_device_map[mount_point] = block_type
return block_device_map
示例4: vol2ami
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def vol2ami(self, volume_id, name, description=None):
snap = self.ctxt.cnx_ec2.create_snapshot(volume_id, 'boto snapshot for %s' % name)
block_map = BlockDeviceMapping()
sda = BlockDeviceType()
sda.snapshot_id = snap.id
sda.ebs = True
root_device_name = '/dev/sda1'
block_map[root_device_name] = sda
return self.ctxt.cnx_ec2.register_image(name=name, architecture='x86_64', root_device_name=root_device_name, block_device_map=block_map, description=description)
示例5: _process_block_device_mappings
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def _process_block_device_mappings(self, launch_config, zone=None):
"""
Processes block device mapping information
and returns a Boto BlockDeviceMapping object. If new volumes
are requested (source is None and destination is VOLUME), they will be
created and the relevant volume ids included in the mapping.
"""
bdm = BlockDeviceMapping()
# Assign letters from f onwards
# http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
next_letter = iter(list(string.ascii_lowercase[6:]))
# assign ephemeral devices from 0 onwards
ephemeral_counter = 0
for device in launch_config.block_devices:
bd_type = BlockDeviceType()
if device.is_volume:
if device.is_root:
bdm['/dev/sda1'] = bd_type
else:
bdm['sd' + next(next_letter)] = bd_type
if isinstance(device.source, Snapshot):
bd_type.snapshot_id = device.source.id
elif isinstance(device.source, Volume):
bd_type.volume_id = device.source.id
elif isinstance(device.source, MachineImage):
# Not supported
pass
else:
# source is None, but destination is volume, therefore
# create a blank volume. If the Zone is None, this
# could fail since the volume and instance may be created
# in two different zones.
if not zone:
raise InvalidConfigurationException(
"A zone must be specified when launching with a"
" new blank volume block device mapping.")
new_vol = self.provider.block_store.volumes.create(
'',
device.size,
zone)
bd_type.volume_id = new_vol.id
bd_type.delete_on_terminate = device.delete_on_terminate
if device.size:
bd_type.size = device.size
else: # device is ephemeral
bd_type.ephemeral_name = 'ephemeral%s' % ephemeral_counter
return bdm
示例6: clone_instance
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def clone_instance(instance):
new_bdm = None
ec2 = instance.connection
if instance.block_device_mapping:
root_device_name = instance.get_attribute('rootDeviceName')['rootDeviceName']
user_data = instance.get_attribute('userData')['userData']
# user_data comes back base64 encoded. Need to decode it so it
# can get re-encoded by run_instance !
user_data = base64.b64decode(user_data)
new_bdm = BlockDeviceMapping()
for dev in instance.block_device_mapping:
# if this entry is about the root device, skip it
if dev != root_device_name:
bdt = instance.block_device_mapping[dev]
if bdt.volume_id:
volume = ec2.get_all_volumes([bdt.volume_id])[0]
snaps = volume.snapshots()
if len(snaps) == 0:
print 'No snapshots available for %s' % volume.id
else:
# sort the list of snapshots, newest is at the end now
snaps.sort(key=lambda snap: snap.start_time)
latest_snap = snaps[-1]
new_bdt = BlockDeviceType()
new_bdt.snapshot_id = latest_snap.id
new_bdm[dev] = new_bdt
return ec2.run_instances(
instance.image_id,
key_name=instance.key_name,
security_groups=[g.name for g in instance.groups],
user_data=user_data,
instance_type=instance.instance_type,
kernel_id=instance.kernel,
ramdisk_id=instance.ramdisk,
monitoring_enabled=instance.monitored,
placement=instance.placement,
block_device_map=new_bdm
).instances[0]
示例7: _parse_block_device_mappings
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def _parse_block_device_mappings(self):
block_device_map = BlockDeviceMapping()
for mapping in self.block_device_mapping_dict:
block_type = BlockDeviceType()
mount_point = mapping.get('device_name')
if 'ephemeral' in mapping.get('virtual_name', ''):
block_type.ephemeral_name = mapping.get('virtual_name')
else:
block_type.volume_type = mapping.get('ebs._volume_type')
block_type.snapshot_id = mapping.get('ebs._snapshot_id')
block_type.delete_on_termination = mapping.get('ebs._delete_on_termination')
block_type.size = mapping.get('ebs._volume_size')
block_type.iops = mapping.get('ebs._iops')
block_device_map[mount_point] = block_type
return block_device_map
示例8: register
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def register(snapshot_id, region, arch, size=None, name=None, desc=None, pvm=False):
conn = utils.connect(region)
if None in (name, size):
log.debug('getting snapshot - %s', snapshot_id)
snapshot = conn.get_all_snapshots(snapshot_ids=[snapshot_id])[0]
size = size if size else snapshot.volume_size
name = name if name else snapshot.description
virt = 'hvm'
kernel_id = None
device_base = '/dev/xvd'
ec2_arch = "x86_64" if arch == "amd64" else arch
if pvm:
kernel_id = utils.get_kernel(region, arch)
virt = 'paravirtual'
device_base = '/dev/sd'
name += '-pvm'
log.debug('creating block_device_map')
block_device_map = BlockDeviceMapping()
rootfs = BlockDeviceType()
rootfs.delete_on_termination = True
rootfs.size = size
rootfs.snapshot_id = snapshot_id
rootfs_device_name = device_base + 'a'
block_device_map[rootfs_device_name] = rootfs
ephemeral = BlockDeviceType()
ephemeral.ephemeral_name = 'ephemeral0'
ephemeral_device_name = device_base + 'b'
block_device_map[ephemeral_device_name] = ephemeral
log.debug('registering image - %s', name)
ami_id = conn.register_image(
name=name,
description=desc,
kernel_id=kernel_id,
architecture=ec2_arch,
root_device_name=rootfs_device_name,
block_device_map=block_device_map,
virtualization_type=virt)
log.info('registered image - %s %s %s', ami_id, name, region)
return ami_id, name
示例9: capture
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def capture(self):
volume = self.ec2.get_all_volumes(filters={
'attachment.instance-id': self.instance.id,
'attachment.device': self.root_device,
})[0]
snapshot = self.ec2.create_snapshot(volume.id)
sys.stdout.write("waiting for snapshot to complete ..")
while snapshot.status != 'completed':
sys.stdout.write(".")
sys.stdout.flush()
time.sleep(5)
snapshot.update()
sys.stdout.write("\n")
# create EBS mapping
device = BlockDeviceType()
device.snapshot_id = snapshot.id
mapping = BlockDeviceMapping()
mapping['/dev/sda'] = device
self.get_instance_kernel()
image = self.ec2.register_image(name=self.name, description=self.name,
architecture=self.arch, kernel_id=self.instance_kernel.id,
root_device_name='/dev/sda', block_device_map=mapping)
if self.settings["target/permission"] == "public":
self.ec2.modify_image_attribute(image, groups='all')
with open(self.settings["path/mirror/target"], "w") as fd:
cmd = [
"ec2-run-instances",
"--region", self.region,
"--instance-type", "t1.micro",
image,
]
fd.write(" ".join(cmd))
fd.write("\n")
示例10: register
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def register(snapshot_id, region, size=None, arch=None, name=None, desc=None):
conn = utils.connect(region)
log.debug('getting snapshot - %s', snapshot_id)
snapshot = conn.get_all_snapshots(snapshot_ids=[snapshot_id])[0]
size = size if size else snapshot.volume_size
name = name if name else snapshot.description
desc = desc if desc else utils.parse_imagename(name)['url']
arch = arch if arch else utils.parse_imagename(name)['architecture']
kernel_id = utils.get_kernel(region, arch)
arch_ec2 = "x86_64" if arch == "amd64" else arch
log.debug('creating block_device_map')
rootfs = BlockDeviceType()
rootfs.delete_on_termination = True
rootfs.size = size
rootfs.snapshot_id = snapshot_id
ephemeral = BlockDeviceType()
ephemeral.ephemeral_name = 'ephemeral0'
block_device_map = BlockDeviceMapping()
block_device_map['/dev/sda1'] = rootfs
block_device_map['/dev/sda2'] = ephemeral
log.debug('registering image - %s', name)
ami_id = conn.register_image(
name=name,
description=desc,
architecture=arch_ec2,
kernel_id=kernel_id,
root_device_name="/dev/sda1",
block_device_map=block_device_map)
log.info('registered image - %s %s %s', ami_id, name, region)
return ami_id
示例11: register
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def register(snapshot_id, region, arch, size=None, name=None, desc=None):
conn = utils.connect(region)
if None in (name, size):
log.debug("getting snapshot - %s", snapshot_id)
snapshot = conn.get_all_snapshots(snapshot_ids=[snapshot_id])[0]
size = size if size else snapshot.volume_size
name = name if name else snapshot.description
ec2_arch = "x86_64" if arch == "amd64" else arch
log.debug("creating block_device_map")
block_device_map = BlockDeviceMapping()
rootfs = BlockDeviceType()
rootfs.delete_on_termination = True
rootfs.size = size
rootfs.snapshot_id = snapshot_id
rootfs_device_name = "/dev/xvda"
block_device_map[rootfs_device_name] = rootfs
ephemeral = BlockDeviceType()
ephemeral.ephemeral_name = "ephemeral0"
ephemeral_device_name = "/dev/xvdb"
block_device_map[ephemeral_device_name] = ephemeral
log.debug("registering image - %s", name)
ami_id = conn.register_image(
name=name,
description=desc,
architecture=ec2_arch,
root_device_name=rootfs_device_name,
block_device_map=block_device_map,
virtualization_type="hvm",
)
log.info("registered image - %s %s %s", ami_id, name, region)
return ami_id, name
示例12: parse_block_device_args
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def parse_block_device_args(self, block_device_maps_args):
block_device_map = BlockDeviceMapping()
for block_device_map_arg in block_device_maps_args:
parts = block_device_map_arg.split('=')
if len(parts) > 1:
device_name = parts[0]
block_dev_type = BlockDeviceType()
value_parts = parts[1].split(':')
if value_parts[0].startswith('snap'):
block_dev_type.snapshot_id = value_parts[0]
else:
if value_parts[0].startswith('ephemeral'):
block_dev_type.ephemeral_name = value_parts[0]
if len(value_parts) > 1:
try:
block_dev_type.size = int(value_parts[1])
except ValueError:
pass
if len(value_parts) > 2:
if value_parts[2] == 'true':
block_dev_type.delete_on_termination = True
block_device_map[device_name] = block_dev_type
return block_device_map
示例13: get_block_device_map
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def get_block_device_map(bdmapping_json=None):
"""Parse block_device_mapping JSON and return a configured BlockDeviceMapping object
Mapping JSON structure...
{"/dev/sda":
{"snapshot_id": "snap-23E93E09", "volume_type": null, "delete_on_termination": true, "size": 1} }
"""
if bdmapping_json:
mapping = json.loads(bdmapping_json)
if mapping:
bdm = BlockDeviceMapping()
for key, val in mapping.items():
device = BlockDeviceType()
if val.get('virtual_name') is not None and val.get('virtual_name').startswith('ephemeral'):
device.ephemeral_name = val.get('virtual_name')
else:
device.volume_type = 'standard'
device.snapshot_id = val.get('snapshot_id') or None
device.size = val.get('size')
device.delete_on_termination = val.get('delete_on_termination', False)
bdm[key] = device
return bdm
return None
return None
示例14: __update_bdm
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def __update_bdm(self, bdm, bd_spec):
"""Update the BlockDeviceMapping bdm with the block device
spec bd_spec.
"""
try:
dev_name, dev_value = bd_spec.split('=', 1)
except Exception:
raise CommandError(
"Block device spec missing '=' : %s" % (bd_spec,))
dot = None
bdt = BlockDeviceType()
if ':' in dev_value:
blockdev_origin, dot = dev_value.split(':', 1)
else:
blockdev_origin = dev_value
if blockdev_origin is None:
raise CommandError("No source specified for %s" % (dev_name,))
if blockdev_origin.startswith('ephemeral'):
bdt.ephemeral_name = blockdev_origin
elif blockdev_origin.startswith('snap-'):
bdt.snapshot_id = blockdev_origin
else:
raise CommandError("Bad source specified for %s: %s" % (dev_name,
blockdev_origin))
if dot is not None:
if dot == 'delete':
bdt.delete_on_termination = True
elif dot == 'nodelete':
bdt.delete_on_termination = False
else:
raise CommandError(
"Bad delete-on-termination specified for %s: %s" %
(dev_name, dot))
else:
bdt.delete_on_termination = False
dev_path = '/dev/' + dev_name
bdm[dev_path] = bdt
示例15: handleImages
# 需要导入模块: from boto.ec2.blockdevicemapping import BlockDeviceType [as 别名]
# 或者: from boto.ec2.blockdevicemapping.BlockDeviceType import snapshot_id [as 别名]
def handleImages(self, action, clc, callback=None):
if action == "DescribeImages":
owner = self.get_argument("Owner", None)
if not owner:
owners = None
else:
owners = [owner]
filters = self.get_filter_args()
return clc.get_all_images(owners, filters, callback)
elif action == "DescribeImageAttribute":
imageid = self.get_argument("ImageId")
attribute = self.get_argument("Attribute")
return clc.get_image_attribute(imageid, attribute, callback)
elif action == "ModifyImageAttribute":
imageid = self.get_argument("ImageId")
attribute = self.get_argument("Attribute")
operation = self.get_argument("OperationType")
users = self.get_argument_list("UserId")
groups = self.get_argument_list("UserGroup")
return clc.modify_image_attribute(imageid, attribute, operation, users, groups, callback)
elif action == "ResetImageAttribute":
imageid = self.get_argument("ImageId")
attribute = self.get_argument("Attribute")
return clc.reset_image_attribute(imageid, attribute, callback)
elif action == "DeregisterImage":
image_id = self.get_argument("ImageId")
return clc.deregister_image(image_id, callback)
elif action == "RegisterImage":
image_location = self.get_argument("ImageLocation", None)
name = self.get_argument("Name")
description = self.get_argument("Description", None)
if description != None:
description = base64.b64decode(description)
architecture = self.get_argument("Architecture", None)
kernel_id = self.get_argument("KernelId", None)
ramdisk_id = self.get_argument("RamdiskId", None)
root_dev_name = self.get_argument("RootDeviceName", None)
snapshot_id = self.get_argument("SnapshotId", None)
# get block device mappings
bdm = BlockDeviceMapping()
mapping = self.get_argument("BlockDeviceMapping.1.DeviceName", None)
idx = 1
while mapping:
pre = "BlockDeviceMapping.%d" % idx
dev_name = mapping
block_dev_type = BlockDeviceType()
block_dev_type.ephemeral_name = self.get_argument("%s.VirtualName" % pre, None)
if not (block_dev_type.ephemeral_name):
block_dev_type.no_device = self.get_argument("%s.NoDevice" % pre, "") == "true"
block_dev_type.snapshot_id = self.get_argument("%s.Ebs.SnapshotId" % pre, None)
block_dev_type.size = self.get_argument("%s.Ebs.VolumeSize" % pre, None)
block_dev_type.delete_on_termination = (
self.get_argument("%s.Ebs.DeleteOnTermination" % pre, "") == "true"
)
bdm[dev_name] = block_dev_type
idx += 1
mapping = self.get_argument("BlockDeviceMapping.%d.DeviceName" % idx, None)
if snapshot_id:
rootbdm = BlockDeviceType()
rootbdm.snapshot_id = snapshot_id
bdm["/dev/sda1"] = rootbdm
if len(bdm) == 0:
bdm = None
return clc.register_image(
name, image_location, description, architecture, kernel_id, ramdisk_id, root_dev_name, bdm, callback
)