From a433f1c299f2dffa7d1dcabe74b3b8d6206e2e78 Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Sat, 18 Jan 2014 16:37:56 +0100 Subject: [PATCH] Use volume.size instead of asking the partitionmap --- plugins/prebootstrapped/tasks.py | 2 +- plugins/vagrant/tasks.py | 2 +- providers/ec2/ebsvolume.py | 2 +- providers/ec2/tasks/ami.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/prebootstrapped/tasks.py b/plugins/prebootstrapped/tasks.py index 6e39d05..82c0378 100644 --- a/plugins/prebootstrapped/tasks.py +++ b/plugins/prebootstrapped/tasks.py @@ -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'], diff --git a/plugins/vagrant/tasks.py b/plugins/vagrant/tasks.py index aceef15..a8839f7 100644 --- a/plugins/vagrant/tasks.py +++ b/plugins/vagrant/tasks.py @@ -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) diff --git a/providers/ec2/ebsvolume.py b/providers/ec2/ebsvolume.py index 29e9e41..6ac54e2 100644 --- a/providers/ec2/ebsvolume.py +++ b/providers/ec2/ebsvolume.py @@ -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) diff --git a/providers/ec2/tasks/ami.py b/providers/ec2/tasks/ami.py index 60ab4df..da863b7 100644 --- a/providers/ec2/tasks/ami.py +++ b/providers/ec2/tasks/ami.py @@ -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