mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +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 common.fs.loopbackvolume import LoopbackVolume
|
||||||
from providers.ec2.ebsvolume import EBSVolume
|
from providers.ec2.ebsvolume import EBSVolume
|
||||||
from common.fs.virtualdiskimage import VirtualDiskImage
|
from common.fs.virtualdiskimage import VirtualDiskImage
|
||||||
|
from common.fs.virtualmachinedisk import VirtualMachineDisk
|
||||||
from partitionmaps.gpt import GPTPartitionMap
|
from partitionmaps.gpt import GPTPartitionMap
|
||||||
from partitionmaps.mbr import MBRPartitionMap
|
from partitionmaps.mbr import MBRPartitionMap
|
||||||
from partitionmaps.none import NoPartitions
|
from partitionmaps.none import NoPartitions
|
||||||
|
@ -15,6 +16,7 @@ def load_volume(data):
|
||||||
volume_backings = {'raw': LoopbackVolume,
|
volume_backings = {'raw': LoopbackVolume,
|
||||||
's3': LoopbackVolume,
|
's3': LoopbackVolume,
|
||||||
'vdi': VirtualDiskImage,
|
'vdi': VirtualDiskImage,
|
||||||
|
'vmdk': VirtualMachineDisk,
|
||||||
'ebs': EBSVolume
|
'ebs': EBSVolume
|
||||||
}
|
}
|
||||||
return volume_backings.get(data['backing'])(partition_map)
|
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": {
|
"properties": {
|
||||||
"backing": {
|
"backing": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["raw", "ebs", "s3", "vdi"]
|
"enum": ["raw", "ebs", "s3", "vdi", "vmdk"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["backing"]
|
"required": ["backing"]
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"backing": {
|
"backing": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["raw", "vdi"]
|
"enum": ["raw", "vdi", "vmdk"]
|
||||||
},
|
},
|
||||||
"partitions": {
|
"partitions": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|
Loading…
Add table
Reference in a new issue