Skip to content

Commit

Permalink
Merge pull request #390 from mshriver/rhevm-add-disk-kwargs
Browse files Browse the repository at this point in the history
[1LP][RFR] Update rhevm add_disk kwargs
  • Loading branch information
izapolsk authored Jun 14, 2019
2 parents 70c94e6 + 4c2e0de commit 70213c9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions wrapanapi/systems/rhevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ def _is_disk_ok(self, disk_id):
if self.system.api.follow_link(disk_attach.disk).id == disk_id].pop()
return getattr(disk, 'status', None) == types.DiskStatus.OK

def add_disk(self, storage_domain=None, size=None, interface='VIRTIO', format=None,
active=True):
def add_disk(self, storage_domain=None, size=None, interface='virtio', format='cow',
active=True, sparse=True, name=None):
"""
Add disk to VM
Expand All @@ -443,6 +443,8 @@ def add_disk(self, storage_domain=None, size=None, interface='VIRTIO', format=No
interface: string disk interface type
format: string disk format type
active: boolean whether the disk is active
sparse: boolean whether the disk is preallocated (False) or thin-provisioned (True)
name: string name of the disk
Returns: None
Notes:
Disk format and interface type definitions, and their valid values,
Expand All @@ -452,10 +454,12 @@ def add_disk(self, storage_domain=None, size=None, interface='VIRTIO', format=No
"""
disk_attachments_service = self.api.disk_attachments_service()
disk_attach = types.DiskAttachment(
disk=types.Disk(format=types.DiskFormat(format),
disk=types.Disk(name=name,
format=types.DiskFormat(format.lower()),
provisioned_size=size,
storage_domains=[types.StorageDomain(name=storage_domain)]),
interface=getattr(types.DiskInterface, interface),
storage_domains=[types.StorageDomain(name=storage_domain)],
sparse=bool(sparse)),
interface=types.DiskInterface(interface.lower()),
active=active
)
disk_attachment = disk_attachments_service.add(disk_attach)
Expand Down

0 comments on commit 70213c9

Please sign in to comment.