[libvirt] [PATCHv2 00/14] CPU Hotplug series
by Peter Krempa
This is a rebased and a bit improved version of the first posting of support
for cpu hotplug related stuff. Since nobody reviewed v1 I did't specify changes
to the previous version.
Peter Krempa (14):
virsh-domain-monitor: Remove ATTRIBUTE_UNUSED from a argument
qemu: Use bool instead of int in qemuMonitorSetCPU APIs
qemu: Extract more information about vCPUs and threads
qemu_agent: Introduce helpers for agent based CPU hot(un)plug
API: Introduce VIR_DOMAIN_VCPU_AGENT, for agent based CPU hot(un)plug
qemu: Implement request of vCPU state using the guest agent
qemu: Implement support for VIR_DOMAIN_VCPU in qemuDomainSetVcpusFlags
lib: Add API to map virtual cpus of a guest
virsh-domain-monitor: Implement command to map guest vCPUs
qemu: Implement virDomainGetVCPUMap for the qemu driver
qemu: Implement new QMP command for cpu hotplug
lib: Add API to modify vCPU state from the guest using the guest agent
virsh-domain: Implement command for virDomainSetGuestVcpu
qemu: Implement virDomainSetGuestVcpu in qemu driver
daemon/remote.c | 54 +++++
include/libvirt/libvirt.h.in | 26 +++
python/generator.py | 1 +
python/libvirt-override-api.xml | 7 +
python/libvirt-override.c | 66 ++++++
src/driver.h | 14 ++
src/libvirt.c | 153 ++++++++++++-
src/libvirt_public.syms | 7 +
src/qemu/qemu_agent.c | 148 +++++++++++++
src/qemu/qemu_agent.h | 12 ++
src/qemu/qemu_driver.c | 468 +++++++++++++++++++++++++++++++++++++---
src/qemu/qemu_monitor.c | 11 +-
src/qemu/qemu_monitor.h | 13 +-
src/qemu/qemu_monitor_json.c | 86 ++++++--
src/qemu/qemu_monitor_json.h | 4 +-
src/qemu/qemu_monitor_text.c | 94 ++++----
src/qemu/qemu_monitor_text.h | 4 +-
src/qemu/qemu_process.c | 63 ++++--
src/remote/remote_driver.c | 48 +++++
src/remote/remote_protocol.x | 31 ++-
src/remote_protocol-structs | 20 ++
tools/virsh-domain-monitor.c | 112 +++++++++-
tools/virsh-domain.c | 102 ++++++++-
tools/virsh.pod | 42 +++-
24 files changed, 1452 insertions(+), 134 deletions(-)
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH] qemuDomainGetVcpusFlags: Initialize ncpuinfo
by Michal Privoznik
Currently, there's a path to use the ncpuinfo variable uninitialized,
which leads to a compiler warning:
qemu/qemu_driver.c: In function 'qemuDomainGetVcpusFlags':
qemu/qemu_driver.c:4573:9: error: 'ncpuinfo' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
for (i = 0; i < ncpuinfo; i++) {
^
---
Pushed under trivial & build-breaker rules.
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 e5f6988..c24f39c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4512,7 +4512,7 @@ qemuDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
int ret = -1;
virCapsPtr caps = NULL;
qemuAgentCPUInfoPtr cpuinfo = NULL;
- int ncpuinfo;
+ int ncpuinfo = -1;
int i;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH RESEND 0/5] VirtualBox version 4.2 support for libvirt vbox driver
by Manuel VIVES
Hello,
I'm re-sending this patch for reviewing.
If necessary I'm willing to make
some changes to those patches.
I'm currently working on a better management for snapshots with virtualbox,
and my work is based on Virtualbox 4.2 so that's why I'm re sending this patch.
Regards,
Manuel VIVES
Ryan Woodsmall said originally:
"This patch set adds VirtualBox 4.2 initial support for the libvirt vbox driver.
I've tested enough to check capabilities, create a VM, destroy it, etc. Five
patches total:
- Patch 1 is the C API header file from Oracle, cleaned up for libvirt.
- Patch 2 is the version specific source file for version dependency.
- Patch 3 is the src/Makefile.am change to pick up the two new files.
- Patch 4 is the vbox driver support for the new VirtualBox API/version.
- Patch 5 is the vbox_tmpl.c template support for the new version.
A few things have changed in the VirtualBox API - some small (capitalizations
of things in function names like Ip to IP and Dhcp to DHCP) and some much larger
(FindMedium is superceded by OpenMedium). The biggest change for the sake of this
patch set is the signature of CreateMachine is quite a bit different. Using the
Oracle source as a guide, to spin up a VM with a given UUID, it looks like a text
flag has to be passed in a new argument to CreateMachine. This flag is built in the
VirtualBox 4.2 specific ifdefs and is kind of ugly but works. Additionally, there
is now (unused) VM groups support in CreateMachine and the previous 'osTypeId' arg
is currently set to nsnull as in the Oracle code.
The FindMedium to OpenMedium changes were more straightforward and are pretty clear.
The rest of the vbox template changes are basically spelling/capitalization changes
from the looks of things.
This probably isn't perfect, but it works on git and patched against 0.10.2 for a
few quick tests. Not currently on the list, so ping me directly if you need any
other info on these, or if anything could use additional work. Thanks! "
ryan woodsmall (5):
vbox C API header for VirtualBox v4.2
vbox version-specific C file for VirtualBox v4.2
Makefile.am additions for VirtualBox v4.2
vbox driver support for VirtualBox v4.2
vbox template support for VirtualBox v4.2
src/Makefile.am | 3 +-
src/vbox/vbox_CAPI_v4_2.h | 8855 +++++++++++++++++++++++++++++++++++++++++++++
src/vbox/vbox_V4_2.c | 13 +
src/vbox/vbox_driver.c | 8 +
src/vbox/vbox_tmpl.c | 90 +-
5 files changed, 8958 insertions(+), 11 deletions(-)
create mode 100644 src/vbox/vbox_CAPI_v4_2.h
create mode 100644 src/vbox/vbox_V4_2.c
--
1.7.10.4
11 years, 5 months
[libvirt] [PATCH v2] iscsi: pass hostnames to iscsiadm instead of resolving them
by Ján Tomko
iscsiadm now supports specifying hostnames in the portal argument [1]
Instead of resolving the hostname to a single IPv4 address, pass the
hostname to isciadm, allowing IPv6 targets to work.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=907171
[1] https://bugzilla.redhat.com/show_bug.cgi?id=624437
---
v1: https://www.redhat.com/archives/libvir-list/2013-May/msg01930.html
src/storage/storage_backend_iscsi.c | 69 +++++++------------------------------
1 file changed, 12 insertions(+), 57 deletions(-)
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index ad38ab2..0a4cd22 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -24,9 +24,6 @@
#include <config.h>
#include <dirent.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
#include <stdio.h>
@@ -47,55 +44,12 @@
#define VIR_FROM_THIS VIR_FROM_STORAGE
-static int
-virStorageBackendISCSITargetIP(const char *hostname,
- char *ipaddr,
- size_t ipaddrlen)
-{
- struct addrinfo hints;
- struct addrinfo *result = NULL;
- int ret;
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_flags = AI_ADDRCONFIG;
- hints.ai_family = AF_INET;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_protocol = 0;
-
- ret = getaddrinfo(hostname, NULL, &hints, &result);
- if (ret != 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("host lookup failed %s"),
- gai_strerror(ret));
- return -1;
- }
-
- if (result == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("no IP address for target %s"),
- hostname);
- return -1;
- }
-
- if (getnameinfo(result->ai_addr, result->ai_addrlen,
- ipaddr, ipaddrlen, NULL, 0,
- NI_NUMERICHOST) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot format ip addr for %s"),
- hostname);
- freeaddrinfo(result);
- return -1;
- }
-
- freeaddrinfo(result);
- return 0;
-}
-
static char *
virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
{
- char ipaddr[NI_MAXHOST];
- char *portal;
+ char *portal = NULL;
+ const char *host;
+ int port = 3260;
if (source->nhost != 1) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -103,15 +57,16 @@ virStorageBackendISCSIPortal(virStoragePoolSourcePtr source)
return NULL;
}
- if (virStorageBackendISCSITargetIP(source->hosts[0].name,
- ipaddr, sizeof(ipaddr)) < 0)
- return NULL;
+ host = source->hosts[0].name;
+ if (source->hosts[0].port != 0)
+ port = source->hosts[0].port;
- if (virAsprintf(&portal, "%s:%d,1", ipaddr,
- source->hosts[0].port ?
- source->hosts[0].port : 3260) < 0) {
- virReportOOMError();
- return NULL;
+ if (strchr(host, ':')) {
+ if (virAsprintf(&portal, "[%s]:%d,1", host, port) < 0)
+ virReportOOMError();
+ } else {
+ if (virAsprintf(&portal, "%s:%d,1", host, port) < 0)
+ virReportOOMError();
}
return portal;
--
1.8.1.5
11 years, 5 months
[libvirt] [PATCH v2 1/2] virsocket: Introduce virSocketAddrIsAny
by Michal Privoznik
This internal API checks, if passed address is ANYCAST address.
---
src/libvirt_private.syms | 1 +
src/util/virsocketaddr.c | 20 ++++++++++++++++++++
src/util/virsocketaddr.h | 1 +
tests/sockettest.c | 38 ++++++++++++++++++++++++++++++++++++++
4 files changed, 60 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b93629f..1ea7467 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1782,6 +1782,7 @@ virSocketAddrGetPort;
virSocketAddrGetRange;
virSocketAddrIsNetmask;
virSocketAddrIsPrivate;
+virSocketAddrIsWildcard;
virSocketAddrMask;
virSocketAddrMaskByPrefix;
virSocketAddrParse;
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 1071b00..e84c58e 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -227,6 +227,26 @@ virSocketAddrIsPrivate(const virSocketAddrPtr addr)
}
/*
+ * virSocketAddrIsWildcard:
+ * @addr: address to check
+ *
+ * Check if passed address is a variant of ANYCAST address.
+ */
+bool
+virSocketAddrIsWildcard(const virSocketAddrPtr addr)
+{
+ in_addr_t tmp = INADDR_ANY;
+ switch (addr->data.stor.ss_family) {
+ case AF_INET:
+ return memcmp(&addr->data.inet4.sin_addr.s_addr, &tmp,
+ sizeof(addr->data.inet4.sin_addr.s_addr)) == 0;
+ case AF_INET6:
+ return IN6_IS_ADDR_UNSPECIFIED(&addr->data.inet6.sin6_addr.s6_addr);
+ }
+ return false;
+}
+
+/*
* virSocketAddrFormat:
* @addr: an initialized virSocketAddrPtr
*
diff --git a/src/util/virsocketaddr.h b/src/util/virsocketaddr.h
index 1c9e54a..b28fe6c 100644
--- a/src/util/virsocketaddr.h
+++ b/src/util/virsocketaddr.h
@@ -123,4 +123,5 @@ bool virSocketAddrEqual(const virSocketAddrPtr s1,
const virSocketAddrPtr s2);
bool virSocketAddrIsPrivate(const virSocketAddrPtr addr);
+bool virSocketAddrIsWildcard(const virSocketAddrPtr addr);
#endif /* __VIR_SOCKETADDR_H__ */
diff --git a/tests/sockettest.c b/tests/sockettest.c
index 5b36a6c..092de88 100644
--- a/tests/sockettest.c
+++ b/tests/sockettest.c
@@ -157,6 +157,28 @@ static int testNetmaskHelper(const void *opaque)
return testNetmask(data->addr1, data->addr2, data->netmask, data->pass);
}
+static int testWildcard(const char *addrstr,
+ bool pass)
+{
+ virSocketAddr addr;
+
+ if (virSocketAddrParse(&addr, addrstr, AF_UNSPEC) < 0)
+ return -1;
+
+ if (virSocketAddrIsWildcard(&addr))
+ return pass ? 0 : -1;
+ return pass ? -1 : 0;
+}
+
+struct testWildcardData {
+ const char *addr;
+ bool pass;
+};
+static int testWildcardHelper(const void *opaque)
+{
+ const struct testWildcardData *data = opaque;
+ return testWildcard(data->addr, data->pass);
+}
static int
mymain(void)
@@ -223,6 +245,14 @@ mymain(void)
ret = -1; \
} while (0)
+#define DO_TEST_WILDCARD(addr, pass) \
+ do { \
+ struct testWildcardData data = { addr, pass}; \
+ if (virtTestRun("Test wildcard " addr, 1, \
+ testWildcardHelper, &data) < 0) \
+ ret = -1; \
+ } while (0)
+
DO_TEST_PARSE_AND_FORMAT("127.0.0.1", AF_UNSPEC, true);
DO_TEST_PARSE_AND_FORMAT("127.0.0.1", AF_INET, true);
@@ -276,6 +306,14 @@ mymain(void)
DO_TEST_NETMASK("2000::1:1", "9000::1:1",
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:0", false);
+ DO_TEST_WILDCARD("0.0.0.0", true);
+ DO_TEST_WILDCARD("::", true);
+ DO_TEST_WILDCARD("0", true);
+ DO_TEST_WILDCARD("0.0", true);
+ DO_TEST_WILDCARD("0.0.0", true);
+ DO_TEST_WILDCARD("1", false);
+ DO_TEST_WILDCARD("0.1", false);
+
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
1.8.2.1
11 years, 5 months
[libvirt] [PATCH 0/3 v3] Cgroup fixes
by Osier Yang
Instead of only post v2 of 5/7 (v2) in the old mail thread, this
resend the left patches of v2 with a independant thread for easy
reviewing.
v2 - v3:
* 1/7 ~ 4/7 of v1 are pushed.
* goto label "cleanup" is kept with Daniel's suggestion for 5/7 (v1)
* Commit log of 6/7 (v1) are updated a bit to reflect more clear
about the cause
v1 - v2:
* Just resending
v2: https://www.redhat.com/archives/libvir-list/2013-May/msg01314.html
Osier Yang (3):
qemu: Abstract code for the cpu controller setting into a helper
qemu: Set cpuset.cpus for domain process
qemu: Prohibit getting the numa parameters if mode is not strict
src/qemu/qemu_cgroup.c | 94 ++++++++++++++++++++++++++++++++++++--------------
src/qemu/qemu_driver.c | 11 ++++--
2 files changed, 78 insertions(+), 27 deletions(-)
--
1.8.1.4
11 years, 5 months
[libvirt] libxl: calculating free pages in libvirt
by Dario Faggioli
Hi Jim,
As I told you in Dublin, I'm looking into libvirt a bit, with the main
purpose of implementing the NUMA interface for the libxl driver.
While at it I noticed that libxlNodeGetFreeMemory() uses the value
contained in phy_info.free_pages to check how many pages of free memory
we have.
However, starting from (Xen's git) commit bec8f17e, the number of free
pages should be computed like this:
(phy_info.free_pages - phy_info.outstanding_pages)
to take the memory claiming mechanism introduced by Oracle properly into
account. You can see an example of that, for instance, looking at the
output_physinfo() function in tools/libxl/xl_cmdimpl.c (in the Xen
codebase, of course :-) ).
Said commit is from last May, and the claim mechanism altogether --which
includes adding the outstanding_pages field to the libxl_physinfo struct
in libxl-- was introduced during the 4.3 development cycle.
So, forgive the possibly dumb question, but what's the preferred way to
fix this in libvirt, without breaking build with old libxl versions?
(Provided this is something libvirt cares about, does it?)
For other features added within this last dev cycle, libxl has a
`#define LIBXL_HAVE_<foo>' (e.g., LIBXL_HAVE_DOMAIN_NODEAFFINITY), but I
don't see one for this particular field... Konrad, Ian, am I missing it?
If no, should we add it?
Thanks and Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
11 years, 5 months
[libvirt] [PATCH v3 0/2] BSD implementation of virNetDevTapCreate() and virNetDevTapDelete()
by Roman Bogorodskiy
Changes from v2:
* changed error message in virNetDevSetupControl() as per
Dan's suggestion
* avoid compile time signature change for virNetDevSetupControl()
* fixed memleak in virNetDevTapCreate()
Roman Bogorodskiy (2):
Make virNetDevSetupControl() public.
BSD: implement virNetDevTapCreate() and virNetDevTapDelete()
src/libvirt_private.syms | 1 +
src/util/virnetdev.c | 15 +++++-
src/util/virnetdev.h | 15 +++++-
src/util/virnetdevtap.c | 118 ++++++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 144 insertions(+), 5 deletions(-)
--
1.8.0
11 years, 5 months
[libvirt] [PATCH v2 0/2] BSD implementation of virNetDevTapCreate() and virNetDevTapDelete()
by Roman Bogorodskiy
Changes from the previous version:
* virNetDevSetupControl patch: remove pointless <config.h> include from
virnetdev.h
* virnetdevtap.c patch: rebase to include new tapfdSize param for
virNetDevTapCreate()
Roman Bogorodskiy (2):
Make virNetDevSetupControl() public.
BSD: implement virNetDevTapCreate() and virNetDevTapDelete()
src/libvirt_private.syms | 1 +
src/util/virnetdev.c | 15 ++++-
src/util/virnetdev.h | 11 ++++
src/util/virnetdevmacvlan.c | 2 +-
src/util/virnetdevtap.c | 116 ++++++++++++++++++++++++++++++++++++++-
src/util/virnetdevvportprofile.c | 2 +-
6 files changed, 141 insertions(+), 6 deletions(-)
--
1.8.0
11 years, 5 months
[libvirt] [PATCH] build: only install examples when nwfilter is defined
by Jim Fehlig
Only install nwfilter example XML files when WITH_NWFILTER
is defined.
---
examples/xml/nwfilter/Makefile.am | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/examples/xml/nwfilter/Makefile.am b/examples/xml/nwfilter/Makefile.am
index 6264428..0344ce9 100644
--- a/examples/xml/nwfilter/Makefile.am
+++ b/examples/xml/nwfilter/Makefile.am
@@ -39,6 +39,7 @@ confdir = $(sysconfdir)/libvirt
NWFILTER_DIR = "$(DESTDIR)$(sysconfdir)/libvirt/nwfilter"
+if WITH_NWFILTER
install-data-local:
$(MKDIR_P) "$(NWFILTER_DIR)"
for f in $(FILTERS); do \
@@ -50,3 +51,7 @@ uninstall-local::
rm -f "$(NWFILTER_DIR)/$$f"; \
done
-test -z $(shell ls $(NWFILTER_DIR)) || rmdir $(NWFILTER_DIR)
+else
+install-data-local:
+uninstall-local::
+endif
--
1.8.0.1
11 years, 5 months