fix packaging of omf_resctl
[nodemanager.git] / plugins / codemux.py
index c3a6a8f..49ada18 100644 (file)
@@ -1,12 +1,10 @@
-# $Id$
-# $URL$
-
 """Codemux configurator.  Monitors slice attributes and configures CoDemux to mux port 80 based on HOST field in HTTP request.  Forwards to localhost port belonging to configured slice."""
 
 import logger
 import os
-import libvirt
+
 from config import Config
+import slivermanager
 
 CODEMUXCONF="/etc/codemux/codemux.conf"
 
@@ -54,7 +52,7 @@ def GetSlivers(data, config, plc = None):
 
                 try:
                     # Check to see if sliver is running.  If not, continue
-                    if isLXCDomRunning(sliver['name']):
+                    if slivermanager.is_running(sliver['name']):
                         # Check if new or needs updating
                         if (sliver['name'] not in slicesinconf.keys()) \
                         or (params not in slicesinconf.get(sliver['name'], [])):
@@ -169,13 +167,3 @@ def stopService():
         logger.log_call(["/etc/init.d/codemux", "stop", ])
     logger.log_call(["/sbin/chkconfig", "codemux", "off"])
 
-def isLXCDomRunning(domName):
-    try:
-        running = False
-        conn = libvirt.open('lxc://')
-        dom  = conn.lookupByName(domName)
-        running = dom.info()[0] == libvirt.VIR_DOMAIN_RUNNING
-    finally:
-        conn.close()
-    return running
-