# check the template exists -- there's probably a better way..
if not os.path.isdir(refImgDir):
logger.log('sliver_lxc: %s: ERROR Could not create sliver - reference image %s not found' % (name,vref))
+ logger.log('sliver_lxc: %s: ERROR ctd expected reference image in %s'%(name,refImgDir))
+ return
+
+ # Template for libvirt sliver configuration
+ template_filename = Sliver_LXC.REF_IMG_BASE_DIR + '/config_template.xml'
+ try:
+ with open(template_filename) as f:
+ template = Template(f.read())
+ xml = template.substitute(name=name, xid=xid)
+ except IOError:
+ logger.log('Cannot find XML template file %s'%template_filename)
return
# Snapshot the reference image fs (assume the reference image is in its own
# can get the correct xid based on the name of the slice
xid = bwlimit.get_xid(name)
- # Template for libvirt sliver configuration
- try:
- with open(Sliver_LXC.REF_IMG_BASE_DIR + '/config_template.xml') as f:
- template = Template(f.read())
- xml = template.substitute(name=name, xid=xid)
- except IOError:
- logger.log('Cannot find XML template file')
- return
-
# Lookup for the sliver before actually
# defining it, just in case it was already defined.
try: