[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] [PATCH][RFC] Add --keymap option to virt-install



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 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]