[libvirt] [libvirt-test-API] [PATCH] fix some typo
by Shanzhi Yu
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
repos/domain/fsinfo.py | 2 +-
repos/domain/install_linux_check.py | 2 +-
repos/domain/install_linux_net.py | 2 +-
repos/interface/define.py | 2 +-
repos/interface/undefine.py | 4 ++--
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/repos/domain/fsinfo.py b/repos/domain/fsinfo.py
index e6d1bf0..d4614f5 100644
--- a/repos/domain/fsinfo.py
+++ b/repos/domain/fsinfo.py
@@ -81,7 +81,7 @@ def fsinfo(params):
return 1
fsinfo = vm.fsInfo()
- logger.info("get geust filesystem information")
+ logger.info("get guest filesystem information")
mac = get_guest_mac(vm)
if not mac:
diff --git a/repos/domain/install_linux_check.py b/repos/domain/install_linux_check.py
index ab1e7db..bb3cc2a 100644
--- a/repos/domain/install_linux_check.py
+++ b/repos/domain/install_linux_check.py
@@ -99,7 +99,7 @@ def install_linux_check(params):
Test_Result = 1
return Test_Result
- # Check whether vcpu equals the value set in geust config xml
+ # Check whether vcpu equals the value set in guest config xml
logger.info("check point3: check cpu number in guest equals to \
the value set in domain config xml")
vcpunum_expect = int(utils.get_num_vcpus(domain_name))
diff --git a/repos/domain/install_linux_net.py b/repos/domain/install_linux_net.py
index 4367d97..7173294 100644
--- a/repos/domain/install_linux_net.py
+++ b/repos/domain/install_linux_net.py
@@ -239,7 +239,7 @@ def install_linux_net(params):
logger.info("booting guest vm off harddisk failed")
return 1
else:
- logger.info("geust is booting up")
+ logger.info("guest is booting up")
else:
interval = 0
while(interval < 3600):
diff --git a/repos/interface/define.py b/repos/interface/define.py
index 18ba71b..e0dbcf4 100644
--- a/repos/interface/define.py
+++ b/repos/interface/define.py
@@ -42,7 +42,7 @@ def define(params):
try:
conn.interfaceDefineXML(xmlstr, 0)
if check_define_interface(ifacename):
- logger.info("define a interface form xml is successful")
+ logger.info("define a interface from xml is successful")
else:
logger.error("fail to check define interface")
return 1
diff --git a/repos/interface/undefine.py b/repos/interface/undefine.py
index f9b2d74..8b250de 100644
--- a/repos/interface/undefine.py
+++ b/repos/interface/undefine.py
@@ -39,14 +39,14 @@ def undefine(params):
try:
ifaceobj.undefine()
if check_undefine_interface(ifacename):
- logger.info("undefine a interface form xml is successful")
+ logger.info("undefine a interface is successful")
else:
logger.error("fail to check undefine interface")
return 1
except libvirtError, e:
logger.error("API error message: %s, error code is %s" \
% (e.message, e.get_error_code()))
- logger.error("fail to undefine a interface from xml")
+ logger.error("fail to undefine a interface")
return 1
return 0
--
1.8.3.1
9 years, 8 months
[libvirt] [libvirt-test-API] [PATCH] fix two error in script pin_iothread.py and connection_getAllDomainStats.py
by Shanzhi Yu
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
repos/domain/pin_iothread.py | 2 +-
repos/virconn/connection_getAllDomainStats.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/repos/domain/pin_iothread.py b/repos/domain/pin_iothread.py
index 28ee2c4..d2d812f 100644
--- a/repos/domain/pin_iothread.py
+++ b/repos/domain/pin_iothread.py
@@ -116,7 +116,7 @@ def pin_iothread(params):
if not find_iothreadid_fromxml(vm, 1, 1):
logger.info("add iothread %d to running guest" % 1)
- vm.addIOThread(i, libvirt.VIR_DOMAIN_AFFECT_LIVE)
+ vm.addIOThread(1, libvirt.VIR_DOMAIN_AFFECT_LIVE)
vm.pinIOThread(1, tu_cpu, libvirt.VIR_DOMAIN_AFFECT_LIVE)
cpuset = find_iothreadpin_fromxml(vm, 1, 1)
diff --git a/repos/virconn/connection_getAllDomainStats.py b/repos/virconn/connection_getAllDomainStats.py
index d95004f..3362444 100644
--- a/repos/virconn/connection_getAllDomainStats.py
+++ b/repos/virconn/connection_getAllDomainStats.py
@@ -164,7 +164,7 @@ def check_each_vcpu(logger,dom_name,dom_active,dom_eles):
if not vcpu_cur:
for i in range(0,vcpu_max):
vcpu_pre = "vcpu."+ str(i) + "."
- logger.debug("Checking %sstate: %d" \
+ logger.debug("Checking %sstate: %s" \
%(vcpu_pre, dom_eles.get(vcpu_pre + "state")))
if not compare_value(logger,vcpu_stat, \
dom_eles.get(vcpu_pre + "state")):
@@ -172,7 +172,7 @@ def check_each_vcpu(logger,dom_name,dom_active,dom_eles):
elif int(vcpu_cur.nodeValue) <= vcpu_max:
for i in range(0,int(vcpu_cur.nodeValue)):
vcpu_pre = "vcpu."+ str(i) + "."
- logger.debug("Checking %sstate: %d" \
+ logger.debug("Checking %sstate: %s" \
%(vcpu_pre, dom_eles.get(vcpu_pre + "state")))
if not compare_value(logger,vcpu_stat, \
dom_eles.get(vcpu_pre + "state")):
--
1.8.3.1
9 years, 8 months
[libvirt] [libvirt-test-API] [PATCH] Add two cases for API interfaceAddresses and make small changes to global.cfg
by Shanzhi Yu
Signed-off-by: Shanzhi Yu <shyu(a)redhat.com>
---
cases/linux_domain.conf | 12 +++++++
global.cfg | 8 +++--
repos/domain/get_guest_network_info.py | 66 ++++++++++++++++++++++++++++++++++
3 files changed, 84 insertions(+), 2 deletions(-)
create mode 100644 repos/domain/get_guest_network_info.py
diff --git a/cases/linux_domain.conf b/cases/linux_domain.conf
index 8440c61..5b216f9 100644
--- a/cases/linux_domain.conf
+++ b/cases/linux_domain.conf
@@ -66,6 +66,18 @@ domain:set_guest_time
flags
sync
+domain:get_guest_network_info
+ guestname
+ $defaultname
+ flags
+ lease
+
+domain:get_guest_network_info
+ guestname
+ $defaultname
+ flags
+ agent
+
virconn:connection_getAllDomainStats
stats
state|cpu|balloon|vcpu|interface|block
diff --git a/global.cfg b/global.cfg
index 56677a5..1b72119 100644
--- a/global.cfg
+++ b/global.cfg
@@ -44,6 +44,8 @@ rhel6u1_i386 = http://
rhel6u1_x86_64 = http://
rhel6u2_i386 = http://
rhel6u2_x86_64 = http://
+rhel7u1_x86_64 = http://
+rhel7u2_x86_64 = http://
fedora12_i386 = http://
fedora12_x86_64 = http://
win2008_i386 = http://
@@ -70,6 +72,8 @@ rhel6_i386_http_ks = http://
rhel6_x86_64_http_ks = http://
rhel6u2_i386_http_ks = http://
rhel6u2_x86_64_http_ks = kickstart.cfg
+rhel7u1_x86_64_http_ks = http://
+rhel7u2_x86_64_http_ks = http://
fedora12_i386_http_ks = http://
fedora12_x86_64_http_ks = http://
@@ -97,7 +101,7 @@ sourcepath = /media/share
# also exercise DNS resolution
#
[other]
-wget_url = http://
+wget_url = http://libvirt.org/index.html
#
# The variables section is a set of variables used by the
@@ -127,7 +131,7 @@ defaulthv = kvm
defaultname = libvirt_test_api
# default os version to use for installing a new guest
# the value of it is the first part of 'rhel6u2_x86_64' in [guest] section above
-defaultos = rhel6u2
+defaultos = rhel7u2
# default architecture to use for installing a new guest
defaultarch = x86_64
# default the number of vcpu to use for defining or installing a guest
diff --git a/repos/domain/get_guest_network_info.py b/repos/domain/get_guest_network_info.py
new file mode 100644
index 0000000..35bba3b
--- /dev/null
+++ b/repos/domain/get_guest_network_info.py
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+
+import libvirt
+from libvirt import libvirtError
+from src import sharedmod
+
+required_params = ('guestname', 'flags',)
+optional_params = {}
+
+def check_guest_status(domobj):
+ """check guest current status
+ """
+ state = domobj.info()[0]
+ if state == libvirt.VIR_DOMAIN_SHUTOFF or \
+ state == libvirt.VIR_DOMAIN_SHUTDOWN:
+ return False
+ else:
+ return True
+
+def get_guest_network_info(params):
+ """get guest network interface info
+ """
+
+ logger = params['logger']
+ guestname = params['guestname']
+ flags = params['flags']
+
+ conn = sharedmod.libvirtobj['conn']
+
+ domobj = conn.lookupByName(guestname)
+
+ flags = params['flags']
+ logger.info("The flags are %s" % flags)
+ flags_string = flags.split("|")
+ flags = 0
+
+ for flag in flags_string:
+ if flag == 'lease':
+ flags |= libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE
+ elif flag == 'agent':
+ flags |= libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT
+ else:
+ logger.error("unknow flags")
+ return 1
+
+ logger.info("the given flags is %d" % flags)
+
+ # Check domain status
+ if check_guest_status(domobj):
+ logger.info("Guest is running")
+ else:
+ logger.error("Guest is shut off status")
+ return 1
+
+ try:
+ info = domobj.interfaceAddresses(flags)
+ logger.info("get guest interface info")
+
+ except libvirtError, e:
+ logger.error("API error message: %s, error code is %s" \
+ % (e.message, e.get_error_code()))
+ return 1
+
+ return 0
+
+
--
1.8.3.1
9 years, 8 months
[libvirt] [PATCH tck 0/6] Update TCK for current libvirt/qemu environments
by Mike Latimer
Hi,
TCK needs some changes in order to better handle current libvirt/qemu
environments. This patch series contains patches to address most (not all*)
of the issues I've been encountering:
- IP addresses can no longer be retrieved from default.leases
- NUMA flags AFFECT_LIVE and AFFECT_CONFIG are mutually exclusive
- cow format is no longer supported by qemu
- dnsmasq spawns a child process with the same process name and params
In addition to the above fixes, additional delays improve the reliability
of the nwfilter and hotplugging tests.
Thanks,
Mike
* I'll post another series shortly, dealing with issues in 121-block-info.t.
Mike Latimer (6):
Retrieve ip address from arp instead of leases
nwfilter startup and shutdown delay
NUMA flags are exclusive
Remove cow format tests
Delay before hotplugging
Handle dnsmasq child processes
lib/Sys/Virt/TCK/NetworkHelpers.pm | 8 ++++----
scripts/domain/200-disk-hotplug.t | 1 +
scripts/domain/202-numa-set-parameters.t | 14 +++++++++-----
scripts/domain/210-nic-hotplug.t | 1 +
scripts/domain/215-nic-hotplug-many.t | 1 +
scripts/networks/networkxml2hostout/tck-testnet-1.dat | 2 +-
scripts/networks/networkxml2hostout/tck-testnet-2.dat | 2 +-
scripts/networks/networkxml2hostout/tck-testnet-3.dat | 2 +-
scripts/nwfilter/100-ping-still-working.t | 4 ++--
scripts/nwfilter/210-no-mac-spoofing.t | 4 ++--
scripts/nwfilter/220-no-ip-spoofing.t | 15 ++++++++++++---
scripts/nwfilter/230-no-mac-broadcast.t | 4 ++--
scripts/nwfilter/240-no-arp-spoofing.t | 4 ++--
scripts/storage/100-create-vol-dir.t | 19 +------------------
scripts/storage/200-clone-vol-dir.t | 4 ++--
15 files changed, 42 insertions(+), 43 deletions(-)
--
1.8.4.5
9 years, 8 months
[libvirt] [PATCH] src: Generate virkeymaps.h into the correct directory
by Michal Privoznik
So after a9fe620372144db we are generating virkeymaps.h all the
time during build. This is good. However, when doing a VPATH
build, we are not generating it into the correct directory, since
there's $(srcdir) prefix missing to the path to the file:
make[2]: Entering directory
`/home/jenkins/libvirt/systems/libvirt-fedora-20/build/src'
GEN util/virkeymaps.h
...
CC util/libvirt_util_la-virkeycode.lo
CC util/libvirt_util_la-virkeyfile.lo
CC util/libvirt_util_la-virlockspace.lo
CC util/libvirt_util_la-virlog.lo
../../src/util/virkeycode.c:27:24: fatal error: virkeymaps.h: No such file or directory
#include "virkeymaps.h"
^
compilation terminated.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Even though this would qualify as build breaker, I'm sending it for review.
src/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index e4660eb..0bf28cf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -177,10 +177,10 @@ EXTRA_DIST += $(srcdir)/util/keymaps.csv $(srcdir)/util/virkeycode-mapgen.py
BUILT_SOURCES += util/virkeymaps.h
MAINTAINERCLEANFILES += util/virkeymaps.h
-util/virkeymaps.h: $(srcdir)/util/keymaps.csv \
+$(srcdir)/util/virkeymaps.h: $(srcdir)/util/keymaps.csv \
$(srcdir)/util/virkeycode-mapgen.py
$(AM_V_GEN)$(PYTHON) $(srcdir)/util/virkeycode-mapgen.py \
- <$(srcdir)/util/keymaps.csv >util/virkeymaps.h
+ <$(srcdir)/util/keymaps.csv >$(srcdir)/util/virkeymaps.h
# Internal generic driver infrastructure
NODE_INFO_SOURCES = nodeinfo.h nodeinfo.c nodeinfopriv.h
--
2.4.9
9 years, 8 months
[libvirt] [PATCH v2 0/4] Be tolerant to relabel errors for session mode
by Michal Privoznik
This is a reworked version of my previous patch:
https://www.redhat.com/archives/libvir-list/2015-July/msg00576.html
Michal Privoznik (4):
virSecuritySELinuxSetSecurityAllLabel: drop useless virFileIsSharedFSType
security_selinux: Replace SELinuxSCSICallbackData with proper struct
virSecurityManager: Track if running as privileged
security_selinux: Take @privileged into account
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_driver.c | 3 +-
src/qemu/qemu_driver.c | 7 +-
src/security/security_manager.c | 29 ++++++--
src/security/security_manager.h | 5 +-
src/security/security_selinux.c | 147 ++++++++++++++++++++++++---------------
tests/qemuhotplugtest.c | 2 +-
tests/seclabeltest.c | 2 +-
tests/securityselinuxlabeltest.c | 2 +-
tests/securityselinuxtest.c | 2 +-
10 files changed, 127 insertions(+), 74 deletions(-)
--
2.4.6
9 years, 8 months
[libvirt] [PATCH] vz: cleanup
by Maxim Nestratov
From: Maxim Nestratov <mnestratov(a)virtuozzo.com>
Remove unused definitions, functions and structure fields.
Signed-off-by: Maxim Nestratov <mnestratov(a)virtuozzo.com>
---
src/vz/vz_driver.c | 1 -
src/vz/vz_utils.c | 67 ----------------------------------------------------
src/vz/vz_utils.h | 20 ---------------
3 files changed, 0 insertions(+), 88 deletions(-)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index d0b4692..15dc70f 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -262,7 +262,6 @@ vzOpenDefault(virConnectPtr conn)
error:
virObjectUnref(privconn->domains);
virObjectUnref(privconn->caps);
- virStoragePoolObjListFree(&privconn->pools);
virObjectEventStateFree(privconn->domainEventState);
prlsdkDisconnect(privconn);
prlsdkDeinit();
diff --git a/src/vz/vz_utils.c b/src/vz/vz_utils.c
index 08b7f5a..894f7dd 100644
--- a/src/vz/vz_utils.c
+++ b/src/vz/vz_utils.c
@@ -115,33 +115,6 @@ vzDoCmdRun(char **outbuf, const char *binary, va_list list)
}
/*
- * Run command and parse its JSON output, return
- * pointer to virJSONValue or NULL in case of error.
- */
-virJSONValuePtr
-vzParseOutput(const char *binary, ...)
-{
- char *outbuf;
- virJSONValuePtr jobj = NULL;
- va_list list;
- int ret;
-
- va_start(list, binary);
- ret = vzDoCmdRun(&outbuf, binary, list);
- va_end(list);
- if (ret)
- return NULL;
-
- jobj = virJSONValueFromString(outbuf);
- if (!jobj)
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("invalid output from prlctl: %s"), outbuf);
-
- VIR_FREE(outbuf);
- return jobj;
-}
-
-/*
* Run command and return its output, pointer to
* buffer or NULL in case of error. Caller os responsible
* for freeing the buffer.
@@ -161,43 +134,3 @@ vzGetOutput(const char *binary, ...)
return outbuf;
}
-
-/*
- * Run prlctl command and check for errors
- *
- * Return value is 0 in case of success, else - -1
- */
-int
-vzCmdRun(const char *binary, ...)
-{
- int ret;
- va_list list;
-
- va_start(list, binary);
- ret = vzDoCmdRun(NULL, binary, list);
- va_end(list);
-
- return ret;
-}
-
-/*
- * Return new file path in malloced string created by
- * concatenating first and second function arguments.
- */
-char *
-vzAddFileExt(const char *path, const char *ext)
-{
- char *new_path = NULL;
- size_t len = strlen(path) + strlen(ext) + 1;
-
- if (VIR_ALLOC_N(new_path, len) < 0)
- return NULL;
-
- if (!virStrcpy(new_path, path, len)) {
- VIR_FREE(new_path);
- return NULL;
- }
- strcat(new_path, ext);
-
- return new_path;
-}
diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h
index 77f49f0..84cf08f 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -27,11 +27,8 @@
# include "driver.h"
# include "conf/domain_conf.h"
-# include "conf/storage_conf.h"
# include "conf/domain_event.h"
-# include "conf/network_conf.h"
# include "virthread.h"
-# include "virjson.h"
# define vzParseError() \
virReportErrorHelper(VIR_FROM_TEST, VIR_ERR_OPERATION_FAILED, __FILE__, \
@@ -50,11 +47,6 @@
# define PARALLELS_DOMAIN_ROUTED_NETWORK_NAME "Routed"
# define PARALLELS_DOMAIN_BRIDGED_NETWORK_NAME "Bridged"
-# define PARALLELS_REQUIRED_HOSTONLY_NETWORK "Host-Only"
-# define PARALLELS_HOSTONLY_NETWORK_TYPE "host-only"
-# define PARALLELS_REQUIRED_BRIDGED_NETWORK "Bridged"
-# define PARALLELS_BRIDGED_NETWORK_TYPE "bridged"
-
struct _vzConn {
virMutex lock;
@@ -62,12 +54,9 @@ struct _vzConn {
virDomainObjListPtr domains;
PRL_HANDLE server;
- virStoragePoolObjList pools;
- virNetworkObjListPtr networks;
virCapsPtr caps;
virDomainXMLOptionPtr xmlopt;
virObjectEventStatePtr domainEventState;
- virStorageDriverStatePtr storageState;
const char *drivername;
};
@@ -97,19 +86,10 @@ typedef struct vzDomObj *vzDomObjPtr;
virDomainObjPtr vzDomObjFromDomain(virDomainPtr domain);
virDomainObjPtr vzDomObjFromDomainRef(virDomainPtr domain);
-virJSONValuePtr vzParseOutput(const char *binary, ...)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
char * vzGetOutput(const char *binary, ...)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
-int vzCmdRun(const char *binary, ...)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
-char * vzAddFileExt(const char *path, const char *ext);
void vzDriverLock(vzConnPtr driver);
void vzDriverUnlock(vzConnPtr driver);
-virStorageVolPtr vzStorageVolLookupByPathLocked(virConnectPtr conn,
- const char *path);
-int vzStorageVolDefRemove(virStoragePoolObjPtr privpool,
- virStorageVolDefPtr privvol);
# define PARALLELS_BLOCK_STATS_FOREACH(OP) \
OP(rd_req, VIR_DOMAIN_BLOCK_STATS_READ_REQ, "read_requests") \
--
1.7.1
9 years, 8 months
[libvirt] [PATCH] AUTHORS: Add myself to the list of committers
by Andrea Bolognani
---
Ján insisted so much. Pushed as trivial.
AUTHORS.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/AUTHORS.in b/AUTHORS.in
index 7e4359f..d385fbc 100644
--- a/AUTHORS.in
+++ b/AUTHORS.in
@@ -8,6 +8,7 @@ Daniel Veillard <veillard(a)redhat.com> or <daniel(a)veillard.com>
The primary maintainers and people with commit access rights:
Alex Jia <ajia(a)redhat.com>
+Andrea Bolognani <abologna(a)redhat.com>
Cédric Bosdonnat <cbosdonnat(a)suse.com>
Christophe Fergeau <cfergeau(a)redhat.com>
Claudio Bley <claudio.bley(a)gmail.com>
--
2.4.3
9 years, 8 months
[libvirt] [PATCH tck 0/3] Account for blockstats changes in 121-block-info.t
by Mike Latimer
Hi,
Due to libvirt commit 0282ca45, 121-block-info.t fails as the allocation size
returned by block-info is now zero. While addressing this, a few aspects of
the test were also cleaned up. The changes are not extensive, but it made more
sense to submit them in a series.
Thanks,
Mike
Mike Latimer (3):
Rename volume1 variables
Reorder and add qcow tests
Disk allocation should be zero
scripts/domain/121-block-info.t | 65 +++++++++++++++++++++++------------------
1 file changed, 37 insertions(+), 28 deletions(-)
--
1.8.4.5
9 years, 8 months
[libvirt] [sandbox] virt-sandbox-image: separate templates from the different sources
by Cédric Bosdonnat
Put templates files in a folder for the corresponding source to avoid
potential name conflicts.
---
libvirt-sandbox/image/cli.py | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py
index d449a7b..9b9c00b 100755
--- a/libvirt-sandbox/image/cli.py
+++ b/libvirt-sandbox/image/cli.py
@@ -64,17 +64,21 @@ def debug(msg):
def info(msg):
sys.stdout.write(msg)
+def get_template_dir(args):
+ tmpl = template.Template.from_uri(args.template)
+ return "%s/%s" % (args.template_dir, tmpl.source)
+
def delete(args):
tmpl = template.Template.from_uri(args.template)
source = tmpl.get_source_impl()
source.delete_template(template=tmpl,
- templatedir=args.template_dir)
+ templatedir=get_template_dir(args))
def create(args):
tmpl = template.Template.from_uri(args.template)
source = tmpl.get_source_impl()
source.create_template(template=tmpl,
- templatedir=args.template_dir,
+ templatedir=get_template_dir(args),
connect=args.connect)
def run(args):
@@ -83,9 +87,10 @@ def run(args):
tmpl = template.Template.from_uri(args.template)
source = tmpl.get_source_impl()
+ template_dir = get_template_dir(args)
# Create the template image if needed
- if not source.has_template(tmpl, args.template_dir):
+ if not source.has_template(tmpl, template_dir):
create(args)
name = args.name
@@ -94,11 +99,11 @@ def run(args):
name = tmpl.path[1:] + ":" + randomid
diskfile = source.get_disk(template=tmpl,
- templatedir=args.template_dir,
+ templatedir=template_dir,
imagedir=args.image_dir,
sandboxname=name)
- commandToRun = source.get_command(tmpl, args.template_dir, args.args)
+ commandToRun = source.get_command(tmpl, template_dir, args.args)
if len(commandToRun) == 0:
commandToRun = ["/bin/sh"]
cmd = ['virt-sandbox', '--name', name]
@@ -112,7 +117,7 @@ def run(args):
params.append('-N')
params.append(networkArgs)
- allEnvs = source.get_env(tmpl, args.template_dir)
+ allEnvs = source.get_env(tmpl, template_dir)
envArgs = args.env
if envArgs is not None:
allEnvs = allEnvs + envArgs
@@ -128,7 +133,7 @@ def run(args):
cmd = cmd + params + ['--'] + commandToRun
subprocess.call(cmd)
os.unlink(diskfile)
- source.post_run(tmpl, args.template_dir, name)
+ source.post_run(tmpl, template_dir, name)
def requires_template(parser):
parser.add_argument("template",
--
2.1.4
9 years, 8 months