Skip to content

Commit 2a66be8

Browse files
committed
Fixed breaking changes
1 parent 35442a2 commit 2a66be8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

remove/vdisk.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ class VDiskRemover(object):
3030
def __init__(self):
3131
pass
3232

33+
@staticmethod
34+
def remove_vdisks_with_structure(vdisks):
35+
"""
36+
Remove many vdisks at once. Will keep the parent structure in mind
37+
:param vdisks: list of vdisks
38+
:return:
39+
"""
40+
removed_guids = []
41+
for vdisk in vdisks:
42+
if vdisk.guid in removed_guids:
43+
continue
44+
if len(vdisk.child_vdisks_guids) > 0:
45+
for vdisk_child_guid in vdisk.child_vdisks_guids:
46+
VDiskRemover.remove_vdisk(vdisk_child_guid)
47+
removed_guids.append(vdisk_child_guid)
48+
VDiskRemover.remove_vdisk(vdisk.guid)
49+
removed_guids.append(vdisk.guid)
50+
3351
@staticmethod
3452
def remove_snapshot(snapshot_guid, vdisk_name, vpool_name, api, timeout=REMOVE_SNAPSHOT_TIMEOUT):
3553
"""

0 commit comments

Comments
 (0)