[libvirt] [PATCH] qemu: Fix the wrong expression
by Osier Yang
Wrong use of the parentheses causes "rc" always having a boolean value,
either "1" or "0", and thus we can't get the detailed error message
when it fails:
Before (I only have 1 node):
% virsh numatune f18 --nodeset 12
error: Unable to change numa parameters
error: unable to set numa tunable: Unknown error -1
After:
virsh numatune f18 --nodeset 12
error: Unable to change numa parameters
error: unable to set numa tunable: Invalid argument
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index cee5557..0de7ffd 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7470,7 +7470,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
continue;
}
- if ((rc = virCgroupSetCpusetMems(priv->cgroup, nodeset_str) != 0)) {
+ if ((rc = virCgroupSetCpusetMems(priv->cgroup, nodeset_str)) != 0) {
virReportSystemError(-rc, "%s",
_("unable to set numa tunable"));
virBitmapFree(nodeset);
--
1.8.1.4
11 years, 7 months
[libvirt] USB pass-through with XEN
by Carlos Rodrigues
Hello everybody,
I try to doing USB pass-through with XEN hypervisor using libvirt and i
get the following error:
# virsh attach-device c6test /tmp/usb_device.xml
error: Failed to attach device from /tmp/usb_device.xml
error: unsupported configuration: unsupported device type
# cat /tmp/usb_device.xml
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id="0x0529" />
<product id="0x0001" />
</source>
</hostdev>
But using xm command, the USB pass-through has been successfully
# xm usb-add c6test host:0529:0001
I try it on Fedora 17 with libvirt 1.0.4 and xen 4.2.1.
Does anyone know how can i do to put libvirt work with XEN USB pass-through?
Best regards,
--
Carlos Rodrigues <cmar(a)eurotux.com>
Engenheiro de Software Sénior
Eurotux Informática, S.A. | www.eurotux.com
(t) +351 253 680 300
11 years, 7 months
[libvirt] [PATCH 0/5] qemu: invoke qemu-bridge-helper from libvirtd
by Paolo Bonzini
The <interface type='bridge'> is working mostly because of a bad design
decision in Linux. Ideally, QEMU would run with an empty capability
bounding set and would not be able to do any privileged operation
(not even by running a helper program). This is not the case because
dropping capabilities from the bounding set requires a capability of its
own, CAP_SETPCAP; thus QEMU does *not* run with an empty bounding set if
invoked via qemu:///session.
This series lets libvirtd invoke the privileged helper program on its own,
which is a cleaner design that would work even if the above Linux bug
was not there. Also, this adds a <target dev='tap0'/> element to the
XML of an active domain using <interface type='bridge'>.
libvirt now needs to know the path to the helper (patch
3), and must not set permitted/effective capabilities on children when
running unprivileged (patches 1/2). Apart from this, the recvfd and
virCommand APIs make the task almost trivial.
Paolo Bonzini (5):
util: simplify virSetUIDGIDWithCaps
util: allow using virCommandAllowCap with setuid helpers
qemu_conf: add new configuration key bridge_helper
virnetdevtap: add virNetDevTapGetName
qemu: launch bridge helper from libvirtd
src/libvirt_private.syms | 1 +
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 8 +++
src/qemu/qemu_command.c | 133 +++++++++++++++++++++++++++----------
src/qemu/qemu_command.h | 1 -
src/qemu/qemu_conf.c | 3 +
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_hotplug.c | 25 +++----
src/qemu/test_libvirtd_qemu.aug.in | 1 +
src/util/virnetdevtap.c | 33 +++++++++
src/util/virnetdevtap.h | 3 +
src/util/virutil.c | 36 +++++++---
12 files changed, 183 insertions(+), 63 deletions(-)
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH] docs: fix usage of 'onto'
by Eric Blake
http://www.uhv.edu/ac/newsletters/writing/grammartip2009.07.01.htm
(and several other sites) give hints that 'onto' is best used if
you can also add 'up' just before it and still make sense. In many
cases in the code base, we really want the two-word form, or even
a simplification to just 'on' or 'to'.
* docs/hacking.html.in: Use correct 'on to'.
* python/libvirt-override.c: Likewise.
* src/lxc/lxc_controller.c: Likewise.
* src/util/virpci.c: Likewise.
* daemon/THREADS.txt: Use simpler 'on'.
* docs/formatdomain.html.in: Better usage.
* docs/internals/rpc.html.in: Likewise.
* src/conf/domain_event.c: Likewise.
* src/rpc/virnetclient.c: Likewise.
* tests/qemumonitortestutils.c: Likewise.
* HACKING: Regenerate.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the trivial rule.
daemon/THREADS.txt | 2 +-
docs/formatdomain.html.in | 6 +++---
docs/hacking.html.in | 2 +-
docs/internals/rpc.html.in | 8 ++++----
python/libvirt-override.c | 4 ++--
src/conf/domain_event.c | 4 ++--
src/lxc/lxc_controller.c | 2 +-
src/rpc/virnetclient.c | 4 ++--
src/util/virpci.c | 4 ++--
tests/qemumonitortestutils.c | 2 +-
10 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/daemon/THREADS.txt b/daemon/THREADS.txt
index 6386941..762ca25 100644
--- a/daemon/THREADS.txt
+++ b/daemon/THREADS.txt
@@ -40,7 +40,7 @@ The server lock is used in conjunction with a condition variable
to pass jobs from the event loop thread to the workers. The main
event loop thread handles I/O from the client socket, and once a
complete RPC message has been read off the wire (and optionally
-decrypted), it will be placed onto the 'dx' job queue for the
+decrypted), it will be placed on the 'dx' job queue for the
associated client object. The job condition will be signalled and
a worker will wakup and process it.
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0cc56d9..888c005 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -741,7 +741,7 @@
<p>
Resource partitions are currently supported by the QEMU and
- LXC drivers, which map partition paths onto cgroups directories,
+ LXC drivers, which map partition paths to cgroups directories,
in all mounted controllers. <span class="since">Since 1.0.5</span>
</p>
@@ -2701,7 +2701,7 @@
</p>
<p>
- Provides a bridge from the VM directly onto the LAN. This assumes
+ Provides a bridge from the VM directly to the LAN. This assumes
there is a bridge device on the host which has one or more of the hosts
physical NICs enslaved. The guest VM will have an associated tun device
created with a name of vnetN, which can also be overridden with the
@@ -2908,7 +2908,7 @@
<dl>
<dt><code>profileid</code></dt>
<dd>The profile ID contains the name of the port profile that is to
- be applied onto this interface. This name is resolved by the port
+ be applied to this interface. This name is resolved by the port
profile database into the network parameters from the port profile,
and those network parameters will be applied to this interface.
</dd>
diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index 632d357..99933d1 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -394,7 +394,7 @@
</pre>
<p>
- However, the moment your loop/if/else body extends onto a second
+ However, the moment your loop/if/else body extends on to a second
line, for whatever reason (even if it's just an added comment), then
you should add braces. Otherwise, it would be too easy to insert a
statement just before that comment (without adding braces), thinking
diff --git a/docs/internals/rpc.html.in b/docs/internals/rpc.html.in
index 4cf1e38..91e8449 100644
--- a/docs/internals/rpc.html.in
+++ b/docs/internals/rpc.html.in
@@ -418,7 +418,7 @@
After a complete packet has been read, the header must be decoded
and all 6 fields fully validated, before attempting to dispatch
the payload. Once dispatched, the payload can be decoded and passed
- onto the appropriate API for execution. The RPC code must not take
+ on to the appropriate API for execution. The RPC code must not take
any action based on the payload, since it has no way to validate
the semantics of the payload data. It must delegate this to the
execution API (e.g. corresponding libvirt public API).
@@ -785,7 +785,7 @@
return value and output parameters, or error object and encode
them into a reply packet. Again it does not attempt to do any
semantic validation of output data, aside from variable length
- field limit checks. The worker thread puts the reply packet onto
+ field limit checks. The worker thread puts the reply packet on
the transmission queue for the client. The worker is now finished
and goes back to wait for another incoming method call.
</p>
@@ -811,10 +811,10 @@
for the worker threads, it is sidetracked into a per-stream
processing queue. When the stream becomes writable, queued
incoming stream packets will be processed, passing their data
- payload onto the stream. Conversely when the stream becomes
+ payload on the stream. Conversely when the stream becomes
readable, chunks of data will be read from it, encoded into
new outgoing packets, and placed on the client's transmit
- queue
+ queue.
</p>
<h4><a name="apiserverdispatchex1">Example with overlapping methods</a></h4>
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 3d8490c..244b7ec 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -4,7 +4,7 @@
* entry points where an automatically generated stub is
* unpractical
*
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2013 Red Hat, Inc.
*
* Daniel Veillard <veillard(a)redhat.com>
*/
@@ -5084,7 +5084,7 @@ libvirt_virEventRegisterImpl(ATTRIBUTE_UNUSED PyObject * self,
updateTimeoutName = py_str(updateTimeoutObj);
removeTimeoutName = py_str(removeTimeoutObj);
- /* Inc refs since we're holding onto these objects until
+ /* Inc refs since we're holding on to these objects until
* the next call (if any) to this function.
*/
Py_INCREF(addHandleObj);
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 96a07ac..825012a 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1,7 +1,7 @@
/*
* domain_event.c: domain event queue processing helpers
*
- * Copyright (C) 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2010-2013 Red Hat, Inc.
* Copyright (C) 2008 VirtualIron
*
* This library is free software; you can redistribute it and/or
@@ -1179,7 +1179,7 @@ virDomainEventPtr virDomainEventBalloonChangeNewFromObj(virDomainObjPtr obj,
* @evtQueue: the dom event queue
* @event: the event to add
*
- * Internal function to push onto the back of a virDomainEventQueue
+ * Internal function to push to the back of a virDomainEventQueue
*
* Returns: 0 on success, -1 on failure
*/
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index f46f813..740b872 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1699,7 +1699,7 @@ int main(int argc, char *argv[])
_exit(0);
}
- /* Don't hold onto any cwd we inherit from libvirtd either */
+ /* Don't hold on to any cwd we inherit from libvirtd either */
if (chdir("/") < 0) {
virReportSystemError(errno, "%s",
_("Unable to change to root dir"));
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 010c5c3..1d228f0 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1,7 +1,7 @@
/*
* virnetclient.c: generic network RPC client
*
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 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
@@ -1771,7 +1771,7 @@ static int virNetClientIO(virNetClientPtr client,
goto cleanup;
}
- /* Grr, someone passed the buck onto us ... */
+ /* Grr, someone passed the buck to us ... */
} else {
client->haveTheBuck = true;
}
diff --git a/src/util/virpci.c b/src/util/virpci.c
index d94ff54..0fcf8ca 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1208,7 +1208,7 @@ virPCIDeviceReattach(virPCIDevicePtr dev,
* condition where the hypervisor is still cleaning up the device while
* libvirt is trying to re-attach it to the host device driver. To avoid
* this situation, we look through /proc/iomem, and if the hypervisor is
- * still holding onto the bar (denoted by the string in the matcher variable),
+ * still holding on to the bar (denoted by the string in the matcher variable),
* then we can wait around a bit for that to clear up.
*
* A typical /proc/iomem looks like this (snipped for brevity):
@@ -1230,7 +1230,7 @@ virPCIDeviceReattach(virPCIDevicePtr dev,
* f0000000-f0003fff : kvm_assigned_device
*
* Returns 0 if we are clear to continue, and 1 if the hypervisor is still
- * holding onto the resource.
+ * holding on to the resource.
*/
int
virPCIDeviceWaitForCleanup(virPCIDevicePtr dev, const char *matcher)
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index fe98813..43e7cb9 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -77,7 +77,7 @@ struct _qemuMonitorTest {
static void qemuMonitorTestItemFree(qemuMonitorTestItemPtr item);
/*
- * Appends data for a reply onto the outgoing buffer
+ * Appends data for a reply to the outgoing buffer
*/
static int qemuMonitorTestAddReponse(qemuMonitorTestPtr test,
const char *response)
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH] audit: properly encode device path in cgroup audit
by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=922186
Commit d04916fa introduced a regression in audit quality - even
though the code was computing the proper escaped name for a
path, it wasn't feeding that escaped name on to the audit message.
As a result, /var/log/audit/audit.log would mention a field
path=/dev/hpet instead of the intended path="/dev/hpet", which
in turn caused ausearch to format the audit log as path=(null).
* src/conf/domain_audit.c (virDomainAuditCgroupPath): Use
constructed encoding.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
A rather embarrassing bug of mine, especially since it took
two years to find that such a trivial fix was needed.
src/conf/domain_audit.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 85d97b4..6d0ae48 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -1,7 +1,7 @@
/*
* domain_audit.c: Domain audit management
*
- * Copyright (C) 2006-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2013 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -682,8 +682,8 @@ virDomainAuditCgroupPath(virDomainObjPtr vm, virCgroupPtr cgroup,
rdev = virDomainAuditGetRdev(path);
if (!(detail = virAuditEncode("path", path)) ||
- virAsprintf(&extra, "path path=%s rdev=%s acl=%s",
- path, VIR_AUDIT_STR(rdev), perms) < 0) {
+ virAsprintf(&extra, "path %s rdev=%s acl=%s",
+ detail, VIR_AUDIT_STR(rdev), perms) < 0) {
VIR_WARN("OOM while encoding audit message");
goto cleanup;
}
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH v2 00/11] qemu: add PCI bridge support
by Ján Tomko
Add new 'pci' controller type with two models:
pci-root - auto-added to a pc* machine, providing pci bus 0
pci-bridge - auto-added if the devices would not leave
at least one slot empty on bus 0 or bus >0 is specified
Ján Tomko (10):
qemu: make qemuComparePCIDevice aware of multiple buses
qemu: print PCI address hexadecimally in errors
qemu: QEMU_PCI constant consistency
qemu: move PCI address check out of qemuPCIAddressAsString
qemu: switch PCI address set from hash table to an array
qemu: rename CheckSlot to SlotInUse
conf: add model attribute to virDomainDefMaybeAddController
conf: add PCI controllers
qemu: auto-add bridges and allow using them
qemu: auto-add pci-root controller for pc machine types
liguang (1):
qemu: build command line for pci-bridge device
docs/schemas/domaincommon.rng | 3 +
src/conf/domain_conf.c | 63 ++-
src/conf/domain_conf.h | 14 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 3 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 477 +++++++++++++--------
src/qemu/qemu_command.h | 4 +-
src/qemu/qemu_domain.c | 37 ++
src/qemu/qemu_hotplug.c | 4 +-
tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 1 +
tests/domainsnapshotxml2xmlout/external_vm.xml | 1 +
tests/domainsnapshotxml2xmlout/full_domain.xml | 1 +
tests/domainsnapshotxml2xmlout/metadata.xml | 1 +
tests/qemuhelptest.c | 21 +-
.../qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml | 1 +
.../qemuxml2argv-blkiotune-device.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-blkiotune.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-boot-floppy.xml | 1 +
.../qemuxml2argv-boot-menu-disable.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-boot-multi.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-boot-network.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-boot-order.xml | 1 +
.../qemuxml2argv-channel-guestfwd.xml | 1 +
.../qemuxml2argv-channel-virtio.xml | 1 +
.../qemuxml2argv-clock-localtime.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.xml | 1 +
.../qemuxml2argv-console-compat.xml | 1 +
.../qemuxml2argv-console-virtio-many.xml | 1 +
.../qemuxml2argv-controller-order.xml | 1 +
.../qemuxml2argv-cpu-eoi-disabled.xml | 1 +
.../qemuxml2argv-cpu-eoi-enabled.xml | 1 +
.../qemuxml2argv-cpu-host-kvmclock.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-cpu-kvmclock.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-cputune.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-aio.xml | 1 +
.../qemuxml2argv-disk-cdrom-empty.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-cdrom.xml | 1 +
.../qemuxml2argv-disk-drive-boot-cdrom.xml | 1 +
.../qemuxml2argv-disk-drive-boot-disk.xml | 1 +
.../qemuxml2argv-disk-drive-cache-directsync.xml | 1 +
.../qemuxml2argv-disk-drive-cache-unsafe.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v1-none.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v1-wb.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v1-wt.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v2-none.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v2-wb.xml | 1 +
.../qemuxml2argv-disk-drive-cache-v2-wt.xml | 1 +
...muxml2argv-disk-drive-error-policy-enospace.xml | 1 +
.../qemuxml2argv-disk-drive-error-policy-stop.xml | 1 +
...rgv-disk-drive-error-policy-wreport-rignore.xml | 1 +
.../qemuxml2argv-disk-drive-fat.xml | 1 +
.../qemuxml2argv-disk-drive-fmt-qcow.xml | 1 +
.../qemuxml2argv-disk-drive-network-gluster.xml | 1 +
.../qemuxml2argv-disk-drive-network-iscsi-auth.xml | 1 +
.../qemuxml2argv-disk-drive-network-iscsi.xml | 1 +
.../qemuxml2argv-disk-drive-network-nbd-export.xml | 1 +
...xml2argv-disk-drive-network-nbd-ipv6-export.xml | 1 +
.../qemuxml2argv-disk-drive-network-nbd-ipv6.xml | 1 +
.../qemuxml2argv-disk-drive-network-nbd-unix.xml | 1 +
.../qemuxml2argv-disk-drive-network-nbd.xml | 1 +
...emuxml2argv-disk-drive-network-rbd-ceph-env.xml | 1 +
.../qemuxml2argv-disk-drive-network-rbd-ipv6.xml | 1 +
.../qemuxml2argv-disk-drive-network-rbd.xml | 1 +
.../qemuxml2argv-disk-drive-network-sheepdog.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-disk-floppy.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-many.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-disk-mirror.xml | 1 +
.../qemuxml2argv-disk-scsi-device.xml | 1 +
.../qemuxml2argv-disk-scsi-disk-vpd.xml | 1 +
...qemuxml2argv-disk-scsi-lun-passthrough-sgio.xml | 1 +
.../qemuxml2argv-disk-scsi-megasas.xml | 1 +
.../qemuxml2argv-disk-scsi-virtio-scsi.xml | 1 +
.../qemuxml2argv-disk-scsi-vscsi.xml | 1 +
.../qemuxml2argv-disk-source-pool.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml | 1 +
.../qemuxml2argv-disk-virtio-scsi-num_queues.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-disk-virtio.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-disk-xenvbd.xml | 1 +
.../qemuxml2argv-encrypted-disk.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-eoi-disabled.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-eoi-enabled.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-event_idx.xml | 1 +
.../qemuxml2argv-floppy-drive-fat.xml | 1 +
.../qemuxml2argv-graphics-listen-network.xml | 1 +
.../qemuxml2argv-graphics-sdl-fullscreen.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml | 1 +
.../qemuxml2argv-graphics-spice-compression.xml | 1 +
.../qemuxml2argv-graphics-spice-qxl-vga.xml | 1 +
.../qemuxml2argv-graphics-spice.xml | 1 +
.../qemuxml2argv-graphics-vnc-sasl.xml | 1 +
.../qemuxml2argv-graphics-vnc-socket.xml | 1 +
.../qemuxml2argv-graphics-vnc-tls.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml | 1 +
.../qemuxml2argv-hostdev-pci-address.xml | 1 +
.../qemuxml2argv-hostdev-usb-address.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-hyperv.xml | 1 +
.../qemuxml2argv-input-usbmouse.xml | 1 +
.../qemuxml2argv-input-usbtablet.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-kvmclock.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-lease.xml | 1 +
.../qemuxml2argv-machine-core-off.xml | 1 +
.../qemuxml2argv-machine-core-on.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-migrate.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-minimal.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.xml | 1 +
.../qemuxml2argv-misc-disable-s3.xml | 1 +
.../qemuxml2argv-misc-disable-suspends.xml | 1 +
.../qemuxml2argv-misc-enable-s4.xml | 1 +
.../qemuxml2argv-misc-no-reboot.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.xml | 1 +
.../qemuxml2argv-net-bandwidth.xml | 1 +
.../qemuxml2argv-net-eth-ifname.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-net-hostdev.xml | 1 +
.../qemuxml2argv-net-openvswitch.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-user.xml | 1 +
.../qemuxml2argv-net-virtio-device.xml | 1 +
.../qemuxml2argv-net-virtio-network-portgroup.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-net-virtio.xml | 1 +
.../qemuxml2argv-nographics-vga.xml | 1 +
.../qemuxml2argv-numad-static-vcpu-no-numatune.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-parallel-tcp.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-pci-rom.xml | 1 +
.../qemuxml2argv-qemu-ns-no-env.xml | 1 +
.../qemuxml2argv-reboot-timeout-disabled.xml | 1 +
.../qemuxml2argv-reboot-timeout-enabled.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-restore-v1.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-restore-v2.xml | 1 +
.../qemuxml2argv-seclabel-dynamic-baselabel.xml | 1 +
.../qemuxml2argv-seclabel-dynamic-override.xml | 1 +
.../qemuxml2argv-seclabel-none.xml | 1 +
.../qemuxml2argv-seclabel-static.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-dev.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-serial-file.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-serial-many.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-pty.xml | 1 +
.../qemuxml2argv-serial-tcp-telnet.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-tcp.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-serial-unix.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-smp.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-sound-device.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-sound.xml | 1 +
.../qemuxml2argv-tpm-passthrough.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-virtio-lun.xml | 1 +
.../qemuxml2argv-virtio-rng-egd.xml | 1 +
.../qemuxml2argv-virtio-rng-random.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-watchdog.xml | 1 +
.../qemuxml2xmlout-balloon-device-auto.xml | 1 +
.../qemuxml2xmlout-channel-virtio-auto.xml | 1 +
.../qemuxml2xmlout-console-compat-auto.xml | 1 +
.../qemuxml2xmlout-console-virtio.xml | 1 +
.../qemuxml2xmlout-disk-mirror.xml | 1 +
.../qemuxml2xmlout-disk-scsi-device-auto.xml | 1 +
.../qemuxml2xmlout-graphics-listen-network2.xml | 1 +
.../qemuxml2xmlout-graphics-spice-timeout.xml | 1 +
.../qemuxml2xmloutdata/qemuxml2xmlout-memtune.xml | 1 +
.../qemuxml2xmloutdata/qemuxml2xmlout-metadata.xml | 1 +
...emuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml | 1 +
...ad-auto-memory-vcpu-no-cpuset-and-placement.xml | 1 +
.../qemuxml2xmlout-numad-auto-vcpu-no-numatune.xml | 1 +
.../qemuxml2xmlout-serial-target-port-auto.xml | 1 +
.../qemuxml2xmlout-usb-ich9-ehci-addr.xml | 1 +
168 files changed, 574 insertions(+), 211 deletions(-)
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCHv2] conf: Reword error message to be more universal
by Peter Krempa
The error message that warns user when a request to chagne/get
persistent configuration of a transient domain is requested suggests
that changes are being made. Reword it to be more universal and allow it
to be used for getter APIs too.
Before:
$ virsh vcpucount transient-domain --config
error: Requested operation is not valid: cannot change persistent config of a transient domain
After:
$ virsh vcpucount transient-domain --config
error: Requested operation is not valid: transient domains do not have any persistent config
---
src/conf/domain_conf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1643f30..758f416 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2251,8 +2251,8 @@ virDomainLiveConfigHelperMethod(virCapsPtr caps,
if (*flags & VIR_DOMAIN_AFFECT_CONFIG) {
if (!dom->persistent) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot change persistent config of a "
- "transient domain"));
+ _("transient domains do not have any "
+ "persistent config"));
goto cleanup;
}
if (!(*persistentDef = virDomainObjGetPersistentDef(caps, xmlopt, dom))) {
--
1.8.2.1
11 years, 7 months
[libvirt] [PATCH] qemu: Enable the capability bit for -no-kvm-pit-reinjection on x86 only
by Viktor Mihajlovski
From: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
On architectures not supporting the Intel specific programmable interval
timer, like e.g. S390, starting a domain with a clock definition containing
a pit timer results in the error "Option no-kvm-pit-reinjection not supported
for this target".
By moving the capability enablement for -no-kvm-pit-reinjection from the
InitQMPBasic section into the x86_64 and i686 only enablement section all
other architectures are no longer automatically enabled. In addition
architecture related capabilities enablements were refactored into a new
architecture bound capabilities initialization function.
Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/qemu/qemu_capabilities.c | 55 ++++++++++++++++++++++++++++--------------
1 file changed, 37 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a95f23c..028e77c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2367,13 +2367,48 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX);
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_OPT);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE);
}
+/* Capabilities that are architecture depending
+ * initialized for QEMU.
+ */
+static int
+virQEMUCapsInitArchQMPBasic(virQEMUCapsPtr qemuCaps,
+ qemuMonitorPtr mon)
+{
+ char *archstr = NULL;
+ int ret = -1;
+
+ if (!(archstr = qemuMonitorGetTargetArch(mon)))
+ return -1;
+
+ if ((qemuCaps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unknown QEMU arch %s"), archstr);
+ goto cleanup;
+ }
+
+ /*
+ * Currently only x86_64 and i686 support PCI-multibus,
+ * -no-acpi and -no-kvm-pit-reinjection.
+ */
+ if (qemuCaps->arch == VIR_ARCH_X86_64 ||
+ qemuCaps->arch == VIR_ARCH_I686) {
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
+ }
+
+ ret = 0;
+
+cleanup:
+ VIR_FREE(archstr);
+ return ret;
+}
static int
virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
@@ -2391,7 +2426,6 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
char *monarg = NULL;
char *monpath = NULL;
char *pidfile = NULL;
- char *archstr;
pid_t pid = 0;
virDomainObj vm;
@@ -2508,23 +2542,8 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
if (qemuCaps->version >= 1003000)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_USB_OPT);
- if (!(archstr = qemuMonitorGetTargetArch(mon)))
- goto cleanup;
-
- if ((qemuCaps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unknown QEMU arch %s"), archstr);
- VIR_FREE(archstr);
+ if (virQEMUCapsInitArchQMPBasic(qemuCaps, mon) < 0)
goto cleanup;
- }
- VIR_FREE(archstr);
-
- /* Currently only x86_64 and i686 support PCI-multibus and -no-acpi. */
- if (qemuCaps->arch == VIR_ARCH_X86_64 ||
- qemuCaps->arch == VIR_ARCH_I686) {
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI);
- }
if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0)
goto cleanup;
--
1.7.9.5
11 years, 7 months
[libvirt] [PATCHv2] network: bridge_driver: don't lose transient networks on daemon restart
by Peter Krempa
Until now tranisent networks weren't really useful as libvirtd wasn't
able to remember them across restarts. This patch adds support for
loading status files of transient networks (that already were generated)
so that the status isn't lost.
This patch chops up virNetworkObjUpdateParseFile and turns it into
virNetworkLoadState and a few friends that will help us to load status
XMLs and refactors the functions that are loading the configs to use
them.
---
Notes:
Version 2:
- renamed confDir to statusDir
- clarified comment about goto
- removed check if bridge name is present in XML
- switched removal of inactive transient networks to while loop to avoid re-iteration
src/conf/network_conf.c | 207 ++++++++++++++++++++++++++++----------------
src/conf/network_conf.h | 10 ++-
src/libvirt_private.syms | 2 +-
src/network/bridge_driver.c | 51 ++++++-----
4 files changed, 171 insertions(+), 99 deletions(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 75584a0..18a7d57 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1967,81 +1967,6 @@ cleanup:
return def;
}
-int
-virNetworkObjUpdateParseFile(const char *filename,
- virNetworkObjPtr net)
-{
- int ret = -1;
- xmlDocPtr xml = NULL;
- xmlNodePtr node = NULL;
- virNetworkDefPtr tmp = NULL;
- xmlXPathContextPtr ctxt = NULL;
-
- xml = virXMLParse(filename, NULL, _("(network status)"));
- if (!xml)
- return -1;
-
- ctxt = xmlXPathNewContext(xml);
- if (ctxt == NULL) {
- virReportOOMError();
- goto cleanup;
- }
-
- node = xmlDocGetRootElement(xml);
- if (xmlStrEqual(node->name, BAD_CAST "networkstatus")) {
- /* Newer network status file. Contains useful
- * info which are not to be found in bare config XML */
- char *class_id = NULL;
- char *floor_sum = NULL;
-
- ctxt->node = node;
- class_id = virXPathString("string(./class_id[1]/@bitmap)", ctxt);
- if (class_id) {
- virBitmapFree(net->class_id);
- if (virBitmapParse(class_id, 0,
- &net->class_id, CLASS_ID_BITMAP_SIZE) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Malformed 'class_id' attribute: %s"),
- class_id);
- VIR_FREE(class_id);
- goto cleanup;
- }
- }
- VIR_FREE(class_id);
-
- floor_sum = virXPathString("string(./floor[1]/@sum)", ctxt);
- if (floor_sum &&
- virStrToLong_ull(floor_sum, NULL, 10, &net->floor_sum) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Malformed 'floor_sum' attribute: %s"),
- floor_sum);
- VIR_FREE(floor_sum);
- }
- VIR_FREE(floor_sum);
- }
-
- node = virXPathNode("//network", ctxt);
- if (!node) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Could not find any 'network' element"));
- goto cleanup;
- }
-
- ctxt->node = node;
- tmp = virNetworkDefParseXML(ctxt);
-
- if (tmp) {
- net->newDef = net->def;
- net->def = tmp;
- }
-
- ret = 0;
-
-cleanup:
- xmlFreeDoc(xml);
- xmlXPathFreeContext(ctxt);
- return ret;
-}
static int
virNetworkDNSDefFormat(virBufferPtr buf,
@@ -2554,6 +2479,104 @@ cleanup:
return ret;
}
+virNetworkObjPtr
+virNetworkLoadState(virNetworkObjListPtr nets,
+ const char *stateDir,
+ const char *name)
+{
+ char *configFile = NULL;
+ virNetworkDefPtr def = NULL;
+ virNetworkObjPtr net = NULL;
+ xmlDocPtr xml = NULL;
+ xmlNodePtr node = NULL;
+ xmlXPathContextPtr ctxt = NULL;
+ virBitmapPtr class_id_map = NULL;
+ unsigned long long floor_sum_val = 0;
+
+
+ if ((configFile = virNetworkConfigFile(stateDir, name)) == NULL)
+ goto error;
+
+ if (!(xml = virXMLParseCtxt(configFile, NULL, _("(network status)"), &ctxt)))
+ goto error;
+
+ if (!(node = virXPathNode("//network", ctxt))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not find any 'network' element in status file"));
+ goto error;
+ }
+
+ /* parse the definition first */
+ ctxt->node = node;
+ if (!(def = virNetworkDefParseXML(ctxt)))
+ goto error;
+
+ if (!STREQ(name, def->name)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Network config filename '%s'"
+ " does not match network name '%s'"),
+ configFile, def->name);
+ goto error;
+ }
+
+ /* now parse possible status data */
+ node = xmlDocGetRootElement(xml);
+ if (xmlStrEqual(node->name, BAD_CAST "networkstatus")) {
+ /* Newer network status file. Contains useful
+ * info which are not to be found in bare config XML */
+ char *class_id = NULL;
+ char *floor_sum = NULL;
+
+ ctxt->node = node;
+ if ((class_id = virXPathString("string(./class_id[1]/@bitmap)", ctxt))) {
+ if (virBitmapParse(class_id, 0, &class_id_map,
+ CLASS_ID_BITMAP_SIZE) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Malformed 'class_id' attribute: %s"),
+ class_id);
+ VIR_FREE(class_id);
+ goto error;
+ }
+ }
+ VIR_FREE(class_id);
+
+ floor_sum = virXPathString("string(./floor[1]/@sum)", ctxt);
+ if (floor_sum &&
+ virStrToLong_ull(floor_sum, NULL, 10, &floor_sum_val) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Malformed 'floor_sum' attribute: %s"),
+ floor_sum);
+ VIR_FREE(floor_sum);
+ }
+ VIR_FREE(floor_sum);
+ }
+
+ /* create the object */
+ if (!(net = virNetworkAssignDef(nets, def, true)))
+ goto error;
+ /* do not put any "goto error" below this comment */
+
+ /* assign status data stored in the network object */
+ if (class_id_map) {
+ virBitmapFree(net->class_id);
+ net->class_id = class_id_map;
+ }
+
+ if (floor_sum_val > 0)
+ net->floor_sum = floor_sum_val;
+
+cleanup:
+ VIR_FREE(configFile);
+ xmlFreeDoc(xml);
+ xmlXPathFreeContext(ctxt);
+ return net;
+
+error:
+ virBitmapFree(class_id_map);
+ virNetworkDefFree(def);
+ goto cleanup;
+}
+
virNetworkObjPtr virNetworkLoadConfig(virNetworkObjListPtr nets,
const char *configDir,
const char *autostartDir,
@@ -2612,6 +2635,40 @@ error:
return NULL;
}
+
+int
+virNetworkLoadAllState(virNetworkObjListPtr nets,
+ const char *stateDir)
+{
+ DIR *dir;
+ struct dirent *entry;
+
+ if (!(dir = opendir(stateDir))) {
+ if (errno == ENOENT)
+ return 0;
+
+ virReportSystemError(errno, _("Failed to open dir '%s'"), stateDir);
+ return -1;
+ }
+
+ while ((entry = readdir(dir))) {
+ virNetworkObjPtr net;
+
+ if (entry->d_name[0] == '.')
+ continue;
+
+ if (!virFileStripSuffix(entry->d_name, ".xml"))
+ continue;
+
+ if ((net = virNetworkLoadState(nets, stateDir, entry->d_name)))
+ virNetworkObjUnlock(net);
+ }
+
+ closedir(dir);
+ return 0;
+}
+
+
int virNetworkLoadAllConfigs(virNetworkObjListPtr nets,
const char *configDir,
const char *autostartDir)
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 1a86e3d..163478c 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -280,9 +280,6 @@ virNetworkDefPtr virNetworkDefParseString(const char *xmlStr);
virNetworkDefPtr virNetworkDefParseFile(const char *filename);
virNetworkDefPtr virNetworkDefParseNode(xmlDocPtr xml,
xmlNodePtr root);
-int virNetworkObjUpdateParseFile(const char *filename,
- virNetworkObjPtr net);
-
char *virNetworkDefFormat(const virNetworkDefPtr def, unsigned int flags);
static inline const char *
@@ -318,10 +315,17 @@ virNetworkObjPtr virNetworkLoadConfig(virNetworkObjListPtr nets,
const char *autostartDir,
const char *file);
+virNetworkObjPtr virNetworkLoadState(virNetworkObjListPtr nets,
+ const char *stateDir,
+ const char *name);
+
int virNetworkLoadAllConfigs(virNetworkObjListPtr nets,
const char *configDir,
const char *autostartDir);
+int virNetworkLoadAllState(virNetworkObjListPtr nets,
+ const char *stateDir);
+
int virNetworkDeleteConfig(const char *configDir,
const char *autostartDir,
virNetworkObjPtr net);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 30fdcd7..f778e9c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -454,6 +454,7 @@ virNetworkIpDefNetmask;
virNetworkIpDefPrefix;
virNetworkList;
virNetworkLoadAllConfigs;
+virNetworkLoadAllState;
virNetworkObjAssignDef;
virNetworkObjFree;
virNetworkObjGetPersistentDef;
@@ -465,7 +466,6 @@ virNetworkObjSetDefTransient;
virNetworkObjUnlock;
virNetworkObjUnsetDefTransient;
virNetworkObjUpdate;
-virNetworkObjUpdateParseFile;
virNetworkRemoveInactive;
virNetworkSaveConfig;
virNetworkSaveStatus;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 6ea09fa..27dd230 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -180,6 +180,7 @@ networkRemoveInactive(struct network_driver *driver,
char *radvdconfigfile = NULL;
char *configfile = NULL;
char *radvdpidbase = NULL;
+ char *statusfile = NULL;
dnsmasqContext *dctx = NULL;
virNetworkDefPtr def = virNetworkObjGetPersistentDef(net);
@@ -201,6 +202,9 @@ networkRemoveInactive(struct network_driver *driver,
if (!(configfile = networkDnsmasqConfigFileName(def->name)))
goto no_memory;
+ if (!(statusfile = virNetworkConfigFile(NETWORK_STATE_DIR, def->name)))
+ goto no_memory;
+
/* dnsmasq */
dnsmasqDelete(dctx);
unlink(leasefile);
@@ -210,6 +214,9 @@ networkRemoveInactive(struct network_driver *driver,
unlink(radvdconfigfile);
virPidFileDelete(NETWORK_PID_DIR, radvdpidbase);
+ /* remove status file */
+ unlink(statusfile);
+
/* remove the network definition */
virNetworkRemoveInactive(&driver->networks, net);
@@ -220,6 +227,7 @@ cleanup:
VIR_FREE(configfile);
VIR_FREE(radvdconfigfile);
VIR_FREE(radvdpidbase);
+ VIR_FREE(statusfile);
dnsmasqContextFree(dctx);
return ret;
@@ -253,33 +261,15 @@ networkBridgeDummyNicName(const char *brname)
}
static void
-networkFindActiveConfigs(struct network_driver *driver) {
+networkFindActiveConfigs(struct network_driver *driver)
+{
unsigned int i;
for (i = 0 ; i < driver->networks.count ; i++) {
virNetworkObjPtr obj = driver->networks.objs[i];
- char *config;
virNetworkObjLock(obj);
- if ((config = virNetworkConfigFile(NETWORK_STATE_DIR,
- obj->def->name)) == NULL) {
- virNetworkObjUnlock(obj);
- continue;
- }
-
- if (access(config, R_OK) < 0) {
- VIR_FREE(config);
- virNetworkObjUnlock(obj);
- continue;
- }
-
- /* Try and load the live config */
- if (virNetworkObjUpdateParseFile(config, obj) < 0)
- VIR_WARN("Unable to update config of '%s' network",
- obj->def->name);
- VIR_FREE(config);
-
/* If bridge exists, then mark it active */
if (obj->def->bridge &&
virNetDevExists(obj->def->bridge) == 1) {
@@ -306,6 +296,21 @@ networkFindActiveConfigs(struct network_driver *driver) {
cleanup:
virNetworkObjUnlock(obj);
}
+
+ /* remove inactive transient networks */
+ i = 0;
+ while (i < driver->networks.count) {
+ virNetworkObjPtr obj = driver->networks.objs[i];
+ virNetworkObjLock(obj);
+
+ if (!obj->persistent && !obj->active) {
+ networkRemoveInactive(driver, obj);
+ continue;
+ }
+
+ virNetworkObjUnlock(obj);
+ i++;
+ }
}
@@ -415,6 +420,10 @@ networkStartup(bool privileged,
/* if this fails now, it will be retried later with dnsmasqCapsRefresh() */
driverState->dnsmasqCaps = dnsmasqCapsNewFromBinary(DNSMASQ);
+ if (virNetworkLoadAllState(&driverState->networks,
+ NETWORK_STATE_DIR) < 0)
+ goto error;
+
if (virNetworkLoadAllConfigs(&driverState->networks,
driverState->networkConfigDir,
driverState->networkAutostartDir) < 0)
@@ -479,6 +488,8 @@ networkReload(void) {
return 0;
networkDriverLock(driverState);
+ virNetworkLoadAllState(&driverState->networks,
+ NETWORK_STATE_DIR);
virNetworkLoadAllConfigs(&driverState->networks,
driverState->networkConfigDir,
driverState->networkAutostartDir);
--
1.8.2.1
11 years, 7 months
[libvirt] [PATCH v2 1/1] Set legacy USB option with default for ppc64.
by Li Zhang
From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
Currently, -device xxx still can't work well for ppc64 platform.
It's better use legacy USB option with default for ppc64.
This patch is to legacy USB option with default for ppc64.
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
v2 -> v1:
* Add test cases for USB controller configuration on PPC64.
src/qemu/qemu_command.c | 3 ++-
.../qemuxml2argv-pseries-usb-default.args | 1 +
.../qemuxml2argv-pseries-usb-default.xml | 17 +++++++++++++++++
.../qemuxml2argv-pseries-usb-multi.args | 1 +
.../qemuxml2argv-pseries-usb-multi.xml | 19 +++++++++++++++++++
tests/qemuxml2argvtest.c | 8 ++++++++
6 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 63b9350..a48eada 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6467,7 +6467,8 @@ qemuBuildCommandLine(virConnectPtr conn,
}
} else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
cont->model == -1 &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
+ (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
+ def->os.arch == VIR_ARCH_PPC64)) {
if (usblegacy) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Multiple legacy USB controllers are "
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
new file mode 100644
index 0000000..745910b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu-system-ppc64 -S -M pseries -m 512 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.xml
new file mode 100644
index 0000000..e62a78c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-default.xml
@@ -0,0 +1,17 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <memory unit='KiB'>524288</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc64' machine='pseries'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <devices>
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <console type='pty'>
+ <address type="spapr-vio"/>
+ </console>
+ <memballoon model="none"/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args
new file mode 100644
index 0000000..ac17b8c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu-system-ppc64 -S -M pseries -m 512 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -device piix3-usb-uhci,id=usb,bus=pci,addr=0x1.0x2 -device pci-ohci,id=usb1,bus=pci,addr=0x3 -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.xml
new file mode 100644
index 0000000..f45d9d1
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-usb-multi.xml
@@ -0,0 +1,19 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <memory unit='KiB'>524288</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc64' machine='pseries'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <devices>
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <console type='pty'>
+ <address type="spapr-vio"/>
+ </console>
+ <controller type='usb' index='0' model='piix3-uhci'/>
+ <controller type='usb' index='1' model='pci-ohci'/>
+ <memballoon model="none"/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index be6c759..3bbe395 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -902,6 +902,14 @@ mymain(void)
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
DO_TEST("pseries-vio", QEMU_CAPS_DRIVE,
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
+ DO_TEST("pseries-usb-default", QEMU_CAPS_DRIVE,
+ QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
+ QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
+ QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION);
+ DO_TEST("pseries-usb-multi", QEMU_CAPS_DRIVE,
+ QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
+ QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_PIIX3_USB_UHCI,
+ QEMU_CAPS_PCI_OHCI, QEMU_CAPS_PCI_MULTIFUNCTION);
DO_TEST("pseries-vio-user-assigned", QEMU_CAPS_DRIVE,
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
DO_TEST_ERROR("pseries-vio-address-clash", QEMU_CAPS_DRIVE,
--
1.8.1.4
11 years, 7 months