From 5308fa264c3ec8b41e4f4e96febff8023b645c58 Mon Sep 17 00:00:00 2001 From: Eusebiu Petu Date: Wed, 14 Nov 2018 15:40:04 +0200 Subject: [PATCH] fixed vmedia_mount_remove_all() --- imcsdk/apis/server/vmedia.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/imcsdk/apis/server/vmedia.py b/imcsdk/apis/server/vmedia.py index cb3a10cd..6adca0cf 100644 --- a/imcsdk/apis/server/vmedia.py +++ b/imcsdk/apis/server/vmedia.py @@ -404,14 +404,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',