[Libvir] [PATCH][RFC] Add --keymap option to virt-install
by Takahashi Tomohiro
Hi,
I would like to add --keymap option to virt-install in order to set up
jp106 keymap. Because I can't use jp106 keyboard. So, I made a patch
(notes:It relates python-virtinst)
Usage: virt-install --keymap=ja
I confirmed that I can use jp106 keyboard on HVM domain.
But didn't confirm PV domain.
Please give me an advice, if you have it.
Signed-off-by: Tomohiro Takahashi <takatom(a)jp.fujitsu.com>
Thanks,
Tomohiro Takahashi.
==================================================================================
diff -uNrp ./libvirt.orig/src/xml.c ./libvirt/src/xml.c
--- ./libvirt.orig/src/xml.c 2007-02-15 01:22:02.000000000 +0900
+++ ./libvirt/src/xml.c 2007-03-06 20:17:38.000000000 +0900
@@ -246,6 +246,7 @@ static int virDomainParseXMLGraphicsDesc
xmlChar *vncport = xmlGetProp(node, BAD_CAST "port");
xmlChar *vnclisten = xmlGetProp(node, BAD_CAST "listen");
xmlChar *vncpasswd = xmlGetProp(node, BAD_CAST "passwd");
+ xmlChar *keymap = xmlGetProp(node, BAD_CAST "keymap");
if (vncport != NULL) {
long port = strtol((const char *)vncport, NULL, 10);
if (port == -1)
@@ -262,6 +263,10 @@ static int virDomainParseXMLGraphicsDesc
virBufferVSprintf(buf, "(vncpasswd %s)", vncpasswd);
xmlFree(vncpasswd);
}
+ if (keymap != NULL) {
+ virBufferVSprintf(buf, "(keymap %s)", keymap);
+ xmlFree(keymap);
+ }
}
}
xmlFree(graphics_type);
@@ -305,6 +310,7 @@ static int virDomainParseXMLGraphicsDesc
xmlChar *vncport = xmlGetProp(node, BAD_CAST "port");
xmlChar *vnclisten = xmlGetProp(node, BAD_CAST "listen");
xmlChar *vncpasswd = xmlGetProp(node, BAD_CAST "passwd");
+ xmlChar *keymap = xmlGetProp(node, BAD_CAST "keymap");
if (vncport != NULL) {
long port = strtol((const char *)vncport, NULL, 10);
if (port == -1)
@@ -321,6 +327,10 @@ static int virDomainParseXMLGraphicsDesc
virBufferVSprintf(buf, "(vncpasswd %s)", vncpasswd);
xmlFree(vncpasswd);
}
+ if (keymap != NULL) {
+ virBufferVSprintf(buf, "(keymap %s)", keymap);
+ xmlFree(keymap);
+ }
}
virBufferAdd(buf, "))", 2);
xmlFree(graphics_type);
diff -uNrp ./libvirt.orig/src/xm_internal.c ./libvirt/src/xm_internal.c
--- ./libvirt.orig/src/xm_internal.c 2007-02-23 17:51:30.000000000
+0900
+++ ./libvirt/src/xm_internal.c 2007-03-06 20:20:32.000000000 +0900
@@ -1863,6 +1863,9 @@ virConfPtr xenXMParseXMLToConfig(virConn
if (xenXMConfigSetStringFromXPath(conn, conf, ctxt, "vncpasswd",
"string(/domain/devices/graphics[@type='vnc']/@passwd)", 1,
"cannot set the vncpasswd
parameter") < 0)
goto error;
+ if (xenXMConfigSetStringFromXPath(conn, conf, ctxt, "keymap",
"string(/domain/devices/graphics[@type='vnc']/@keymap)", 1,
+ "cannot set the vncpasswd
parameter") < 0)
+ goto error;
/* XXX vncdisplay */
/*
@@ -1894,6 +1897,7 @@ virConfPtr xenXMParseXMLToConfig(virConn
xmlChar *vncport =
xmlGetProp(obj->nodesetval->nodeTab[i], BAD_CAST "port");
xmlChar *vnclisten =
xmlGetProp(obj->nodesetval->nodeTab[i], BAD_CAST "listen");
xmlChar *vncpasswd =
xmlGetProp(obj->nodesetval->nodeTab[i], BAD_CAST "passwd");
+ xmlChar *keymap =
xmlGetProp(obj->nodesetval->nodeTab[i], BAD_CAST "keymap");
int vncunused = vncport ? (!strcmp((const
char*)vncport, "-1") ? 1 : 0) : 1;
if (vncunused)
len += 12;
@@ -1903,6 +1907,8 @@ virConfPtr xenXMParseXMLToConfig(virConn
len += 11 + strlen((const char*)vnclisten);
if (vncpasswd)
len += 11 + strlen((const char*)vncpasswd);
+ if (keymap)
+ len += 11 + strlen((const char*)keymap);
if ((val = malloc(len)) != NULL) {
strcpy(val, "type=vnc");
if (vncunused) {
@@ -1923,6 +1929,11 @@ virConfPtr xenXMParseXMLToConfig(virConn
strcat(val, (const char*)vncpasswd);
xmlFree(vncpasswd);
}
+ if (keymap) {
+ strcat(val, ",keymap=");
+ strcat(val, (const char*)keymap);
+ xmlFree(keymap);
+ }
}
}
xmlFree(type);
17 years, 9 months
[Libvir] [PATCH] add global --readonly flag to virsh
by Richard W.M. Jones
The current vshInit function in virsh tries some dodgy heuristics to see
if it should connect readonly or read/write to the hypervisor.
Unfortunately these heuristics fail, eg. when you have a root-owned
system-wide qemud, and a user trying to run virsh as non-root.
This patch removes the heuristics and replaces them with a simple -r |
--readonly flag on the command line. If omitted, we try to connect
read/write, otherwise we try to connect readonly.
Note that this doesn't affect the "connect" command in the shell, which
still has its own --readonly flag that is completely separate from this
new global flag.
Rich.
17 years, 9 months
[Libvir] [PATCH] unlink roSockname, not sockname
by Richard W.M. Jones
Very trivial fix, but necessary because it prevents the qemu proxy from
restarting.
Rich.
--
Emerging Technologies, Red Hat http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF Mobile: +44 7866 314 421
"[Negative numbers] darken the very whole doctrines of the equations
and make dark of the things which are in their nature excessively
obvious and simple" (Francis Maseres FRS, mathematician, 1759)
17 years, 9 months
[Libvir] Error when paravirtualization domain starts with virsh.
by Michel Gauthier
With the RHEL5 RC distribution on our IA64 platform (4 CPUs), when we use
virsh to start a paravirtuailzation domain, we've got the following:
virsh # list
Id Name State
----------------------------------
0 Domain-0 running
virsh # create hndom2
Failed to get devices for domain hndom2
error: Failed to create domain from hndom2
virsh # list
Id Name State
----------------------------------
0 Domain-0 running
24 Domain-24 paused
In spite of an error message, a domain named Domain-Id is created instead of
the hndom2 domain.
The corresponding XML configuration file is the following:
<domain type="xen">
<name>hndom2</name>
<os>
<type>linux</type>
<kernel>/boot/efi/efi/redhat/vmlinuz-2.6.18-8.el5xen</kernel>
<root>/dev/hda1</root>
<initrd>/boot/efi/efi/redhat/initrd-2.6.18-8.el5xenU.img</initrd>
<cmdline>console=tty0 nomca 3 ide0=noprobe ide1=noprobe ide2=noprobe
ide3=noprobe selinux=0</cmdline>
</os>
<memory>527360</memory>
<currentMemory>393216</currentMemory>
<vcpu>3</vcpu>
<on_poweroff>restart</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type="block">
<driver name="phy"/>
<source dev="/dev/sda5"/>
<target dev="/dev/hda1"/>
</disk>
<interface type="bridge">
<source bridge=""/>
</interface>
</devices>
</domain>
If the <currentMemory> tag is suppressed from the XML configuration file,
all is OK.
This behaviour appears with the libvirt version 0.1.8 released with the
RHEL5 RC, and also with the libvirt version 0.1.10.
Are you aware of this problem?
If you want some complementary infos (xend log), we can send it to you.
Regards,
Michel Gauthier.
17 years, 9 months
[Libvir] [RFC] The idea of 'policy manager'
by ASANO Yuzuru
Hello,
I summarized the idea about 'policy manager'. The purpose of 'policy manager'
is to manage and to operate 'runtime policy' such as cpu pin/weight/cap.
Please refer to the following thread about earlier argument about
'policy manager'.
https://www.redhat.com/archives/libvir-list/2007-February/msg00211.html
To implement the above mentioned features, I think that 'policy manager'
need to be constructed by CLI and API. Is it all right in the following ideas?
- About CLI
At first, I think the following commands are necessary.
('xxx' means temporary command name)
(1) xxx vcpupin <domain> <vcpu> <cpulist>
: Same as virsh vcpupin <domain> <vcpu> <cpulist> command
(2) xxx schedweight <domain> <weight>
: Same as xm sched-credit -d <domain> -w <weight> command
(3) xxx schedcap <domain> <cap>
: Same as xm sched-credit -d <domain> -c <cap> command
(4) xxx cpuoccupy <pcpu> <domains>
: The domains specified by <domains> can use the <pcpu> in occupancy,
and the other domains can't use it. (*)
(5) xxx cpupolicy <domain>
: Show the CPU runtime policy of <domain>.
(*) When a running domain has vcpu pinned to only single pcpu,
the other domains can't occupy the pcpu.
In above mentioned (1)-(4), policy informations of not only running domains
but also inactive domains are managed in the following API.
- About API
The main function which is necessary for API are as follows.
o When CLI command is executed, the demanded processing is done
by calling libvirt from API.
o API preserves the specified by CLI command to a specific file.
o When start/reboot domain command is executed by libvirt,
API is called from libvirt and the domain is set the runtime policy.
- TODO list
o It is necessary to add new function into libvirt to change scheduler
parameters (cpu weight/cap) previously.
Any other thoughts from anyone?
Regards,
Yuzuru Asano.
17 years, 9 months
[Libvir] [PATCH] patch for virsh domname <uuid> command error
by Tatsuro Enokura
Hi,
Virsh domname <uuid> command for shut-off domain fails on xen-3.0.4.
I think that xm_internal.c shoud be modified.
But, it seems that xm_internal's structure isn't for xen-3.0.4,
and shut-off domain's information is got from xend.
I make a patch for xend_internal.c
The attached patch resolve this issue in the following way:
1) If the domain's name can't be pulled out from
the running domains list by uuid, request xend by
"/xend/domains/<uuid>".
2) If the domain's data can be teken from xend, pull out
the domain's name.
Signed-off-by: Tatsuro Enokura <fj7716hz(a)aa.jp.fujitsu.com>
Thanks,
Tatsuro Enokura.
Index: src/xend_internal.c (libvirt-0.2.0)
===================================================================
--- xend_internal.c 2007-02-15 01:16:16.000000000 +0900
+++ xend_internal.c.new 2007-02-23 21:13:22.000000000 +0900
@@ -2759,6 +2759,8 @@ xenDaemonLookupByUUID(virConnectPtr conn
char **tmp;
unsigned char ident[VIR_UUID_BUFLEN];
int id = -1;
+ struct sexpr *root = NULL;
+ char *domname = NULL;
names = xenDaemonListDomainsOld(conn);
tmp = names;
@@ -2779,6 +2781,26 @@ xenDaemonLookupByUUID(virConnectPtr conn
}
free(names);
+ if (name == NULL) {
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ memset(uuidstr, '\0', VIR_UUID_STRING_BUFLEN);
+
+ snprintf(uuidstr, VIR_UUID_STRING_BUFLEN,
+
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ uuid[0], uuid[1], uuid[2], uuid[3],
+ uuid[4], uuid[5], uuid[6], uuid[7],
+ uuid[8], uuid[9], uuid[10], uuid[11],
+ uuid[12], uuid[13], uuid[14], uuid[15]);
+ root = sexpr_get(conn, "/xend/domain/%s?detail=1", uuidstr);
+ if (root == NULL)
+ goto error;
+ domname = (char*)sexpr_node(root, "domain/name");
+ if (domname == NULL)
+ goto error;
+ name = strdup(domname);
+ id = -1;
+ }
+
if (name == NULL)
goto error;
@@ -2793,6 +2815,8 @@ xenDaemonLookupByUUID(virConnectPtr conn
return (ret);
error:
+ if (root != NULL)
+ sexpr_free(root);
if (name != NULL)
free(name);
return (NULL);
===================================================================
17 years, 9 months
[Libvir] [PATCH]Report the error from xend for Domain-0
by Kazuki Mizushima
Hi,
When I test virsh subcommands, dump save, for Domain-0,
It says following normal messages, but the processing is not done.
#virsh dump 0 a
Domain 0 dumpd to a
#echo $?
0
#virsh save 0 a
Domain 0 saved to a
#echo $?
0
I made a patch which reports the error from xend like this.
#virsh dump 0 a
libvir: Xen Daemon error : POST operation failed: (xend.err 'Cannot save privileged domain 0')
libvir: error : library call virDomainSave failed, possibly not supported
error: Failed to save domain 0 to a
# echo $?
1
#virsh dump 0 a
libvir: Xen Daemon error : POST operation failed: (xend.err 'Cannot dump core for privileged domain 0')
libvir: error : library call virDomainCoreDump failed, possibly not supported
error: Failed to core dump domain 0 to a
# echo $?
1
Signed-off-by: Kazuki Mizushima <mizushima.kazuk(a)jp.fujitsu.com>
Thanks,
Kazuki Mizushima
Index: xend_internal.c (libvirt-0.2.0)
----------------------------------------------------------------------
--- ../../libvirt-0.2.0/src/xend_internal.c 2007-02-15 01:16:16.000000000 +0900
+++ xend_internal.c 2007-02-27 22:45:05.000000000 +0900
@@ -507,7 +507,10 @@ xend_post(virConnectPtr xend, const char
if ((ret < 0) || (ret >= 300)) {
virXendError(xend, VIR_ERR_POST_FAILED, content);
- } else if ((ret = 202) && (strstr(content, "failed") != NULL)) {
+ } else if ((ret == 202) && (strstr(content, "failed") != NULL)) {
+ virXendError(xend, VIR_ERR_POST_FAILED, content);
+ ret = -1;
+ } else if ((ret == 202) && (strcasestr(content, "cannot") != NULL)) {
virXendError(xend, VIR_ERR_POST_FAILED, content);
ret = -1;
}
----------------------------------------------------------------------
17 years, 9 months
[Libvir] Warnings about GNU make extensions
by Richard W.M. Jones
I'm seeing the warnings below when compiling on Fedora Rawhide.
src/Makefile.am:84: `%'-style pattern rules are a GNU make extension
tests/Makefile.am:11: wildcard $(top_builddir: non-POSIX variable name
tests/Makefile.am:11: (probably a GNU make extension)
tests/confdata/Makefile.am:2: wildcard *.conf: non-POSIX variable name
tests/confdata/Makefile.am:2: (probably a GNU make extension)
tests/confdata/Makefile.am:2: wildcard *.out: non-POSIX variable name
tests/confdata/Makefile.am:2: (probably a GNU make extension)
tests/sexpr2xmldata/Makefile.am:2: wildcard *.xml: non-POSIX variable name
tests/sexpr2xmldata/Makefile.am:2: (probably a GNU make extension)
tests/sexpr2xmldata/Makefile.am:2: wildcard *.sexpr: non-POSIX variable name
tests/sexpr2xmldata/Makefile.am:2: (probably a GNU make extension)
tests/virshdata/Makefile.am:2: wildcard *.txt: non-POSIX variable name
tests/virshdata/Makefile.am:2: (probably a GNU make extension)
tests/xmconfigdata/Makefile.am:2: wildcard *.xml: non-POSIX variable name
tests/xmconfigdata/Makefile.am:2: (probably a GNU make extension)
tests/xmconfigdata/Makefile.am:2: wildcard *.cfg: non-POSIX variable name
tests/xmconfigdata/Makefile.am:2: (probably a GNU make extension)
tests/xml2sexprdata/Makefile.am:2: wildcard *.xml: non-POSIX variable name
tests/xml2sexprdata/Makefile.am:2: (probably a GNU make extension)
tests/xml2sexprdata/Makefile.am:2: wildcard *.sexpr: non-POSIX variable name
tests/xml2sexprdata/Makefile.am:2: (probably a GNU make extension)
Versions:
$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-redhat-linux-gnu
$ autoconf --version
autoconf (GNU Autoconf) 2.61
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by David J. MacKenzie and Akim Demaille.
$ automake --version
automake (GNU automake) 1.10
Written by Tom Tromey <tromey(a)redhat.com>
and Alexandre Duret-Lutz <adl(a)gnu.org>.
Copyright 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Rich.
17 years, 9 months
[Libvir] Patch: driver->open functions return declined or error status
by Richard W.M. Jones
I want to change the driver->open function so that as well as declining
a name (returning -1 as now), it may also indicate that it accepts the
name, but there is an error opening the name (-2). virConnectOpen fails
in this second case, rather than going on and trying the next driver in
sequence.
Rich.
--
Emerging Technologies, Red Hat http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF Mobile: +44 7866 314 421
"[Negative numbers] darken the very whole doctrines of the equations
and make dark of the things which are in their nature excessively
obvious and simple" (Francis Maseres FRS, mathematician, 1759)
17 years, 9 months