From 2a2c8a78013ddf91b6f1bce75367fed331ede89b Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 12 Apr 2012 10:11:14 +0200 Subject: [PATCH] revert change n-1 : restore order for xml initialization --- sliver_lxc.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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: -- 2.43.0