[libvirt] Cannot use console with 0.7.5, error: internal error no assigned pty for device serial0
[my apologies for this re-post. I stupidly managed to hide the first instance of this mail away in an unrelated patch-thread and am thus afraid that the people who could have answered didn't see it] Hi, I have one test host running Debian unstable (kernel 2.6.32.3), and I would like to virtualize on it using KVM and virsh. Debian unstable has libvirt 0.7.5. On this host, I cannot start any KVM domain using console with these XML parts: serial type='pty' target port='0'/ /serial console type='pty' target port='0'/ /console When I try virsh start $domain, I get the error message: error: internal error no assigned pty for device serial0 When I remove the serial and console stanza, the machine starts up. This is the configuration documented everywhere. At first, I suspected a change in the configuration syntax and filed Debian bug #565145, But on the #virt IRC channel, people suggested that there was a change in libvirt parsing KVM's output, which may be a genuine bug breaking the console. Is this already a known issue? Can I do anything to help debugging? Greetings Marc -- - Marc Haber | I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things.Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC] Proposal for introduction of n etwork traffic filtering capabilities for filtering of n etwork traffic from and to VMs
Le 14/01/2010 vers 01:09, dans le message intitulé Re: [libvirt] [RFC] Proposal for introduction of network trafficfiltering capabilities for filtering of network traffic from and to VMs, Dimitrios Pendarakis(Dimitrios Pendarakis dimit...@us.ibm.com) a écrit: Hi, Note that this is the case for the standard VMware ESX vSwitch. However, the Cisco Nexus 1000v, which is an optional virtual switch for ESX, does appear to provide (guest) VM firewall capabilities. OpenVswitch project (http://openvswitch.org/) seems to provide the same thing for KVM, Xen and Virtualbox. This should be wonderfull if the VM based filtering is done using OpenVswitch capabilities... -- http://www.glennie.fr If the only tool you have is hammer, you tend to see every problem as a nail. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] xen: do not report a write-to-Xen-daemon failure as a read failure
FYI, pushed as obvious... From 02765872876ba8a820a5047f664da8a7b870b7b9 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Fri, 15 Jan 2010 10:22:08 +0100 Subject: [PATCH] xen: do not report a write-to-Xen-daemon failure as a read failure * src/xen/xend_internal.c (wr_sync): Correct the diagnostic. --- src/xen/xend_internal.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index d9bfa15..9c5127f 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -196,11 +196,11 @@ wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int do_read) if (do_read) virXendError(xend, VIR_ERR_INTERNAL_ERROR, %s, _(failed to read from Xen Daemon)); else virXendError(xend, VIR_ERR_INTERNAL_ERROR, - %s, _(failed to read from Xen Daemon)); + %s, _(failed to write to Xen Daemon)); return (-1); } offset += len; -- 1.6.6.556.gd6679 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix compilation of virt-aa-helper.c
Matthias Bolte wrote: Commit 5073aa994af460e775cb3e548528e28d7660fcc8 added an additional '}' to a case block that messed up the block structure of the get_files function. --- src/security/virt-aa-helper.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 3c8b49a..1b0b2cd 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -851,7 +851,6 @@ get_files(vahControl * ctl) if (rc != 0) goto clean; break; -} } ACK. Obviously fixes the compilation failure. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] xen: do not report a write-to-Xen-daemon failure as a read failure
On Fri, Jan 15, 2010 at 10:41:49AM +0100, Jim Meyering wrote: FYI, pushed as obvious... From 02765872876ba8a820a5047f664da8a7b870b7b9 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Fri, 15 Jan 2010 10:22:08 +0100 Subject: [PATCH] xen: do not report a write-to-Xen-daemon failure as a read failure * src/xen/xend_internal.c (wr_sync): Correct the diagnostic. --- src/xen/xend_internal.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index d9bfa15..9c5127f 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -196,11 +196,11 @@ wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int do_read) if (do_read) virXendError(xend, VIR_ERR_INTERNAL_ERROR, %s, _(failed to read from Xen Daemon)); else virXendError(xend, VIR_ERR_INTERNAL_ERROR, - %s, _(failed to read from Xen Daemon)); + %s, _(failed to write to Xen Daemon)); return (-1); } offset += len; ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] newer gnulib: requires several header-include fixes
On Fri, Jan 15, 2010 at 11:03:01AM +0100, Jim Meyering wrote: A week or two ago, upstream gnulib was fixed to be more namespace friendly in how it creates replacement headers. For some of its replacements (e.g., stdio.h, used via gnulib/lib/stdio.h), it would unnecessarily include another header, e.g., stdlib.h. That would make it so that an application using gnulib's stdio.h could think it's fine *not* to include stdlib.h, even though it uses a function like exit whose declaration usually requires an explicit inclusion of stdlib.h. [the example above is made up -- in reality it was more subtle] Well, now, those excess inclusions have been removed, and when I upgraded libvirt to use the latest gnulib, I saw many compilation failures due to missing #include directives. This series fixes the problems, then adds a change-set to update to the latest gnulib. Here are the one-line summaries: util.c: include required header, no longer masked by gnulib cpu_x86_data.h: include required header vbox: include required headers esx_vi_types.c: include required headers storage_backend.h: include required headers build: update gnulib submodule to latest From ed2e5140a5a5529ca19e730d061f6d5b3872bb7f Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Fri, 15 Jan 2010 10:31:23 +0100 Subject: [PATCH 1/6] util.c: include required header, no longer masked by gnulib Until recently, some gnulib-generated replacement headers included *other* headers that were not strictly necessary, thus masking the need in this file for an explicit stdlib.h. * src/util/util.c: Include stdlib.h for declarations of e.g., strtol, random_r, getenv, etc. --- src/util/util.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/util/util.c b/src/util/util.c index 45ca657..67fae00 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -1,7 +1,7 @@ /* * utils.c: common, generic utility functions * - * Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc. + * Copyright (C) 2006-2010 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * Copyright (C) 2006, 2007 Binary Karma * Copyright (C) 2006 Shuveb Hussain @@ -28,6 +28,7 @@ #include stdio.h #include stdarg.h +#include stdlib.h #include unistd.h #include fcntl.h #include errno.h -- 1.6.6.556.gd6679 From c920cd6ae55e4b89aa32c7303ed206a83071f5c0 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Fri, 15 Jan 2010 10:33:32 +0100 Subject: [PATCH 2/6] cpu_x86_data.h: include required header * src/cpu/cpu_x86_data.h: Include stdint.h. --- src/cpu/cpu_x86_data.h |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h index 8b09d23..25ee2a5 100644 --- a/src/cpu/cpu_x86_data.h +++ b/src/cpu/cpu_x86_data.h @@ -1,7 +1,7 @@ /* * cpu_x86_data.h: x86 specific CPU data * - * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2009-2010 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,6 +24,8 @@ #ifndef __VIR_CPU_X86_DATA_H__ #define __VIR_CPU_X86_DATA_H__ +#include stdint.h + struct cpuX86cpuid { uint32_t function; uint32_t eax; -- 1.6.6.556.gd6679 From 5efa5755bd38f0e7fb0f802c21dbd798e49ba5a3 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Fri, 15 Jan 2010 10:35:41 +0100 Subject: [PATCH 3/6] vbox: include required headers * src/vbox/vbox_driver.c: Include stdint.h unistd.h sys/types.h. --- src/vbox/vbox_driver.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c index ad5f239..ef3eb4b 100644 --- a/src/vbox/vbox_driver.c +++ b/src/vbox/vbox_driver.c @@ -28,6 +28,10 @@ #include config.h +#include stdint.h +#include unistd.h +#include sys/types.h + #include internal.h #include datatypes.h -- 1.6.6.556.gd6679 From b860fa5ed20cb54c56f50e25b40a9864b9ff4b60 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Fri, 15 Jan 2010 10:37:03 +0100 Subject: [PATCH 4/6] esx_vi_types.c: include required headers * src/esx/esx_vi_types.c: Include stdint.h. --- src/esx/esx_vi_types.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index 8c5b17b..c042e89 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -22,6 +22,7 @@ #include config.h +#include stdint.h #include libxml/parser.h #include libxml/xpathInternals.h -- 1.6.6.556.gd6679 From b57e46d562501d449f5e56bdf780496899494bf4 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Fri, 15 Jan 2010 10:38:36 +0100 Subject: [PATCH 5/6] storage_backend.h: include required headers
Re: [libvirt] [PATCH] Add docs about new mailing list
Daniel P. Berrange wrote: * docs/contact.html.in: Document new users mailing list ... Sounds good. +p + Both mailing lists require that you strongsubscribe before posting to the list/strong, Since both lists are using listhelper, http://savannah.gnu.org/maintenance/ListHelperAntiSpam it is now possible to remove the subscribe-before-posting requirement. If we remove it, that makes it easier for people to send their first post. Now, that may not always be such a good thing ;-) but at least it won't result in spam. + otherwise your posting will be blocked by mailman. You can subscribe at the linked webpages + above. Perhaps say delayed for manual approval rather than blocked? +/p +p + Patches with explanations and provided as attachments are really appreciated and should + be directed to the development mailing list will be discussed on the mailing list. If possible generate the patches by using codegit diff/code in a GIT clone. /p Minor wording fix, and say we prefer git format-patch, rather than git diff output, since the former can provide (we hope) a commit log and useful attribution, if/when we apply the patch, while git diff does not. Patches with explanations and provided as attachments are really appreciated. They should be sent to the development mailing list, and will be discussed there. If possible, generate the patches by using codegit format-patch/code in a GIT clone. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Using ESX domain XML for V2V
2010/1/15 Matthias Bolte matthias.bo...@googlemail.com: 2010/1/14 Matthew Booth mbo...@redhat.com: I'm trying to use the ESX driver to extract metadata from ESX in an easily digestible form for driving V2V. I've noticed the domain XML seems to be missing a few bits: features/ This is currently not implemented, but could be by parsing the CPUIDs. This is on my todo list. graphics/ VMware seems to use a certain type of VNC for this, but they use a custom authentication mechanism. There is a Firefox plugin for that (vmware-mks.xpi), but IIRC its Windows only. I think this could be implemented but there is more research necessary what to expose as graphics element. Okay, I should have looked at this in more detail before answering... ESX (at least 4.0) supports normal VNC as well. It can be enabled by adding RemoteDisplay.vnc.enabled = true RemoteDisplay.vnc.port = port RemoteDisplay.vnc.password = password to the VMX config. I tested it and it works, but I had to manually open the VNC port range in the ESX firewall using the VI client GUI. I think this can be done using the VI API, but I'm not sure whether the ESX driver should do this automatically or if proper firewall configuration should stay a responsibility of the user. Matthias -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix compilation of virt-aa-helper.c
2010/1/15 Jim Meyering j...@meyering.net: Matthias Bolte wrote: Commit 5073aa994af460e775cb3e548528e28d7660fcc8 added an additional '}' to a case block that messed up the block structure of the get_files function. --- src/security/virt-aa-helper.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 3c8b49a..1b0b2cd 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -851,7 +851,6 @@ get_files(vahControl * ctl) if (rc != 0) goto clean; break; - } } ACK. Obviously fixes the compilation failure. Thanks, pushed. Matthias -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Using ESX domain XML for V2V
On Fri, Jan 15, 2010 at 12:04:50PM +0100, Matthias Bolte wrote: 2010/1/15 Matthias Bolte matthias.bo...@googlemail.com: 2010/1/14 Matthew Booth mbo...@redhat.com: I'm trying to use the ESX driver to extract metadata from ESX in an easily digestible form for driving V2V. I've noticed the domain XML seems to be missing a few bits: features/ This is currently not implemented, but could be by parsing the CPUIDs. This is on my todo list. graphics/ VMware seems to use a certain type of VNC for this, but they use a custom authentication mechanism. There is a Firefox plugin for that (vmware-mks.xpi), but IIRC its Windows only. I think this could be implemented but there is more research necessary what to expose as graphics element. Interesting - if there is any docs or source code illustrating this auth mechanism we could try and hook it into GTK-VNC and see if it really does have normalish VNC Okay, I should have looked at this in more detail before answering... ESX (at least 4.0) supports normal VNC as well. It can be enabled by adding RemoteDisplay.vnc.enabled = true RemoteDisplay.vnc.port = port RemoteDisplay.vnc.password = password to the VMX config. I tested it and it works, but I had to manually open the VNC port range in the ESX firewall using the VI client GUI. I think this can be done using the VI API, but I'm not sure whether the ESX driver should do this automatically or if proper firewall configuration should stay a responsibility of the user. That's the responsibility of hte ESX admin, in same way the Linux host admin has to open the firewall for VNC when using KVM/Xen Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Cannot use console with 0.7.5, error: internal error no assigned pty for device serial0
On 15/01/10 09:18, Marc Haber wrote: [my apologies for this re-post. I stupidly managed to hide the first instance of this mail away in an unrelated patch-thread and am thus afraid that the people who could have answered didn't see it] Hi, I have one test host running Debian unstable (kernel 2.6.32.3), and I would like to virtualize on it using KVM and virsh. Debian unstable has libvirt 0.7.5. On this host, I cannot start any KVM domain using console with these XML parts: serial type='pty' target port='0'/ /serial console type='pty' target port='0'/ /console When I try virsh start $domain, I get the error message: error: internal error no assigned pty for device serial0 When I remove the serial and console stanza, the machine starts up. This is the configuration documented everywhere. At first, I suspected a change in the configuration syntax and filed Debian bug #565145, But on the #virt IRC channel, people suggested that there was a change in libvirt parsing KVM's output, which may be a genuine bug breaking the console. Is this already a known issue? Can I do anything to help debugging? Hi, Marc, Could you please post the full domain XML, and the QEMU command line it generated? You can get the latter from /var/log/libvirt/qemu/domain.log. Can you also post the versions of qemu and libvirt? This should let me see where it's going wrong. Thanks, Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team M: +44 (0)7977 267231 GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Using ESX domain XML for V2V
2010/1/15 Daniel P. Berrange berra...@redhat.com: On Fri, Jan 15, 2010 at 12:04:50PM +0100, Matthias Bolte wrote: 2010/1/15 Matthias Bolte matthias.bo...@googlemail.com: 2010/1/14 Matthew Booth mbo...@redhat.com: I'm trying to use the ESX driver to extract metadata from ESX in an easily digestible form for driving V2V. I've noticed the domain XML seems to be missing a few bits: features/ This is currently not implemented, but could be by parsing the CPUIDs. This is on my todo list. graphics/ VMware seems to use a certain type of VNC for this, but they use a custom authentication mechanism. There is a Firefox plugin for that (vmware-mks.xpi), but IIRC its Windows only. I think this could be implemented but there is more research necessary what to expose as graphics element. Interesting - if there is any docs or source code illustrating this auth mechanism we could try and hook it into GTK-VNC and see if it really does have normalish VNC Well that's the VMware MKS stuff. The VI API contains a AcquireMksTicket method [1] that returns a VirtualMachineMksTicket [2] containing some information to establish a connection. But IIRC the port return is 902 and thats the port of the vmware-authd-mks service. I'm not sure if there is any public documentation available about the auth mechanism for this service. But there is no need for the VMware MKS stuff as I just discovered. The VMX RemoteDisplay.vnc.* config options allow to enable normal VNC. I edited the config of a virtual machine by hand and used the default vncviewer of my Ubuntu box here to connect. On connect it asks for the password and then it works as expected. I'll have a patch for that shortly. Okay, I should have looked at this in more detail before answering... ESX (at least 4.0) supports normal VNC as well. It can be enabled by adding RemoteDisplay.vnc.enabled = true RemoteDisplay.vnc.port = port RemoteDisplay.vnc.password = password to the VMX config. I tested it and it works, but I had to manually open the VNC port range in the ESX firewall using the VI client GUI. I think this can be done using the VI API, but I'm not sure whether the ESX driver should do this automatically or if proper firewall configuration should stay a responsibility of the user. That's the responsibility of hte ESX admin, in same way the Linux host admin has to open the firewall for VNC when using KVM/Xen Daniel Okay. [1] http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.VirtualMachine.html#acquireMksTicket [2] http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.VirtualMachine.MksTicket.html Matthias -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 01/34] Make test suite output less verbose
On Fri, Jan 08, 2010 at 05:22:57PM +, Daniel P. Berrange wrote: Only print out '.' for each test case, full test output can be re-enabled with VIR_TEST_VERBOSE=1, or VIR_TEST_DEBUG= Sample output now looks like TEST: statstest 40 ... 75 OK PASS: statstest TEST: qparamtest 32 OK PASS: qparamtest TEST: 12 OK Okay, way more compact, ACK Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2] Implement CPU topology support for QEMU driver
QEMU's command line equivalent for the following domain XML fragment vcpus2/vcpus cpu ... ... topology sockets='1' cores='2', threads='1'/ /cpu is -smp 2,sockets=1,cores=2,threads=1 This syntax was introduced in QEMU-0.12. Version 2 changes: - -smp argument build split into a separate function - always add ,sockets=S,cores=C,threads=T to -smp if qemu supports it - use qemuParseCommandLineKeywords for command line parsing Signed-off-by: Jiri Denemark jdene...@redhat.com --- src/qemu/qemu_conf.c | 159 +- src/qemu/qemu_conf.h |3 +- 2 files changed, 145 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 9f35217..09bbf7a 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1,7 +1,7 @@ /* * qemu_conf.c: QEMU configuration management * - * Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc. + * Copyright (C) 2006, 2007, 2008, 2009, 2010 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -1115,6 +1115,10 @@ static unsigned int qemudComputeCmdFlags(const char *help, flags |= QEMUD_CMD_FLAG_CHARDEV; if (strstr(help, -balloon)) flags |= QEMUD_CMD_FLAG_BALLOON; +if (strstr(help, cores=) +strstr(help, threads=) +strstr(help, sockets=)) +flags |= QEMUD_CMD_FLAG_SMP_TOPOLOGY; if (version = 9000) flags |= QEMUD_CMD_FLAG_VNC_COLON; @@ -1865,6 +1869,39 @@ no_memory: goto cleanup; } +static char * +qemudBuildCommandLineSmp(virConnectPtr conn, + const virDomainDefPtr def, + int qemuCmdFlags) +{ +virBuffer buf = VIR_BUFFER_INITIALIZER; + +virBufferVSprintf(buf, %lu, def-vcpus); + +if ((qemuCmdFlags QEMUD_CMD_FLAG_SMP_TOPOLOGY)) { +/* sockets, cores, and threads are either all zero + * or all non-zero, thus checking one of them is enough */ +if (def-cpu def-cpu-sockets) { +virBufferVSprintf(buf, ,sockets=%u, def-cpu-sockets); +virBufferVSprintf(buf, ,cores=%u, def-cpu-cores); +virBufferVSprintf(buf, ,threads=%u, def-cpu-threads); +} +else { +virBufferVSprintf(buf, ,sockets=%lu, def-vcpus); +virBufferVSprintf(buf, ,cores=%u, 1); +virBufferVSprintf(buf, ,threads=%u, 1); +} +} + +if (virBufferError(buf)) { +virBufferFreeAndReset(buf); +virReportOOMError(conn); +return NULL; +} + +return virBufferContentAndReset(buf); +} + #define QEMU_SERIAL_PARAM_ACCEPTED_CHARS \ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ @@ -1900,7 +1937,6 @@ int qemudBuildCommandLine(virConnectPtr conn, const char *migrateFrom) { int i; char memory[50]; -char vcpus[50]; char boot[VIR_DOMAIN_BOOT_LAST]; struct utsname ut; int disableKQEMU = 0; @@ -1914,6 +1950,7 @@ int qemudBuildCommandLine(virConnectPtr conn, char uuid[VIR_UUID_STRING_BUFLEN]; char domid[50]; char *cpu; +char *smp; uname_normalize(ut); @@ -2049,7 +2086,6 @@ int qemudBuildCommandLine(virConnectPtr conn, * is not supported, then they're out of luck anyway */ snprintf(memory, sizeof(memory), %lu, def-maxmem/1024); -snprintf(vcpus, sizeof(vcpus), %lu, def-vcpus); snprintf(domid, sizeof(domid), %d, def-id); ADD_ENV_LIT(LC_ALL=C); @@ -2112,8 +2148,13 @@ int qemudBuildCommandLine(virConnectPtr conn, ADD_ARG_LIT(-mem-path); ADD_ARG_LIT(driver-hugepage_path); } + +if (!(smp = qemudBuildCommandLineSmp(conn, def, qemuCmdFlags))) +goto error; + ADD_ARG_LIT(-smp); -ADD_ARG_LIT(vcpus); +ADD_ARG_LIT(smp); +VIR_FREE(smp); if (qemuCmdFlags QEMUD_CMD_FLAG_NAME) { ADD_ARG_LIT(-name); @@ -3740,6 +3781,27 @@ error: } +static virCPUDefPtr +qemuInitGuestCPU(virConnectPtr conn, + virDomainDefPtr dom) +{ +if (!dom-cpu) { +virCPUDefPtr cpu; + +if (VIR_ALLOC(cpu) 0) { +virReportOOMError(conn); +return NULL; +} + +cpu-type = VIR_CPU_TYPE_GUEST; +cpu-match = VIR_CPU_MATCH_EXACT; +dom-cpu = cpu; +} + +return dom-cpu; +} + + static int qemuParseCommandLineCPU(virConnectPtr conn, virDomainDefPtr dom, @@ -3749,10 +3811,8 @@ qemuParseCommandLineCPU(virConnectPtr conn, const char *p = val; const char *next; -if (VIR_ALLOC(cpu) 0) -goto no_memory; - -cpu-type = VIR_CPU_TYPE_GUEST; +if (!(cpu = qemuInitGuestCPU(conn, dom))) +goto error; do { if (*p == '\0' || *p == ',') @@ -3796,7 +3856,6 @@ qemuParseCommandLineCPU(virConnectPtr conn, } } while ((p = next)); -dom-cpu = cpu; return 0;
Re: [libvirt] [PATCH 02/34] Introduce a standardized data structure for device addresses
On Fri, Jan 08, 2010 at 05:22:58PM +, Daniel P. Berrange wrote: All guest devices now use a common device address structure summarized by: enum virDomainDeviceAddressType { VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI, }; struct _virDomainDevicePCIAddress { unsigned int domain; unsigned int bus; unsigned int slot; unsigned int function; }; struct _virDomainDeviceInfo { int type; union { virDomainDevicePCIAddress pci; } addr; }; This replaces the anonymous structs in Disk/Net/Hostdev data structures. Where available, the address is *always* printed in the XML file, instead of being hidden in the internal state file. address type='pci' domain='0x' bus='0x1e' slot='0x07' function='0x0'/ The structure definition is based on Wolfgang Mauerer's disk controller patch series. * docs/schemas/domain.rng: Define the address syntax and associate it with disk/net/hostdev devices * src/conf/domain_conf.h, src/conf/domain_conf.c, src/libvirt_private.syms: APIs for parsing/formatting address information. Also remove the QEMU specific 'pci_addr' attributes * src/qemu/qemu_driver.c: Replace use of 'pci_addr' attrs with new standardized format. --- docs/schemas/domain.rng | 55 +-- src/conf/domain_conf.c | 420 +- src/conf/domain_conf.h | 84 +- src/libvirt_private.syms |6 + src/qemu/qemu_driver.c | 64 --- 5 files changed, 428 insertions(+), 201 deletions(-) [...] +int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info, + int type) +{ +if (info-type != type) +return 0; + +switch (info-type) { +case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: +return virDomainDevicePCIAddressIsValid(info-addr.pci); +} Hum, a switch without default and not handling all cases may generate a warning with some compiler options (I find this useful when extending the union) maybe we should explicitely return 0 with _NONE +static int +virDomainDevicePCIAddressParseXML(virConnectPtr conn, + xmlNodePtr node, + virDomainDevicePCIAddressPtr addr) +{ +char *domain, *slot, *bus, *function; +int ret = -1; + +memset(addr, 0, sizeof(*addr)); + +domain = virXMLPropString(node, domain); +bus = virXMLPropString(node, bus); +slot = virXMLPropString(node, slot); +function = virXMLPropString(node, function); + +if (domain +virStrToLong_ui(domain, NULL, 16, addr-domain) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, %s, + _(Cannot parse address 'domain' attribute)); +goto cleanup; +} Hum, there is a small mismatch between the parsing function and the validation, virStrToLong_ uses strtol like function decoding 0 leading numbers as octal, but we don't match octal in the Relax-NG associated functions: define name=pciDomain data type=string param name=pattern(0x)?[0-9a-fA-F]{1,4}/param /data /define Do we really intent to allow 0 started octal values ? I guess in octal we would need more than 4 digit to cover the address range. But it's a minor point, we could fix the RNG later ACK, the new routines are nice and the refactoring is a good cleanup ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 03/34] Extend the virDomainDeviceAddress struture to allow disk controller addresses
On Fri, Jan 08, 2010 at 05:22:59PM +, Daniel P. Berrange wrote: Introduce a new structure struct _virDomainDeviceDriveAddress { unsigned int controller; unsigned int bus; unsigned int unit; }; and plug that into virDomainDeviceAddress and generates XML that looks like address type='drive' controller='1' bus='0' unit='5'/ This syntax will be used by the QEMU driver to explicitly control how drives are attached to the bus * src/conf/domain_conf.h, src/conf/domain_conf.c: Parsing and formatting of drive addresses * docs/schemas/domain.rng: Define new address format for drives [...] @@ -1434,6 +1455,21 @@ param name=pattern(0x)?[0-7]/param /data /define + define name=driveController +data type=string + param name=pattern[0-9]{1,2}/param +/data + /define + define name=driveBus +data type=string + param name=pattern[0-9]{1,2}/param +/data + /define + define name=driveUnit +data type=string + param name=pattern[0-9]{1,2}/param +/data + /define define name=featureName data type=string param name='pattern'[a-zA-Z0-9\-_]+/param [...] +static int +virDomainDeviceDriveAddressParseXML(virConnectPtr conn, +xmlNodePtr node, +virDomainDeviceDriveAddressPtr addr) +{ +char *bus, *unit, *controller; +int ret = -1; + +memset(addr, 0, sizeof(*addr)); + +controller = virXMLPropString(node, controller); +bus = virXMLPropString(node, bus); +unit = virXMLPropString(node, unit); + +if (controller +virStrToLong_ui(controller, NULL, 10, addr-controller) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, %s, + _(Cannot parse address 'controller' attribute)); +goto cleanup; +} + +if (bus +virStrToLong_ui(bus, NULL, 10, addr-bus) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, %s, + _(Cannot parse address 'bus' attribute)); +goto cleanup; +} + +if (unit +virStrToLong_ui(unit, NULL, 10, addr-unit) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, %s, + _(Cannot parse address 'unit' attribute)); +goto cleanup; +} There is also a mismatch here, as the RNG will allow only values 0-99 and the parsing will allow any unsigned decimal. But again that's not a blocker, the issue could be fixed later, just keep a comment somewhere about the todo on the parser side. ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 04/34] Add address info to sound, video and watchdog devices
On Fri, Jan 08, 2010 at 05:23:00PM +, Daniel P. Berrange wrote: Add the virDomainDeviceAddress information to the sound, video and watchdog devices. This means all of them gain the new XML element address / This brings them upto par with disk/net/hostdev devices which already have address info * src/conf/domain_conf.h: Add virDomainDeviceAddress to sound, video watchdog device struts. * src/conf/domain_conf.c: Hook up parsing/formatting for virDomainDeviceAddress in sound, video watchdog devices * docs/schemas/domain.rng: Associate device address info with sound, video watchdog --- docs/schemas/domain.rng |9 +++ src/conf/domain_conf.c | 54 +++--- src/conf/domain_conf.h |3 ++ 3 files changed, 57 insertions(+), 9 deletions(-) ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 05/34] Set default disk controller/bus/unit props
On Fri, Jan 08, 2010 at 05:23:01PM +, Daniel P. Berrange wrote: When parsing the disk element specification, if no address is provided for the disk, then automatically assign one based on the target dev='sdXX'/ device name. This provides for backwards compatability with existing applications using libvirt, while also allowing new apps to have complete fine grained control. * src/conf/domain_conf.h, src/conf/domain_conf.c, src/libvirt_private.syms: Add virDomainDiskDefAssignAddress() for assigning a controller/bus/unit address based on disk target * src/qemu/qemu_conf.c: Call virDomainDiskDefAssignAddress() after generating XML from ARGV * tests/qemuxml2argvdata/*.xml: Add in drive address information to all XML files ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 06/34] Add new domain device: controller
On Fri, Jan 08, 2010 at 05:23:02PM +, Daniel P. Berrange wrote: From: Wolfgang Mauerer wolfgang.maue...@siemens.com This augments virDomainDevice with a controller element that is used to represent disk controllers (e.g., scsi controllers). The XML format is given by controller type=scsi index=num address type=pci domain=0xNUM bus=0xNUM slot=0xNUM/ /controller Actually we also allow decimal or even octal values where type denotes the disk interface (scsi, ide,...), index is an integer that identifies the controller for association with disks, and the address element specifies the controller address on the PCI bus as described in previous commits The address element can be omitted; in this case, an address will be assigned automatically. Most of the code in this patch is from Wolfgang Mauerer's previous disk controller series * docs/schemas/domain.rng: Define syntax for controller XML element * src/conf/domain_conf.c, src/conf/domain_conf.h: Define virDomainControllerDef struct, and routines for parsing and formatting XML * src/libvirt_private.syms: Add virDomainControllerInsert and virDomainControllerDefFree [...] +void virDomainControllerDefFree(virDomainControllerDefPtr def) +{ +if (!def) +return; + +virDomainDeviceInfoClear(def-info); superfluous, unless we start allocating data there. +VIR_FREE(def); +} + [...] +/* Parse the XML definition for a controller + * @param node XML nodeset to parse for controller definition + */ +static virDomainControllerDefPtr +virDomainControllerDefParseXML(virConnectPtr conn, + xmlNodePtr node, + int flags) +{ +virDomainControllerDefPtr def; +char *type = NULL; +char *idx = NULL; + +if (VIR_ALLOC(def) 0) { +virReportOOMError(conn); +return NULL; +} + +type = virXMLPropString(node, type); +if (type) { +if ((def-type = virDomainDiskBusTypeFromString(type)) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _(unknown disk controller type '%s'), type); +goto error; +} +} + +idx = virXMLPropString(node, index); I like the code style found in the previous parsing routines where all the virXMLPropString are done at the beginning and we can drop the NULL initializations, looks simpler to me, but it's really not a big deal. +void virDomainControllerInsertPreAlloced(virDomainDefPtr def, + virDomainControllerDefPtr controller) +{ +int i; +/* Tenatively plan to insert controller at the end. */ +int insertAt = -1; + +/* Then work backwards looking for controllers of + * the same type. If we find a controller with a + * index greater than the new one, insert at + * that position + */ +for (i = (def-ncontrollers - 1) ; i = 0 ; i--) { +/* If bus matches and current controller is after + * new controller, then new controller should go here */ +if ((def-controllers[i]-type == controller-type) +(def-controllers[i]-idx controller-idx)) { +insertAt = i; +} else if (def-controllers[i]-type == controller-type + insertAt == -1) { +/* Last controller with match bus is before the + * new controller, then put new controller just after + */ +insertAt = i + 1; +} +} + +/* No controllers with this bus yet, so put at end of list */ +if (insertAt == -1) +insertAt = def-ncontrollers; + +if (insertAt def-ncontrollers) +memmove(def-controllers + insertAt + 1, +def-controllers + insertAt, +(sizeof(def-controllers[0]) * (def-ncontrollers-insertAt))); + +def-controllers[insertAt] = controller; +def-ncontrollers++; +} I find that a bit complex, instead of trying to insert in an ordered fashion, what about another routine sorting the full set in one pass after the array had been fully initialized. We could use qsort and a single comparison function. I think that would be equivalent, except controllers would be ordered by type too and we would loose that order if provided by the user. Unsure if this is a significant information. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 07/34] Convert monitor over to use virDomainDeviceAddress
On Fri, Jan 08, 2010 at 05:23:03PM +, Daniel P. Berrange wrote: Convert the QEMU monitor APIs over to use virDomainDeviceAddress structs for passing addresses in/out, instead of individual bits. This makes the number of parameters smaller easier to deal with. No functional change * src/qemu/qemu_driver.c, src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Change monitor hotplug APIs to take an explicit address ptr for all host/guest addresses --- src/qemu/qemu_driver.c | 35 +--- src/qemu/qemu_monitor.c | 60 -- src/qemu/qemu_monitor.h | 21 +++--- src/qemu/qemu_monitor_json.c | 55 +- src/qemu/qemu_monitor_json.h | 22 +++ src/qemu/qemu_monitor_text.c | 56 ++- src/qemu/qemu_monitor_text.h | 22 +++ 7 files changed, 90 insertions(+), 181 deletions(-) ACK, makes the code way nicer ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 08/34] Split code for building QEMU -drive arg in separate method
On Fri, Jan 08, 2010 at 05:23:04PM +, Daniel P. Berrange wrote: To enable it to be called from multiple locations, split out the code for building the -drive arg string. This will be needed by later patches which do drive hotplug, the conversion to use -device, and the conversion to controller/bus/unit addressing * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add qemuBuildDriveStr for building -drive arg string --- src/qemu/qemu_conf.c | 191 ++--- src/qemu/qemu_conf.h |5 ++ 2 files changed, 106 insertions(+), 90 deletions(-) ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 09/34] Specify bus/unit instead of index for disks with QEMU
On Fri, Jan 08, 2010 at 05:23:05PM +, Daniel P. Berrange wrote: The current code for using -drive simply sets the -drive 'index' parameter. QEMU internally converts this to bus/unit depending on the type of drive. This does not give us precise control over the bus/unit assignment though. This change switches over to make libvirt explicitly calculate the bus/unit number. In addition bus/unit/index are actually irrelevant for VirtIO disks, since each virtio disk is a separate PCI device. No disk controller is involved. Doing the conversion to bus/unit in libvirt allows us to correctly attach SCSI controllers when required. * src/qemu/qemu_conf.c: Specify bus/unit instead of index for disks * tests/qemuxml2argvdata/qemuxml2argv-disk*.args: Switch over from using index=, to bus=NN, unit=NN for SCSI/IDE/Floppy disks Hum, that's an importabt change, but I'm a bit surprized to not see any checking from the version or help message to detect support. Was full addressing implemented so long ago that we shouldn't check for it and try to detect at startup if it's missing ? Just wondering, not a blocker ! ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 09/34] Specify bus/unit instead of index for disks with QEMU
On Fri, Jan 15, 2010 at 02:34:21PM +0100, Daniel Veillard wrote: On Fri, Jan 08, 2010 at 05:23:05PM +, Daniel P. Berrange wrote: The current code for using -drive simply sets the -drive 'index' parameter. QEMU internally converts this to bus/unit depending on the type of drive. This does not give us precise control over the bus/unit assignment though. This change switches over to make libvirt explicitly calculate the bus/unit number. In addition bus/unit/index are actually irrelevant for VirtIO disks, since each virtio disk is a separate PCI device. No disk controller is involved. Doing the conversion to bus/unit in libvirt allows us to correctly attach SCSI controllers when required. * src/qemu/qemu_conf.c: Specify bus/unit instead of index for disks * tests/qemuxml2argvdata/qemuxml2argv-disk*.args: Switch over from using index=, to bus=NN, unit=NN for SCSI/IDE/Floppy disks Hum, that's an importabt change, but I'm a bit surprized to not see any checking from the version or help message to detect support. Was full addressing implemented so long ago that we shouldn't check for it and try to detect at startup if it's missing ? Just wondering, not a blocker ! Yeah, it has supported this syntax for as long as -drive has existed so the check for '-drive' is sufficient Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Using ESX domain XML for V2V
2010/1/15 Matthew Booth mbo...@redhat.com: On 15/01/10 10:37, Matthias Bolte wrote: 2010/1/14 Matthew Booth mbo...@redhat.com: I'm trying to use the ESX driver to extract metadata from ESX in an easily digestible form for driving V2V. I've noticed the domain XML seems to be missing a few bits: features/ This is currently not implemented, but could be by parsing the CPUIDs. This is on my todo list. This would be extremely useful. graphics/ VMware seems to use a certain type of VNC for this, but they use a custom authentication mechanism. There is a Firefox plugin for that (vmware-mks.xpi), but IIRC its Windows only. I think this could be implemented but there is more research necessary what to expose as graphics element. input/ A ESX virtual machine has a PS2 mouse and keyboard by default and AFAIK that's not changeable. So the ESX driver could output input elements for them, but the user won't be able to change it when defining a new virtual machine. Currently input elements are ignored by the ESX driver. To explain my use case, I'm using the domain XML provided by the ESX driver to form the basis of domain XML for the QEMU driver. I don't need to be able to modify or even access the underlying guest, I just need to know that the devices exist and what drivers they are using. I believe there is more than 1 available graphics device in ESX, so that would be most important. I assume you mixed up video and graphics devices. The graphics device will be VNC. I just looked up If the video device type can be configured but I can't find anything about that, there is only a single type. But VRAM size can be configured and 3D acceleration support can be enabled with ESX 4.0. Matthias -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 06/34] Add new domain device: controller
On Fri, Jan 15, 2010 at 02:08:54PM +0100, Daniel Veillard wrote: On Fri, Jan 08, 2010 at 05:23:02PM +, Daniel P. Berrange wrote: From: Wolfgang Mauerer wolfgang.maue...@siemens.com This augments virDomainDevice with a controller element that is used to represent disk controllers (e.g., scsi controllers). The XML format is given by controller type=scsi index=num address type=pci domain=0xNUM bus=0xNUM slot=0xNUM/ /controller Actually we also allow decimal or even octal values where type denotes the disk interface (scsi, ide,...), index is an integer that identifies the controller for association with disks, and the address element specifies the controller address on the PCI bus as described in previous commits The address element can be omitted; in this case, an address will be assigned automatically. Most of the code in this patch is from Wolfgang Mauerer's previous disk controller series * docs/schemas/domain.rng: Define syntax for controller XML element * src/conf/domain_conf.c, src/conf/domain_conf.h: Define virDomainControllerDef struct, and routines for parsing and formatting XML * src/libvirt_private.syms: Add virDomainControllerInsert and virDomainControllerDefFree [...] +void virDomainControllerDefFree(virDomainControllerDefPtr def) +{ +if (!def) +return; + +virDomainDeviceInfoClear(def-info); superfluous, unless we start allocating data there. +VIR_FREE(def); +} + [...] +/* Parse the XML definition for a controller + * @param node XML nodeset to parse for controller definition + */ +static virDomainControllerDefPtr +virDomainControllerDefParseXML(virConnectPtr conn, + xmlNodePtr node, + int flags) +{ +virDomainControllerDefPtr def; +char *type = NULL; +char *idx = NULL; + +if (VIR_ALLOC(def) 0) { +virReportOOMError(conn); +return NULL; +} + +type = virXMLPropString(node, type); +if (type) { +if ((def-type = virDomainDiskBusTypeFromString(type)) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, + _(unknown disk controller type '%s'), type); +goto error; +} +} + +idx = virXMLPropString(node, index); I like the code style found in the previous parsing routines where all the virXMLPropString are done at the beginning and we can drop the NULL initializations, looks simpler to me, but it's really not a big deal. +void virDomainControllerInsertPreAlloced(virDomainDefPtr def, + virDomainControllerDefPtr controller) +{ +int i; +/* Tenatively plan to insert controller at the end. */ +int insertAt = -1; + +/* Then work backwards looking for controllers of + * the same type. If we find a controller with a + * index greater than the new one, insert at + * that position + */ +for (i = (def-ncontrollers - 1) ; i = 0 ; i--) { +/* If bus matches and current controller is after + * new controller, then new controller should go here */ +if ((def-controllers[i]-type == controller-type) +(def-controllers[i]-idx controller-idx)) { +insertAt = i; +} else if (def-controllers[i]-type == controller-type + insertAt == -1) { +/* Last controller with match bus is before the + * new controller, then put new controller just after + */ +insertAt = i + 1; +} +} + +/* No controllers with this bus yet, so put at end of list */ +if (insertAt == -1) +insertAt = def-ncontrollers; + +if (insertAt def-ncontrollers) +memmove(def-controllers + insertAt + 1, +def-controllers + insertAt, +(sizeof(def-controllers[0]) * (def-ncontrollers-insertAt))); + +def-controllers[insertAt] = controller; +def-ncontrollers++; +} I find that a bit complex, instead of trying to insert in an ordered fashion, what about another routine sorting the full set in one pass after the array had been fully initialized. We could use qsort and a single comparison function. I think that would be equivalent, except controllers would be ordered by type too and we would loose that order if provided by the user. Unsure if this is a significant information. Hum, I realize I forgot to ack it, that's more a question than anything else ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list
Re: [libvirt] Cannot use console with 0.7.5, error: internal error no assigned pty for device serial0
Hi, On Fri, Jan 15, 2010 at 11:43:26AM +, Matthew Booth wrote: Could you please post the full domain XML, and the QEMU command line it generated? You can get the latter from /var/log/libvirt/qemu/domain.log. Can you also post the versions of qemu and libvirt? $ cat /etc/libvirt/qemu/grml-test.xml domain type='kvm' namegrml-test/name uuidce24153b-b997-0f04-6fd1-ac06cfb780a7/uuid memory262144/memory currentMemory262144/currentMemory vcpu1/vcpu os type arch='x86_64' machine='pc'hvm/type boot dev='hd'/ /os features acpi/ /features clock offset='utc'/ on_poweroffdestroy/on_poweroff on_rebootdestroy/on_reboot on_crashdestroy/on_crash devices emulator/usr/bin/kvm/emulator disk type='file' device='disk' source file='/dev/mapper/usb160g-grml--test'/ target dev='vda' bus='virtio'/ /disk interface type='bridge' mac address='52:54:00:39:d8:4b'/ source bridge='br0'/ model type='virtio'/ /interface serial type='pty' target port='0'/ /serial console type='pty' target port='0'/ /console input type='mouse' bus='ps2'/ graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='de'/ video model type='cirrus' vram='9216' heads='1'/ /video /devices /domain $ sudo tail /var/log/libvirt/qemu/grml-test.log LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin HOME=/ QEMU_AUDIO_DRV=none /usr/bin/kvm -S -M pc -m 256 -smp 1 -name grml-test -monitor unix:/var/lib/libvirt/qemu/grml-test.monitor,server,nowait -no-reboot -boot c -drive file=/dev/mapper/usb160g-grml--test,if=virtio,index=0,boot=on -net nic,macaddr=52:54:00:39:d8:4b,vlan=0,model=virtio -net tap,fd=39,vlan=0 -serial pty -parallel none -usb -vnc 127.0.0.1:0 -k de char device redirected to /dev/pts/3 $ dpkg --list *kvm* Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name VersionDescription +++-==-==- ii kvm72+dfsg-2 Full virtualization on x86 hardware $ dpkg --list *qemu* Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name VersionDescription +++-==-==- ii qemu 0.11.1-2 fast processor emulator ii qemu-system0.11.1-2 QEMU full system emulation binaries ii qemu-user 0.11.1-2 QEMU user mode emulation binaries ii qemu-utils 0.11.1-2 QEMU utilities $ dpkg --list '*libvirt*' Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name VersionDescription +++-==-==- ii libvirt-bin0.7.5-3the programs for the libvirt library ii libvirt0 0.7.5-3library for interfacing with different virtu ii python-libvirt 0.7.5-3libvirt Python bindings $ I am not sure whether the qemu listed above is actually used by the kvm binary. If you need additional information, please ask. Greetings Marc -- - Marc Haber | I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things.Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Cannot use console with 0.7.5, error: internal error no assigned pty for device serial0
On Fri, Jan 15, 2010 at 03:13:25PM +0100, Marc Haber wrote: Hi, On Fri, Jan 15, 2010 at 11:43:26AM +, Matthew Booth wrote: Could you please post the full domain XML, and the QEMU command line it generated? You can get the latter from /var/log/libvirt/qemu/domain.log. Can you also post the versions of qemu and libvirt? $ cat /etc/libvirt/qemu/grml-test.xml domain type='kvm' namegrml-test/name uuidce24153b-b997-0f04-6fd1-ac06cfb780a7/uuid memory262144/memory currentMemory262144/currentMemory vcpu1/vcpu os type arch='x86_64' machine='pc'hvm/type boot dev='hd'/ /os features acpi/ /features clock offset='utc'/ on_poweroffdestroy/on_poweroff on_rebootdestroy/on_reboot on_crashdestroy/on_crash devices emulator/usr/bin/kvm/emulator disk type='file' device='disk' source file='/dev/mapper/usb160g-grml--test'/ target dev='vda' bus='virtio'/ /disk interface type='bridge' mac address='52:54:00:39:d8:4b'/ source bridge='br0'/ model type='virtio'/ /interface serial type='pty' target port='0'/ /serial console type='pty' target port='0'/ /console input type='mouse' bus='ps2'/ graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='de'/ video model type='cirrus' vram='9216' heads='1'/ /video /devices /domain $ sudo tail /var/log/libvirt/qemu/grml-test.log LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin HOME=/ QEMU_AUDIO_DRV=none /usr/bin/kvm -S -M pc -m 256 -smp 1 -name grml-test -monitor unix:/var/lib/libvirt/qemu/grml-test.monitor,server,nowait -no-reboot -boot c -drive file=/dev/mapper/usb160g-grml--test,if=virtio,index=0,boot=on -net nic,macaddr=52:54:00:39:d8:4b,vlan=0,model=virtio -net tap,fd=39,vlan=0 -serial pty -parallel none -usb -vnc 127.0.0.1:0 -k de If I were a betting man, I'd bet on this changeset which was missed from the 0.7.5 release http://libvirt.org/git/?p=libvirt.git;a=commit;h=c0a9b6a5338e54b64a4a28415ffbdb6bcc2b38c5 Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 10/34] Implement SCSI controller hotplug/unplug for QEMU
On Fri, Jan 08, 2010 at 05:23:06PM +, Daniel P. Berrange wrote: From: Wolfgang Mauerer wolfgang.maue...@siemens.com This patch allows for explicit hotplug/unplug of SCSI controllers. Ordinarily this is not required, since QEMU/libvirt will attach a new SCSI controller whenever one is required. Allowing explicit hotplug of controllers though, enables the caller to specify a static PCI address, instead of auto-assigning the next available PCI slot. Or it will when we have static PCI addressing. This patch is derived from Wolfgang Mauerer's disk controller patch series. * src/qemu/qemu_driver.c: Support hotplug unplug of SCSI controllers * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h, src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add new API for attaching PCI SCSI controllers --- src/libvirt_private.syms |2 + src/qemu/qemu_driver.c | 118 ++ src/qemu/qemu_monitor.c | 16 ++ src/qemu/qemu_monitor.h |4 ++ src/qemu/qemu_monitor_json.c | 40 ++ src/qemu/qemu_monitor_json.h |4 ++ src/qemu/qemu_monitor_text.c | 45 src/qemu/qemu_monitor_text.h |5 ++ 8 files changed, 234 insertions(+), 0 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a346aa5..fa8825f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -183,6 +183,8 @@ virDomainDeviceAddressIsValid; virDomainDevicePCIAddressIsValid; virDomainDeviceInfoIsSet; virDomainDeviceAddressClear; +virDomainControllerTypeToString; +virDomainControllerDefFree; # domain_event.h diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8c2e6d6..9dcbe25 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5111,6 +5111,45 @@ static int qemudDomainAttachPciDiskDevice(virConnectPtr conn, return ret; } +static int qemudDomainAttachPciControllerDevice(virConnectPtr conn, +struct qemud_driver *driver, +virDomainObjPtr vm, +virDomainControllerDefPtr def) +{ +int i, ret; +const char* type = virDomainControllerTypeToString(def-type); +qemuDomainObjPrivatePtr priv = vm-privateData; + +for (i = 0 ; i vm-def-ncontrollers ; i++) { +if ((vm-def-controllers[i]-type == def-type) +(vm-def-controllers[i]-idx == def-idx)) { +qemudReportError(conn, dom, NULL, VIR_ERR_OPERATION_FAILED, + _(target %s:%d already exists), + type, def-idx); +return -1; +} +} + +if (VIR_REALLOC_N(vm-def-controllers, vm-def-ncontrollers+1) 0) { +virReportOOMError(conn); +return -1; +} + +qemuDomainObjEnterMonitorWithDriver(driver, vm); +ret = qemuMonitorAttachPCIDiskController(priv-mon, + type, + def-info.addr.pci); +qemuDomainObjExitMonitorWithDriver(driver, vm); + +if (ret == 0) { +def-info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; +virDomainControllerInsertPreAlloced(vm-def, def); +} + +return ret; +} + + static int qemudDomainAttachUsbMassstorageDevice(virConnectPtr conn, struct qemud_driver *driver, virDomainObjPtr vm, @@ -5496,6 +5535,15 @@ static int qemudDomainAttachDevice(virDomainPtr dom, virCgroupDenyDevicePath(cgroup, dev-data.disk-src); } +} else if (dev-type == VIR_DOMAIN_DEVICE_CONTROLLER) { +if (dev-data.controller-type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { +ret = qemudDomainAttachPciControllerDevice(dom-conn, driver, vm, dev-data.controller); +} else { +qemudReportError(dom-conn, dom, NULL, VIR_ERR_NO_SUPPORT, + _(disk controller bus '%s' cannot be hotplugged.), + virDomainControllerTypeToString(dev-data.controller-type)); +/* fallthrough */ +} } else if (dev-type == VIR_DOMAIN_DEVICE_NET) { ret = qemudDomainAttachNetDevice(dom-conn, driver, vm, dev, qemuCmdFlags); } else if (dev-type == VIR_DOMAIN_DEVICE_HOSTDEV) { @@ -5587,6 +5635,67 @@ cleanup: return ret; } +static int qemudDomainDetachPciControllerDevice(virConnectPtr conn, +struct qemud_driver *driver, +virDomainObjPtr vm, +virDomainDeviceDefPtr dev) +{
Re: [libvirt] [PATCH 11/34] Properly support SCSI drive hotplug
On Fri, Jan 08, 2010 at 05:23:07PM +, Daniel P. Berrange wrote: The current SCSI hotplug support attaches a brand new SCSI controller for every disk. This is broken because the semantics differ from those used when starting the VM initially. In the latter case, each SCSI controller is filled before a new one is added. If the user specifies an high drive index (sdazz) then at initial startup, many intermediate SCSI controllers may be added with no drives. Argh, okay :-) This patch changes SCSI hotplug so that it exactly matches the behaviour of initial startup. First the SCSI controller number is determined for the drive to be hotplugged. If any controller upto and including that controller number is not yet present, it is attached. Then finally the drive is attached to the last controller. NB, this breaks SCSI hotunplug, because there is no 'drive_del' command in current QEMU. Previous SCSI hotunplug was broken in any case because it was unplugging the entire controller, not just the drive in question. A future QEMU will allow proper SCSI hotunplug of a drive. This patch is derived from work done by Wolfgang Mauerer on disk controllers. * src/qemu/qemu_driver.c: Fix SCSI hotplug to add a drive to the correct controller, instead of just attaching a new controller. * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h, src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h: Add support for 'drive_add' command --- src/libvirt_private.syms |1 + src/qemu/qemu_driver.c | 123 +++-- src/qemu/qemu_monitor.c | 20 +++ src/qemu/qemu_monitor.h |5 ++ src/qemu/qemu_monitor_json.c | 81 +--- src/qemu/qemu_monitor_json.h |5 ++ src/qemu/qemu_monitor_text.c | 102 ++ src/qemu/qemu_monitor_text.h |5 ++ 8 files changed, 329 insertions(+), 13 deletions(-) [...] +static virDomainControllerDefPtr +qemuDomainFindOrCreateSCSIDiskController(virConnectPtr conn, + struct qemud_driver *driver, + virDomainObjPtr vm, + int controller) +{ +int i; +virDomainControllerDefPtr cont; +for (i = 0 ; i vm-def-ncontrollers ; i++) { +cont = vm-def-controllers[i]; + +if (cont-type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI) +continue; + +if (cont-idx == controller) +return cont; +} + +/* No SCSI controller present, for back compatability we + * now hotplug a controller */ +if (VIR_ALLOC(cont) 0) { +virReportOOMError(conn); +return NULL; +} +cont-type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI; +cont-idx = 0; + +VIR_INFO0(No SCSI controller present, hotplugging one); +if (qemudDomainAttachPciControllerDevice(conn, driver, + vm, cont) 0) { +VIR_FREE(cont); +return NULL; +} +return cont; +} cosmetic change, formatting the comment and blank line after argument declaration, if you can sneak it in @@ -1515,7 +1514,75 @@ int qemuMonitorJSONAttachPCIDiskController(qemuMonitorPtr mon, ret = qemuMonitorJSONCheckError(cmd, reply); if (ret == 0 -qemuMonitorJSONGetGuestAddress(reply, guestAddr) 0) +qemuMonitorJSONGetGuestPCIAddress(reply, guestAddr) 0) +ret = -1; + +virJSONValueFree(cmd); +virJSONValueFree(reply); +return ret; +} Hum, looks like a leak plug too here, or I got confused by the patch +if (ret == 0 +qemuMonitorJSONGetGuestDriveAddress(reply, driveAddr) 0) ret = -1; virJSONValueFree(cmd); okay probably a patch side effect +static int +qemudParseDriveAddReply(const char *reply, +virDomainDeviceDriveAddressPtr addr) +{ +char *s, *e; + +/* If the command succeeds qemu prints: + * OK bus X, unit Y + */ + +if (!(s = strstr(reply, OK ))) +return -1; + +s += 3; I would rather search for bus in the string here +if (STRPREFIX(s, bus )) { +s += strlen(bus ); + +if (virStrToLong_ui(s, e, 10, addr-bus) == -1) { +VIR_WARN(_(Unable to parse bus '%s'\n), s); +return -1; +} + +if (!STRPREFIX(e, , )) { +VIR_WARN(_(Expected ', ' parsing drive_add reply '%s'\n), s); +return -1; +} +s = e + 2; +} and then search for unit for inceased flexibility +if (!STRPREFIX(s, unit )) { +VIR_WARN(_(Expected 'unit ' parsing drive_add reply '%s'\n), s); +return -1; +} +s += strlen(bus ); + +if (virStrToLong_ui(s, e, 10, addr-unit) == -1) { +
Re: [libvirt] [PATCH 14/34] Fixed char device stuff
On Fri, Jan 08, 2010 at 05:23:10PM +, Daniel P. Berrange wrote: Temp hack --- src/qemu/qemu_monitor_text.c |9 +++-- 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 52cd97c..2b8c1e8 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -1678,14 +1678,12 @@ cleanup: int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon, virHashTablePtr paths) { -const char *cmd = info chardev; char *reply = NULL; int ret = -1; -if (qemuMonitorCommand(mon, cmd, reply) 0) { -qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _(failed to retrieve chardev info in qemu with '%s'), - cmd); +if (qemuMonitorCommand(mon, info chardev, reply) 0) { +qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, %s, + _(failed to retrieve chardev info in qemu with 'info chardev')); goto cleanup; } @@ -1747,7 +1745,6 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon, ret = 0; cleanup: -VIR_FREE(cmd); VIR_FREE(reply); return ret; } Looks strictly equivalent, ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 12/34] Detect PCI addresses at QEMU startup
On Fri, Jan 08, 2010 at 05:23:08PM +, Daniel P. Berrange wrote: Hotunplug of devices requires that we know their PCI address. Even hotplug of SCSI drives, required that we know the PCI address of the SCSI controller to attach the drive to. We can find this out by running 'info pci' and then correlating the vendor/product IDs with the devices we booted with. Although this approach is somewhat fragile, it is the only viable option with QEMU 0.12, since there is no way for libvirto set explicit PCI addresses when creating devices in the first place. For QEMU 0.12, this code will not be used. Okay, this looks a bit fragile, but a temporary measure, parsing code looked fine, ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 13/34] Remove restriction on duplicated sound devices in parser
On Fri, Jan 08, 2010 at 05:23:09PM +, Daniel P. Berrange wrote: It is perfectly acceptable to have multiple sound devices of same type in guest configuration. If the underlying hypervisor does not like this, it is its job to complain, not the XML parser's * src/conf/domain_conf.c: Remove hack which deleted duplicated sound device models. * tests/xml2sexprdata/xml2sexpr-fv-sound.xml: Remove duplicate models --- src/conf/domain_conf.c | 11 --- tests/xml2sexprdata/xml2sexpr-fv-sound.xml |3 --- 2 files changed, 0 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index dd10f36..5caf2ca 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3756,23 +3756,12 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn, if (n VIR_ALLOC_N(def-sounds, n) 0) goto no_memory; for (i = 0 ; i n ; i++) { -int collision = 0, j; virDomainSoundDefPtr sound = virDomainSoundDefParseXML(conn, nodes[i], flags); if (!sound) goto error; -/* Verify there's no duplicated sound card */ -for (j = 0 ; j def-nsounds ; j++) { -if (def-sounds[j]-model == sound-model) -collision = 1; -} -if (collision) { -virDomainSoundDefFree(sound); -continue; -} - def-sounds[def-nsounds++] = sound; } VIR_FREE(nodes); diff --git a/tests/xml2sexprdata/xml2sexpr-fv-sound.xml b/tests/xml2sexprdata/xml2sexpr-fv-sound.xml index 0fe92fe..75c295c 100644 --- a/tests/xml2sexprdata/xml2sexpr-fv-sound.xml +++ b/tests/xml2sexprdata/xml2sexpr-fv-sound.xml @@ -32,9 +32,6 @@ /disk graphics type='vnc' port='5917' keymap='ja'/ sound model='sb16'/ -sound model='sb16'/ -sound model='es1370'/ -sound model='sb16'/ sound model='es1370'/ /devices /domain makes sense, ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 15/34] Auto-add disk controllers based on defined disks
On Fri, Jan 08, 2010 at 05:23:11PM +, Daniel P. Berrange wrote: Existing applications using libvirt are not aware of the disk controller concept. Thus, after parsing the disk definitions in the XML, it is neccessary to create controller elements to satisfy all requested disks, as per their defined drive addresses * src/conf/domain_conf.c, src/conf/domain_conf.h, src/libvirt_private.syms: Add virDomainDefAddDiskControllers() method for populating disk controllers, and call it after parsing disk definitions. * src/qemu/qemu_conf.c: Call virDomainDefAddDiskControllers() when doing ARGV - XML conversion * tests/qemuxml2argvdata/qemuxml2argv*.xml: Add disk controller data to all data files which don't have it already +/* + * Based on the declared address type=drive info for any disks, + * add neccessary drive controllers which are not already present + * in the XML. This is for compat with existing apps which will + * not know/care about controller info in the XML + */ +int virDomainDefAddDiskControllers(virDomainDefPtr def) +{ +if (virDomainDefAddDiskControllersForType(def, + VIR_DOMAIN_CONTROLLER_TYPE_SCSI, + VIR_DOMAIN_DISK_BUS_SCSI) 0) +return -1; + +if (virDomainDefAddDiskControllersForType(def, + VIR_DOMAIN_CONTROLLER_TYPE_FDC, + VIR_DOMAIN_DISK_BUS_FDC) 0) +return -1; + +if (virDomainDefAddDiskControllersForType(def, + VIR_DOMAIN_CONTROLLER_TYPE_IDE, + VIR_DOMAIN_DISK_BUS_IDE) 0) +return -1; + +return 0; +} IIRC a previous patch in the serie disk controler are not sorted, so the order here is just arbitrary, right ? --- a/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-floppy-drive-fat.xml @@ -21,5 +21,7 @@ readonly/ address type='drive' controller='0' bus='0' unit='0'/ /disk +controller type='ide' index='0'/ +controller type='fdc' index='0'/ /devices /domain strange here in the output we get ide before fdc, I would have assume the reverse based on the new function. I hope the order in generated output won't change randomly. Except that remark looks fine, ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] esx: Add stubs for secondary driver types
This stops libvirt from probing for a libvirtd on the ESX server and sets the base for the implementation of the secondary drivers. --- src/Makefile.am|5 ++ src/esx/esx_device_monitor.c | 93 +++ src/esx/esx_device_monitor.h | 29 ++ src/esx/esx_driver.c | 28 +- src/esx/esx_driver.h | 20 +++- src/esx/esx_interface_driver.c | 96 src/esx/esx_interface_driver.h | 29 ++ src/esx/esx_network_driver.c | 101 ++ src/esx/esx_network_driver.h | 29 ++ src/esx/esx_secret_driver.c| 91 +++ src/esx/esx_secret_driver.h| 28 ++ src/esx/esx_storage_driver.c | 117 src/esx/esx_storage_driver.h | 29 ++ 13 files changed, 680 insertions(+), 15 deletions(-) create mode 100644 src/esx/esx_device_monitor.c create mode 100644 src/esx/esx_device_monitor.h create mode 100644 src/esx/esx_interface_driver.c create mode 100644 src/esx/esx_interface_driver.h create mode 100644 src/esx/esx_network_driver.c create mode 100644 src/esx/esx_network_driver.h create mode 100644 src/esx/esx_secret_driver.c create mode 100644 src/esx/esx_secret_driver.h create mode 100644 src/esx/esx_storage_driver.c create mode 100644 src/esx/esx_storage_driver.h diff --git a/src/Makefile.am b/src/Makefile.am index 324030b..7d426ae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -214,6 +214,11 @@ ONE_DRIVER_SOURCES = \ ESX_DRIVER_SOURCES = \ esx/esx_driver.c esx/esx_driver.h \ + esx/esx_interface_driver.c esx/esx_interface_driver.h \ + esx/esx_network_driver.c esx/esx_network_driver.h \ + esx/esx_storage_driver.c esx/esx_storage_driver.h \ + esx/esx_device_monitor.c esx/esx_device_monitor.h \ + esx/esx_secret_driver.c esx/esx_secret_driver.h \ esx/esx_util.c esx/esx_util.h \ esx/esx_vi.c esx/esx_vi.h \ esx/esx_vi_methods.c esx/esx_vi_methods.h \ diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c new file mode 100644 index 000..c813adf --- /dev/null +++ b/src/esx/esx_device_monitor.c @@ -0,0 +1,93 @@ + +/* + * esx_device_monitor.c: device monitor methods for managing VMware ESX + * host devices + * + * Copyright (C) 2010 Matthias Bolte matthias.bo...@googlemail.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * 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 internal.h +#include virterror_internal.h +#include util.h +#include memory.h +#include logging.h +#include uuid.h +#include esx_driver.h +#include esx_device_monitor.h +#include esx_vi.h +#include esx_vi_methods.h +#include esx_util.h + +#define VIR_FROM_THIS VIR_FROM_ESX + +#define ESX_ERROR(conn, code, fmt...) \ +virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,\ + __LINE__, fmt) + + + +static virDrvOpenStatus +esxDeviceOpen(virConnectPtr conn, + virConnectAuthPtr auth ATTRIBUTE_UNUSED, + int flags ATTRIBUTE_UNUSED) +{ +if (STRNEQ(conn-driver-name, ESX)) { +return VIR_DRV_OPEN_DECLINED; +} + +conn-devMonPrivateData = conn-privateData; + +return VIR_DRV_OPEN_SUCCESS; +} + + + +static int +esxDeviceClose(virConnectPtr conn) +{ +conn-devMonPrivateData = NULL; + +return 0; +} + + + +static virDeviceMonitor esxDeviceMonitor = { +ESX, /* name */ +esxDeviceOpen, /* open */ +esxDeviceClose,/* close */ +NULL, /* numOfDevices */ +NULL, /* listDevices */ +NULL, /* deviceLookupByName */ +NULL, /* deviceDumpXML */ +NULL,
[libvirt] [PATCH] Use closest CPU model when decoding from CPUID
Current implementation of x86Decode() used for CPUID - model+features translation does not always select the closest CPU model. When walking through all models from cpu_map.xml the function considers a new candidate as a better choice than a previously selected candidate only if the new one is a superset of the old one. In case the new candidate is closer to host CPU but lacks some feature comparing to the old candidate, the function does not choose well. This patch changes the algorithm so that the closest model is always selected. That is, the model which requires the lowest number of additional features to describe host CPU. Signed-off-by: Jiri Denemark jdene...@redhat.com --- src/cpu/cpu_x86.c | 122 ++--- 1 files changed, 78 insertions(+), 44 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 298b632..dae7c90 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -238,6 +238,55 @@ x86DataFromModel(const struct x86_model *model) } +static virCPUDefPtr +x86DataToCPU(const union cpuData *data, + const struct x86_model *model, + const struct x86_map *map) +{ +virCPUDefPtr cpu; +union cpuData *tmp = NULL; +struct cpuX86cpuid *cpuid; +const struct x86_feature *feature; +int i; + +if (VIR_ALLOC(cpu) 0 || +(cpu-model = strdup(model-name)) == NULL || +(tmp = x86DataCopy(data)) == NULL) +goto no_memory; + +for (i = 0; i model-ncpuid; i++) { +x86cpuidClearBits(x86DataCpuid(tmp, model-cpuid[i].function), + model-cpuid + i); +} + +feature = map-features; +while (feature != NULL) { +for (i = 0; i feature-ncpuid; i++) { +if ((cpuid = x86DataCpuid(tmp, feature-cpuid[i].function)) + x86cpuidMatchMasked(cpuid, feature-cpuid + i)) { +x86cpuidClearBits(cpuid, feature-cpuid + i); +if (virCPUDefAddFeature(NULL, cpu, feature-name, +VIR_CPU_FEATURE_REQUIRE) 0) +goto error; +} +} + +feature = feature-next; +} + +cleanup: +x86DataFree(tmp); +return cpu; + +no_memory: +virReportOOMError(NULL); +error: +virCPUDefFree(cpu); +cpu = NULL; +goto cleanup; +} + + static void x86FeatureFree(struct x86_feature *feature) { @@ -896,10 +945,9 @@ x86Decode(virCPUDefPtr cpu, { int ret = -1; struct x86_map *map; -const struct x86_feature *feature; -const struct x86_model *model = NULL; const struct x86_model *candidate; -union cpuData *tmp = NULL; +virCPUDefPtr cpuCandidate; +virCPUDefPtr cpuModel = NULL; struct cpuX86cpuid *cpuid; int i; @@ -908,6 +956,8 @@ x86Decode(virCPUDefPtr cpu, candidate = map-models; while (candidate != NULL) { +bool allowed = (models == NULL); + for (i = 0; i candidate-ncpuid; i++) { cpuid = x86DataCpuid(data, candidate-cpuid[i].function); if (cpuid == NULL @@ -915,65 +965,49 @@ x86Decode(virCPUDefPtr cpu, goto next; } -if (model == NULL -|| x86ModelCompare(model, candidate) == SUBSET) { -bool found = false; -for (i = 0; i nmodels; i++) { -if (STREQ(models[i], candidate-name)) { -found = true; -break; -} +for (i = 0; i nmodels; i++) { +if (STREQ(models[i], candidate-name)) { +allowed = true; +break; } +} -if (nmodels 0 !found) { -VIR_DEBUG(CPU model %s not allowed by hypervisor; ignoring, - candidate-name); -} -else -model = candidate; +if (!allowed) { +VIR_DEBUG(CPU model %s not allowed by hypervisor; ignoring, + candidate-name); +goto next; } +if (!(cpuCandidate = x86DataToCPU(data, candidate, map))) +goto out; + +if (cpuModel == NULL +|| cpuModel-nfeatures cpuCandidate-nfeatures) { +virCPUDefFree(cpuModel); +cpuModel = cpuCandidate; +} else +virCPUDefFree(cpuCandidate); + next: candidate = candidate-next; } -if (model == NULL) { +if (cpuModel == NULL) { virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, %s, _(Cannot find suitable CPU model for given data)); goto out; } -if ((cpu-model = strdup(model-name)) == NULL -|| (tmp = x86DataCopy(data)) == NULL) { -virReportOOMError(NULL); -goto out; -} - -for (i = 0; i model-ncpuid; i++) { -x86cpuidClearBits(x86DataCpuid(tmp, model-cpuid[i].function), - model-cpuid + i); -} - -feature
[libvirt] [PATCH] Minor fixes for API extension doc
Update the API Extensions doc to reflect new source directory layout. --- docs/api_extension.html.in |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/api_extension.html.in b/docs/api_extension.html.in index 59d3414..de6eedc 100644 --- a/docs/api_extension.html.in +++ b/docs/api_extension.html.in @@ -178,7 +178,7 @@ involves making two additions to: /p -pcodeqemud/remote_protocol.x/code/p +pcodesrc/remote/remote_protocol.x/code/p p First, create two new structs for each new function that you're adding @@ -198,7 +198,7 @@ p Once these changes are in place, it's necessary to run 'make rpcgen' - in the qemud directory to create the .c and .h files required by the + in the src directory to create the .c and .h files required by the remote protocol code. This must be done on a Linux host using the GLibC rpcgen program. Other rpcgen versions may generate code which results in bogus compile time warnings @@ -213,7 +213,7 @@ the rpcgen generated .h files. The remote method calls go in: /p -pcodesrc/remote_internal.c/code/p +pcodesrc/remote/remote_internal.c/code/p pEach remote method invocation does the following:/p @@ -243,7 +243,7 @@ The server side dispatchers are implemented in: /p -pcodeqemud/remote.c/code/p +pcodedaemon/remote.c/code/p pAgain, this step uses the .h files generated by make rpcgen./p -- 1.6.0.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 16/34] Clear assigned PCI devices at shutdown
On Fri, Jan 15, 2010 at 05:12:52PM +0100, Daniel Veillard wrote: On Fri, Jan 08, 2010 at 05:23:12PM +, Daniel P. Berrange wrote: The PCI device addresses are only valid while the VM is running, since they are auto-assigned by QEMU. After shutdown they must all be cleared. Future QEMU driver enhancement will allow for persistent PCI address assignment * src/conf/domain_conf.h, src/conf/domain_conf.c, src/libvirt_private.syms Add virDomainDefClearPCIAddresses() method for wiping out auto assigned PCI addresses * src/qemu/qemu_driver.c: Clear PCI addresses at VM shutdown --- src/conf/domain_conf.c | 36 src/conf/domain_conf.h |2 ++ src/libvirt_private.syms |1 + src/qemu/qemu_driver.c |2 ++ 4 files changed, 41 insertions(+), 0 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5edd060..ef5dbe9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -816,6 +816,42 @@ void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info) } +static void virDomainDeviceInfoClearField(virDomainDeviceInfoPtr info) +{ +if (info-type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { +memset(info-addr, 0, sizeof(info-addr)); +info-type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE; +} +} + + +static void virDomainDefClearDeviceInfo(virDomainDefPtr def) +{ +int i; + +for (i = 0; i def-ndisks ; i++) +virDomainDeviceInfoClearField(def-disks[i]-info); +for (i = 0; i def-nnets ; i++) +virDomainDeviceInfoClearField(def-nets[i]-info); +for (i = 0; i def-nsounds ; i++) +virDomainDeviceInfoClearField(def-sounds[i]-info); +for (i = 0; i def-nhostdevs ; i++) +virDomainDeviceInfoClearField(def-hostdevs[i]-info); +for (i = 0; i def-nvideos ; i++) +virDomainDeviceInfoClearField(def-videos[i]-info); +for (i = 0; i def-ncontrollers ; i++) +virDomainDeviceInfoClearField(def-controllers[i]-info); +if (def-watchdog) +virDomainDeviceInfoClearField(def-watchdog-info); +} + + +void virDomainDefClearPCIAddresses(virDomainDefPtr def) +{ +virDomainDefClearDeviceInfo(def); +} + + /* Generate a string representation of a device address * @param address Device address to stringify */ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 1831d17..a6f7ab2 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -736,6 +736,8 @@ int virDomainDevicePCIAddressIsValid(virDomainDevicePCIAddressPtr addr); int virDomainDeviceDriveAddressIsValid(virDomainDeviceDriveAddressPtr addr); int virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info); void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info); +void virDomainDefClearPCIAddresses(virDomainDefPtr def); + void virDomainDefFree(virDomainDefPtr vm); void virDomainObjRef(virDomainObjPtr vm); /* Returns 1 if the object was freed, 0 if more refs exist */ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a4a02e7..678d610 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -187,6 +187,7 @@ virDomainControllerTypeToString; virDomainControllerDefFree; virDomainDeviceAddressTypeToString; virDomainDefAddDiskControllers; +virDomainDefClearPCIAddresses; # domain_event.h diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cd406ec..6a3af61 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3032,6 +3032,8 @@ static void qemudShutdownVMDaemon(virConnectPtr conn, VIR_FREE(vm-def-seclabel.imagelabel); } +virDomainDefClearPCIAddresses(vm-def); + if (qemuDomainSetAllDeviceOwnership(conn, driver, vm-def, 1) 0) VIR_WARN(Failed to restore all device ownership for %s, vm-def-name); -- 1.6.5.2 Hum, I don't see in the patch what's makes the difference between an auto-assigned PCI address and one which might be set by the user. Since it shows up in the XML construct it has to be setable by the user so I'm a bit confused here, This patch series is currently not supporting persistent addresses, so all addresses will be cleared. A later patch will allow persistence when using QEMU = 0.12 (it isn't possible for older QEMU at all) Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 16/34] Clear assigned PCI devices at shutdown
On Fri, Jan 08, 2010 at 05:23:12PM +, Daniel P. Berrange wrote: The PCI device addresses are only valid while the VM is running, since they are auto-assigned by QEMU. After shutdown they must all be cleared. Future QEMU driver enhancement will allow for persistent PCI address assignment * src/conf/domain_conf.h, src/conf/domain_conf.c, src/libvirt_private.syms Add virDomainDefClearPCIAddresses() method for wiping out auto assigned PCI addresses * src/qemu/qemu_driver.c: Clear PCI addresses at VM shutdown --- src/conf/domain_conf.c | 36 src/conf/domain_conf.h |2 ++ src/libvirt_private.syms |1 + src/qemu/qemu_driver.c |2 ++ 4 files changed, 41 insertions(+), 0 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5edd060..ef5dbe9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -816,6 +816,42 @@ void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info) } +static void virDomainDeviceInfoClearField(virDomainDeviceInfoPtr info) +{ +if (info-type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { +memset(info-addr, 0, sizeof(info-addr)); +info-type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE; +} +} + + +static void virDomainDefClearDeviceInfo(virDomainDefPtr def) +{ +int i; + +for (i = 0; i def-ndisks ; i++) +virDomainDeviceInfoClearField(def-disks[i]-info); +for (i = 0; i def-nnets ; i++) +virDomainDeviceInfoClearField(def-nets[i]-info); +for (i = 0; i def-nsounds ; i++) +virDomainDeviceInfoClearField(def-sounds[i]-info); +for (i = 0; i def-nhostdevs ; i++) +virDomainDeviceInfoClearField(def-hostdevs[i]-info); +for (i = 0; i def-nvideos ; i++) +virDomainDeviceInfoClearField(def-videos[i]-info); +for (i = 0; i def-ncontrollers ; i++) +virDomainDeviceInfoClearField(def-controllers[i]-info); +if (def-watchdog) +virDomainDeviceInfoClearField(def-watchdog-info); +} + + +void virDomainDefClearPCIAddresses(virDomainDefPtr def) +{ +virDomainDefClearDeviceInfo(def); +} + + /* Generate a string representation of a device address * @param address Device address to stringify */ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 1831d17..a6f7ab2 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -736,6 +736,8 @@ int virDomainDevicePCIAddressIsValid(virDomainDevicePCIAddressPtr addr); int virDomainDeviceDriveAddressIsValid(virDomainDeviceDriveAddressPtr addr); int virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info); void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info); +void virDomainDefClearPCIAddresses(virDomainDefPtr def); + void virDomainDefFree(virDomainDefPtr vm); void virDomainObjRef(virDomainObjPtr vm); /* Returns 1 if the object was freed, 0 if more refs exist */ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a4a02e7..678d610 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -187,6 +187,7 @@ virDomainControllerTypeToString; virDomainControllerDefFree; virDomainDeviceAddressTypeToString; virDomainDefAddDiskControllers; +virDomainDefClearPCIAddresses; # domain_event.h diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cd406ec..6a3af61 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3032,6 +3032,8 @@ static void qemudShutdownVMDaemon(virConnectPtr conn, VIR_FREE(vm-def-seclabel.imagelabel); } +virDomainDefClearPCIAddresses(vm-def); + if (qemuDomainSetAllDeviceOwnership(conn, driver, vm-def, 1) 0) VIR_WARN(Failed to restore all device ownership for %s, vm-def-name); -- 1.6.5.2 Hum, I don't see in the patch what's makes the difference between an auto-assigned PCI address and one which might be set by the user. Since it shows up in the XML construct it has to be setable by the user so I'm a bit confused here, ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 17/34] Introduce device aliases
On Fri, Jan 08, 2010 at 05:23:13PM +, Daniel P. Berrange wrote: This patch introduces the support for giving all devices a short, unique name, henceforth known as a 'device alias'. These aliases are not set by the end user, instead being assigned by the hypervisor if it decides it want to support this concept. The QEMU driver sets them whenever using the -device arg syntax and uses them for improved hotplug/hotunplug. it is the intent that other APIs (block / interface stats device hotplug) be able to accept device alias names in the future. The XML syntax is alias name=video0/ This may appear in any type of device that supports device info. [...] -static void virDomainDeviceInfoClearField(virDomainDeviceInfoPtr info) +static void virDomainDeviceInfoClearField(virDomainDeviceInfoPtr info, int alias, int pciaddr) { -if (info-type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { +if (alias) +VIR_FREE(info-alias); +if (pciaddr +info-type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { memset(info-addr, 0, sizeof(info-addr)); info-type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE; } } okay, now this routine really makes sense :-) [...] diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a6f7ab2..87fbba7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -92,6 +92,7 @@ struct _virDomainDeviceDriveAddress { typedef struct _virDomainDeviceInfo virDomainDeviceInfo; typedef virDomainDeviceInfo *virDomainDeviceInfoPtr; struct _virDomainDeviceInfo { +char *alias; int type; union { virDomainDevicePCIAddress pci; @@ -246,8 +247,6 @@ struct _virDomainNetDef { char *ifname; virDomainDeviceInfo info; /* XXX figure out how to remove this */ -char *nic_name; -/* XXX figure out how to remove this */ char *hostnet_name; /* XXX figure out how to remove this */ int vlan; and that gives a clear example of use, okay ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 18/34] Add device info to serial, parallel, channel, input fs devices
On Fri, Jan 08, 2010 at 05:23:14PM +, Daniel P. Berrange wrote: Although the serial, parallel, chanel, input fs devices do not have PCI address info, they can all have device aliases. Thus it neccessary to associate the virDomainDeviceInfo data with them all. * src/conf/domain_conf.c, src/conf/domain_conf.h: Add hooks for parsing / formatting device info for serial, parallel, channel input and fs devices. * docs/schemas/domain.rng: Associate device info with character devices, input fs device --- docs/schemas/domain.rng | 12 src/conf/domain_conf.c | 67 ++ src/conf/domain_conf.h |4 +++ 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index a32ce45..f4bef7b 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -600,6 +600,9 @@ /interleave /group /choice + optional + ref name=address/ + /optional /element /define define name=filesystemtgt @@ -990,6 +993,9 @@ /optional /element /optional + optional + ref name=address/ + /optional /interleave /define define name=qemucdevSrcType @@ -1119,6 +1125,9 @@ interleave ref name=qemucdevSrcDef/ ref name=guestfwdTarget/ + optional + ref name=address/ + /optional /interleave /element /define @@ -1139,6 +1148,9 @@ /choice /attribute /optional + optional + ref name=address/ + /optional /element /define define name=hostdev Hum, unless I'm mistaken this also allow to add a PCI like address on input even if it would be ignored, maybe this should be tightened to just allow the info otherwise looks fine ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Minor fixes for API extension doc
On 01/15/2010 10:30 AM, Jim Fehlig wrote: Update the API Extensions doc to reflect new source directory layout. --- docs/api_extension.html.in |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/api_extension.html.in b/docs/api_extension.html.in index 59d3414..de6eedc 100644 --- a/docs/api_extension.html.in +++ b/docs/api_extension.html.in @@ -178,7 +178,7 @@ involves making two additions to: /p -pcodeqemud/remote_protocol.x/code/p +pcodesrc/remote/remote_protocol.x/code/p p First, create two new structs for each new function that you're adding @@ -198,7 +198,7 @@ p Once these changes are in place, it's necessary to run 'make rpcgen' - in the qemud directory to create the .c and .h files required by the + in the src directory to create the .c and .h files required by the remote protocol code. This must be done on a Linux host using the GLibC rpcgen program. Other rpcgen versions may generate code which results in bogus compile time warnings @@ -213,7 +213,7 @@ the rpcgen generated .h files. The remote method calls go in: /p -pcodesrc/remote_internal.c/code/p +pcodesrc/remote/remote_internal.c/code/p pEach remote method invocation does the following:/p @@ -243,7 +243,7 @@ The server side dispatchers are implemented in: /p -pcodeqemud/remote.c/code/p +pcodedaemon/remote.c/code/p pAgain, this step uses the .h files generated by make rpcgen./p ACK, thanks for taking the time to do that. Dave -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 19/34] Probe for -device and use -nodefaults
On Fri, Jan 08, 2010 at 05:23:15PM +, Daniel P. Berrange wrote: Probe for the new -device flag and if available set the -nodefaults flag, instead of using -net none, -serial none or -parallel none. Other device types will be converted to use -device in later patches. The -nodefaults flag will help avoid unwelcome surprises from future QEMU releases * src/qemu/qemu_conf.c: Probe for -device. Add -nodefaults flag. Remove -net none, -serial none or -parallel none * src/qemu/qemu_conf.h: Define QEMU_CMD_FLAG_DEVICE * tests/qemuhelpdata/qemu-0.12.1: New data file for 0.12.1 QEMU * tests/qemuhelptest.c: Test feature extraction from 0.12.1 QEMU [...] @@ -1115,6 +1115,8 @@ static unsigned int qemudComputeCmdFlags(const char *help, flags |= QEMUD_CMD_FLAG_CHARDEV; if (strstr(help, -balloon)) flags |= QEMUD_CMD_FLAG_BALLOON; +if (strstr(help, -device)) +flags |= QEMUD_CMD_FLAG_DEVICE; [...] --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -78,6 +78,7 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_ENABLE_KVM= (1 23), /* Is the -enable-kvm flag available to enable KVM full virtualization support */ QEMUD_CMD_FLAG_MONITOR_JSON = (1 24), /* JSON mode for monitor */ QEMUD_CMD_FLAG_BALLOON = (1 25), /* -balloon available */ +QEMUD_CMD_FLAG_DEVICE= (1 26), /* Is the new -chardev arg available */ }; comment error, it's -device arg, not -chardev which is tested there --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -21,6 +21,20 @@ struct testInfo { static char *progname; static char *abs_srcdir; +static void printMismatchedFlags(int got, int expect) +{ +int i; + +for (i = 0 ; i (sizeof(got)*8) ; i++) { +int gotFlag = (got (1 i)); +int expectFlag = (expect (1 i)); +if (gotFlag !expectFlag) +fprintf(stderr, Extra flag %i\n, i); +if (!gotFlag expectFlag) +fprintf(stderr, Missing flag %i\n, i); +} +} + static int testHelpStrParsing(const void *data) { const struct testInfo *info = data; @@ -40,6 +54,10 @@ static int testHelpStrParsing(const void *data) if (flags != info-flags) { fprintf(stderr, Computed flags do not match: got 0x%x, expected 0x%x\n, flags, info-flags); + +if (getenv(VIR_TEST_DEBUG)) +printMismatchedFlags(flags, info-flags); + return -1; } Ah, nice improvement ! ACK, but comment need fix Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 02/34] Introduce a standardized data structure for device addresses
On Fri, Jan 15, 2010 at 01:39:18PM +0100, Daniel Veillard wrote: On Fri, Jan 08, 2010 at 05:22:58PM +, Daniel P. Berrange wrote: All guest devices now use a common device address structure summarized by: enum virDomainDeviceAddressType { VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI, }; struct _virDomainDevicePCIAddress { unsigned int domain; unsigned int bus; unsigned int slot; unsigned int function; }; struct _virDomainDeviceInfo { int type; union { virDomainDevicePCIAddress pci; } addr; }; This replaces the anonymous structs in Disk/Net/Hostdev data structures. Where available, the address is *always* printed in the XML file, instead of being hidden in the internal state file. address type='pci' domain='0x' bus='0x1e' slot='0x07' function='0x0'/ The structure definition is based on Wolfgang Mauerer's disk controller patch series. * docs/schemas/domain.rng: Define the address syntax and associate it with disk/net/hostdev devices * src/conf/domain_conf.h, src/conf/domain_conf.c, src/libvirt_private.syms: APIs for parsing/formatting address information. Also remove the QEMU specific 'pci_addr' attributes * src/qemu/qemu_driver.c: Replace use of 'pci_addr' attrs with new standardized format. --- docs/schemas/domain.rng | 55 +-- src/conf/domain_conf.c | 420 +- src/conf/domain_conf.h | 84 +- src/libvirt_private.syms |6 + src/qemu/qemu_driver.c | 64 --- 5 files changed, 428 insertions(+), 201 deletions(-) [...] +int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info, + int type) +{ +if (info-type != type) +return 0; + +switch (info-type) { +case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: +return virDomainDevicePCIAddressIsValid(info-addr.pci); +} Hum, a switch without default and not handling all cases may generate a warning with some compiler options (I find this useful when extending the union) maybe we should explicitely return 0 with _NONE +static int +virDomainDevicePCIAddressParseXML(virConnectPtr conn, + xmlNodePtr node, + virDomainDevicePCIAddressPtr addr) +{ +char *domain, *slot, *bus, *function; +int ret = -1; + +memset(addr, 0, sizeof(*addr)); + +domain = virXMLPropString(node, domain); +bus = virXMLPropString(node, bus); +slot = virXMLPropString(node, slot); +function = virXMLPropString(node, function); + +if (domain +virStrToLong_ui(domain, NULL, 16, addr-domain) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, %s, + _(Cannot parse address 'domain' attribute)); +goto cleanup; +} Hum, there is a small mismatch between the parsing function and the validation, virStrToLong_ uses strtol like function decoding 0 leading numbers as octal, but we don't match octal in the Relax-NG associated functions: We pass an explicit '16' to the virStrToLong_ui() so that should prevent it doing octal IIUC define name=pciDomain data type=string param name=pattern(0x)?[0-9a-fA-F]{1,4}/param /data /define Do we really intent to allow 0 started octal values ? I guess in octal we would need more than 4 digit to cover the address range. But it's a minor point, we could fix the RNG later My intent was for these attributes to always be interpreted as hex, no matter what, even if 0x is left off. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 20/34] Assign device aliases for all devices at startup
On Fri, Jan 08, 2010 at 05:23:16PM +, Daniel P. Berrange wrote: When starting a guest, give every device a unique alias. This will be used for the 'id' parameter in -device args in later patches. It can also be used to uniquely identify devices in the monitor For old QEMU without -device, assign disk names based on QEMU's historical naming scheme. * src/qemu/qemu_conf.c: Assign unique device aliases * src/qemu/qemu_driver.c: Remove obsolete qemudDiskDeviceName and use the device alias in eject blockstats commands --- src/qemu/qemu_conf.c | 173 src/qemu/qemu_driver.c | 104 ++--- 2 files changed, 195 insertions(+), 82 deletions(-) How would the user see the alias in practice ? They won't be dumped in the XML if I understand correctly so how to they get exposed ? ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Cannot use console with 0.7.5, error: internal error no assigned pty for device serial0
On Fri, Jan 15, 2010 at 02:29:09PM +, Daniel P. Berrange wrote: If I were a betting man, I'd bet on this changeset which was missed from the 0.7.5 release http://libvirt.org/git/?p=libvirt.git;a=commit;h=c0a9b6a5338e54b64a4a28415ffbdb6bcc2b38c5 Took that patch, applied it to Debian's 0.7.5-4 source package, built the package, installed it, same error. Greetings Marc -- - Marc Haber | I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things.Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 20/34] Assign device aliases for all devices at startup
On Fri, Jan 15, 2010 at 05:42:31PM +0100, Daniel Veillard wrote: On Fri, Jan 08, 2010 at 05:23:16PM +, Daniel P. Berrange wrote: When starting a guest, give every device a unique alias. This will be used for the 'id' parameter in -device args in later patches. It can also be used to uniquely identify devices in the monitor For old QEMU without -device, assign disk names based on QEMU's historical naming scheme. * src/qemu/qemu_conf.c: Assign unique device aliases * src/qemu/qemu_driver.c: Remove obsolete qemudDiskDeviceName and use the device alias in eject blockstats commands --- src/qemu/qemu_conf.c | 173 src/qemu/qemu_driver.c | 104 ++--- 2 files changed, 195 insertions(+), 82 deletions(-) How would the user see the alias in practice ? They won't be dumped in the XML if I understand correctly so how to they get exposed ? Yes, they'll appear in the XML dump. Here is a huge example: http://www.redhat.com/archives/libvir-list/2010-January/msg00186.html Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 21/34] Convert character devices over to use -device
On Fri, Jan 08, 2010 at 05:23:17PM +, Daniel P. Berrange wrote: The current character device syntax uses either -serial tty,path=/dev/ttyS2 Or -chardev tty,id=serial0,path=/dev/ttyS2 -serial chardev:serial0 With the new -device support, we now prefer -chardev file,id=serial0,path=/tmp/serial.log -device isa-serial,chardev=serial0 This patch changes the existing -chardev syntax to use this new scheme, and fallbacks to the old plain -serial syntax for old QEMU. The monitor device changes to -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor In addition, this patch adds --nodefaults, which kills off the default serial, parallel, vga and nic devices. THis avoids the need for us to explicitly turn each off ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 24/34] Convert disk drive over to use -device where available
On Fri, Jan 08, 2010 at 05:23:20PM +, Daniel P. Berrange wrote: The current preferred syntax for disk drives uses -drive file=/vms/plain.qcow,if=virtio,index=0,boot=on,format=qcow The new syntax splits this up into a pair of linked args -drive file=/vms/plain.qcow,if=none,id=drive-virtio-0,format=qcow2 -device virtio-blk-pci,drive=drive-virtio-0,id=virtio-0,addr=PCI SLOT SCSI/IDE devices also get a bus property linking them to the controller -device scsi-disk,drive=drive-scsi0-0-0,id=scsi0-0-0,bus=scsi0.0,scsi-id=0 -device ide-drive,drive=drive-ide0-0-0,id=ide0-0-0,bus=ide0,unit=0 --- src/qemu/qemu_conf.c | 157 +++--- 1 files changed, 148 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 067fe42..8b8455d 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1852,17 +1852,26 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk, virBufferVSprintf(opt, file=%s,, disk-src); } } -virBufferVSprintf(opt, if=%s, bus); +if (qemuCmdFlags QEMUD_CMD_FLAG_DEVICE) +virBufferAddLit(opt, if=none); +else +virBufferVSprintf(opt, if=%s, bus); + if (disk-device == VIR_DOMAIN_DISK_DEVICE_CDROM) virBufferAddLit(opt, ,media=cdrom); -if (busid == -1 unitid == -1) { -if (idx != -1) -virBufferVSprintf(opt, ,index=%d, idx); + +if (qemuCmdFlags QEMUD_CMD_FLAG_DEVICE) { +virBufferVSprintf(opt, ,id=drive-%s, disk-info.alias); } else { -if (busid != -1) -virBufferVSprintf(opt, ,bus=%d, busid); -if (unitid != -1) -virBufferVSprintf(opt, ,unit=%d, unitid); +if (busid == -1 unitid == -1) { +if (idx != -1) +virBufferVSprintf(opt, ,index=%d, idx); +} else { +if (busid != -1) +virBufferVSprintf(opt, ,bus=%d, busid); +if (unitid != -1) +virBufferVSprintf(opt, ,unit=%d, unitid); +} } if (bootable disk-device == VIR_DOMAIN_DISK_DEVICE_DISK) @@ -1901,6 +1910,91 @@ error: return NULL; } +static int +qemuBuildDriveDevStr(virConnectPtr conn, + virDomainDiskDefPtr disk, + char **str) +{ +virBuffer opt = VIR_BUFFER_INITIALIZER; +const char *bus = virDomainDiskQEMUBusTypeToString(disk-bus); +int idx = virDiskNameToIndex(disk-dst); + +if (idx 0) { +qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + _(unsupported disk type '%s'), disk-dst); +goto error; +} + +switch (disk-bus) { +case VIR_DOMAIN_DISK_BUS_IDE: +virBufferAddLit(opt, ide-drive); +virBufferVSprintf(opt, ,bus=ide.%d,unit=%d, + disk-info.addr.drive.bus, + disk-info.addr.drive.unit); +break; +case VIR_DOMAIN_DISK_BUS_SCSI: +virBufferAddLit(opt, scsi-disk); +virBufferVSprintf(opt, ,bus=scsi%d.%d,scsi-id=%d, + disk-info.addr.drive.controller, + disk-info.addr.drive.bus, + disk-info.addr.drive.unit); +break; +case VIR_DOMAIN_DISK_BUS_VIRTIO: +virBufferAddLit(opt, virtio-blk-pci); +qemuBuildDeviceAddressStr(opt, disk-info); +break; + +default: +qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, + _(unsupported disk bus '%s' with device setup), bus); +goto error; +} +virBufferVSprintf(opt, ,drive=drive-%s, disk-info.alias); +virBufferVSprintf(opt, ,id=%s, disk-info.alias); + +*str = virBufferContentAndReset(opt); +return 0; + +error: +virBufferFreeAndReset(opt); +*str = NULL; +return -1; +} + + +static char * +qemuBuildControllerDevStr(virDomainControllerDefPtr def) +{ +virBuffer buf = VIR_BUFFER_INITIALIZER; + +switch (def-type) { +case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: +virBufferAddLit(buf, lsi); +virBufferVSprintf(buf, ,id=scsi%d, def-idx); +break; + +case VIR_DOMAIN_CONTROLLER_TYPE_IDE: +virBufferAddLit(buf, piix4-ide); +virBufferVSprintf(buf, ,id=ide%d, def-idx); +break; + +default: +goto error; +} + +if (qemuBuildDeviceAddressStr(buf, def-info) 0) +goto error; + +if (virBufferError(buf)) +goto error; + +return virBufferContentAndReset(buf); + +error: +virBufferFreeAndReset(buf); +return NULL; +} + int qemuBuildNicStr(virConnectPtr conn, @@ -2692,6 +2786,21 @@ int qemudBuildCommandLine(virConnectPtr conn, } } +if (qemuCmdFlags QEMUD_CMD_FLAG_DEVICE) { +for (i = 0 ; i def-ncontrollers ; i++) {
Re: [libvirt] [PATCH 25/34] Convert NICs over to use -device -netdev where possible
On Fri, Jan 08, 2010 at 05:23:21PM +, Daniel P. Berrange wrote: The current syntax uses a pair of args -net nic,macaddr=52:54:00:56:6c:55,vlan=3,model=pcnet,name=pcnet.0 -net user,vlan=3,name=user.0 The new syntax does not need the vlan craziness anymore, and so has a simplified pair of args -netdev user,id=user.0 -device pcnet,netdev=user.0,id=pcnet.0,mac=52:54:00:56:6c:55,addr=PCI SLOT --- src/qemu/qemu_conf.c | 175 .../qemuxml2argv-net-virtio-device.args|1 + .../qemuxml2argv-net-virtio-device.xml | 26 +++ tests/qemuxml2argvtest.c |1 + 4 files changed, 174 insertions(+), 29 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-device.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-device.xml diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 8b8455d..709c3f4 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1488,6 +1488,8 @@ qemuAssignDeviceAliases(virDomainDefPtr def) if (virAsprintf(def-nets[i]-info.alias, nic%d, i) 0) goto no_memory; } +if (virAsprintf(def-nets[i]-hostnet_name, netdev%d, i) 0) +goto no_memory; } for (i = 0; i def-nsounds ; i++) { @@ -2021,6 +2023,41 @@ qemuBuildNicStr(virConnectPtr conn, return 0; } +static char * +qemuBuildNicDevStr(virDomainNetDefPtr net) +{ +virBuffer buf = VIR_BUFFER_INITIALIZER; +const char *nic; + +if (!net-model) { +nic = rtl8139; +} else if (STREQ(net-model, virtio)) { +nic = virtio-net-pci; +} else { +nic = net-model; +} + +virBufferVSprintf(buf, %s,netdev=%s, nic, net-hostnet_name); +virBufferVSprintf(buf, ,id=%s, net-info.alias); +virBufferVSprintf(buf, ,mac=%02x:%02x:%02x:%02x:%02x:%02x, + net-mac[0], net-mac[1], + net-mac[2], net-mac[3], + net-mac[4], net-mac[5]); +if (qemuBuildDeviceAddressStr(buf, net-info) 0) +goto error; + +if (virBufferError(buf)) { +virReportOOMError(NULL); +goto error; +} + +return virBufferContentAndReset(buf); + +error: +virBufferFreeAndReset(buf); +return NULL; +} + int qemuBuildHostNetStr(virConnectPtr conn, virDomainNetDefPtr net, @@ -2118,6 +2155,88 @@ qemuBuildHostNetStr(virConnectPtr conn, } +static int +qemuBuildNetDevStr(virConnectPtr conn, + virDomainNetDefPtr net, + const char *tapfd, + char **str) +{ +switch (net-type) { +case VIR_DOMAIN_NET_TYPE_NETWORK: +case VIR_DOMAIN_NET_TYPE_BRIDGE: +if (virAsprintf(str, tap,fd=%s,id=%s, +tapfd, net-hostnet_name) 0) { +virReportOOMError(conn); +return -1; +} +break; + +case VIR_DOMAIN_NET_TYPE_ETHERNET: +{ +virBuffer buf = VIR_BUFFER_INITIALIZER; + +virBufferAddLit(buf, tap); +if (net-ifname) +virBufferVSprintf(buf, ,ifname=%s, net-ifname); +if (net-data.ethernet.script) +virBufferVSprintf(buf, ,script=%s, + net-data.ethernet.script); +if (net-hostnet_name) +virBufferVSprintf(buf, ,id=%s, + net-hostnet_name); +if (virBufferError(buf)) { +virBufferFreeAndReset(buf); +virReportOOMError(conn); +return -1; +} + +*str = virBufferContentAndReset(buf); +} +break; + +case VIR_DOMAIN_NET_TYPE_CLIENT: +case VIR_DOMAIN_NET_TYPE_SERVER: +case VIR_DOMAIN_NET_TYPE_MCAST: +{ +const char *mode = NULL; + +switch (net-type) { +case VIR_DOMAIN_NET_TYPE_CLIENT: +mode = connect; +break; +case VIR_DOMAIN_NET_TYPE_SERVER: +mode = listen; +break; +case VIR_DOMAIN_NET_TYPE_MCAST: +mode = mcast; +break; +} + +if (virAsprintf(str, socket,%s=%s:%d,id=%s, +mode, +net-data.socket.address, +net-data.socket.port, +net-hostnet_name) 0) { +virReportOOMError(conn); +return -1; +} +} +break; + +case VIR_DOMAIN_NET_TYPE_USER: +default: +if (virAsprintf(str, user,id=%s, +net-hostnet_name) 0) { +virReportOOMError(conn); +return
Re: [libvirt] [PATCH 21/34] Convert character devices over to use -device
On Wed, Jan 13, 2010 at 03:56:03PM +0100, Paolo Bonzini wrote: On 01/08/2010 06:23 PM, Daniel P. Berrange wrote: diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 5dcd50f..eded887 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1592,6 +1592,9 @@ static char *qemuDiskDriveName(const virDomainDiskDefPtr disk) case VIR_DOMAIN_DISK_BUS_VIRTIO: ret = virAsprintf(devname, virtio%d, devid); break; +case VIR_DOMAIN_DISK_BUS_XEN: +ret = virAsprintf(devname, xenblk%d, devid); +break; default: qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT, _(Unsupported disk name mapping for bus '%s'), Belongs in previous patch. Opps, not sure how that got in there ! Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] gnulib added a new syntax-check test: use $(VAR), not @VAR@
Updating to newer gnulib also pulled in a new sytnax-check test that evoked new warnings. No big deal, but I addressed them. The only trick was to see that the warnings about @SCHEMADIR@ and @SYSCONFDIR@ were false positives. To allow them, I defined the variable in cfg.mk. See below. From 6e76cfe38ba0ccafa7c4e81dcc0af04e31f8f447 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Fri, 15 Jan 2010 11:09:01 +0100 Subject: [PATCH] gnulib added a new syntax-check test: use $(VAR), not @VAR@ The latter is not officially wrong, but *is* terribly anachronistic. I think automake documentation or comments call that syntax obsolescent. * cfg.mk (_makefile_at_at_check_exceptions): Exempt @SCHEMADIR@ and @SYSCONFDIR@ uses -- there are no Makefile variables for those. * docs/Makefile.am: Use $(INSTALL), not @inst...@. * examples/dominfo/Makefile.am: Similar. * examples/domsuspend/Makefile.am: Similar. * proxy/Makefile.am: Similar. * python/Makefile.am: Similar. * python/tests/Makefile.am: Similar. * src/Makefile.am: Similar. * tests/Makefile.am: Similar. --- cfg.mk |5 - docs/Makefile.am|4 ++-- examples/dominfo/Makefile.am|2 +- examples/domsuspend/Makefile.am |2 +- proxy/Makefile.am |2 +- python/Makefile.am | 10 +- python/tests/Makefile.am|2 +- src/Makefile.am | 10 +- tests/Makefile.am |2 +- 9 files changed, 21 insertions(+), 18 deletions(-) diff --git a/cfg.mk b/cfg.mk index 45d6531..0f2d2a6 100644 --- a/cfg.mk +++ b/cfg.mk @@ -1,5 +1,5 @@ # Customize Makefile.maint. -*- makefile -*- -# Copyright (C) 2003-2009 Free Software Foundation, Inc. +# Copyright (C) 2003-2010 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -265,3 +265,6 @@ ifeq (0,$(MAKELEVEL)) $(error gnulib update required; run ./autogen.sh first) endif endif + +# Exempt @...@ uses of these symbols. +_makefile_at_at_check_exceptions = ' !/(SCHEMA|SYSCONF)DIR/' diff --git a/docs/Makefile.am b/docs/Makefile.am index c19e963..eaac627 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -143,7 +143,7 @@ rebuild: api all install-data-local: $(mkinstalldirs) $(DESTDIR)$(HTML_DIR) - -...@install@ -m 0644 $(srcdir)/FAQ.html \ + -$(INSTALL) -m 0644 $(srcdir)/FAQ.html \ $(srcdir)/Libxml2-Logo-90x34.gif $(DESTDIR)$(HTML_DIR) $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/html for h in $(apihtml); do \ @@ -152,7 +152,7 @@ install-data-local: $(INSTALL) -m 0644 $(srcdir)/$$p $(DESTDIR)$(HTML_DIR)/html; done $(mkinstalldirs) $(DESTDIR)$(DEVHELP_DIR) for file in $(devhelphtml) $(devhelppng) $(devhelpcss); do \ - @INSTALL@ -m 0644 $(srcdir)/$${file} $(DESTDIR)$(DEVHELP_DIR) ; \ + $(INSTALL) -m 0644 $(srcdir)/$${file} $(DESTDIR)$(DEVHELP_DIR) ; \ done uninstall-local: diff --git a/examples/dominfo/Makefile.am b/examples/dominfo/Makefile.am index a1694b8..2913e5b 100644 --- a/examples/dominfo/Makefile.am +++ b/examples/dominfo/Makefile.am @@ -1,6 +1,6 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -...@srcdir@/include -LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la $(COVERAGE_LDFLAGS) +LDADDS = $(STATIC_BINARIES) $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la $(COVERAGE_LDFLAGS) noinst_PROGRAMS=info1 diff --git a/examples/domsuspend/Makefile.am b/examples/domsuspend/Makefile.am index 41e9fdb..14b4205 100644 --- a/examples/domsuspend/Makefile.am +++ b/examples/domsuspend/Makefile.am @@ -1,6 +1,6 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -...@srcdir@/include -LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la $(COVERAGE_LDFLAGS) +LDADDS = $(STATIC_BINARIES) $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la $(COVERAGE_LDFLAGS) noinst_PROGRAMS=suspend diff --git a/proxy/Makefile.am b/proxy/Makefile.am index 97d6e5a..aef11ca 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -7,7 +7,7 @@ INCLUDES = -I$(top_srcdir)/gnulib/lib -I../gnulib/lib \ -...@top_srcdir@/src/util \ -...@top_srcdir@/src/conf \ -...@top_srcdir@/src/xen \ - @LIBXML_CFLAGS@ \ + $(LIBXML_CFLAGS) \ -DPROXY -DLOCALEBASEDIR=\$(datadir)/locale\ \ -DGETTEXT_PACKAGE=\$(PACKAGE)\ $(WARN_CFLAGS) $(XEN_CFLAGS) diff --git a/python/Makefile.am b/python/Makefile.am index 58c6729..6b67e38 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -37,12 +37,12 @@ pyexec_LTLIBRARIES = libvirtmod.la libvirtmod_la_SOURCES = libvirt-override.c typewrappers.c libvirt.c libvirt.h # Python = 2.4 header files contain a redundant decl, hence we # need extra flags here
Re: [libvirt] [PATCH] gnulib added a new syntax-check test: use $(VAR), not @VAR@
On Fri, Jan 15, 2010 at 11:11:08AM +0100, Jim Meyering wrote: Updating to newer gnulib also pulled in a new sytnax-check test that evoked new warnings. No big deal, but I addressed them. The only trick was to see that the warnings about @SCHEMADIR@ and @SYSCONFDIR@ were false positives. To allow them, I defined the variable in cfg.mk. See below. From 6e76cfe38ba0ccafa7c4e81dcc0af04e31f8f447 Mon Sep 17 00:00:00 2001 From: Jim Meyering meyer...@redhat.com Date: Fri, 15 Jan 2010 11:09:01 +0100 Subject: [PATCH] gnulib added a new syntax-check test: use $(VAR), not @VAR@ The latter is not officially wrong, but *is* terribly anachronistic. ACK, it is way overdue for us to standarize on $(VAR) rather than arbitrarily mixing the two syntax Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix validation of news.html
FYI, I pushed this simple fix. Matthias --- docs/news.html.in |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/docs/news.html.in b/docs/news.html.in index 7e06096..83b394f 100644 --- a/docs/news.html.in +++ b/docs/news.html.in @@ -26,7 +26,7 @@ and check the a href=ChangeLog.htmlChangeLog/a to gauge progress./p esx: Extend documentation about 'vcenter' and add some about 'auto_answer' (Matthias Bolte), Fix and improve domain xml video element description (Matthias Bolte), Fix owner and group in example volume XML (Matthew Booth), - add missing doc for device shareable/ option (Daniel Veillard), + add missing doc for device lt;shareable/gt; option (Daniel Veillard), add AppArmor test and examples to dist (Jamie Strandboge), Update location of C# bindings. (Richard Jones), Fix typo in QEMU driver webpage (Daniel P. Berrange), -- 1.6.3.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Cannot use console with 0.7.5, error: internal error no assigned pty for device serial0
On Fri, Jan 15, 2010 at 05:45:27PM +0100, Marc Haber wrote: Took that patch, applied it to Debian's 0.7.5-4 source package, built the package, installed it, same error. Looks to me like the issue is still present in git head. git clone ./autogen create debian/ to allow building the debian package rm debian/patches/series rm docs/Makefile.am touch docs/Makefile.am autoreconf debuild dpkg --install issue still present. Greetings Marc -- - Marc Haber | I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things.Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 26/34] Convert USB disks over to -device
On Fri, Jan 08, 2010 at 05:23:22PM +, Daniel P. Berrange wrote: The previous syntax was severely limited in its options -usbdevice disk:/home/berrange/output.img The new syntax is the same as for other disk types -drive file=/home/berrange/output.img,if=none,id=usb-1,index=1 -device usb-storage,drive=usb-1 Again, the index= arg is wrong here, and will be removed in a later merge ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 27/34] Convert USB hostdevices over to -device
On Fri, Jan 08, 2010 at 05:23:23PM +, Daniel P. Berrange wrote: The old syntax was -usbdevice host:PRODUCT:VENDOR Or -usbdevice host:BUS.DEV The new syntax is -device usb-host,product=PRODUCT,vendor=VENDOR Or -device usb-host,hostbus=BUS,hostaddr=DEV --- src/qemu/qemu_conf.c | 32 ++- .../qemuxml2argv-hostdev-usb-address-device.args |1 + .../qemuxml2argv-hostdev-usb-address-device.xml| 27 tests/qemuxml2argvtest.c |1 + 4 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address-device.xml ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 28/34] Convert USB input devices to -device
On Fri, Jan 08, 2010 at 05:23:24PM +, Daniel P. Berrange wrote: --- src/qemu/qemu_conf.c | 34 -- 1 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 1ea61a9..3b39a91 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -2268,6 +2268,28 @@ error: } +static char *qemuBuildUSBInputDevStr(virDomainInputDefPtr dev) +{ +virBuffer buf = VIR_BUFFER_INITIALIZER; + +virBufferVSprintf(buf, %s, + dev-type == VIR_DOMAIN_INPUT_TYPE_MOUSE ? + usb-mouse : usb-tablet); +virBufferVSprintf(buf, ,id=%s, dev-info.alias); + +if (virBufferError(buf)) { +virReportOOMError(NULL); +goto error; +} + +return virBufferContentAndReset(buf); + +error: +virBufferFreeAndReset(buf); +return NULL; +} + + static char * qemuBuildSoundDevStr(virDomainSoundDefPtr sound) { @@ -3273,8 +3295,16 @@ int qemudBuildCommandLine(virConnectPtr conn, virDomainInputDefPtr input = def-inputs[i]; if (input-bus == VIR_DOMAIN_INPUT_BUS_USB) { -ADD_ARG_LIT(-usbdevice); -ADD_ARG_LIT(input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE ? mouse : tablet); +if (qemuCmdFlags QEMUD_CMD_FLAG_DEVICE) { +char *optstr; +ADD_ARG_LIT(-device); +if (!(optstr = qemuBuildUSBInputDevStr(input))) +goto error; +ADD_ARG(optstr); +} else { +ADD_ARG_LIT(-usbdevice); +ADD_ARG_LIT(input-type == VIR_DOMAIN_INPUT_TYPE_MOUSE ? mouse : tablet); +} } } ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 29/34] Convert PCI device assignment over to -device
On Fri, Jan 08, 2010 at 05:23:25PM +, Daniel P. Berrange wrote: The old syntax is -pcidevice host=BUS:SLOT:FUNCTION The new syntax is -device pci-assign,host=BUS:SLOT:FUNCTION,addr=PCI SLOT,id=host0 --- src/qemu/qemu_conf.c | 51 +++- .../qemuxml2argv-hostdev-pci-address-device.args |1 + .../qemuxml2argv-hostdev-pci-address-device.xml| 27 ++ tests/qemuxml2argvtest.c |1 + 4 files changed, 68 insertions(+), 12 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address-device.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-address-device.xml ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Current cpu and memory usage for Host and Domains
Seem there is no way to get host CPU usage in libvirt API? I can get freeMemory by virNodeGetFreeMemory, but no cpu usage API. How about add a new api for it? The host CPU usage is also important for VM creation and migration decision, like the free memory. Yes, I know, I can got it from top...:) On Thu, Dec 17, 2009 at 5:06 AM, Daniel Veillard veill...@redhat.comwrote: On Thu, Dec 17, 2009 at 06:26:41PM +0530, anuj rampal wrote: Hi, Is there a way to get the Current CPU and Memory usage of the Host machine and the Guest Domains..?? See http://libvirt.org/html/libvirt-libvirt.html#virDomainGetInfo and http://libvirt.org/html/libvirt-libvirt.html#virDomainInfo plus the mails exchanged on the subject in the last few days ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 30/34] Convert guestfwd to -device, and add -sdl explicit args
On Fri, Jan 08, 2010 at 05:23:26PM +, Daniel P. Berrange wrote: The old syntax was -chardev SOMECONFIG -nic user,guestfwd=tcp:IP:PORT-chardev:CHARDEV The new syntax is -chardev SOMECONFIG -netdev user,guestfwd=tcp:IP:PORT,chardev=ID,id=user-ID --- src/qemu/qemu_conf.c | 11 ++- .../qemuxml2argv-channel-guestfwd.args |2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index a09fb62..9cd53f9 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -3283,9 +3283,10 @@ int qemudBuildCommandLine(virConnectPtr conn, switch(channel-targetType) { case VIR_DOMAIN_CHR_TARGET_TYPE_GUESTFWD: -if (!(qemuCmdFlags QEMUD_CMD_FLAG_CHARDEV)) { +if (!(qemuCmdFlags QEMUD_CMD_FLAG_CHARDEV) || +!(qemuCmdFlags QEMUD_CMD_FLAG_DEVICE)) { qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT, - %s, _(guestfwd requires QEMU to support -chardev)); + %s, _(guestfwd requires QEMU to support -chardev -device)); goto error; } @@ -3301,8 +3302,9 @@ int qemudBuildCommandLine(virConnectPtr conn, const char *addr = virSocketFormatAddr(channel-target.addr); int port = virSocketGetPort(channel-target.addr); -virBufferVSprintf(buf, user,guestfwd=tcp:%s:%i-chardev:%s, - addr, port, channel-info.alias); +ADD_ARG_LIT(-netdev); +virBufferVSprintf(buf, user,guestfwd=tcp:%s:%i,chardev=%s,id=user-%s, + addr, port, channel-info.alias, channel-info.alias); VIR_FREE(addr); @@ -3311,7 +3313,6 @@ int qemudBuildCommandLine(virConnectPtr conn, goto no_memory; } -ADD_ARG_LIT(-net); ADD_ARG(virBufferContentAndReset(buf)); } } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.args b/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.args index c3148df..e93e934 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-guestfwd.args @@ -1 +1 @@ -LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev pipe,id=channel0,path=/tmp/guestfwd -net user,guestfwd=tcp:10.0.2.1:4600-chardev:channel0 -usb +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults -chardev socket,id=monitor,path=/tmp/test-monitor,server,nowait -mon chardev=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev pipe,id=channel0,path=/tmp/guestfwd -netdev user,guestfwd=tcp:10.0.2.1:4600,chardev=channel0,id=user-channel0 -usb -- 1.6.5.2 ACK Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 31/34] Add support for explicit -sdl flag to QEMU
On Fri, Jan 08, 2010 at 05:23:27PM +, Daniel P. Berrange wrote: Not all QEMU builds default to SDL graphics for their display. Newer QEMU now has an explicit -sdl flag, which we can use to explicitly request SDL intead of relying on the default. This protects libvirt against unexpected changes in graphics default if (def-nvideos) { diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 174d397..4a862d1 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -79,6 +79,7 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_MONITOR_JSON = (1 24), /* JSON mode for monitor */ QEMUD_CMD_FLAG_BALLOON = (1 25), /* -balloon available */ QEMUD_CMD_FLAG_DEVICE= (1 26), /* Is the new -chardev arg available */ +QEMUD_CMD_FLAG_SDL = (1 27), /* Is the new -sdl arg available */ }; Aren't we getting close to the 32 options limits ? ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 32/34] Pass -vga none if no video card specified
On Fri, Jan 08, 2010 at 05:23:28PM +, Daniel P. Berrange wrote: QEMU always configures a VGA card. If no video card is included in the libvirt XML, it is neccessary to explicitly turn off the default using -vga none * src/qemu/qemu_conf.c: Pass -vga none if no video card is configured * tests/qemuargv2xmltest.c, tests/qemuxml2argvtest.c: Test for handling -vga none. * tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.args, tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml: Test data files --- src/qemu/qemu_conf.c | 25 +-- tests/qemuargv2xmltest.c |1 + .../qemuxml2argv-nographics-vga.args |1 + .../qemuxml2argv-nographics-vga.xml| 24 +++ tests/qemuxml2argvtest.c |1 + 5 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-nographics-vga.xml ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 33/34] Auto-assign PCI addresses
On Fri, Jan 08, 2010 at 05:23:29PM +, Daniel P. Berrange wrote: Instead of relying on QEMU to assign PCI addresses and then querying them with 'info pci', manually assign all PCI addresses before starting the guest. These addresses are not stable across reboots. That will come in a later patch NB, the PIIX3 (IDE, FDC, ISA-Bridge) will always have slot 1 and VGA will always have slot 2. We declare the Virtio Balloon gets slot 3, and then all remaining slots are for configured devices. Just wondering, how many slot is there, and shouldn't we try to keep a couple of reserved slots there for future needs, not important now but if we want to make them stable later that may be needed then ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 34/34] Convert VirtIO balloon over to -device syntax
On Fri, Jan 08, 2010 at 05:23:30PM +, Daniel P. Berrange wrote: Replace -balloon virtio With -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 This allows it to get correct assigned PCI address as declared in previous patch ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 02/34] Introduce a standardized data structure for device addresses
On Fri, Jan 15, 2010 at 04:33:01PM +, Daniel P. Berrange wrote: On Fri, Jan 15, 2010 at 01:39:18PM +0100, Daniel Veillard wrote: On Fri, Jan 08, 2010 at 05:22:58PM +, Daniel P. Berrange wrote: All guest devices now use a common device address structure summarized by: enum virDomainDeviceAddressType { VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI, }; struct _virDomainDevicePCIAddress { unsigned int domain; unsigned int bus; unsigned int slot; unsigned int function; }; struct _virDomainDeviceInfo { int type; union { virDomainDevicePCIAddress pci; } addr; }; This replaces the anonymous structs in Disk/Net/Hostdev data structures. Where available, the address is *always* printed in the XML file, instead of being hidden in the internal state file. address type='pci' domain='0x' bus='0x1e' slot='0x07' function='0x0'/ The structure definition is based on Wolfgang Mauerer's disk controller patch series. * docs/schemas/domain.rng: Define the address syntax and associate it with disk/net/hostdev devices * src/conf/domain_conf.h, src/conf/domain_conf.c, src/libvirt_private.syms: APIs for parsing/formatting address information. Also remove the QEMU specific 'pci_addr' attributes * src/qemu/qemu_driver.c: Replace use of 'pci_addr' attrs with new standardized format. --- docs/schemas/domain.rng | 55 +-- src/conf/domain_conf.c | 420 +- src/conf/domain_conf.h | 84 +- src/libvirt_private.syms |6 + src/qemu/qemu_driver.c | 64 --- 5 files changed, 428 insertions(+), 201 deletions(-) [...] +int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info, + int type) +{ +if (info-type != type) +return 0; + +switch (info-type) { +case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: +return virDomainDevicePCIAddressIsValid(info-addr.pci); +} Hum, a switch without default and not handling all cases may generate a warning with some compiler options (I find this useful when extending the union) maybe we should explicitely return 0 with _NONE +static int +virDomainDevicePCIAddressParseXML(virConnectPtr conn, + xmlNodePtr node, + virDomainDevicePCIAddressPtr addr) +{ +char *domain, *slot, *bus, *function; +int ret = -1; + +memset(addr, 0, sizeof(*addr)); + +domain = virXMLPropString(node, domain); +bus = virXMLPropString(node, bus); +slot = virXMLPropString(node, slot); +function = virXMLPropString(node, function); + +if (domain +virStrToLong_ui(domain, NULL, 16, addr-domain) 0) { +virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, %s, + _(Cannot parse address 'domain' attribute)); +goto cleanup; +} Hum, there is a small mismatch between the parsing function and the validation, virStrToLong_ uses strtol like function decoding 0 leading numbers as octal, but we don't match octal in the Relax-NG associated functions: We pass an explicit '16' to the virStrToLong_ui() so that should prevent it doing octal IIUC define name=pciDomain data type=string param name=pattern(0x)?[0-9a-fA-F]{1,4}/param /data /define Do we really intent to allow 0 started octal values ? I guess in octal we would need more than 4 digit to cover the address range. But it's a minor point, we could fix the RNG later My intent was for these attributes to always be interpreted as hex, no matter what, even if 0x is left off. okay, I though I had looked if we included the base in the call, weird. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Schedule for libvirt-0.7.6
So the plan is still to start the feature freeze end of next friday the 22 Jan and try to push 0.7.6 on the 29th. This mean there is still one week to push features :-) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Supressing error messages
2010/1/15 Bryan Kearney bkear...@redhat.com: When using the java library, we are seeing libvirt error messages spit out.. such as: libvir: Remote error : unable to connect to '/var/run/libvirt/libvirt-sock': No such file or directory Is there a means of supressing that logging via the api? -- bk Yes. The default error callback prints this messages to stderr. Use virSetErrorFunc to replace the default error callback with your custom one. For example like this static void dummyErrorHandler(void *userData, virErrorPtr error) { } ... virSetErrorFunc(NULL, dummyErrorHandler); Matthias -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list