- conn = Sliver_LV.getConnection()
- try:
- self.container = conn.lookupByName(self.name)
- except:
- print "Unexpected error:", sys.exc_info()[0]
-
- @staticmethod
- def create(name, rec = None):
- ''' Create dirs, copy fs image, lxc_create '''
- print "LIBVIRT %s create"%(name)
- logger.verbose ('sliver_libvirt: %s create'%(name))
- dir = '/vservers/%s'%(name)
- config = '%s/config.xml'%(dir)
- lxc_log = '%s/log'%(dir)
-
- if not (os.path.isdir(dir) and
- os.access(dir, os.R_OK | os.W_OK | os.X_OK)):
- logger.verbose('lxc_create: directory %s does not exist or wrong perms'%(dir))
- return
-
- # Get a connection and lookup for the sliver before actually
- # defining it, just in case it was already defined.
- conn = Sliver_LV.getConnection()
- try:
- dom = conn.lookupByName(name)
- except:
- xml = open(config).read()
- dom = conn.defineXML(xml)
- print Sliver_LV.info(dom)
-
- @staticmethod
- def destroy(name):
- ''' NEVER CALLED... Figure out when and what to do... '''
-
- print "LIBVIRT %s destroy"%(name)
- logger.verbose ('sliver_libvirt: %s destroy'%(name))
-
- dir = '/vservers/%s'%(name)
- lxc_log = '%s/lxc.log'%(dir)
-
- conn = conn.Sliver_LV.getConnection()