+
+
+# before shutting down slivers, it is safe to first remove them from vsys's scope
+# so that we are sure that no dangling open file remains
+# this will also restart vsys if needed
+def removeSliverFromVsys (sliver):
+ current_slivers=parseConf()
+ new_slivers= [ s for s in current_slivers if s != sliver ]
+ if writeConf (current_slivers, new_slivers):
+ restartService()
+ trashVsysHandleInSliver (sliver)
+ else:
+ logger.log("vsys.removeSliverFromConf: no need to remove %s"%sliver)
+
+
+def trashVsysHandleInSliver (sliver):
+ slice_vsys_area = "/vservers/%s/vsys"%sliver
+ if not os.path.exists(slice_vsys_area):
+ logger.log("vsys.trashVsysHandleInSliver: no action needed, %s not found"%slice_vsys_area)
+ return
+ ret=subprocess.call([ 'rm', '-rf' , slice_vsys_area])
+ logger.log ("vsys.trashVsysHandleInSliver: Removed %s (retcod=%s)"%(slice_vsys_area,retcod))