Explorar o código

resource fixes

Joshua Cornutt %!s(int64=9) %!d(string=hai) anos
pai
achega
2c8432d3eb

+ 2 - 1
cloudbridge/cloud/providers/aws/resources.py

@@ -517,6 +517,7 @@ class AWSSnapshot(BaseSnapshot):
     # ApiReference-cmd-DescribeSnapshots.html
     # ApiReference-cmd-DescribeSnapshots.html
     SNAPSHOT_STATE_MAP = {
     SNAPSHOT_STATE_MAP = {
         'pending': SnapshotState.PENDING,
         'pending': SnapshotState.PENDING,
+        'deleting': SnapshotState.PENDING,
         'completed': SnapshotState.AVAILABLE,
         'completed': SnapshotState.AVAILABLE,
         'error': SnapshotState.ERROR
         'error': SnapshotState.ERROR
     }
     }
@@ -624,7 +625,7 @@ class AWSKeyPair(BaseKeyPair):
         :return: Unencrypted private key or ``None`` if not available.
         :return: Unencrypted private key or ``None`` if not available.
 
 
         """
         """
-        return self._key_pair.material
+        return self._key_pair.key_material
 
 
 
 
 class AWSSecurityGroup(BaseSecurityGroup):
 class AWSSecurityGroup(BaseSecurityGroup):

+ 9 - 5
cloudbridge/cloud/providers/aws/services.py

@@ -280,11 +280,15 @@ class AWSVolumeService(BaseVolumeService):
         zone_id = zone.id if isinstance(zone, PlacementZone) else zone
         zone_id = zone.id if isinstance(zone, PlacementZone) else zone
         snapshot_id = snapshot.id if isinstance(
         snapshot_id = snapshot.id if isinstance(
             snapshot, AWSSnapshot) and snapshot else snapshot
             snapshot, AWSSnapshot) and snapshot else snapshot
-        res = self.iface.create('create_volume',
-                                Size=size,
-                                Iops=iops,
-                                AvailabilityZone=zone_id,
-                                SnapshotId=snapshot_id)
+        params = {
+            'Size': size,
+            'AvailabilityZone': zone_id
+        }
+        if iops:
+            params['Iops'] = iops
+        if snapshot_id:
+            params['SnapshotId'] = snapshot_id
+        res = self.iface.create('create_volume', **params)
         res.name = name
         res.name = name
         if res.description:
         if res.description:
             res.description = description
             res.description = description