Re: [libvirt] [Qemu-devel] [PATCH 6/9] net: Improve layout of 'info network'
by Anthony Liguori
On 06/07/2011 11:45 AM, Jan Kiszka wrote:
> Improve the layout when listing non-vlan clients via 'info network'. The
> result looks like this:
>
> (qemu) info network
> Devices not on any VLAN:
> orphan: net=10.0.2.0, restricted=n
> virtio-net-pci.0: model=virtio-net-pci,macaddr=52:54:00:12:34:56
> \ network2: fd=5
> e1000.0: model=e1000,macaddr=52:54:00:12:34:57
> \ network1: net=10.0.2.0, restricted=n
> rtl8139.0: model=rtl8139,macaddr=52:54:00:12:34:58
>
> ie. peers are grouped, orphans are listed as before.
>
> CC: Markus Armbruster<armbru(a)redhat.com>
> Signed-off-by: Jan Kiszka<jan.kiszka(a)siemens.com>
There isn't a query-network yet in QMP so libvirt is probably still
using the HMP version.
Can someone on the libvirt side Ack/Nack about whether this patch will
break libvirt?
Regards,
Anthony Liguori
> ---
> net.c | 14 +++++++++-----
> 1 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/net.c b/net.c
> index 4f777c3..606ce70 100644
> --- a/net.c
> +++ b/net.c
> @@ -1224,7 +1224,8 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
> void do_info_network(Monitor *mon)
> {
> VLANState *vlan;
> - VLANClientState *vc;
> + VLANClientState *vc, *peer;
> + net_client_type type;
>
> QTAILQ_FOREACH(vlan,&vlans, next) {
> monitor_printf(mon, "VLAN %d devices:\n", vlan->id);
> @@ -1235,11 +1236,14 @@ void do_info_network(Monitor *mon)
> }
> monitor_printf(mon, "Devices not on any VLAN:\n");
> QTAILQ_FOREACH(vc,&non_vlan_clients, next) {
> - monitor_printf(mon, " %s: %s", vc->name, vc->info_str);
> - if (vc->peer) {
> - monitor_printf(mon, " peer=%s", vc->peer->name);
> + peer = vc->peer;
> + type = vc->info->type;
> + if (!peer || type == NET_CLIENT_TYPE_NIC) {
> + monitor_printf(mon, " %s: %s\n", vc->name, vc->info_str);
> + }
> + if (peer&& type == NET_CLIENT_TYPE_NIC) {
> + monitor_printf(mon, " \\ %s: %s\n", peer->name, peer->info_str);
> }
> - monitor_printf(mon, "\n");
> }
> }
>
13 years, 10 months
[libvirt] [PATCH 0/7] lxc: Improve container startup error reporting
by Cole Robinson
Currently most LXC container startup failures result in a reported
success followed immediately by a guest shutoff.
This patch series tries to improve the situation by adding a basic
handshake from driver<->controller and controller<->container. If
the handshake fails, the driver will return the output from the
guest logfile, similar to how we do for qemu guests.
A few additional error reporting improvements are also included.
Cole Robinson (7):
lxc: Drop container stdio as late as possible
lxc: Don't report error in Wait/SendContinue
lxc: Refactor controller command building
lxc: Improve guest startup error reporting
lxc: controller: Improve container error reporting
lxc: Verify root fs exists before mounting
lxc: Ensure container <init> actually exists
src/lxc/lxc_container.c | 67 +++++++++++-------
src/lxc/lxc_container.h | 2 +
src/lxc/lxc_controller.c | 63 ++++++++++++++++-
src/lxc/lxc_driver.c | 173 +++++++++++++++++++++++++++++++++++++---------
4 files changed, 243 insertions(+), 62 deletions(-)
--
1.7.4.4
13 years, 10 months
[libvirt] [PATCH 0/4 v3] More virCommand conversions and cleanups
by Cole Robinson
The following series converts the last user of virExec to use
virCommand. The remaining functionality is then moved out of
util.c and into command.c
v2:
Committed some patches
Dropped final patch, can be submitted seperately
Addressed Eric's comments
v3:
Commited some patches
Addressed Eric's v2 comments
Cole Robinson (4):
qemu: Convert virExec usage to virCommand
util: Remove unused virExec wrapper
util: Implement virRun as a wrapper around virCommand
Move virRun, virExec*, virFork to util/command
cfg.mk | 3 +-
src/libvirt_private.syms | 6 +-
src/lxc/veth.c | 2 +-
src/nwfilter/nwfilter_ebiptables_driver.c | 1 +
src/qemu/qemu_driver.c | 26 +-
src/qemu/qemu_process.c | 2 +-
src/storage/storage_backend_fs.c | 2 +-
src/storage/storage_backend_logical.c | 2 +-
src/util/command.c | 565 ++++++++++++++++++++++++-
src/util/command.h | 14 +
src/util/ebtables.c | 2 +-
src/util/pci.c | 2 +-
src/util/util.c | 661 +----------------------------
src/util/util.h | 32 --
src/vmware/vmware_driver.c | 1 +
15 files changed, 608 insertions(+), 713 deletions(-)
--
1.7.4.4
13 years, 10 months
[libvirt] [PATCH] Fix allocation of veth's to not skip an index
by Daniel P. Berrange
The algorithm for autoassigning vethXXX devices, was always
skipping over the starting dev index when finding a free
name for the guest device. This should only be done if the host
device was autoallocated.
* src/lxc/veth.c: Don't skip over veth indexes
---
src/lxc/veth.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/lxc/veth.c b/src/lxc/veth.c
index a00aa23..22dbed5 100644
--- a/src/lxc/veth.c
+++ b/src/lxc/veth.c
@@ -46,6 +46,7 @@ static int getFreeVethName(char **veth, int startDev)
int devNum = startDev-1;
char *path = NULL;
+ VIR_DEBUG("Find free from veth%d", startDev);
do {
VIR_FREE(path);
++devNum;
@@ -53,6 +54,7 @@ static int getFreeVethName(char **veth, int startDev)
virReportOOMError();
return -1;
}
+ VIR_DEBUG("Probe %s", path);
} while (virFileExists(path));
VIR_FREE(path);
@@ -60,6 +62,7 @@ static int getFreeVethName(char **veth, int startDev)
virReportOOMError();
return -1;
}
+
return devNum;
}
@@ -98,18 +101,19 @@ int vethCreate(char** veth1, char** veth2)
bool veth1_alloc = false;
bool veth2_alloc = false;
- VIR_DEBUG("veth1: %s veth2: %s", NULLSTR(*veth1), NULLSTR(*veth2));
+ VIR_DEBUG("Host: %s guest: %s", NULLSTR(*veth1), NULLSTR(*veth2));
if (*veth1 == NULL) {
if ((vethDev = getFreeVethName(veth1, vethDev)) < 0)
goto cleanup;
- VIR_DEBUG("Assigned veth1: %s", *veth1);
+ VIR_DEBUG("Assigned host: %s", *veth1);
veth1_alloc = true;
+ vethDev++;
}
argv[3] = *veth1;
while (*veth2 == NULL) {
- if ((vethDev = getFreeVethName(veth2, vethDev + 1)) < 0) {
+ if ((vethDev = getFreeVethName(veth2, vethDev)) < 0) {
if (veth1_alloc)
VIR_FREE(*veth1);
goto cleanup;
@@ -122,12 +126,12 @@ int vethCreate(char** veth1, char** veth2)
continue;
}
- VIR_DEBUG("Assigned veth2: %s", *veth2);
+ VIR_DEBUG("Assigned guest: %s", *veth2);
veth2_alloc = true;
}
argv[8] = *veth2;
- VIR_DEBUG("veth1: %s veth2: %s", *veth1, *veth2);
+ VIR_DEBUG("Create Host: %s guest: %s", *veth1, *veth2);
if (virRun(argv, NULL) < 0) {
if (veth1_alloc)
VIR_FREE(*veth1);
--
1.7.4.4
13 years, 10 months
[libvirt] [PATCH] esx: Remove duplicated invalid-argument checks
by Matthias Bolte
Those checks are already performed at the public API level.
---
src/esx/esx_driver.c | 10 ----------
src/esx/esx_storage_driver.c | 5 -----
2 files changed, 0 insertions(+), 15 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 500dc52..a5b96a9 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1479,11 +1479,6 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
esxVI_VirtualMachinePowerState powerState;
int count = 0;
- if (ids == NULL || maxids < 0) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
- return -1;
- }
-
if (maxids == 0) {
return 0;
}
@@ -2895,11 +2890,6 @@ esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
int count = 0;
int i;
- if (names == NULL || maxnames < 0) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
- return -1;
- }
-
if (maxnames == 0) {
return 0;
}
diff --git a/src/esx/esx_storage_driver.c b/src/esx/esx_storage_driver.c
index 6461917..c7fc992 100644
--- a/src/esx/esx_storage_driver.c
+++ b/src/esx/esx_storage_driver.c
@@ -167,11 +167,6 @@ esxListStoragePools(virConnectPtr conn, char **const names, int maxnames)
int count = 0;
int i;
- if (names == NULL || maxnames < 0) {
- ESX_ERROR(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
- return -1;
- }
-
if (maxnames == 0) {
return 0;
}
--
1.7.0.4
13 years, 10 months
[libvirt] vcpupin: fix cpu affinity setting bug of qemu driver
by Taku Izumi
There is the case where cpu affinites for vcpu of qemu doesn't work
correctly.
For example, if only one vcpupin setting entry is provided and its setting
is
not for vcpu0, it doesn't work.
# virsh dumpxml VM
...
<vcpu>4</vcpu>
<cputune>
<vcpupin vcpu='3' cpuset='9-11'/>
</cputune>
...
# virsh start VM
Domain VM started
# virsh vcpuinfo VM
VCPU: 0
CPU: 31
State: running
CPU time: 2.5s
CPU Affinity: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
VCPU: 1
CPU: 12
State: running
CPU time: 0.9s
CPU Affinity: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
VCPU: 2
CPU: 30
State: running
CPU time: 1.5s
CPU Affinity: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
VCPU: 3
CPU: 13
State: running
CPU time: 1.7s
CPU Affinity: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
This patch fixes this problem.
Signed-off-by: Taku Izumi <izumi.taku(a)jp.fujitsu.com>
---
src/qemu/qemu_process.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
Index: libvirt/src/qemu/qemu_process.c
===================================================================
--- libvirt.orig/src/qemu/qemu_process.c
+++ libvirt/src/qemu/qemu_process.c
@@ -1194,7 +1194,7 @@ qemuProcessSetVcpuAffinites(virConnectPt
virNodeInfo nodeinfo;
pid_t vcpupid;
unsigned char *cpumask;
- int vcpu, cpumaplen, hostcpus, maxcpu;
+ int vcpu, cpumaplen, hostcpus, maxcpu, n;
unsigned char *cpumap = NULL;
int ret = -1;
@@ -1223,14 +1223,12 @@ qemuProcessSetVcpuAffinites(virConnectPt
return -1;
}
- for (vcpu = 0; vcpu < def->cputune.nvcpupin; vcpu++) {
- if (vcpu != def->cputune.vcpupin[vcpu]->vcpuid)
- continue;
-
+ for (n = 0; n < def->cputune.nvcpupin; n++) {
int i;
+ vcpu = def->cputune.vcpupin[n]->vcpuid;
memset(cpumap, 0, cpumaplen);
- cpumask = (unsigned char *)def->cputune.vcpupin[vcpu]->cpumask;
+ cpumask = (unsigned char *)def->cputune.vcpupin[n]->cpumask;
vcpupid = priv->vcpupids[vcpu];
/* Convert cpumask to bitmap here. */
13 years, 10 months
[libvirt] USB 2.0 support in qemu
by Gerd Hoffmann
Hi,
Recently USB 2.0 support was merged into upstream qemu, I guess libvirt
and virt-manager needs some bits to support this ...
The docs/usb2.txt file in the qemu source tree carries some information
on how to use it, and also some hints for USB pass-through. The most
recent version (not yet merged upstream) can be found here:
http://www.kraxel.org/cgit/qemu/tree/docs/usb2.txt?h=usb.15
If there are any questions feel free to ask.
cheers,
Gerd
13 years, 10 months
[libvirt] [PATCH] docs: Add doc for video element
by Osier Yang
For backwards compatability, if no <video> is set but there is a
<graphics> tag, then we add a default <video> according to the
guest type. Add docs to tell the user about this to not make
them confused. Especially if they remove the video (such as via
"virsh edit"), it will be surprised for them to see the video
element is still in domain XML.
---
docs/formatdomain.html.in | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f8baffd..455f4dd 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1868,7 +1868,12 @@ qemu-kvm -net nic,model=? /dev/null
<dt><code>video</code></dt>
<dd>
The <code>video</code> element is the a container for describing
- video devices.
+ video devices. NB, for backwards compatability, if no <code>video</code>
+ is set but there is a <code>graphics</code> in domain xml, then libvirt
+ will add a default <code>video</code> according to the guest type, e.g.
+ For a guest of type "kvm", the default <code>video</code> for it is:
+ <code>type</code> with value "cirrus", <code>vram</code> with value "9216",
+ and <code>heads</code> with value "1".
</dd>
<dt><code>model</code></dt>
--
1.7.4
13 years, 10 months
[libvirt] [PATCH] Avoid virGetVersion failure on specific driver support configurations
by Matthias Bolte
virGetVersion itself doesn't take a virConnectPtr, but in order to obtain
the hypervisor version against which libvirt was compiled it is used in
combination with virConnectGetType like this:
hvType = virConnectGetType(conn)
virGetVersion(&libVer, hvType, &typeVer)
When virConnectGetType is called on a remote connection then the remote
driver returns the type of the underlying driver on the server side, for
example QEMU. Then virGetVersion compares hvType to a set of strings that
depend on configure options and returns LIBVIR_VERSION_NUMBER in most
cases. Now this fails in case libvirt on the client side is just compiled
with the remote driver enabled only and the server side has the actual
driver such as the QEMU driver. It just happens to work when the actual
driver is enabled on client and server side. But that's not always true.
I noticed this on FreeBSD:
freebsd# virsh -c qemu+tcp://192.168.178.22/system version
Compiled against library: libvir 0.9.2
error: failed to get the library version
error: this function is not supported by the connection driver: virGetVersion
This is not FreeBSD specific, happens on Windows as well due to the
similar driver support configuration. The problem is that virConnectGetType
returns QEMU, but virGetVersion on the client side only accepts Remote
as hvType due to all other drivers being disabled on the client side.
Daniel P. Berrange suggested to get rid of all the conditional code in
virGetVersion, ignoring the hvType and always setting typeVer to
LIBVIR_VERSION_NUMBER. virConnectGetVersion is supposed to be used to
obtain the hypervisor version.
---
src/libvirt.c | 86 ++++++--------------------------------------------------
1 files changed, 10 insertions(+), 76 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c
index cbe1926..5a96625 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -894,21 +894,24 @@ int virStateActive(void) {
/**
* virGetVersion:
* @libVer: return value for the library version (OUT)
- * @type: the type of connection/driver looked at, if @typeVer is not NULL
+ * @type: the type of the connection driver, ignored, just pass NULL
* @typeVer: optional return value for the version of the hypervisor (OUT)
*
* Provides information on up to two versions: @libVer is the version of the
* library and will always be set unless an error occurs, in which case an
- * error code will be returned. If @typeVer is not NULL it will be set to the
- * version of the hypervisor @type against which the library was compiled.
- * If @type is NULL, "Xen" is assumed, if @type is unknown or not
- * available, an error code will be returned and @typeVer will be 0.
+ * error code will be returned. If @typeVer is not NULL it should have been be
+ * set to the version of the hypervisor @type against which the library was
+ * compiled. Due to a design problem this doesn't work as intented. Therefore,
+ * this function is only usefull to obtain the local library version number via
+ * @libVer. To get the version of the running hypervisor use the
+ * virConnectGetVersion function instead. To get the libvirt library version
+ * used by a connection use the virConnectGetLibVersion instead.
*
* Returns -1 in case of failure, 0 otherwise, and values for @libVer and
* @typeVer have the format major * 1,000,000 + minor * 1,000 + release.
*/
int
-virGetVersion(unsigned long *libVer, const char *type,
+virGetVersion(unsigned long *libVer, const char *type ATTRIBUTE_UNUSED,
unsigned long *typeVer)
{
VIR_DEBUG("libVir=%p, type=%s, typeVer=%p", libVer, type, typeVer);
@@ -921,78 +924,9 @@ virGetVersion(unsigned long *libVer, const char *type,
goto error;
*libVer = LIBVIR_VERSION_NUMBER;
- if (typeVer != NULL) {
- if (type == NULL)
- type = "Xen";
-
-/* FIXME: Add _proper_ type version handling for loadable driver modules... */
-#ifdef WITH_DRIVER_MODULES
+ if (typeVer != NULL)
*typeVer = LIBVIR_VERSION_NUMBER;
-#else
- *typeVer = 0;
-# if WITH_XEN
- if (STRCASEEQ(type, "Xen"))
- *typeVer = xenUnifiedVersion();
-# endif
-# if WITH_TEST
- if (STRCASEEQ(type, "Test"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_QEMU
- if (STRCASEEQ(type, "QEMU"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_LXC
- if (STRCASEEQ(type, "LXC"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_LIBXL
- if (STRCASEEQ(type, "xenlight"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_PHYP
- if (STRCASEEQ(type, "phyp"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_OPENVZ
- if (STRCASEEQ(type, "OpenVZ"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_VMWARE
- if (STRCASEEQ(type, "VMware"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_VBOX
- if (STRCASEEQ(type, "VBox"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_UML
- if (STRCASEEQ(type, "UML"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_ONE
- if (STRCASEEQ(type, "ONE"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_ESX
- if (STRCASEEQ(type, "ESX"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_XENAPI
- if (STRCASEEQ(type, "XenAPI"))
- *typeVer = LIBVIR_VERSION_NUMBER;
-# endif
-# if WITH_REMOTE
- if (STRCASEEQ(type, "Remote"))
- *typeVer = remoteVersion();
-# endif
- if (*typeVer == 0) {
- virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
- goto error;
- }
-#endif /* WITH_DRIVER_MODULES */
- }
return 0;
error:
--
1.7.0.4
13 years, 10 months
[libvirt] [PATCH v2 0/3] add support for changing blkio parameters for inactive domains
by Hu Tao
This series enables user to change blkio parameters for inactive
domains from virsh command line.
CHANGES:
v1-v2:
- unify PARAM_CONFIG/PARAM_LIVE/PARAM_CURRENT
Hu Tao (3):
unify PARAM_CURRENT/PARAM_LIVE/PARAM_CONFIG flags
update qemuDomainGetBlkioParameters to use flags
Update qemuDomainSetBlkioParameters to use flags
include/libvirt/libvirt.h.in | 58 ++----
src/esx/esx_driver.c | 10 +-
src/libvirt.c | 4 +-
src/openvz/openvz_driver.c | 10 +-
src/qemu/qemu_driver.c | 442 ++++++++++++++++++++++++++----------------
src/test/test_driver.c | 42 ++--
src/uml/uml_driver.c | 4 +-
src/vbox/vbox_tmpl.c | 22 +-
tools/virsh.c | 74 ++++----
9 files changed, 371 insertions(+), 295 deletions(-)
--
1.7.3.1
13 years, 10 months