Skip to content

Commit

Permalink
Added the same fix of api/v3 vmedia_mount_remove_all() to api/v2
Browse files Browse the repository at this point in the history
  • Loading branch information
eusebiu-constantin-petu-dbk committed Jan 28, 2019
1 parent c84bfb8 commit 3bfb23a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion imcsdk/apis/server/vmedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ def vmedia_mount_remove_all(handle, server_id=1):
if virt_media.get_class_id() == "CommSavedVMediaMap":
virt_media.admin_action = CommSavedVMediaMapConsts.ADMIN_ACTION_DELETE_VOLUME
handle.set_mo(virt_media)
# Remove the mapped ISO
elif virt_media.get_class_id() == "CommVMediaMap":
handle.remove_mo(virt_media)

Expand Down
10 changes: 8 additions & 2 deletions imcsdk/apis/v2/server/vmedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,20 @@ def vmedia_mount_remove_all(handle, server_id=1):
Examples:
vmedia_mount_remove_all(handle)
"""
from imcsdk.mometa.comm.CommSavedVMediaMap import CommSavedVMediaMapConsts

# Get all current virtually mapped ISOs
virt_media_maps = handle.query_children(in_dn=_get_vmedia_mo_dn(handle,
server_id))
# Loop over each mapped ISO
for virt_media in virt_media_maps:
# Remove the mapped ISO
handle.remove_mo(virt_media)
# Remove the saved mapping
if virt_media.get_class_id() == 'CommSavedVMediaMap':
virt_media.admin_action = CommSavedVMediaMapConsts.ADMIN_ACTION_DELETE_VOLUME
handle.set_mo(virt_media)
elif virt_media.get_class_id() == 'CommVMediaMap':
handle.remove_mo(virt_media)

# Raise error if all mappings not removed
if len(handle.query_children(in_dn="sys/svc-ext/vmedia-svc")) > 0:
raise ImcOperationError('Remove Virtual Media',
Expand Down

0 comments on commit 3bfb23a

Please sign in to comment.