| OLD | NEW |
| 1 # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ |
| 2 # Copyright (c) 2010, Eucalyptus Systems, Inc. | 2 # Copyright (c) 2010, Eucalyptus Systems, Inc. |
| 3 # | 3 # |
| 4 # Permission is hereby granted, free of charge, to any person obtaining a | 4 # Permission is hereby granted, free of charge, to any person obtaining a |
| 5 # copy of this software and associated documentation files (the | 5 # copy of this software and associated documentation files (the |
| 6 # "Software"), to deal in the Software without restriction, including | 6 # "Software"), to deal in the Software without restriction, including |
| 7 # without limitation the rights to use, copy, modify, merge, publish, dis- | 7 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 8 # tribute, sublicense, and/or sell copies of the Software, and to permit | 8 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 9 # persons to whom the Software is furnished to do so, subject to the fol- | 9 # persons to whom the Software is furnished to do so, subject to the fol- |
| 10 # lowing conditions: | 10 # lowing conditions: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 super(Snapshot, self).__init__(connection) | 34 super(Snapshot, self).__init__(connection) |
| 35 self.id = None | 35 self.id = None |
| 36 self.volume_id = None | 36 self.volume_id = None |
| 37 self.status = None | 37 self.status = None |
| 38 self.progress = None | 38 self.progress = None |
| 39 self.start_time = None | 39 self.start_time = None |
| 40 self.owner_id = None | 40 self.owner_id = None |
| 41 self.owner_alias = None | 41 self.owner_alias = None |
| 42 self.volume_size = None | 42 self.volume_size = None |
| 43 self.description = None | 43 self.description = None |
| 44 self.encrypted = None |
| 44 | 45 |
| 45 def __repr__(self): | 46 def __repr__(self): |
| 46 return 'Snapshot:%s' % self.id | 47 return 'Snapshot:%s' % self.id |
| 47 | 48 |
| 48 def endElement(self, name, value, connection): | 49 def endElement(self, name, value, connection): |
| 49 if name == 'snapshotId': | 50 if name == 'snapshotId': |
| 50 self.id = value | 51 self.id = value |
| 51 elif name == 'volumeId': | 52 elif name == 'volumeId': |
| 52 self.volume_id = value | 53 self.volume_id = value |
| 53 elif name == 'status': | 54 elif name == 'status': |
| 54 self.status = value | 55 self.status = value |
| 55 elif name == 'startTime': | 56 elif name == 'startTime': |
| 56 self.start_time = value | 57 self.start_time = value |
| 57 elif name == 'ownerId': | 58 elif name == 'ownerId': |
| 58 self.owner_id = value | 59 self.owner_id = value |
| 59 elif name == 'ownerAlias': | 60 elif name == 'ownerAlias': |
| 60 self.owner_alias = value | 61 self.owner_alias = value |
| 61 elif name == 'volumeSize': | 62 elif name == 'volumeSize': |
| 62 try: | 63 try: |
| 63 self.volume_size = int(value) | 64 self.volume_size = int(value) |
| 64 except: | 65 except: |
| 65 self.volume_size = value | 66 self.volume_size = value |
| 66 elif name == 'description': | 67 elif name == 'description': |
| 67 self.description = value | 68 self.description = value |
| 69 elif name == 'encrypted': |
| 70 self.encrypted = (value.lower() == 'true') |
| 68 else: | 71 else: |
| 69 setattr(self, name, value) | 72 setattr(self, name, value) |
| 70 | 73 |
| 71 def _update(self, updated): | 74 def _update(self, updated): |
| 72 self.progress = updated.progress | 75 self.progress = updated.progress |
| 73 self.status = updated.status | 76 self.status = updated.status |
| 74 | 77 |
| 75 def update(self, validate=False, dry_run=False): | 78 def update(self, validate=False, dry_run=False): |
| 76 """ | 79 """ |
| 77 Update the data associated with this snapshot by querying EC2. | 80 Update the data associated with this snapshot by querying EC2. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 this volume. (optional) | 148 this volume. (optional) |
| 146 """ | 149 """ |
| 147 if isinstance(zone, Zone): | 150 if isinstance(zone, Zone): |
| 148 zone = zone.name | 151 zone = zone.name |
| 149 return self.connection.create_volume( | 152 return self.connection.create_volume( |
| 150 size, | 153 size, |
| 151 zone, | 154 zone, |
| 152 self.id, | 155 self.id, |
| 153 volume_type, | 156 volume_type, |
| 154 iops, | 157 iops, |
| 158 self.encrypted, |
| 155 dry_run=dry_run | 159 dry_run=dry_run |
| 156 ) | 160 ) |
| 157 | 161 |
| 158 | 162 |
| 159 class SnapshotAttribute(object): | 163 class SnapshotAttribute(object): |
| 160 def __init__(self, parent=None): | 164 def __init__(self, parent=None): |
| 161 self.snapshot_id = None | 165 self.snapshot_id = None |
| 162 self.attrs = {} | 166 self.attrs = {} |
| 163 | 167 |
| 164 def startElement(self, name, attrs, connection): | 168 def startElement(self, name, attrs, connection): |
| (...skipping 12 matching lines...) Expand all Loading... |
| 177 self.attrs['user_ids'].append(value) | 181 self.attrs['user_ids'].append(value) |
| 178 else: | 182 else: |
| 179 self.attrs['user_ids'] = [value] | 183 self.attrs['user_ids'] = [value] |
| 180 elif name == 'snapshotId': | 184 elif name == 'snapshotId': |
| 181 self.snapshot_id = value | 185 self.snapshot_id = value |
| 182 else: | 186 else: |
| 183 setattr(self, name, value) | 187 setattr(self, name, value) |
| 184 | 188 |
| 185 | 189 |
| 186 | 190 |
| OLD | NEW |