[PATCH][TEST] Fixed a misused character
by Toshifumi Fujimura
[PATCH][TEST] Fixed a misused character
I found a misused character.
Signed-off-by: Toshifumi Fujimura <fujimura.toshifumi(a)np.css.fujitsu.com>
diff -r 29c875cab8b8 doc/architecture.html.in
--- a/doc/architecture.html.in Tue Nov 04 13:10:46 2008 -0800
+++ b/doc/architecture.html.in Wed Nov 05 18:42:43 2008 +0900
@@ -15,7 +15,7 @@
</ul>
<p>
The provider classes implement the actual CIM class model. Some of
- the provider libraries implement one CIM class and one providier.
+ the provider libraries implement one CIM class and one provider.
However, many of them perform more than one task. For example,
the <tt>Virt_Device</tt> and <tt>Virt_DevicePool</tt> providers
implement the device and device pool classes for each of the major
--
Toshifumi Fujimura.
16 years, 1 month
[PATCH] Avoid clobbering disk flags on redefine
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1225992264 28800
# Node ID 9385e61cd401162bef9c44bc11f64ca349a41abf
# Parent 20af5ae5b01c308d2cfab62899b2dbcb8d186567
Avoid clobbering disk flags on redefine
This patch makes sure we track the shareable and readonly flags that can
be present in a disk device.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 20af5ae5b01c -r 9385e61cd401 libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Wed Nov 05 08:00:07 2008 -0800
+++ b/libxkutil/device_parsing.c Thu Nov 06 09:24:24 2008 -0800
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <inttypes.h>
#include <sys/stat.h>
#include <libxml/tree.h>
@@ -235,6 +236,10 @@
ddev->virtual_dev = get_attr_value(child, "dev");
if (ddev->virtual_dev == NULL)
goto err;
+ } else if (XSTREQ(child->name, "readonly")) {
+ ddev->readonly = true;
+ } else if (XSTREQ(child->name, "shareable")) {
+ ddev->shareable = true;
}
}
if ((ddev->source == NULL) || (ddev->virtual_dev == NULL))
@@ -619,6 +624,8 @@
DUP_FIELD(dev, _dev, dev.disk.driver);
DUP_FIELD(dev, _dev, dev.disk.source);
DUP_FIELD(dev, _dev, dev.disk.virtual_dev);
+ dev->dev.disk.readonly = dev->dev.disk.readonly;
+ dev->dev.disk.shareable = dev->dev.disk.shareable;
} else if (dev->type == CIM_RES_TYPE_MEM) {
dev->dev.mem.size = _dev->dev.mem.size;
dev->dev.mem.maxsize = _dev->dev.mem.maxsize;
diff -r 20af5ae5b01c -r 9385e61cd401 libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Wed Nov 05 08:00:07 2008 -0800
+++ b/libxkutil/device_parsing.h Thu Nov 06 09:24:24 2008 -0800
@@ -25,6 +25,7 @@
#define __DEVICE_PARSING_H
#include <stdint.h>
+#include <stdbool.h>
#include <libvirt/libvirt.h>
#include "../src/svpc_types.h"
@@ -36,6 +37,8 @@
char *source;
char *virtual_dev;
enum {DISK_UNKNOWN, DISK_PHY, DISK_FILE, DISK_FS} disk_type;
+ bool readonly;
+ bool shareable;
};
struct net_device {
diff -r 20af5ae5b01c -r 9385e61cd401 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Wed Nov 05 08:00:07 2008 -0800
+++ b/libxkutil/xmlgen.c Thu Nov 06 09:24:24 2008 -0800
@@ -113,7 +113,7 @@
return 1;
}
-static char *disk_block_xml(const char *path, const char *vdev)
+static char *disk_block_xml(struct disk_device *dev)
{
char *xml;
int ret;
@@ -122,16 +122,20 @@
"<disk type='block' device='disk'>\n"
" <source dev='%s'/>\n"
" <target dev='%s'/>\n"
+ "%s"
+ "%s"
"</disk>\n",
- path,
- vdev);
+ dev->source,
+ dev->virtual_dev,
+ dev->readonly ? "<readonly/>\n" : "",
+ dev->shareable ? "<shareable/>\n" : "");
if (ret == -1)
xml = NULL;
return xml;
}
-static char *disk_file_xml(const char *path, const char *vdev)
+static char *disk_file_xml(struct disk_device *dev)
{
char *xml;
int ret;
@@ -140,16 +144,20 @@
"<disk type='file' device='disk'>\n"
" <source file='%s'/>\n"
" <target dev='%s'/>\n"
+ "%s"
+ "%s"
"</disk>\n",
- path,
- vdev);
+ dev->source,
+ dev->virtual_dev,
+ dev->readonly ? "<readonly/>" : "",
+ dev->shareable ? "<shareable/>" : "");
if (ret == -1)
xml = NULL;
return xml;
}
-static char *disk_fs_xml(const char *path, const char *vdev)
+static char *disk_fs_xml(struct disk_device *dev)
{
char *xml;
int ret;
@@ -159,8 +167,8 @@
" <source dir='%s'/>\n"
" <target dir='%s'/>\n"
"</filesystem>\n",
- path,
- vdev);
+ dev->source,
+ dev->virtual_dev);
if (ret == -1)
xml = NULL;
@@ -173,13 +181,13 @@
struct disk_device *disk = &dev->dev.disk;
if (disk->disk_type == DISK_PHY)
- _xml = disk_block_xml(disk->source, disk->virtual_dev);
+ _xml = disk_block_xml(disk);
else if (disk->disk_type == DISK_FILE)
/* If it's not a block device, we assume a file,
which should be a reasonable fail-safe */
- _xml = disk_file_xml(disk->source, disk->virtual_dev);
+ _xml = disk_file_xml(disk);
else if (disk->disk_type == DISK_FS)
- _xml = disk_fs_xml(disk->source, disk->virtual_dev);
+ _xml = disk_fs_xml(disk);
else
return false;
16 years, 1 month
[PATCH] [TEST] Updating 02_enum_crscap.py tc of RedirectionService to work with libvirt-cim provider with no CRS CAP support
by Deepti B. Kalakeri
# HG changeset patch
# User Deepti B. Kalakeri<deeptik(a)linux.vnet.ibm.com>
# Date 1225804761 28800
# Node ID 82afd0f6f9b91ef42c6fd1602d9929faecb94c9e
# Parent a63c661d0e709149d874d7632ac16f721aea60e6
[TEST] Updating 02_enum_crscap.py tc of RedirectionService to work with libvirt-cim provider with no CRS CAP support.
Updating 02_enum_crscap.py tc of RedirectionService to skip the tc if CRS CAP provider is not present
in the libvirt_cim provider when the libvirt_cim_revision < 691.
Signed-off-by: Deepti B. Kalakeri <deeptik(a)linux.vnet.ibm.com>
diff -r a63c661d0e70 -r 82afd0f6f9b9 suites/libvirt-cim/cimtest/RedirectionService/02_enum_crscap.py
--- a/suites/libvirt-cim/cimtest/RedirectionService/02_enum_crscap.py Tue Nov 04 04:48:25 2008 -0800
+++ b/suites/libvirt-cim/cimtest/RedirectionService/02_enum_crscap.py Tue Nov 04 05:19:21 2008 -0800
@@ -31,15 +31,29 @@
from CimTest.Globals import logger, CIM_ERROR_ENUMERATE
from XenKvmLib.classes import get_typed_class
from XenKvmLib.const import do_main
-from CimTest.ReturnCodes import PASS, FAIL
+from CimTest.ReturnCodes import PASS, FAIL, SKIP
+from XenKvmLib.const import get_provider_version
SHAREMODESUPP = 3
sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
+libvirtcim_crscap_changes = 691
+
@do_main(sup_types)
def main():
virt = main.options.virt
server = main.options.ip
+
+ # This check is required for libivirt-cim providers which do not have
+ # CRSCAP changes in it and the CRSCAP provider is available with
+ # revision >= 691.
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev < libvirtcim_crscap_changes:
+ logger.info("ConsoleRedirectionServiceCapabilities provider not"
+ " supported, hence skipping the tc ....")
+ return SKIP
+
+
cname = 'ConsoleRedirectionServiceCapabilities'
cap_name = 'ConsoleRedirectionCapabilities'
classname = get_typed_class(virt, cname)
16 years, 1 month
[PATCH] Store and preserve keymap attribute for graphics device
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1225900807 28800
# Node ID 20af5ae5b01c308d2cfab62899b2dbcb8d186567
# Parent 29c875cab8b808655c04d2f971c0d6c9a9f03dbd
Store and preserve keymap attribute for graphics device
This prevents us from discarding the keymap setting when we redefine a domain.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 29c875cab8b8 -r 20af5ae5b01c libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Tue Nov 04 13:10:46 2008 -0800
+++ b/libxkutil/device_parsing.c Wed Nov 05 08:00:07 2008 -0800
@@ -76,6 +76,7 @@
free(dev->type);
free(dev->port);
free(dev->host);
+ free(dev->keymap);
}
void cleanup_virt_device(struct virt_device *dev)
@@ -440,6 +441,7 @@
gdev->type = get_attr_value(node, "type");
gdev->port = get_attr_value(node, "port");
gdev->host = get_attr_value(node, "listen");
+ gdev->keymap = get_attr_value(node, "keymap");
if ((gdev->type == NULL) || (gdev->port == NULL))
goto err;
@@ -628,6 +630,7 @@
DUP_FIELD(dev, _dev, dev.graphics.type);
DUP_FIELD(dev, _dev, dev.graphics.port);
DUP_FIELD(dev, _dev, dev.graphics.host);
+ DUP_FIELD(dev, _dev, dev.graphics.keymap);
}
return dev;
diff -r 29c875cab8b8 -r 20af5ae5b01c libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Tue Nov 04 13:10:46 2008 -0800
+++ b/libxkutil/device_parsing.h Wed Nov 05 08:00:07 2008 -0800
@@ -63,6 +63,7 @@
char *type;
char *port;
char *host;
+ char *keymap;
};
struct virt_device {
diff -r 29c875cab8b8 -r 20af5ae5b01c libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Tue Nov 04 13:10:46 2008 -0800
+++ b/libxkutil/xmlgen.c Wed Nov 05 08:00:07 2008 -0800
@@ -342,9 +342,12 @@
struct graphics_device *graphics = &dev->dev.graphics;
ret = asprintf(&_xml,
- "<graphics type='%s' port='%s'/>\n",
+ "<graphics type='%s' port='%s' "
+ "listen='%s' keymap='%s'/>\n",
graphics->type,
- graphics->port);
+ graphics->port,
+ graphics->host != NULL ? graphics->host : "127.0.0.1",
+ graphics->keymap != NULL ? graphics->keymap : "en-us");
if (ret == -1)
return false;
else
16 years, 1 month
[PATCH] Avoid clobbering disk flags on redefine
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1225901751 28800
# Node ID ece7c71cd2aab612dec19cc6247194cdf8b5b049
# Parent 20af5ae5b01c308d2cfab62899b2dbcb8d186567
Avoid clobbering disk flags on redefine
This patch makes sure we track the shareable and readonly flags that can
be present in a disk device.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 20af5ae5b01c -r ece7c71cd2aa libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Wed Nov 05 08:00:07 2008 -0800
+++ b/libxkutil/device_parsing.c Wed Nov 05 08:15:51 2008 -0800
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <inttypes.h>
#include <sys/stat.h>
#include <libxml/tree.h>
@@ -235,6 +236,10 @@
ddev->virtual_dev = get_attr_value(child, "dev");
if (ddev->virtual_dev == NULL)
goto err;
+ } else if (XSTREQ(child->name, "readonly")) {
+ ddev->readonly = true;
+ } else if (XSTREQ(child->name, "shareable")) {
+ ddev->shareable = true;
}
}
if ((ddev->source == NULL) || (ddev->virtual_dev == NULL))
@@ -619,6 +624,8 @@
DUP_FIELD(dev, _dev, dev.disk.driver);
DUP_FIELD(dev, _dev, dev.disk.source);
DUP_FIELD(dev, _dev, dev.disk.virtual_dev);
+ dev->dev.disk.readonly = dev->dev.disk.readonly;
+ dev->dev.disk.shareable = dev->dev.disk.shareable;
} else if (dev->type == CIM_RES_TYPE_MEM) {
dev->dev.mem.size = _dev->dev.mem.size;
dev->dev.mem.maxsize = _dev->dev.mem.maxsize;
diff -r 20af5ae5b01c -r ece7c71cd2aa libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Wed Nov 05 08:00:07 2008 -0800
+++ b/libxkutil/device_parsing.h Wed Nov 05 08:15:51 2008 -0800
@@ -25,6 +25,7 @@
#define __DEVICE_PARSING_H
#include <stdint.h>
+#include <stdbool.h>
#include <libvirt/libvirt.h>
#include "../src/svpc_types.h"
@@ -36,6 +37,8 @@
char *source;
char *virtual_dev;
enum {DISK_UNKNOWN, DISK_PHY, DISK_FILE, DISK_FS} disk_type;
+ bool readonly;
+ bool shareable;
};
struct net_device {
diff -r 20af5ae5b01c -r ece7c71cd2aa libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Wed Nov 05 08:00:07 2008 -0800
+++ b/libxkutil/xmlgen.c Wed Nov 05 08:15:51 2008 -0800
@@ -113,7 +113,7 @@
return 1;
}
-static char *disk_block_xml(const char *path, const char *vdev)
+static char *disk_block_xml(struct disk_device *dev)
{
char *xml;
int ret;
@@ -122,16 +122,20 @@
"<disk type='block' device='disk'>\n"
" <source dev='%s'/>\n"
" <target dev='%s'/>\n"
+ "%s"
+ "%s"
"</disk>\n",
- path,
- vdev);
+ dev->source,
+ dev->virtual_dev,
+ dev->readonly ? "<readonly/>\n" : "",
+ dev->shareable ? "<shareable/>\n" : "");
if (ret == -1)
xml = NULL;
return xml;
}
-static char *disk_file_xml(const char *path, const char *vdev)
+static char *disk_file_xml(struct disk_device *dev)
{
char *xml;
int ret;
@@ -140,16 +144,20 @@
"<disk type='file' device='disk'>\n"
" <source file='%s'/>\n"
" <target dev='%s'/>\n"
+ "%s"
+ "%s"
"</disk>\n",
- path,
- vdev);
+ dev->source,
+ dev->virtual_dev,
+ dev->readonly ? "<readonly/>" : "",
+ dev->shareable ? "shareable/>" : "");
if (ret == -1)
xml = NULL;
return xml;
}
-static char *disk_fs_xml(const char *path, const char *vdev)
+static char *disk_fs_xml(struct disk_device *dev)
{
char *xml;
int ret;
@@ -159,8 +167,8 @@
" <source dir='%s'/>\n"
" <target dir='%s'/>\n"
"</filesystem>\n",
- path,
- vdev);
+ dev->source,
+ dev->virtual_dev);
if (ret == -1)
xml = NULL;
@@ -173,13 +181,13 @@
struct disk_device *disk = &dev->dev.disk;
if (disk->disk_type == DISK_PHY)
- _xml = disk_block_xml(disk->source, disk->virtual_dev);
+ _xml = disk_block_xml(disk);
else if (disk->disk_type == DISK_FILE)
/* If it's not a block device, we assume a file,
which should be a reasonable fail-safe */
- _xml = disk_file_xml(disk->source, disk->virtual_dev);
+ _xml = disk_file_xml(disk);
else if (disk->disk_type == DISK_FS)
- _xml = disk_fs_xml(disk->source, disk->virtual_dev);
+ _xml = disk_fs_xml(disk);
else
return false;
16 years, 1 month
[PATCH] Don't drop disk type on redefine
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1225902171 28800
# Node ID 1d696e80fccc41c9b21b5f24b84deab82d1416cc
# Parent ece7c71cd2aab612dec19cc6247194cdf8b5b049
Don't drop disk type on redefine
Right now, we track the status of disk/cdrom of a disk device, but don't
use it in the XML define. This patch uses the value instead of a static
device='disk'.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r ece7c71cd2aa -r 1d696e80fccc libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Wed Nov 05 08:15:51 2008 -0800
+++ b/libxkutil/xmlgen.c Wed Nov 05 08:22:51 2008 -0800
@@ -119,12 +119,13 @@
int ret;
ret = asprintf(&xml,
- "<disk type='block' device='disk'>\n"
+ "<disk type='block' device='%s'>\n"
" <source dev='%s'/>\n"
" <target dev='%s'/>\n"
"%s"
"%s"
"</disk>\n",
+ dev->device,
dev->source,
dev->virtual_dev,
dev->readonly ? "<readonly/>\n" : "",
@@ -141,12 +142,13 @@
int ret;
ret = asprintf(&xml,
- "<disk type='file' device='disk'>\n"
+ "<disk type='file' device='%s'>\n"
" <source file='%s'/>\n"
" <target dev='%s'/>\n"
"%s"
"%s"
"</disk>\n",
+ dev->device,
dev->source,
dev->virtual_dev,
dev->readonly ? "<readonly/>" : "",
16 years, 1 month
[PATCH] [TEST] Fix VSMS 14_define_sys_disk.py to specify FV or PV disk for Xen guests
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1225932047 28800
# Node ID 78c534011b848cade45897c0c35dac4ebc53fce1
# Parent ddd395416461b33536e9475521548ba8e2c16d84
[TEST] Fix VSMS 14_define_sys_disk.py to specify FV or PV disk for Xen guests.
Without this fix, both FV and PV rasds are passed to the DefineSystem() call
which isn't valid on PV systems.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r ddd395416461 -r 78c534011b84 suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py Tue Nov 04 22:19:33 2008 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/14_define_sys_disk.py Wed Nov 05 16:40:47 2008 -0800
@@ -48,18 +48,22 @@
return path
-def get_vssd_rasd(ip, virt, addr):
+def get_vssd_rasd(ip, virt, addr, disk_type):
vssd = get_vssd_mof(virt, test_dom)
rasds = get_default_rasds(ip, virt)
- for i in range(len(rasds)):
- if 'DiskPool' in rasds[i]['PoolID']:
- rasds[i]['Address'] = addr
- rasds[i] = inst_to_mof(rasds[i])
+ rasd_list = []
+
+ for rasd in rasds:
+ if 'DiskPool' in rasd['PoolID']:
+ if disk_type != "" and rasd['Caption'] != disk_type:
+ continue
+ rasd['Address'] = addr
+ rasd_list.append(inst_to_mof(rasd))
params = { 'vssd' : vssd,
- 'rasd' : rasds
+ 'rasd' : rasd_list
}
return params
@@ -68,12 +72,19 @@
def main():
options = main.options
+ if options.virt == "Xen":
+ disk_cap = "PV disk"
+ elif options.virt == "XenFV":
+ disk_cap = "FV disk"
+ else:
+ disk_cap = ""
+
try:
addr = make_long_disk_path(options.ip)
if addr is None:
raise Exception("Unable to create large disk image")
- define_params = get_vssd_rasd(options.ip, options.virt, addr)
+ define_params = get_vssd_rasd(options.ip, options.virt, addr, disk_cap)
if len(define_params) != 2:
raise Exception("Unable to get VSSD and RASDs for %s" % test_dom)
16 years, 1 month
[PATCH] [TEST]#2 Move some functions from live.py and utils.py to xm_virt_util.py
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1225951428 28800
# Node ID a56da9383d25d808284820338091e2d1cc2fdf0c
# Parent 319e2e9509d360334c0e38e17abc9bf2b163e1cb
[TEST]#2 Move some functions from live.py and utils.py to xm_virt_util.py
Also remove CONSOLE_APP_PATH to lib/XenKvmLib/xm_virt_util.py
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r 319e2e9509d3 -r a56da9383d25 lib/VirtLib/live.py
--- a/lib/VirtLib/live.py Tue Nov 04 05:22:21 2008 -0800
+++ b/lib/VirtLib/live.py Wed Nov 05 22:03:48 2008 -0800
@@ -25,59 +25,6 @@
import os
import utils
import socket
-
-def processors_count(ip, vs_name):
- """Returns the number of processors of the specified VS
- """
-
- guest_cmd = "grep '^$' /proc/cpuinfo | wc -l"
-
- rc, out = utils.run_remote_guest(ip, vs_name, guest_cmd)
- if rc != 0:
- return -1
-
- try:
- cpus = int(out)
- return cpus
- except ValueError:
- return -1
-
-def memory_count(ip, vs_name):
- """Returns the memory size (in Bytes) of the specified VS.
- """
-
- guest_cmd = "grep MemTotal /proc/meminfo"
-
- rc, out = utils.run_remote_guest(ip, vs_name, guest_cmd)
- if rc != 0:
- return -1
-
- try:
- mem = int( out.split()[1] )
- return mem * 1024
- except (IndexError, ValueError):
- return -1
-
-def network_macs(ip, vs_name):
- """Returns a list of MAC address of the specified VS.
- """
-
- guest_cmd = "ifconfig -a | grep eth"
-
- rc, out = utils.run_remote_guest(ip, vs_name, guest_cmd)
- if rc != 0:
- return []
-
- ret = []
- lines = out.splitlines()
- for l in lines:
- try:
- mac = l.split()[-1]
- ret.append( mac )
- except IndexError:
- pass
-
- return ret
def available_bridges(ip):
"""Return a list of the available bridges in the running dom0.
diff -r 319e2e9509d3 -r a56da9383d25 lib/VirtLib/utils.py
--- a/lib/VirtLib/utils.py Tue Nov 04 05:22:21 2008 -0800
+++ b/lib/VirtLib/utils.py Wed Nov 05 22:03:48 2008 -0800
@@ -23,8 +23,6 @@
import os
import commands
-
-CONSOLE_APP_PATH = "/tmp/Console.py"
# ssh utils
@@ -103,11 +101,3 @@
cmd = 'ssh-keygen -y -f %s' % SSH_KEY
pubkey = commands.getoutput(cmd)
write_pubkey(pubkey)
-
-def run_remote_guest(ip, domain, command):
- """ Execute commands on remote guest console.
- """
-
- cmd = 'python %s %s "%s"' % (CONSOLE_APP_PATH, domain, command)
-
- return run_remote(ip, cmd)
diff -r 319e2e9509d3 -r a56da9383d25 suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py Tue Nov 04 05:22:21 2008 -0800
+++ b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py Wed Nov 05 22:03:48 2008 -0800
@@ -26,6 +26,7 @@
from VirtLib import utils
import socket
+CONSOLE_APP_PATH = "/tmp/Console.py"
def xm_domname(ip, domid):
cmd = "xm domname %s" % domid
@@ -287,3 +288,65 @@
if virt == "LXC":
return "lxc:///system"
return ""
+
+def run_remote_guest(ip, domain, command):
+ """ Execute commands on remote guest console.
+ """
+
+ cmd = 'python %s %s "%s"' % (CONSOLE_APP_PATH, domain, command)
+
+ return run_remote(ip, cmd)
+
+def processors_count(ip, vs_name):
+ """Returns the number of processors of the specified VS
+ """
+
+ guest_cmd = "grep '^$' /proc/cpuinfo | wc -l"
+
+ rc, out = run_remote_guest(ip, vs_name, guest_cmd)
+ if rc != 0:
+ return -1
+
+ try:
+ cpus = int(out)
+ return cpus
+ except ValueError:
+ return -1
+
+def memory_count(ip, vs_name):
+ """Returns the memory size (in Bytes) of the specified VS.
+ """
+
+ guest_cmd = "grep MemTotal /proc/meminfo"
+
+ rc, out = run_remote_guest(ip, vs_name, guest_cmd)
+ if rc != 0:
+ return -1
+
+ try:
+ mem = int( out.split()[1] )
+ return mem * 1024
+ except (IndexError, ValueError):
+ return -1
+
+def network_macs(ip, vs_name):
+ """Returns a list of MAC address of the specified VS.
+ """
+
+ guest_cmd = "ifconfig -a | grep eth"
+
+ rc, out = run_remote_guest(ip, vs_name, guest_cmd)
+ if rc != 0:
+ return []
+
+ ret = []
+ lines = out.splitlines()
+ for l in lines:
+ try:
+ mac = l.split()[-1]
+ ret.append( mac )
+ except IndexError:
+ pass
+
+ return ret
+
16 years, 1 month
[PATCH] [TEST] Move some functions from utils.py to xm_virt_util.py
by yunguol@cn.ibm.com
# HG changeset patch
# User Guolian Yun <yunguol(a)cn.ibm.com>
# Date 1225701642 28800
# Node ID 636e060429738891aae9d1c5ca43e12d1508773c
# Parent d1614c101c281b57bd2bc98dfb6625f790748e54
[TEST] Move some functions from utils.py to xm_virt_util.py
I will do below on the next:
1) Update common_util.py
2) Delete these functions in utils.py
3) Update all related tc
Signed-off-by: Guolian Yun <yunguol(a)cn.ibm.com>
diff -r d1614c101c28 -r 636e06042973 suites/libvirt-cim/lib/XenKvmLib/test_doms.py
--- a/suites/libvirt-cim/lib/XenKvmLib/test_doms.py Wed Oct 29 20:11:47 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/test_doms.py Mon Nov 03 00:40:42 2008 -0800
@@ -24,7 +24,7 @@
import tempfile
import os
from VirtLib import utils
-from XenKvmLib.xm_virt_util import domain_list
+from XenKvmLib.xm_virt_util import domain_list, virt2uri
from CimTest.Globals import CIM_FUUID
try:
@@ -47,19 +47,19 @@
f.write(xml)
f.close()
- cmd = "virsh -c %s define %s" % (utils.virt2uri(virt), name)
+ cmd = "virsh -c %s define %s" % (virt2uri(virt), name)
s, o = utils.run_remote(server, cmd)
return s == 0
def undefine_test_domain(name, server, virt="Xen"):
- cmd = "virsh -c %s undefine %s" % (utils.virt2uri(virt), name)
+ cmd = "virsh -c %s undefine %s" % (virt2uri(virt), name)
s, o = utils.run_remote(server, cmd)
return s == 0
def start_test_domain(name, server, virt="Xen"):
- cmd = "virsh -c %s start %s" % (utils.virt2uri(virt), name)
+ cmd = "virsh -c %s start %s" % (virt2uri(virt), name)
s, o = utils.run_remote(server, cmd)
return s == 0
@@ -68,7 +68,7 @@
"""Get a list of domid from virsh"""
cmd = "virsh -c %s list 2>/dev/null | sed '1,2 d; /^$/d'" % \
- utils.virt2uri(virt)
+ virt2uri(virt)
ret, out = utils.run_remote(server, cmd)
if ret != 0:
return None
@@ -109,7 +109,7 @@
def viruuid(name, server, virt="Xen"):
"""Return domain uuid given domid or domname"""
cmd = "virsh -c %s domuuid %s 2>/dev/null | sed '/^$/d'" % \
- (utils.virt2uri(virt), name)
+ (virt2uri(virt), name)
ret, out = utils.run_remote(server, cmd)
if ret == 0:
return out.strip(" \n")
@@ -120,7 +120,7 @@
"""Destroy and undefine a domain.
name could be domid or domname"""
cmd = "virsh -c %s 'destroy %s ; undefine %s'" % \
- (utils.virt2uri(virt), name, name)
+ (virt2uri(virt), name, name)
utils.run_remote(server, cmd)
def destroy_and_undefine_all(server, virt="Xen", aggressive = False):
@@ -154,7 +154,7 @@
else:
name = xmlfile_domname
- vcmd = "virsh -c %s %s %s" % (utils.virt2uri(virt), cmd, name)
+ vcmd = "virsh -c %s %s %s" % (virt2uri(virt), cmd, name)
s, o = utils.run_remote(server, vcmd)
if cmd == "define" or cmd == "create":
f.close()
@@ -165,7 +165,7 @@
Get the vcpu lists. The input is either the domid or domname.
"""
cmd = "virsh -c %s vcpuinfo %s | grep '^$' | wc -l" % \
- (utils.virt2uri(virt), name_id)
+ (virt2uri(virt), name_id)
ret, out = utils.run_remote(server, cmd)
if ret != 0:
@@ -180,7 +180,7 @@
nf.write(net_xml)
nf.flush()
fname = nf.name
- cmd = "virsh -c %s net-create %s" % (utils.virt2uri(virt), fname)
+ cmd = "virsh -c %s net-create %s" % (virt2uri(virt), fname)
ret, out = utils.run_remote(server, cmd)
nf.close()
if ret != 0:
diff -r d1614c101c28 -r 636e06042973 suites/libvirt-cim/lib/XenKvmLib/test_xml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/test_xml.py Wed Oct 29 20:11:47 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/test_xml.py Mon Nov 03 00:40:42 2008 -0800
@@ -35,7 +35,7 @@
from XenKvmLib.test_doms import set_uuid, create_vnet
from VirtLib.live import available_bridges
from XenKvmLib.xm_virt_util import net_list, get_bridge_from_network_xml, \
- bootloader
+ bootloader, virt2uri
from CimTest.ReturnCodes import SKIP
image_dir = "/tmp"
@@ -201,7 +201,7 @@
def dumpxml(name, server, virt="Xen"):
- cmd = "virsh -c %s dumpxml %s" % (utils.virt2uri(virt), name)
+ cmd = "virsh -c %s dumpxml %s" % (virt2uri(virt), name)
s, o = utils.run_remote(server, cmd)
if s == 0:
return o
diff -r d1614c101c28 -r 636e06042973 suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py
--- a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py Wed Oct 29 20:11:47 2008 -0700
+++ b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py Mon Nov 03 00:40:42 2008 -0800
@@ -63,7 +63,7 @@
"""
guest_cmd = "cat /proc/partitions | awk '/^ /{ print $4 } ' "
- rc, out = utils.run_remote_guest(ip, vs_name, guest_cmd)
+ rc, out = run_remote_guest(ip, vs_name, guest_cmd)
if rc != 0:
return None
@@ -89,7 +89,7 @@
virt = "Xen"
cmd = "virsh -c %s list --all | sed -e '1,2 d' -e '$ d'" % \
- utils.virt2uri(virt)
+ virt2uri(virt)
ret, out = utils.run_remote(server, cmd)
if ret != 0:
@@ -109,7 +109,7 @@
virt = "Xen"
cmd = "virsh -c %s list | sed -e '1,2 d' -e '$ d'" % \
- utils.virt2uri(virt)
+ virt2uri(virt)
ret, out = utils.run_remote(server, cmd)
if ret != 0:
@@ -156,7 +156,7 @@
"""Function to list active network"""
names = []
cmd = "virsh -c %s net-list | sed -e '1,2 d' -e '$ d'" % \
- utils.virt2uri(virt)
+ virt2uri(virt)
ret, out = utils.run_remote(server, cmd)
if ret != 0:
@@ -173,7 +173,7 @@
"""Function returns bridge name for a given virtual network"""
cmd = "virsh -c %s net-dumpxml %s | awk '/bridge name/ { print $2 }'" % \
- (utils.virt2uri(virt), network)
+ (virt2uri(virt), network)
ret, out = utils.run_remote(server, cmd)
if ret != 0:
@@ -196,7 +196,7 @@
return None
def virsh_version(server, virt="KVM"):
- cmd = "virsh -c %s -v " % utils.virt2uri(virt)
+ cmd = "virsh -c %s -v " % virt2uri(virt)
ret, out = utils.run_remote(server, cmd)
if ret != 0:
return None
@@ -206,7 +206,7 @@
"""Function to list active DiskPool list"""
names = []
cmd = "virsh -c %s pool-list | sed -e '1,2 d' -e '$ d'" % \
- utils.virt2uri(virt)
+ virt2uri(virt)
ret, out = utils.run_remote(server, cmd)
if ret != 0:
@@ -221,7 +221,7 @@
return names
def virsh_vcpuinfo(server, dom, virt="Xen"):
- cmd = "virsh -c %s vcpuinfo %s | grep VCPU | wc -l" % (utils.virt2uri(virt),
+ cmd = "virsh -c %s vcpuinfo %s | grep VCPU | wc -l" % (virt2uri(virt),
dom)
ret, out = utils.run_remote(server, cmd)
if out.isdigit():
@@ -229,10 +229,70 @@
return None
def get_hv_ver(server, virt="Xen"):
- cmd = "virsh -c %s version | grep ^Running | cut -d ' ' -f 3,4" % utils.virt2uri(virt)
+ cmd = "virsh -c %s version | grep ^Running | cut -d ' ' -f 3,4" %virt2uri(virt)
ret, out = utils.run_remote(server, cmd)
if ret == 0:
return out
else:
return None
+def run_remote_guest(ip, domain, command):
+ """ Execute commands on remote guest console.
+ """
+
+ cmd = 'python %s %s "%s"' % (CONSOLE_APP_PATH, domain, command)
+
+ return run_remote(ip, cmd)
+
+
+def get_xmtest_files(ip, kernel):
+ # get the xm-test disk from morbo
+ rc, out = run_remote(ip,
+ "rm -rf /tmp/boot ; mkdir -p /tmp/boot /tmp/xmtest")
+ rc, out = run_remote(ip,
+ "cd /tmp/boot ; wget http://morbo.linux.ibm.com/pub/xmtest.disk.gz")
+ if rc != 0:
+ return 2, "fetching xmtest.disk failed:\n%s" % out
+
+ # mount on /tmp/xmtest
+ rc, out = run_remote(ip,
+ "gzip -d /tmp/boot/xmtest.disk.gz ; mount -o loop /tmp/boot/xmtest.disk /tmp/xmtest")
+ if rc != 0:
+ run_remote(ip, "umount /tmp/xmtest")
+ return 2, "mounting xmtest.disk failed:\n%s" % out
+
+ # We need "uname -r" to name the kernel correctly
+ rc, uname = run_remote(ip, "uname -r")
+ if rc != 0:
+ run_remote(ip, "umount /tmp/xmtest")
+ return 2, "uname failed:\n%s" % out
+
+ # get the kernel binary, put in /tmp/boot
+ rc, out = run_remote(ip,
+ "wget %s -O /tmp/boot/vmlinuz-\`uname -r\`" % kernel)
+ if rc != 0:
+ run_remote(ip, "umount /tmp/xmtest")
+ return 2, "fetching kernel failed:\n%s" % out
+
+ return 0, ""
+
+def customize_xmtest_ramdisk(ip):
+ # customize modules on xm-test ramdisk
+ # cd $xmtestdir/ramdisk ; bin/add_modules_to_initrd ; cd
+ rc, out = run_remote(ip,
+ "cd /tmp/xmtest/ramdisk ; bin/add_modules_to_initrd")
+ if rc != 0:
+ run_remote(ip, "umount /tmp/xmtest")
+ return 2, "customizing ramdisk failed:\n%s" % out
+
+ return 0, ""
+
+def virt2uri(virt):
+ # convert cimtest --virt param string to libvirt uri
+ if virt == "Xen" or virt == "XenFV":
+ return "xen:///"
+ if virt == "KVM":
+ return "qemu:///system"
+ if virt == "LXC":
+ return "lxc:///system"
+ return ""
diff -r d1614c101c28 -r 636e06042973 suites/libvirt-cim/main.py
--- a/suites/libvirt-cim/main.py Wed Oct 29 20:11:47 2008 -0700
+++ b/suites/libvirt-cim/main.py Mon Nov 03 00:40:42 2008 -0800
@@ -36,6 +36,7 @@
default_pool_name
from XenKvmLib.reporting import gen_report, send_report
from VirtLib import utils
+from XenKvmLib.xm_virt_util import virt2uri
from CimTest.ReturnCodes import PASS, FAIL
from XenKvmLib.common_util import create_netpool_conf, destroy_netpool, \
create_diskpool_conf, destroy_diskpool
@@ -90,12 +91,12 @@
print "Cleaned log files."
def pre_check(ip, virt):
- cmd = "virsh -c %s list --all" % utils.virt2uri(virt)
+ cmd = "virsh -c %s list --all" % virt2uri(virt)
ret, out = utils.run_remote(ip, cmd)
if ret != 0:
return "This libvirt install does not support %s" % virt
- cmd = "virsh -c %s version" % utils.virt2uri(virt)
+ cmd = "virsh -c %s version" % virt2uri(virt)
ret, out = utils.run_remote(ip, cmd)
if ret != 0:
return "Encountered an error querying libvirt with: %s" % cmd
16 years, 1 month
[PATCH] Fix potiential seg fault in SDC
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1225926589 28800
# Node ID 16aa18cf5325f5e689c4967d35288d15825fc2be
# Parent ece7c71cd2aab612dec19cc6247194cdf8b5b049
Fix potiential seg fault in SDC.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r ece7c71cd2aa -r 16aa18cf5325 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Wed Nov 05 08:15:51 2008 -0800
+++ b/src/Virt_SettingsDefineCapabilities.c Wed Nov 05 15:09:49 2008 -0800
@@ -270,6 +270,14 @@
base,
NAMESPACE(ref));
+ if (inst == NULL) {
+ cu_statusf(_BROKER, s,
+ CMPI_RC_ERR_FAILED,
+ "Unable to create instance of type %s",
+ base);
+ goto out;
+ }
+
CMSetProperty(inst, "ResourceType", &resource_type, CMPI_uint16);
out:
@@ -310,6 +318,8 @@
}
inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_MEM);
+ if ((inst == NULL) || (s.rc != CMPI_RC_OK))
+ goto out;
CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
CMSetProperty(inst, "AllocationUnits",
@@ -395,6 +405,8 @@
}
inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_PROC);
+ if ((inst == NULL) || (s.rc != CMPI_RC_OK))
+ goto out;
CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
CMSetProperty(inst, "AllocationUnits",
@@ -528,6 +540,8 @@
}
inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_NET);
+ if ((inst == NULL) || (s.rc != CMPI_RC_OK))
+ goto out;
CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
CMSetProperty(inst, "VirtualQuantity",
@@ -606,6 +620,8 @@
}
inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_DISK);
+ if ((inst == NULL) || (s.rc != CMPI_RC_OK))
+ goto out;
CMSetProperty(inst, "InstanceID", (CMPIValue *)id, CMPI_chars);
CMSetProperty(inst, "AllocationQuantity",
@@ -632,6 +648,7 @@
inst_list_add(list, inst);
+ out:
return s;
}
16 years, 1 month