Use volume.size instead of asking the partitionmap

This commit is contained in:
Anders Ingemann 2014-01-18 16:37:56 +01:00
parent 218936d09e
commit a433f1c299
4 changed files with 4 additions and 4 deletions

View file

@ -33,7 +33,7 @@ class CreateFromSnapshot(Task):
@classmethod
def run(cls, info):
volume_size = int(info.volume.partition_map.get_total_size() / 1024)
volume_size = int(info.volume.size / 1024)
snapshot = info.manifest.plugins['prebootstrapped']['snapshot']
ebs_volume = info.connection.create_volume(volume_size,
info.host['availabilityZone'],

View file

@ -163,7 +163,7 @@ class PackageBox(Task):
# VHDURI = "http://go.microsoft.com/fwlink/?LinkId=137171"
volume_uuid = info.volume.get_uuid()
[disk] = root.findall('./ovf:DiskSection/ovf:Disk', namespaces)
attr(disk, 'ovf:capacity', info.volume.partition_map.get_total_size() * 1024 * 1024)
attr(disk, 'ovf:capacity', info.volume.size * 1024 * 1024)
attr(disk, 'ovf:format', info.volume.ovf_uri)
attr(disk, 'ovf:uuid', volume_uuid)

View file

@ -12,7 +12,7 @@ class EBSVolume(Volume):
conn = e.connection
zone = e.zone
import math
size = int(math.ceil(self.partition_map.get_total_size() / 1024))
size = int(math.ceil(self.size / 1024))
self.volume = conn.create_volume(size, zone)
while self.volume.volume_state() != 'available':
time.sleep(5)

View file

@ -166,7 +166,7 @@ class RegisterAMI(Task):
from boto.ec2.blockdevicemapping import BlockDeviceType
from boto.ec2.blockdevicemapping import BlockDeviceMapping
block_device = BlockDeviceType(snapshot_id=info.snapshot.id, delete_on_termination=True,
size=info.volume.partition_map.get_total_size() / 1024)
size=info.volume.size / 1024)
registration_params['block_device_map'] = BlockDeviceMapping()
registration_params['block_device_map'][root_dev_name] = block_device