From: Thierry Parmentelat Date: Thu, 12 Apr 2012 08:11:14 +0000 (+0200) Subject: revert change n-1 : restore order for xml initialization X-Git-Tag: nodemanager-2.1-1~5 X-Git-Url: http://git.onelab.eu/?p=nodemanager.git;a=commitdiff_plain;h=2a2c8a78013ddf91b6f1bce75367fed331ede89b revert change n-1 : restore order for xml initialization --- diff --git a/sliver_lxc.py b/sliver_lxc.py index 5700e1c..32f73be 100644 --- a/sliver_lxc.py +++ b/sliver_lxc.py @@ -47,16 +47,6 @@ class Sliver_LXC(lv.Sliver_Libvirt): 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 + '/lxc_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 # subvolume) command = ['btrfs', 'subvolume', 'snapshot', refImgDir, containerDir] @@ -99,6 +89,16 @@ class Sliver_LXC(lv.Sliver_Libvirt): # can get the correct xid based on the name of the slice xid = bwlimit.get_xid(name) + # Template for libvirt sliver configuration + template_filename = Sliver_LXC.REF_IMG_BASE_DIR + '/lxc_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 + # Lookup for the sliver before actually # defining it, just in case it was already defined. try: