[libvirt] problem of escaped scancodes
by Lai Jiangshan
Hi, Daniel P. Berrange,
Our user found that some keycode can not be handled well when
they try to map other keycode to xt_kbd keycode, when xt_kbd keycode
is an escaped scancode.
The xt_kbd keycode http://git.gnome.org/browse/gtk-vnc/plain/src/keymaps.csv
are come from x86_keycodes[] of linux/drivers/char/keyboard.c.
And x86_keycodes[] are:
static const unsigned short x86_keycodes[256] =
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84,118, 86, 87, 88,115,120,119,121,112,123, 92,
284,285,309, 0,312, 91,327,328,329,331,333,335,336,337,338,339,
367,288,302,304,350, 89,334,326,267,126,268,269,125,347,348,349,
360,261,262,263,268,376,100,101,321,316,373,286,289,102,351,355,
103,104,105,275,287,279,258,106,274,107,294,364,358,363,362,361,
291,108,381,281,290,272,292,305,280, 99,112,257,306,359,113,114,
264,117,271,374,379,265,266, 93, 94, 95, 85,259,375,260, 90,116,
377,109,111,277,278,282,283,295,296,297,299,300,301,293,303,307,
308,310,313,314,315,317,318,319,320,357,322,323,324,325,276,330,
332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 };
There is no keycode in range [128, 256] in this table, which means
all escaped scancode "e0 ??" are encoded as "0x100 | ??" in this table.
Example, LeftCtrl is 0x1d, and RightCtrl is escaped: "e0 1d",
RightCtrl is encoded as "0x100 | 0x1d"(=0x11d=285) in this table.
The code also tell me the same information:
code = x86_keycodes[keycode];
if (!code)
return -1;
if (code & 0x100)
put_queue(vc, 0xe0);
put_queue(vc, (code & 0x7f) | up_flag);
But some other place, escaped scancode "e0 ??" are encoded as "0x80 | ??",
this encoding is more commonly used, and qemu uses this encoding,
RightCtrl is encoded as "0x80 | 0x1d"(=0x9d=157) in qemu:
{ 0x9d, "ctrl_r" },
keycode = keycodes[i];
if (keycode & 0x80)
kbd_put_keycode(0xe0);
kbd_put_keycode(keycode & 0x7f);
The problem:
keymaps.csv uses the first encoding while qemu uses the second one, it
causes "virsh send-key" command can't work when it sends escaped scancodes.
Example:
When do "virsh send-key domain KEY_RIGHTCTRL", qemu will receive keycode=285
which is not expected.
So I suggest to change keymaps.csv.
Covert the old
KEY_RIGHTCTRL,97,RightControl,0x3e,,,88,,285,228,VK_RCONTROL,0xa3,0x65,0x65
to new
KEY_RIGHTCTRL,97,RightControl,0x3e,,,88,,157,228,VK_RCONTROL,0xa3,0x65,0x65
(ditto for other escaped scancodes)
Or just add the new line to keymaps.csv followed by the old line, and make
285 and 157 can work at the same time.
Thought?
Thanks,
Lai.
13 years, 3 months
[libvirt] XML files
by Derek
Hi Folks,
I'm running KVM on Debian squeeze. I have some requirements on a new VM to provide customised BIOS vendor/product strings, from my experience so far this is accomplish with the sysinfo/smbios support. So I have added these to the XML file for my VM.
I found 'virsh edit' is the recommended way to make changes to a VM configuration, I find the XML file is not referenced at boot, it is only saved to with 'virsh dumpxml'. 'virsh edit' will update both areas - hypervisor and XML file.
Unfortunately the changes I make for smbios and sysinfo (as below) while editing don't appear to be accepted when saving with 'virsh edit'. After saving I receive "Domain HMC XML configuration edited." but the XML file remains unmodified. I wonder if they are perhaps not supported with virsh edit yet?
<sysinfo type='smbios'>
<bios>
<entry name='vendor'>xxx xxx</entry>
<entry name='version'>xxx</entry>
</bios>
<system>
<entry name='product'>xxx</entry>
<entry name='version'>xxx</entry>
<entry name='manufacturer'>xxx xxx</entry>
</system>
</sysinfo>
<os>
<type arch='x86_64' machine='pc-0.12'>hvm</type>
<boot dev='cdrom'/>
<smbios mode='sysinfo'/>
</os>
Thanks in advance,
Derek
13 years, 3 months
[libvirt] [libvirt-virshcmdref 01/14] update documentation for command attach-device
by Hu Tao
---
source/attach-device.xml | 143 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 137 insertions(+), 6 deletions(-)
diff --git a/source/attach-device.xml b/source/attach-device.xml
index efa46f0..18e3262 100644
--- a/source/attach-device.xml
+++ b/source/attach-device.xml
@@ -5,20 +5,151 @@
<description>
<text>
- Attach device from an XML file
+ Attach a device from an XML file
</text>
</description>
- <options />
+ <options>
+ <parameter requirement="required">
+ <keyword requirement="optional">--domain</keyword>
+ <value type="string" requirement="required">domain</value>
+ <description>
+ <text>
+ domain name, id or uuid
+ </text>
+ <text>
+ "--domain" itself is optional
+ </text>
+ </description>
+ </parameter>
+ <parameter requirement="required">
+ <keyword requirement="optional">--file</keyword>
+ <value type="string" requirement="required">file</value>
+ <description>
+ <text>
+ the XML file describing the device to be attached
+ </text>
+ <text>
+ "--file" itself is optional
+ </text>
+ </description>
+ </parameter>
+ <parameter requirement="optional">
+ <keyword requirement="required">--persistent</keyword>
+ <description>
+ <text>
+ with this option, the XML file of domain will be updated
+ </text>
+ </description>
+ </parameter>
+ </options>
<availability from="0.2.3" />
<notes />
- <examples type="usage" />
+ <examples type="usage">
+ <example>
+ <terminal>
+virsh # <bold>attach-device</bold> <value>example-domain</value> <value>/tmp/new-nic.xml</value></terminal>
+ <text>
+ Attaches a NIC which is defined by <value>/tmp/new-nic.xml</value> to domain <value>example-domain</value>.
+ </text>
+ </example>
+ </examples>
- <examples type="fullcontext" />
-
- <reference type="seealso" />
+ <examples type="fullcontext">
+ <example>
+ <text>
+ In this example we will attach a NIC to a running domain which doesn't have a NIC.
+ The domain is defined as:
+ </text>
+ <terminal>
+<domain type='kvm'>
+ <name>example-domain</name>
+ <uuid>6853c36f-af03-4968-a31d-1f3a9c3f699a</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc-0.12'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/local/bin/qemu-system-x86_64</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='writeback'/>
+ <source file='/mnt/data/libvirt-images/vm2.img'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes'/>
+ <video>
+ <model type='cirrus' vram='9216' heads='1'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain></terminal>
+ <text>
+ Bring up the domain. From the output of <value>lspci</value> we can see that there is no NIC
+ present.
+ </text>
+ <terminal>00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
+00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
+00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
+00:01.2 USB Controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
+00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
+00:02.0 VGA compatible controller: Cirrus Logic GD 5446
+00:03.0 RAM memory: Red Hat, Inc Virtio memory balloon
+00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device</terminal>
+ <text>
+ Now we attach a NIC to the domain:
+ </text>
+ <terminal>virsh # <bold>attach-device</bold> <value>example-domain</value> <value>/tmp/new-nic.xml</value></terminal>
+ <text>
+ the content of <value>/tmp/new-nic.xml</value> is:
+ </text>
+ <terminal>
+<interface type='network'>
+ <source network='default'/>
+</interface></terminal>
+ <text>
+ We can see that the attached NIC is listed by <value>lspci</value>:
+ </text>
+ <terminal>00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
+00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
+00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
+00:01.2 USB Controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
+00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
+00:02.0 VGA compatible controller: Cirrus Logic GD 5446
+00:03.0 RAM memory: Red Hat, Inc Virtio memory balloon
+00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
+00:05.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 20)</terminal>
+ </example>
+ </examples>
+ <reference type="seealso">
+ <item>
+ <link type="internal" href="detach-device" />
+ <name>
+ detach-device
+ </name>
+ <description>
+ Detach a device from an XML file
+ </description>
+ </item>
+ </reference>
</command>
--
1.7.3.1
13 years, 3 months
[libvirt] [PATCH 1/3] virt-manager: Add controller model in details
by Marc-André Lureau
---
src/virtManager/details.py | 5 +++++
src/vmm-details.glade | 29 +++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/src/virtManager/details.py b/src/virtManager/details.py
index 1fb7d3a..fd6cc3a 100644
--- a/src/virtManager/details.py
+++ b/src/virtManager/details.py
@@ -3019,7 +3019,12 @@ class vmmDetails(vmmGObjectUI):
return
type_label = virtinst.VirtualController.pretty_type(dev.type)
+ model_label = dev.model
+ if not model_label:
+ model_label = _("Default")
+
self.widget("controller-type").set_text(type_label)
+ self.widget("controller-model").set_text(model_label)
def refresh_filesystem_page(self):
dev = self.get_hw_selection(HW_LIST_COL_DEVICE)
diff --git a/src/vmm-details.glade b/src/vmm-details.glade
index 0e2d631..8ab386b 100644
--- a/src/vmm-details.glade
+++ b/src/vmm-details.glade
@@ -5553,6 +5553,7 @@ I/O:</property>
<widget class="GtkTable" id="table14">
<property name="visible">True</property>
<property name="n_columns">2</property>
+ <property name="n_rows">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
@@ -5577,6 +5578,34 @@ I/O:</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
+ <child>
+ <widget class="GtkLabel" id="mlabel48">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Model:</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="controller-model">
+ <property name="visible">True</property>
+ <property name="label">foo</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
--
1.7.6
13 years, 3 months
[libvirt] [PATCH 0/4] python-virtinst USB improvements
by Marc-André Lureau
Hi,
Here are a few patches that go with the libvirt series to improve
USB support. It adds --controller and --usbredir, as well as providing
some new API for virt-manager.
The last patch default USB controller to ich9/usb2 on Windows 7 guest.
More OS probably support it, since it's been around since early 2007.
Marc-André Lureau (4):
Fix typo s/type/managed
Add advanced --controller support, augmenting VirtualController
Add --usbredir server:port device
RFC: Default to ICH9 USB2 controller for Win7
man/en/virt-clone.1 | 6 ++-
man/en/virt-image.1 | 45 +++++++--------
man/en/virt-install.1 | 52 ++++++++++++++++-
man/en/virt-install.pod.in | 59 ++++++++++++++++++-
tests/cli-test-xml/compare/many-devices.xml | 30 ++++++++++
tests/clitest.py | 50 ++++++++++++++++
tests/utils.py | 8 +-
tests/xmlparse-xml/change-controllers-in.xml | 4 +
tests/xmlparse-xml/change-controllers-out.xml | 4 +
tests/xmlparse.py | 9 +++
virt-install | 2 +
virtinst/Guest.py | 26 ++++++++
virtinst/VirtualController.py | 78 +++++++++++++++++++++++--
virtinst/VirtualDevice.py | 49 +++++++++++++++-
virtinst/VirtualHostDevice.py | 67 +++++++++++++++++++++-
virtinst/XMLBuilderDomain.py | 10 +++
virtinst/__init__.py | 5 +-
virtinst/cli.py | 78 +++++++++++++++++++++++++
virtinst/osdict.py | 3 +
virtinst/support.py | 6 ++
20 files changed, 547 insertions(+), 44 deletions(-)
--
1.7.6
13 years, 3 months
[libvirt] [PATCH 1/2] qemu: avoid dead store in doPeer2PeerMigrate3
by ajia@redhat.com
* src/qemu/qemu_migration.c: avoid dead 'ret' assignment and silence
clang warning.
Detected by ccc-analyzer:
CC libvirt_driver_qemu_la-qemu_migration.lo
qemu/qemu_migration.c:2046:5: warning: Value stored to 'ret' is never read
ret = qemuMigrationConfirm(driver, sconn, vm,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
src/qemu/qemu_migration.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 5510493..469bb4a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2050,6 +2050,9 @@ finish:
* do, but fortunately worst case is that there is a
* domain left in 'paused' state on source.
*/
+ if (ret < 0)
+ VIR_WARN("Guest %s probably left in 'paused' state on source",
+ vm->def->name);
cleanup:
if (ddomain) {
--
1.7.1
13 years, 3 months
[libvirt] [PATCH] qemu: Correctly label migration TCP socket passed to qemu
by Jiri Denemark
---
src/qemu/qemu_migration.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a84faf6..d787a09 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1484,9 +1484,12 @@ qemuMigrationRun(struct qemud_driver *driver,
case MIGRATION_DEST_FD:
if (spec->fwdType != MIGRATION_FWD_DIRECT)
fd = spec->dest.fd.local;
- ret = qemuMonitorMigrateToFd(priv->mon, migrate_flags,
- spec->dest.fd.qemu);
- VIR_FORCE_CLOSE(spec->dest.fd.qemu);
+ if (virSecurityManagerSetImageFDLabel(driver->securityManager, vm,
+ spec->dest.fd.qemu) == 0) {
+ ret = qemuMonitorMigrateToFd(priv->mon, migrate_flags,
+ spec->dest.fd.qemu);
+ VIR_FORCE_CLOSE(spec->dest.fd.qemu);
+ }
break;
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
--
1.7.6.1
13 years, 3 months
[libvirt] [PATCH v2] remote: Refuse connecting to remote socket
by Michal Privoznik
If users wants to connect to remote unix socket, e.g.
'qemu+unix://<remote>/system' currently the <remote> part is ignored,
ending up connecting to localhost. Connecting to remote socket is not
supported and user should have used TLS/TCP/SSH instead.
---
src/remote/remote_driver.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 28f333b..563ccf4 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -325,9 +325,16 @@ doRemoteOpen (virConnectPtr conn,
} else {
if (STRCASEEQ (transport_str, "tls"))
transport = trans_tls;
- else if (STRCASEEQ (transport_str, "unix"))
- transport = trans_unix;
- else if (STRCASEEQ (transport_str, "ssh"))
+ else if (STRCASEEQ (transport_str, "unix")) {
+ if (conn->uri->server) {
+ remoteError(VIR_ERR_INVALID_ARG, "%s",
+ _("rempte_open: using unix socket and "
+ "remote server is not supported."));
+ return VIR_DRV_OPEN_ERROR;
+ } else {
+ transport = trans_unix;
+ }
+ } else if (STRCASEEQ (transport_str, "ssh"))
transport = trans_ssh;
else if (STRCASEEQ (transport_str, "ext"))
transport = trans_ext;
--
1.7.3.4
13 years, 3 months
[libvirt] [PATCH] Fix command test wrt gnutls initialize & fix debugging
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The VIR_TEST_DEBUG and VIR_TEST_VERBOSE env vars did not work
because we replaced 'environ' with 'newenv'. Simply calling
virTestGetDebug/Verbose() before replacing the 'environ' ensures
we have processed the env variables.
The gnutls initialization code opens /dev/urandom and keeps that
FD around for later use. We have code which kills off FDs 3-5
to avoid interfereing with our test case. Move the virInitialize
call before this point, so it kills off the gnutls /dev/urandom
FD which is irrelevant for testing purposes
* tests/commandtest.c: Fix test debugging & make it robust against
opened FDs
---
tests/commandtest.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/tests/commandtest.c b/tests/commandtest.c
index 4a798fc..dd6c248 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -773,6 +773,13 @@ mymain(void)
setpgid(0, 0);
setsid();
+
+ /* Prime the debug/verbose settings from the env vars,
+ * since we're about to reset 'environ' */
+ virTestGetDebug();
+ virTestGetVerbose();
+
+ virInitialize();
/* Kill off any inherited fds that might interfere with our
* testing. */
fd = 3;
@@ -782,8 +789,6 @@ mymain(void)
fd = 5;
VIR_FORCE_CLOSE(fd);
- virInitialize();
-
environ = (char **)newenv;
# define DO_TEST(NAME) \
--
1.7.6
13 years, 3 months