Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue#171 Adds support for vmedia saved mapping in remove all function #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion imcsdk/apis/v2/server/vmedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,21 @@ 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 saved mapping
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
handle.remove_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