+ ''' Create dirs, copy fs image, lxc_create '''
+ print "LXC create %s"%(name)
+ logger.verbose ('sliver_lxc: %s create'%name)
+ dir = '/vservers/%s'%(name)
+ config = '%s/config'%(dir)
+ lxc_log = '%s/lxc.log'%(dir)
+
+ if not (os.path.isdir(dir) and
+ os.access(dir, os.R_OK | os.W_OK | os.X_OK)):
+ print 'lxc_create: directory %s does not exist or wrong perms'%(dir)
+ return
+ # Assume for now that the directory is there and with a FS
+ command=[]
+ # be verbose
+ command += ['/bin/bash','-x',]
+ command += ['/usr/bin/lxc-create', '-n', name, '-f', config, '&']
+ print command
+ print subprocess.call(command, stdin=open('/dev/null', 'r'), stdout=open(lxc_log, 'a+'), stderr=subprocess.STDOUT, shell=False)