[libvirt] [PATCHv5 0/5] Introduce API to query IP addresses for given domain
by Nehal J Wani
This feature has been requested for a very long time. Since qemu guest
agent gives us reliable results, now the wait is over.
The RFC was first proposed by Michal Privoznik:
http://www.redhat.com/archives/libvir-list/2012-February/msg00437.html
A patch was submitted, using structs:
https://www.redhat.com/archives/libvir-list/2012-June/msg00220.html
Another patch was submitted, using XML:
https://www.redhat.com/archives/libvir-list/2012-June/msg00904.html
Neither of the patches were accepted, probably due to lack of extensibility
and usability. Hence, we thought of using virTypedParameters for reporting
list of interfaces along with their MAC address and IP addresses. The RFC
can be found here:
https://www.redhat.com/archives/libvir-list/2013-July/msg00084.html
The idea of extensibility was rejected and rendered out of scope of
libvirt. Hence, we were back to structs.
This API is called virDomainInterfaceAddresses which returns a dynamically
allocated array of virDomainInterface struct. The great disadvantage is
once this gets released, it's written in stone and we cannot change
or add an item into it.
The API supports two methods:
* Return information (list of all associated interfaces with MAC address
and IP addresses) of all of the domain interfaces by default (if
no interface name is provided)
* Return information for the specified interface (if an interface name
is provided)
v5:
* s/virDomainInterfacesAddresses/virDomainInterfaceAddresses.
* Case for IP aliasing handled using virHashTable.
* New test cases added, involving multiple and 0 IP addresse(s)
per interface.
* IP prefix changed from int to unsigned int.
* Changes to practice libvirt habits.
v4:
* Various style nits, indentation errors, memory leaks fixed.
* https://www.redhat.com/archives/libvir-list/2013-August/msg01265.html
v3:
* Upper bounds to number of interfaces and addresses per interface
introduced.
* Change from array of structs to array of pointers
* ifaces_count moved from function argument to return value
* Changes in variable names
* Test cases added for qemuAgentGetInterfaces.
* https://www.redhat.com/archives/libvir-list/2013-August/msg01215.html
v2:
* Logical errors, memory leaks and few other errors fixed.
* https://www.redhat.com/archives/libvir-list/2013-August/msg00631.html
v1:
* http://www.redhat.com/archives/libvir-list/2013-July/msg01553.html
Nehal J Wani (5):
domifaddr: Implement the public APIs
domifaddr: Implement the remote protocol
domifaddr: Implement the API for qemu
domifaddr: Add virsh support
domifaddr: Expose python binding
daemon/remote.c | 131 +++++++++++++++++++++++++++
examples/python/Makefile.am | 2 +-
examples/python/README | 1 +
examples/python/domipaddrs.py | 50 +++++++++++
include/libvirt/libvirt.h.in | 32 +++++++
python/generator.py | 3 +
python/libvirt-override-api.xml | 8 +-
python/libvirt-override.c | 111 +++++++++++++++++++++++
src/driver.h | 6 ++
src/libvirt.c | 115 ++++++++++++++++++++++++
src/libvirt_public.syms | 6 ++
src/qemu/qemu_agent.c | 193 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_agent.h | 3 +
src/qemu/qemu_driver.c | 55 ++++++++++++
src/remote/remote_driver.c | 99 +++++++++++++++++++++
src/remote/remote_protocol.x | 40 ++++++++-
src/remote_protocol-structs | 24 +++++
tests/qemuagenttest.c | 149 +++++++++++++++++++++++++++++++
tools/virsh-domain-monitor.c | 119 +++++++++++++++++++++++++
tools/virsh.pod | 11 +++
20 files changed, 1155 insertions(+), 3 deletions(-)
create mode 100755 examples/python/domipaddrs.py
--
1.7.11.7
11 years, 3 months
[libvirt] [PATCH 0/n] improvements to native-to-xml parsing
by Eric Blake
I tried to use 'virsh qemu-attach', and hit different failures
with both libvirt.git on Fedora 19, and with an older version
of libvirt on RHEL 6. I'm posting patches that I have so far
to start reviews, but need to write still more patches as I
still haven't succeeded at attaching. I also need to add a
patch to the testsuite to cover the command line that I'm
trying to attach to.
Eric Blake (3):
qemu: only parse basename when determining emulator properties
qemu: simplify list cleanup
qemu: recognize -machine accel=kvm when parsing native
src/conf/domain_conf.c | 6 ++++
src/qemu/qemu_command.c | 87 +++++++++++++++++++++++++------------------------
2 files changed, 50 insertions(+), 43 deletions(-)
--
1.8.3.1
11 years, 3 months
[libvirt] [PATCH] LXC:fix typo in lxc_container.c
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
fix typo in lxc_container.c
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/lxc/lxc_container.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 8abaea0..cf096f3 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1145,7 +1145,7 @@ lxcContainerMountDetectFilesystem(const char *src ATTRIBUTE_UNUSED,
#endif /* ! WITH_BLKID */
/*
- * This functions attempts to do automatic detection of filesystem
+ * This function attempts to do automatic detection of filesystem
* type following the same rules as the util-linux 'mount' binary.
*
* The main difference is that we don't (currently) try to use
@@ -1600,7 +1600,7 @@ static int lxcContainerResolveSymlinks(virDomainDefPtr vmDef)
}
/*
- * This is running as the 'init' process insid the container.
+ * This is running as the 'init' process inside the container.
* It removes some capabilities that could be dangerous to
* host system, since they are not currently "containerized"
*/
@@ -1750,7 +1750,7 @@ static int lxcContainerChild(void *data)
if (lxcContainerSendContinue(argv->handshakefd) < 0) {
virReportSystemError(errno, "%s",
- _("failed to send continue signal to controller"));
+ _("Failed to send continue signal to controller"));
goto cleanup;
}
--
1.8.2.1
11 years, 3 months
[libvirt] [PATCH 0/3] caps: expose the user and group owner of the HV
by Giuseppe Scrivano
virt-manager has no way to known the user/group that run the HV
process without requiring the user to manually set it trough setup.py
or assuming "root" as default value.
This series extends the Guest capabilities with "hv_user" and
"hv_group", to inform the libvirt user about the user/group (when qemu
is used) that run the HV process.
Giuseppe Scrivano (3):
caps: new internal function "virCapabilitiesSetHvUserAndGroup"
qemu: set hv_user/hv_group caps to the user/group which runs qemu
caps: add tests and documentation for hv_user and hv_group
docs/schemas/capability.rng | 10 +++++++
src/conf/capabilities.c | 46 +++++++++++++++++++++++++++++++
src/conf/capabilities.h | 7 +++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_capabilities.c | 3 ++
tests/capabilityschemadata/caps-test2.xml | 4 +++
6 files changed, 71 insertions(+)
--
1.8.3.1
11 years, 3 months
[libvirt] [PATCH 0/3] Keep original file label
by Michal Privoznik
This is just a resurrection of my previous patchset. As of atomicity
problem, I just realized there is none. The qemuProcessHook (which is
responsible for locking the files) is called prior
virSecurityManagerSetAllLabel (responsible for chown()-ing). Anyway,
even if there's still one and it's pre-existing, it shouldn't block this
set, should it?
Michal Privoznik (3):
virFile: Add APIs for extended attributes handling
virfile: Introduce internal API for managing ACL
security_dac: Favour ACLs over chown()
configure.ac | 2 +
libvirt.spec.in | 1 +
m4/virt-acl.m4 | 9 ++
src/Makefile.am | 4 +-
src/libvirt_private.syms | 6 +
src/security/security_dac.c | 297 ++++++++++++++++++++++++++++++++++++++-----
src/util/virfile.c | 301 ++++++++++++++++++++++++++++++++++++++++++++
src/util/virfile.h | 28 +++++
8 files changed, 617 insertions(+), 31 deletions(-)
create mode 100644 m4/virt-acl.m4
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCH] qemu: Remove unnecessary variable assignment
by Hongwei Bi
Remove unnecessary 'addrs = NULL' in
qemuDomainAssignS390Addresses() and
qemuDomainAssignPCIAddresses() due to
the related Free function in label cleanup.
---
src/qemu/qemu_command.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 643532f..3cc9c1d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1320,7 +1320,6 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
qemuDomainCCWAddressSetFree(priv->ccwaddrs);
priv->persistentAddrs = 1;
priv->ccwaddrs = addrs;
- addrs = NULL;
} else {
priv->persistentAddrs = 0;
}
@@ -1901,7 +1900,6 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
qemuDomainPCIAddressSetFree(priv->pciaddrs);
priv->persistentAddrs = 1;
priv->pciaddrs = addrs;
- addrs = NULL;
} else {
priv->persistentAddrs = 0;
}
--
1.7.1
11 years, 3 months
[libvirt] [PATCH 1/1] qemu: avoid users specifying CPU features for non-x86 plaftorm.
by Li Zhang
From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
Currently, only X86 provides users CPU features with CPUID instruction.
If users specify the features for non-x86, it should tell users to
remove them.
This patch is to report one error if features are specified by
users for non-x86 platform.
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
src/qemu/qemu_command.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 91ca86a..1a158e4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10644,6 +10644,14 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
if (*feature == '\0')
goto syntax;
+ if (dom->os.arch != VIR_ARCH_X86_64 &&
+ dom->os.arch != VIR_ARCH_I686) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("%s platform doesn't support CPU features'"),
+ virArchToString(dom->os.arch));
+ goto cleanup;
+ }
+
if (STREQ(feature, "kvmclock")) {
bool present = (policy == VIR_CPU_FEATURE_REQUIRE);
size_t j;
--
1.8.1.4
11 years, 3 months
[libvirt] [PATCH] Docs: fix a typo in virt-login-shell.pod
by Alex Jia
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
tools/virt-login-shell.pod | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virt-login-shell.pod b/tools/virt-login-shell.pod
index e27d500..bcd7855 100644
--- a/tools/virt-login-shell.pod
+++ b/tools/virt-login-shell.pod
@@ -11,7 +11,7 @@ B<virt-login-shell>
The B<virt-login-shell> program is a setuid shell that is used to join
an LXC container that matches the user's name. If the container is not
running, virt-login-shell will attempt to start the container.
-virt-sandbox-shell is not allowed to be run by root. Normal users will get
+virt-login-shell is not allowed to be run by root. Normal users will get
added to a container that matches their username, if it exists, and they are
configured in /etc/libvirt/virt-login-shell.conf.
--
1.7.1
11 years, 3 months
[libvirt] [PATCH] domain_conf: Delete the USB controller check from the USB Device checklist on virDomainDeviceIsUSB
by Liuji (Jeremy)
When using "virsh attach-device" to attach a device, the virDomainDefCompatibleDevice function will check the compatibility.
If the device is a USB device, but the VM don't have any USB controller, the execution of "virsh attach-device" will fails.
It considers the USB controller as a USB device on virDomainDeviceIsUSB, so we can't use "virsh attach-device" to attach a
USB controller for a VM which don't have any other USB controller.
>From ec3257407a9c4aadcd4554dcaad00d40387cf488 Mon Sep 17 00:00:00 2001
From: Liu Ji <jeremy.liu(a)huawei.com>
Date: Thu, 5 Sep 2013 09:56:42 +0800
Subject: [PATCH] domain_conf: Delete the USB controller check from the USB
Device checklist on virDomainDeviceIsUSB
Delete the USB controller check from the USB Device checklist on virDomainDeviceIsUSB, otherwise we
can't use "virsh attach-device" to attach a USB controller for a VM which don't have any other USB controller.
Signed-off-by: Liu Ji <jeremy.liu(a)huawei.com>
---
src/conf/domain_conf.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e3aec69..ffb3254 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16899,8 +16899,6 @@ virDomainDeviceIsUSB(virDomainDeviceDefPtr dev)
int t = dev->type;
if ((t == VIR_DOMAIN_DEVICE_DISK &&
dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) ||
- (t == VIR_DOMAIN_DEVICE_CONTROLLER &&
- dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB) ||
(t == VIR_DOMAIN_DEVICE_INPUT &&
dev->data.input->type == VIR_DOMAIN_INPUT_BUS_USB) ||
(t == VIR_DOMAIN_DEVICE_HOSTDEV &&
--
1.7.11.7
11 years, 3 months
[libvirt] virsh domstate output when kvm killed vs guest OS panic
by Chris Friesen
Hi,
If I kill a libvirt-managed kvm process with "kill -9", running "virsh
domstate --reason <name>" gives
shut off (crashed)
Looking at the code, that corresponds to
VIR_DOMAIN_SHUTOFF/VIR_DOMAIN_SHUTOFF_CRASHED. The comment says that
VIR_DOMAIN_SHUTOFF_CRASHED corresponds to "domain crashed". Is this
supposed to be a crash of the hypervisor, or of the guest OS?
If I trigger a panic in the guest, it sits there in the panicked state
doing nothing and "virsh domstate" gives
running (booted)
So what's the point of VIR_DOMAIN_CRASHED/VIR_DOMAIN_CRASHED_PANICKED?
Chris
11 years, 3 months