[libvirt] [test-API][PATCH 3/3] Target path should not with lines in pool xml

The xml for define and create pool is with line switch in target path. For aa.xml: <pool type="netfs"> <name>netfs_pool</name> <source> <host name="192.168.0.121"/> <dir path="/dir"/> <format type="nfs"/> </source> <target> <path> /tmp/netfs </path> </target> </pool> virsh pool-create aa.xml error: Failed to create pool from aa.xml error: cannot open path ' /tmp/netfs ': No such file or directory Signed-off-by: Wayne Sun <gsun@redhat.com> --- repos/storage/xmls/netfs_pool.xml | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/repos/storage/xmls/netfs_pool.xml b/repos/storage/xmls/netfs_pool.xml index 309a652..d8b88c2 100644 --- a/repos/storage/xmls/netfs_pool.xml +++ b/repos/storage/xmls/netfs_pool.xml @@ -6,8 +6,6 @@ <format type="nfs"/> </source> <target> - <path> - TARGETPATH - </path> + <path>TARGETPATH</path> </target> </pool> -- 1.7.1

Modfiy the function name to avoid generating check case and doing params check before the case run. Signed-off-by: Wayne Sun <gsun@redhat.com> --- repos/domain/cpu_topology.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py index f0f081c..5f4ef52 100644 --- a/repos/domain/cpu_topology.py +++ b/repos/domain/cpu_topology.py @@ -120,7 +120,7 @@ def guest_start(domobj, guestname, logger): return 0, ip -def cpu_topology_check(ip, username, password, +def cpu_topology_chk(ip, username, password, sockets, cores, threads, logger): """login the guest, run lscpu command to check the result""" lscpu = "lscpu" @@ -194,7 +194,7 @@ def cpu_topology(params): if ret: return 1 - if cpu_topology_check(ip, username, password, + if cpu_topology_chk(ip, username, password, sockets, cores, threads, logger): return 1 -- 1.7.1

On 08/17/2012 12:06 PM, Wayne Sun wrote:
Modfiy the function name to avoid generating check case and doing params check before the case run.
Signed-off-by: Wayne Sun <gsun@redhat.com> --- repos/domain/cpu_topology.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/repos/domain/cpu_topology.py b/repos/domain/cpu_topology.py index f0f081c..5f4ef52 100644 --- a/repos/domain/cpu_topology.py +++ b/repos/domain/cpu_topology.py @@ -120,7 +120,7 @@ def guest_start(domobj, guestname, logger):
return 0, ip
-def cpu_topology_check(ip, username, password, +def cpu_topology_chk(ip, username, password, sockets, cores, threads, logger): """login the guest, run lscpu command to check the result""" lscpu = "lscpu" @@ -194,7 +194,7 @@ def cpu_topology(params): if ret: return 1
- if cpu_topology_check(ip, username, password, + if cpu_topology_chk(ip, username, password, sockets, cores, threads, logger): return 1
Makes sense, ACK, Martin

Signed-off-by: Wayne Sun <gsun@redhat.com> --- utils/utils.py | 18 ------------------ 1 files changed, 0 insertions(+), 18 deletions(-) diff --git a/utils/utils.py b/utils/utils.py index eade10d..b174a58 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -514,24 +514,6 @@ def remote_exec(hostname, username, password, cmd): subproc_flag = 0 return -1 -def remote_exec_pexpect(hostname, username, password, cmd): - """Remote exec function via pexpect""" - user_hostname = "%s@%s" % (username, hostname) - child = pexpect.spawn("/usr/bin/ssh", [user_hostname, cmd], - timeout = 60, maxread = 2000, logfile = None) - #child.logfile = sys.stdout - while True: - index = child.expect(['(yes\/no)', 'password:', pexpect.EOF, - pexpect.TIMEOUT]) - if index == 0: - child.sendline("yes") - elif index == 1: - child.sendline(password) - elif index == 2: - return string.strip(child.before) - elif index == 3: - return "TIMEOUT!!!" - def get_remote_vcpus(hostname, username, password): """Get cpu number of specified host""" cmd = "cat /proc/cpuinfo | grep processor | wc -l" -- 1.7.1

On 08/17/2012 12:06 PM, Wayne Sun wrote:
Signed-off-by: Wayne Sun <gsun@redhat.com> --- utils/utils.py | 18 ------------------ 1 files changed, 0 insertions(+), 18 deletions(-)
diff --git a/utils/utils.py b/utils/utils.py index eade10d..b174a58 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -514,24 +514,6 @@ def remote_exec(hostname, username, password, cmd): subproc_flag = 0 return -1
-def remote_exec_pexpect(hostname, username, password, cmd): - """Remote exec function via pexpect""" - user_hostname = "%s@%s" % (username, hostname) - child = pexpect.spawn("/usr/bin/ssh", [user_hostname, cmd], - timeout = 60, maxread = 2000, logfile = None) - #child.logfile = sys.stdout - while True: - index = child.expect(['(yes\/no)', 'password:', pexpect.EOF, - pexpect.TIMEOUT]) - if index == 0: - child.sendline("yes") - elif index == 1: - child.sendline(password) - elif index == 2: - return string.strip(child.before) - elif index == 3: - return "TIMEOUT!!!" - def get_remote_vcpus(hostname, username, password): """Get cpu number of specified host""" cmd = "cat /proc/cpuinfo | grep processor | wc -l"
ACK, Martin

On 08/17/2012 12:06 PM, Wayne Sun wrote:
The xml for define and create pool is with line switch in target path.
For aa.xml: <pool type="netfs"> <name>netfs_pool</name> <source> <host name="192.168.0.121"/> <dir path="/dir"/> <format type="nfs"/> </source> <target> <path> /tmp/netfs </path> </target> </pool>
virsh pool-create aa.xml error: Failed to create pool from aa.xml error: cannot open path ' /tmp/netfs ': No such file or directory
Signed-off-by: Wayne Sun <gsun@redhat.com> --- repos/storage/xmls/netfs_pool.xml | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/repos/storage/xmls/netfs_pool.xml b/repos/storage/xmls/netfs_pool.xml index 309a652..d8b88c2 100644 --- a/repos/storage/xmls/netfs_pool.xml +++ b/repos/storage/xmls/netfs_pool.xml @@ -6,8 +6,6 @@ <format type="nfs"/> </source> <target> - <path> - TARGETPATH - </path> + <path>TARGETPATH</path> </target> </pool>
ACK, Martin

On 2012年08月17日 18:41, Martin Kletzander wrote:
On 08/17/2012 12:06 PM, Wayne Sun wrote:
The xml for define and create pool is with line switch in target path.
For aa.xml: <pool type="netfs"> <name>netfs_pool</name> <source> <host name="192.168.0.121"/> <dir path="/dir"/> <format type="nfs"/> </source> <target> <path> /tmp/netfs </path> </target> </pool>
virsh pool-create aa.xml error: Failed to create pool from aa.xml error: cannot open path ' /tmp/netfs ': No such file or directory
Signed-off-by: Wayne Sun<gsun@redhat.com> --- repos/storage/xmls/netfs_pool.xml | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/repos/storage/xmls/netfs_pool.xml b/repos/storage/xmls/netfs_pool.xml index 309a652..d8b88c2 100644 --- a/repos/storage/xmls/netfs_pool.xml +++ b/repos/storage/xmls/netfs_pool.xml @@ -6,8 +6,6 @@ <format type="nfs"/> </source> <target> -<path> - TARGETPATH -</path> +<path>TARGETPATH</path> </target> </pool>
ACK, Martin
Pushed the series. Regards, Osier
participants (3)
-
Martin Kletzander
-
Osier Yang
-
Wayne Sun