[PATCH] Add SDL graphic device support
by Wayne Xia
# HG changeset patch
# User Wayne Xia <xiawenc(a)linux.vnet.ibm.com>
# Date 1310271518 -28800
# Node ID ec5e5be04391afa9bab3b4a59bc5596a68a9f175
# Parent 395f2d684c1046455462db7e4e87d30e7aae0feb
Add SDL graphic device support
the options are described in ResourceAllocationSettingData.mof
Signed-off-by: Wayne Xia <xiawenc(a)linux.vnet.ibm.com>
diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Tue Jul 05 15:52:31 2011 -0300
+++ b/libxkutil/device_parsing.c Sun Jul 10 12:18:38 2011 +0800
@@ -90,11 +90,16 @@
static void cleanup_graphics_device(struct graphics_device *dev)
{
- free(dev->type);
- free(dev->port);
- free(dev->host);
- free(dev->keymap);
- free(dev->passwd);
+ if (dev->type !=NULL)
+ free(dev->type);
+ if (dev->port !=NULL)
+ free(dev->port);
+ if (dev->host !=NULL)
+ free(dev->host);
+ if (dev->keymap !=NULL)
+ free(dev->keymap);
+ if (dev->passwd !=NULL)
+ free(dev->passwd);
}
static void cleanup_input_device(struct input_device *dev)
@@ -529,6 +534,13 @@
if (gdev->port == NULL || gdev->host == NULL)
goto err;
}
+ else if (STREQC(gdev->type, "sdl")) {
+ SDL_display(gdev) = get_attr_value(node, "display");
+ SDL_xauth(gdev) = get_attr_value(node, "xauth");
+ SDL_fullscreen(gdev) = get_attr_value(node, "fullscreen");
+ gdev->passwd = NULL;
+ }
+
else if (STREQC(gdev->type, "pty")) {
if (node->name == NULL)
goto err;
diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Tue Jul 05 15:52:31 2011 -0300
+++ b/libxkutil/device_parsing.h Sun Jul 10 12:18:38 2011 +0800
@@ -83,6 +83,9 @@
char *path;
};
+#define SDL_display(dev) (dev->port)
+#define SDL_xauth(dev) (dev->host)
+#define SDL_fullscreen(dev) (dev->keymap)
struct graphics_device {
char *type;
char *port;
diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Tue Jul 05 15:52:31 2011 -0300
+++ b/libxkutil/xmlgen.c Sun Jul 10 12:18:38 2011 +0800
@@ -421,8 +421,21 @@
xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type);
- if (STREQC(dev->type, "sdl"))
- return NULL;
+ if (STREQC(dev->type, "sdl")) {
+ if (SDL_display(dev)) {
+ xmlNewProp(tmp, BAD_CAST "display",
+ BAD_CAST SDL_display(dev));
+ }
+ if (SDL_xauth(dev)) {
+ xmlNewProp(tmp, BAD_CAST "xauth",
+ BAD_CAST SDL_xauth(dev));
+ }
+ if (SDL_fullscreen(dev)) {
+ xmlNewProp(tmp, BAD_CAST "fullscreen",
+ BAD_CAST SDL_fullscreen(dev));
+ }
+ return NULL;
+ }
if (dev->port) {
xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port);
diff -r 395f2d684c10 -r ec5e5be04391
schema/ResourceAllocationSettingData.mof
--- a/schema/ResourceAllocationSettingData.mof Tue Jul 05 15:52:31 2011
-0300
+++ b/schema/ResourceAllocationSettingData.mof Sun Jul 10 12:18:38 2011
+0800
@@ -219,7 +219,9 @@
[Description ("If ResourceSubType is 'vnc', this is a VNC Address. "
"IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If
ResourceSubType "
"is 'console', this is a character device path in "
- "path:port format (e.g., '/dev/pts/3:0'\)")]
+ "path:port format (e.g., '/dev/pts/3:0'\)."
+ "if ResourceSubType is 'sdl', this is a combination of its
params as "
+ "xauth:display (e.g., '/root/.Xauthority::0'\)")]
string Address;
[Description ("Keyboard keymapping")]
@@ -228,7 +230,8 @@
[Description ("VNC password")]
string Password;
- [Description ("Is IPv6 only addressing is to be used")]
+ [Description ("Is IPv6 only addressing is to be used."
+ "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")]
boolean IsIPv6Only;
};
diff -r 395f2d684c10 -r ec5e5be04391 src/Virt_RASD.c
--- a/src/Virt_RASD.c Tue Jul 05 15:52:31 2011 -0300
+++ b/src/Virt_RASD.c Sun Jul 10 12:18:38 2011 +0800
@@ -416,12 +416,14 @@
virDomainPtr dom = NULL;
struct infostore_ctx *infostore = NULL;
bool has_passwd = false;
-
+ const struct graphics_device *gdev = &dev->dev.graphics;
+
CMSetProperty(inst, "ResourceSubType",
(CMPIValue *)dev->dev.graphics.type, CMPI_chars);
- if (STREQC(dev->dev.graphics.type, "sdl"))
- rc = asprintf(&addr_str, "%s", dev->dev.graphics.type);
+ if (STREQC(dev->dev.graphics.type, "sdl")) {
+ rc = asprintf(&addr_str, "%s:%s", SDL_xauth(gdev),
SDL_display(gdev));
+ }
else {
rc = asprintf(&addr_str,
"%s:%s",
diff -r 395f2d684c10 -r ec5e5be04391
src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Tue Jul 05 15:52:31 2011
-0300
+++ b/src/Virt_VirtualSystemManagementService.c Sun Jul 10 12:18:38 2011
+0800
@@ -1059,6 +1059,52 @@
return ret;
}
+static int parse_sdl_address(const char *id,
+ char **display,
+ char **xauth)
+{
+ int ret;
+ char *tmp_display = NULL;
+ char *tmp_xauth = NULL;
+
+ CU_DEBUG("Entering parse_sdl_address, address is %s", id);
+
+ ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display);
+
+ if (ret <= 0) {
+ ret = sscanf(id, ":%as", &tmp_display);
+ if (ret <= 0) {
+ if (STREQC(id, ":")) {
+ /* do nothing, it is empty */
+ }
+ else {
+ ret = 0;
+ goto out;
+ }
+ }
+ }
+
+ if (display) {
+ if (tmp_display == NULL)
+ *display = NULL;
+ else
+ *display = strdup(tmp_display);
+ }
+ if (xauth) {
+ if (tmp_xauth == NULL)
+ *xauth = NULL;
+ else
+ *xauth = strdup(tmp_xauth);
+ }
+ ret = 1;
+
+ out:
+ CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s",
+ *display, *xauth);
+
+ return ret;
+}
+
static int parse_vnc_address(const char *id,
char **ip,
char **port)
@@ -1103,6 +1149,7 @@
const char *msg = NULL;
bool ipv6 = false;
int ret;
+ struct graphics_device *gdev = &dev->dev.graphics;
if (cu_get_str_prop(inst, "ResourceSubType", &val) !=
CMPI_RC_OK) {
msg = "GraphicsRASD ResourceSubType field not valid";
@@ -1162,6 +1209,30 @@
msg = "GraphicsRASD field Address not valid";
goto out;
}
+ }
+ else if (STREQC(dev->dev.graphics.type, "sdl")) {
+ if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) {
+ CU_DEBUG("sdl graphics Address empty, using
default");
+ SDL_display(gdev) = NULL;
+ SDL_xauth(gdev) = NULL;
+ }
+ else {
+ ret = parse_sdl_address(val,
+ &SDL_display(gdev),
+ &SDL_xauth(gdev));
+ if (ret != 1) {
+ msg = "GraphicsRASD sdl Address not
valid";
+ goto out;
+ }
+ }
+ SDL_fullscreen(gdev) = NULL;
+ if (cu_get_bool_prop(inst, "IsIPV6Only", &ipv6) ==
+ CMPI_RC_OK) {
+ if (ipv6)
+ SDL_fullscreen(gdev) =
strdup("yes");
+ else
+ SDL_fullscreen(gdev) =
strdup("no");
+ }
} else {
CU_DEBUG("Unsupported graphics type %s",
dev->dev.graphics.type);
@@ -1172,6 +1243,9 @@
free(dev->id);
if (STREQC(dev->dev.graphics.type, "vnc"))
ret = asprintf(&dev->id, "%s", dev->dev.graphics.type);
+ else if (STREQC(dev->dev.graphics.type, "sdl"))
+ ret = asprintf(&dev->id, "%s:%s:%s",
+ dev->dev.graphics.type, SDL_xauth(gdev),
SDL_display(gdev));
else
ret = asprintf(&dev->id, "%s:%s",
dev->dev.graphics.type,
dev->dev.graphics.port);
@@ -1493,7 +1567,6 @@
"Failed to lookup resulting system");
goto out;
}
-
out:
virDomainFree(dom);
virConnectClose(conn);
13 years, 1 month
[PATCH] SwitchService will show the nic connected to VSI switch
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1310745835 25200
# Node ID d458bd51459cd1b470bf9ec74304abb7ff05b53c
# Parent 395f2d684c1046455462db7e4e87d30e7aae0feb
SwitchService will show the nic connected to VSI switch.
SwitchService instance will list out the interface connected to the VSI capable switch. This helps identify which nic is conneced to VSI switch when there are multiple nics.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 395f2d684c10 -r d458bd51459c schema/SwitchService.mof
--- a/schema/SwitchService.mof Tue Jul 05 15:52:31 2011 -0300
+++ b/schema/SwitchService.mof Fri Jul 15 09:03:55 2011 -0700
@@ -5,6 +5,7 @@
{
[Description("Flag to determine if VSI is supported on the switch")]
boolean IsVSISupported;
+ string VSIInterface;
};
@@ -13,6 +14,7 @@
{
[Description("Flag to determine if VSI is supported on the switch")]
boolean IsVSISupported;
+ string VSIInterface;
};
@@ -21,6 +23,7 @@
{
[Description("Flag to determine if VSI is supported on the switch")]
boolean IsVSISupported;
+ string VSIInterface;
};
diff -r 395f2d684c10 -r d458bd51459c src/Virt_SwitchService.c
--- a/src/Virt_SwitchService.c Tue Jul 05 15:52:31 2011 -0300
+++ b/src/Virt_SwitchService.c Fri Jul 15 09:03:55 2011 -0700
@@ -250,6 +250,8 @@
s = check_vsi_support(cmd);
if (s.rc == CMPI_RC_OK) {
vsi = true;
+ CMSetProperty(inst, "VSIInterface",
+ (CMPIValue *)if_list[i], CMPI_chars);
break;
}
else
13 years, 1 month
[PATCH] Make libconfig requirement optional
by Eduardo Lima (Etrunko)
# HG changeset patch
# User Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
# Date 1310149559 10800
# Node ID 2823d4e157125fc47668a9f0d6ef2f52e52169ce
# Parent 395f2d684c1046455462db7e4e87d30e7aae0feb
Make libconfig requirement optional
libconfig is a required to build libvirt-cim since r1104, but the
package is not included in RHEL 5, which we still support. This patch
enables libvirt-cim to be built even if libconfig is not found.
Note that it will not be possible for users of that distro to configure
libvirt-cim to operate in read-only mode.
Signed-off-by: Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
diff --git a/acinclude.m4 b/acinclude.m4
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -272,7 +272,11 @@
AC_DEFUN([CHECK_LIBCONFIG],
[
- PKG_CHECK_MODULES([LIBCONFIG], [libconfig])
+ PKG_CHECK_MODULES([LIBCONFIG], [libconfig],
+ [LIBCONFIG_FOUND=yes], [LIBCONFIG_FOUND=no])
+ if test "$LIBCONFIG_FOUND" = "yes" ; then
+ AC_DEFINE(HAVE_LIBCONFIG, 1, [Define if libconfig development files were found])
+ fi
AC_SUBST([LIBCONFIG_CFLAGS])
AC_SUBST([LIBCONFIG_LIBS])
CPPFLAGS="$CPPFLAGS $LIBCONFIG_CFLAGS"
diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in
--- a/libvirt-cim.spec.in
+++ b/libvirt-cim.spec.in
@@ -22,11 +22,11 @@
BuildRequires: e2fsprogs-devel
%else
BuildRequires: libuuid-devel
+BuildRequires: libconfig-devel
%endif
BuildRequires: libxml2-devel
BuildRequires: libcmpiutil-devel
-BuildRequires: libconfig-devel
BuildConflicts: sblim-cmpi-devel
%description
diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c
--- a/libxkutil/misc_util.c
+++ b/libxkutil/misc_util.c
@@ -20,6 +20,8 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "config.h"
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -35,12 +37,14 @@
#include <libcmpiutil/libcmpiutil.h>
#include <libcmpiutil/std_association.h>
+
+#ifdef HAVE_LIBCONFIG
#include <libconfig.h>
+#endif
#include "misc_util.h"
#include "cs_util.h"
-#include "config.h"
#define URI_ENV "HYPURI"
@@ -58,8 +62,11 @@
static int is_read_only(void)
{
+ int readonly = 0;
+
+#ifdef HAVE_LIBCONFIG
config_t conf;
- int ret, readonly = 0;
+ int ret;
const char *readonly_str = "readonly";
config_init(&conf);
@@ -82,6 +89,7 @@
LIBVIRTCIM_CONF, readonly);
out:
config_destroy(&conf);
+#endif
/* Default value is 0 (false) */
return readonly;
13 years, 1 month
[PATCH] [TEST] Update .hgignore
by Eduardo Lima (Etrunko)
# HG changeset patch
# User Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
# Date 1310497347 10800
# Node ID 021243e63a3b9e0b709618886b63a66d6ab5adc3
# Parent 26f6e541a714d5a915e4149554e057ba7ac328d1
[TEST] Update .hgignore
Signed-off-by: Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -1,1 +1,4 @@
.*.pyc
+.*.log
+.*~
+run_report.txt
13 years, 1 month
[PATCH] libvirt-cim.spec: Use %config(noreplace) for libvirt-cim.conf
by Eduardo Lima (Etrunko)
# HG changeset patch
# User Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
# Date 1309891951 10800
# Node ID cd4aec302d94b587ede84e68356998c01188f265
# Parent 20138a9d4f2b4780664545e412cab7a4c26d7503
libvirt-cim.spec: Use %config(noreplace) for libvirt-cim.conf
This way we avoid overwriting eventual changes to the config file
introduced manually.
Reference:
- http://www-uxsup.csx.cam.ac.uk/~jw35/docs/rpm_config.html
Signed-off-by: Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in
--- a/libvirt-cim.spec.in
+++ b/libvirt-cim.spec.in
@@ -136,7 +136,7 @@
%{_datadir}/libvirt-cim/*.registration
%{_datadir}/libvirt-cim/cim_schema_*-MOFs.zip
%{_sysconfdir}/ld.so.conf.d/libvirt-cim.conf
-%{_sysconfdir}/libvirt-cim.conf
+%config(noreplace) %{_sysconfdir}/libvirt-cim.conf
%changelog
* Wed Oct 28 2009 Richard Maciel <rmaciel(a)linux.vnet.ibm.com> - 0.1-1
13 years, 2 months
[PATCH] Minor fix for MemoryPool.AllocationUnits
by Chip Vincent
# HG changeset patch
# User Chip Vincent <cvincent(a)us.ibm.com>
# Date 1309971496 14400
# Node ID a0dd50c2e523174794974dd1666e8fd611673d3a
# Parent 20138a9d4f2b4780664545e412cab7a4c26d7503
Minor fix for MemoryPool.AllocationUnits
The property value from AllocationUnits in the MemoryPool shows "bytes*210".
The correct value should be "bytes*2^10". This fix is essential for clients
to properly convert/calculate.
Reference: DSP1045 - MemoryResourceAllocationProfile (ch.7.1 AllocationUnits)
Signed-off-by: Chip Vincent <cvincent(a)us.ibm.com>
diff --git a/src/Virt_DevicePool.c b/src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c
+++ b/src/Virt_DevicePool.c
@@ -797,7 +797,7 @@
mempool_set_total(inst, conn);
mempool_set_consumed(inst, conn);
- set_params(inst, CIM_RES_TYPE_MEM, id, "byte*210", NULL, true);
+ set_params(inst, CIM_RES_TYPE_MEM, id, "byte*2^10", NULL, true);
inst_list_add(list, inst);
13 years, 2 months
[PATCH 0 of 1] [TEST] Don't send commands via ssh for localhost
by Eduardo Lima (Etrunko)
Alright, this patch has been around for a while and I think the results
are very similar to the version which sends all commands via ssh, except
for the performance boost.
I am now sending the patch for appreciation and requesting some feedback,
especially if there is any specific test that was working but is now broke
because of this patch.
If possible, run the full cimtest suite first in a pristine checkout and
save the run_report.txt file with a different name. After that, apply the
patch to the tree and run the suite again. Reply to this email attaching
both files so we can analyse the results.
Best regards, Etrunko
--
Eduardo de Barros Lima
Software Engineer, Open Virtualization
Linux Technology Center - IBM/Brazil
eblima(a)br.ibm.com
13 years, 2 months
[PATCH] [TEST] Fix exception in tests
by Eduardo Lima (Etrunko)
# HG changeset patch
# User Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
# Date 1309289907 10800
# Node ID 6397c0670c35acc78ac13d737b408bb90e30632e
# Parent 3c218fe48bb7b9d89549dcca213dd7e0b60035af
[TEST] Fix exception in tests
--------------------------------------------------------------------
Memory - 01_memory.py: FAIL
ERROR - Got CIM error CIM_ERR_FAILED: Failed to define domain: operation virDomainDefineXML forbidden for read only access with return code 1
Traceback (most recent call last):
File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try
rc = f()
File "01_memory.py", line 66, in main
capacity = dev.ConsumableBlocks * dev.BlockSize / 1024
AttributeError: 'NoneType' object has no attribute 'ConsumableBlocks'
--------------------------------------------------------------------
SettingsDefineCapabilities - 01_forward.py: FAIL
ERROR - [dpool, mpool, ppool, npool] None
ERROR - TypeError : 'int' object is not iterable
Traceback (most recent call last):
File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try
rc = f()
File "01_forward.py", line 204, in main
status, pool = get_pool_details(virt, server)
TypeError: 'int' object is not iterable
--------------------------------------------------------------------
VirtualSystemManagementService - 28_definesystem_with_vsi_profile.py: FAIL
ERROR - Exception: 'NoneType' object has no attribute 'InstanceID'
ERROR - Unable to get template RASDs for vsi_guest
ERROR - UnboundLocalError : local variable 'cxml' referenced before assignment
Traceback (most recent call last):
File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try
rc = f()
File "28_definesystem_with_vsi_profile.py", line 211, in main
cxml.cim_destroy(server)
UnboundLocalError: local variable 'cxml' referenced before assignment
Signed-off-by: Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
diff --git a/suites/libvirt-cim/cimtest/Memory/01_memory.py b/suites/libvirt-cim/cimtest/Memory/01_memory.py
--- a/suites/libvirt-cim/cimtest/Memory/01_memory.py
+++ b/suites/libvirt-cim/cimtest/Memory/01_memory.py
@@ -59,15 +59,16 @@
if dev is None:
logger.error("GetInstance() returned None")
status = 1
- elif dev.ConsumableBlocks > dev.NumberOfBlocks:
- logger.error("ConsumableBlocks should not be larger than NumberOfBlocks")
- status = 1
+ else:
+ if dev.ConsumableBlocks > dev.NumberOfBlocks:
+ logger.error("ConsumableBlocks should not be larger than NumberOfBlocks")
+ status = 1
- capacity = dev.ConsumableBlocks * dev.BlockSize / 1024
+ capacity = dev.ConsumableBlocks * dev.BlockSize / 1024
- if capacity != alloc_mem:
- logger.error("Capacity should be %i MB instead of %i MB", alloc_mem, capacity)
- status = 1
+ if capacity != alloc_mem:
+ logger.error("Capacity should be %i MB instead of %i MB", alloc_mem, capacity)
+ status = 1
if status == 0:
logger.info("Checked memory capacity: %s MB", capacity)
diff --git a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py
--- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py
+++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py
@@ -142,7 +142,7 @@
if dpool.InstanceID == None or mpool.InstanceID == None \
or npool.InstanceID == None or ppool.InstanceID == None:
logger.error("Get pool None")
- return FAIL
+ return FAIL, None
else:
pool_set = [dpool, mpool, ppool, npool]
except Exception, detail:
diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
@@ -175,6 +175,7 @@
nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData')
status = FAIL
+ cxml = None
try:
rasd_list = get_rasd_list(server, virt, vsi_defaults, nrasd_cn)
@@ -208,8 +209,9 @@
except Exception, details:
logger.error(details)
- cxml.cim_destroy(server)
- cxml.undefine(server)
+ if cxml is not None:
+ cxml.cim_destroy(server)
+ cxml.undefine(server)
return status
13 years, 2 months