mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Support for vmdk disk format
This commit is contained in:
parent
51041f6aa2
commit
1d69f65a7f
4 changed files with 31 additions and 2 deletions
|
@ -4,6 +4,7 @@ def load_volume(data):
|
|||
from common.fs.loopbackvolume import LoopbackVolume
|
||||
from providers.ec2.ebsvolume import EBSVolume
|
||||
from common.fs.virtualdiskimage import VirtualDiskImage
|
||||
from common.fs.virtualmachinedisk import VirtualMachineDisk
|
||||
from partitionmaps.gpt import GPTPartitionMap
|
||||
from partitionmaps.mbr import MBRPartitionMap
|
||||
from partitionmaps.none import NoPartitions
|
||||
|
@ -15,6 +16,7 @@ def load_volume(data):
|
|||
volume_backings = {'raw': LoopbackVolume,
|
||||
's3': LoopbackVolume,
|
||||
'vdi': VirtualDiskImage,
|
||||
'vmdk': VirtualMachineDisk,
|
||||
'ebs': EBSVolume
|
||||
}
|
||||
return volume_backings.get(data['backing'])(partition_map)
|
||||
|
|
27
common/fs/virtualmachinedisk.py
Normal file
27
common/fs/virtualmachinedisk.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from common.fs.qemuvolume import QEMUVolume
|
||||
|
||||
|
||||
class VirtualMachineDisk(QEMUVolume):
|
||||
|
||||
extension = 'vmdk'
|
||||
qemu_format = 'vmdk'
|
||||
ovf_uri = 'http://www.vmware.com/specifications/vmdk.html#sparse'
|
||||
|
||||
def get_uuid(self):
|
||||
if not hasattr(self, 'uuid'):
|
||||
import uuid
|
||||
self.uuid = uuid.uuid4()
|
||||
return self.uuid
|
||||
# import uuid
|
||||
# with open(self.image_path) as image:
|
||||
# line = ''
|
||||
# lines_read = 0
|
||||
# while 'ddb.uuid.image="' not in line:
|
||||
# line = image.read()
|
||||
# lines_read += 1
|
||||
# if lines_read > 100:
|
||||
# from common.exceptions import VolumeError
|
||||
# raise VolumeError('Unable to find UUID in VMDK file.')
|
||||
# import re
|
||||
# matches = re.search('ddb.uuid.image="(?P<uuid>[^"]+)"', line)
|
||||
# return uuid.UUID(hex=matches.group('uuid'))
|
|
@ -8,7 +8,7 @@
|
|||
"properties": {
|
||||
"backing": {
|
||||
"type": "string",
|
||||
"enum": ["raw", "ebs", "s3", "vdi"]
|
||||
"enum": ["raw", "ebs", "s3", "vdi", "vmdk"]
|
||||
}
|
||||
},
|
||||
"required": ["backing"]
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"properties": {
|
||||
"backing": {
|
||||
"type": "string",
|
||||
"enum": ["raw", "vdi"]
|
||||
"enum": ["raw", "vdi", "vmdk"]
|
||||
},
|
||||
"partitions": {
|
||||
"type": "object",
|
||||
|
|
Loading…
Add table
Reference in a new issue