|
9 | 9 | from SoftLayer import utils |
10 | 10 |
|
11 | 11 | IMAGE_MASK = ('id,accountId,name,globalIdentifier,blockDevices,parentId,' |
12 | | - 'createDate') |
| 12 | + 'createDate,transaction') |
13 | 13 |
|
14 | 14 |
|
15 | 15 | class ImageManager(utils.IdentifierMixin, object): |
@@ -119,7 +119,28 @@ def edit(self, image_id, name=None, note=None, tag=None): |
119 | 119 | else: |
120 | 120 | return False |
121 | 121 |
|
122 | | - def import_image_from_uri(self, data): |
123 | | - """Import images which match the given uri.""" |
124 | | - result = self.vgbdtg.createFromExternalSource(data) |
125 | | - return result |
| 122 | + def import_image_from_uri(self, name, uri, os_code=None, note=None): |
| 123 | + """Import a new image from object storage. |
| 124 | +
|
| 125 | + :param string name: Name of the new image |
| 126 | + :param string uri: The URI for an object storage object |
| 127 | + (.vhd/.iso file) of the format: |
| 128 | + swift://<objectStorageAccount>@<cluster>/<container>/<objectPath> |
| 129 | + :param string os_code: The reference code of the operating system |
| 130 | + :param string note: Note to add to the image |
| 131 | + """ |
| 132 | + return self.vgbdtg.createFromExternalSource({ |
| 133 | + 'name': name, |
| 134 | + 'note': note, |
| 135 | + 'operatingSystemReferenceCode': os_code, |
| 136 | + 'uri': uri, |
| 137 | + }) |
| 138 | + |
| 139 | + def export_image_to_uri(self, image_id, uri): |
| 140 | + """Export image into the given object storage |
| 141 | +
|
| 142 | + :param int image_id: The ID of the image |
| 143 | + :param string uri: The URI for object storage of the format |
| 144 | + swift://<objectStorageAccount>@<cluster>/<container>/<objectPath> |
| 145 | + """ |
| 146 | + return self.vgbdtg.copyToExternalSource({'uri': uri}, id=image_id) |
0 commit comments