# HG changeset patch
# User Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
# Date 1237383510 25200
# Node ID a06ef66126e2c8636f0b2ae0d978d38192471e9d
# Parent daccd46e12ccf2afce3295a41510d7e94ff48d7b
[TEST] Fixing the run() fn of vxml.py.
Fixing run() fn of vxml.py to be able to run virsh commands on the remote machine.
We need this for successful execution of the ssh remote commands like net-createa via
virsh,
otherwise the remote execution of the command fails when the file is not locally present
on the remote machine.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r daccd46e12cc -r a06ef66126e2 suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py Fri Mar 13 10:31:02 2009 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py Wed Mar 18 06:38:30 2009 -0700
@@ -164,12 +164,29 @@
else:
name = param
+ # We need to copy the xml files to remote machine for
+ # successful execution of the ssh remote commands like net-createa via virsh,
+ # otherwise the remote execution of the command fails when the
+ # file is not locally present on the remote machine.
+ if vcmd == 'define' or vcmd == 'create' or vcmd ==
'net-create' or \
+ vcmd == 'pool-create':
+ s, o = utils.copy_remote(ip, name, remote=name)
+ if s != 0:
+ logger.error("Failed to copy the tempxml file to execute
'%s'"\
+ " cmd on '%s'", vcmd, ip)
+ return 0
+
cmd = 'virsh -c %s %s %s' % (self.vuri, vcmd, name)
s, o = utils.run_remote(ip, cmd)
- if vcmd == 'define' or vcmd == 'create':
+ if vcmd == 'define' or vcmd == 'create' or vcmd ==
'net-create' \
+ or vcmd == 'pool-create':
# don't wait till gc does the ntf.close()
ntf.close()
+ # Remove the tmp file copied to the remote machine
+ cmd = 'rm -rf %s' % name
+ utils.run_remote(ip, cmd)
+
return s == 0
class NetXML(Virsh, XMLClass):