[libvirt] [PATCH 0/4] Expose FSFreeze/FSThaw within the guest as commands
by Tomoki Sekiyama
Currently FSFreeze and FSThaw are supported by qemu guest agent and they are
used internally in snapshot-create command with --quiesce option.
However, when users want to utilize the native snapshot feature of storage
devices (such as LVM over iSCSI, various enterprise storage systems, etc.),
they need to issue fsfreeze command separately from libvirt-driven snapshots.
(OpenStack cinder provides these storages' snapshot feature, but it cannot
quiesce the guest filesystems automatically for now.)
Although virDomainQemuGuestAgent() API could be used for this purpose, it
depends too much on specific hypervisor implementation.
This patchset adds virDomainFSFreeze()/virDomainFSThaw() APIs and virsh
domfsfreeze/domfsthaw commands to enable the users to freeze and thaw
domain's filesystems cleanly.
The APIs has mountPoint and flags option currently unsupported for future
extension, as virDomainFSTrim() API.
Duplicated FSFreeze results in error caused by qemu guest agent.
---
Tomoki Sekiyama (4):
Introduce virDomainFSFreeze() public API
remote: Implement virDomainFSFreeze and virDomainFSThaw
qemu: Implement virDomainFSFreeze
virsh: Expose new virDomainFSFreeze and virDomainFSThaw API
include/libvirt/libvirt.h.in | 8 ++
src/access/viraccessperm.c | 2 -
src/access/viraccessperm.h | 6 ++
src/driver.h | 12 ++++
src/libvirt.c | 92 +++++++++++++++++++++++++++
src/libvirt_public.syms | 6 ++
src/qemu/qemu_driver.c | 142 ++++++++++++++++++++++++++++++++++++++++++
src/remote/remote_driver.c | 2 +
src/remote/remote_protocol.x | 26 +++++++-
src/remote_protocol-structs | 12 ++++
src/rpc/gendispatch.pl | 2 +
tools/virsh-domain.c | 108 ++++++++++++++++++++++++++++++++
tools/virsh.pod | 17 +++++
13 files changed, 433 insertions(+), 2 deletions(-)
10 years, 8 months
[libvirt] [PATCH 0/4] qemu: export disk snapshot capability
by Francesco Romani
This patch series extend the QEMU capabilities XML to report
if the underlying QEMU binary supports, or not, the live
disk snapshotting.
Without this patch series, the only way to know if QEMU
has this support is to actually request a disk snapshot and
to see what happens.
The change is split in four patches:
* patch #1
actually adds the new element in the QEMU capabilities XML.
formatcaps.html.in wasn't very detailed about the actual XML format,
so I've not updated it.
Anyone feel free to point out what should be added, and I'll comply.
The new element has the form
<disksnapshot default='value' toggle='off'>
because I'd like to convey two informations:
- disk snapshot is supposed to be here, and it is (default='on')
- disk snapshot is supposed to be here, and is NOT (default='off')
Put in a different way, I tried to help the client as much as
possible.
I'm not particolary fond of this format, and I'm really open to
alternatives here. Perhaps a simpler <disksnapshot/> element can
convey the same meaning? Suggestions welcome.
* patches #2, #3
Are trivial and they provide the ground for the last patch which
add a new unit tests. They are just dependencies for it.
I tried to make them less invasive as possible.
* patch #4
add a new unit test, aiming to test not only this new feature
but also the whole XML capabilities test.
I was under the impression that this kind of test do not really
fit into existing one, so I added a new one.
Suggestions about possible improvements for this test are welcome
Francesco Romani (4):
qemu: export disk snapshot support in capabilities
qemu: add function to fill capabilities cache
qemu: export the virQEMUCapsInitGuest function.
qemu: add unit tests for the capabilities xml
.gitignore | 1 +
docs/schemas/capability.rng | 6 +
src/qemu/qemu_capabilities.c | 40 +++-
src/qemu/qemu_capabilities.h | 4 +
tests/Makefile.am | 10 +-
tests/qemucaps2xmldata/all_1.6.0-1.caps | 142 ++++++++++++++
tests/qemucaps2xmldata/all_1.6.0-1.xml | 51 +++++
tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps | 141 +++++++++++++
tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml | 51 +++++
tests/qemucaps2xmltest.c | 217 +++++++++++++++++++++
10 files changed, 655 insertions(+), 8 deletions(-)
create mode 100644 tests/qemucaps2xmldata/all_1.6.0-1.caps
create mode 100644 tests/qemucaps2xmldata/all_1.6.0-1.xml
create mode 100644 tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps
create mode 100644 tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml
create mode 100644 tests/qemucaps2xmltest.c
--
1.8.4.2
10 years, 9 months
[libvirt] [PATCH] qemu: adjust maxmem/maxvcpu computation
by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=1038363
If a domain has a different maximum for persistent and live maxmem
or max vcpus, then it is possible to hit cases where libvirt
refuses to adjust the current values or gets halfway through
the adjustment before failing. Better is to determine up front
if the change is possible for all requested flags.
* src/qemu/qemu_driver.c (qemuDomainSetMemoryFlags): Compute
correct maximum if both live and config are being set.
(qemuDomainSetVcpusFlags): Likewise.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/qemu/qemu_driver.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a0b3ce3..288b98b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2242,8 +2242,16 @@ static int qemuDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
} else {
/* resize the current memory */
+ unsigned long oldmax = 0;
- if (newmem > vm->def->mem.max_balloon) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE)
+ oldmax = vm->def->mem.max_balloon;
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ if (!oldmax || oldmax > persistentDef->mem.max_balloon)
+ oldmax = persistentDef->mem.max_balloon;
+ }
+
+ if (newmem > oldmax) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("cannot set memory higher than max memory"));
goto endjob;
@@ -4121,6 +4129,7 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
virDomainDefPtr persistentDef;
int ret = -1;
bool maximum;
+ unsigned int maxvcpus = 0;
virQEMUDriverConfigPtr cfg = NULL;
virCapsPtr caps = NULL;
qemuAgentCPUInfoPtr cpuinfo = NULL;
@@ -4168,11 +4177,17 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
goto endjob;
}
- if (!maximum && nvcpus > vm->def->maxvcpus) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE)
+ maxvcpus = vm->def->maxvcpus;
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+ if (!maxvcpus || maxvcpus > persistentDef->maxvcpus)
+ maxvcpus = persistentDef->maxvcpus;
+ }
+ if (!maximum && nvcpus > maxvcpus) {
virReportError(VIR_ERR_INVALID_ARG,
_("requested vcpus is greater than max allowable"
" vcpus for the domain: %d > %d"),
- nvcpus, vm->def->maxvcpus);
+ nvcpus, maxvcpus);
goto endjob;
}
--
1.8.5.3
10 years, 9 months
[libvirt] [PATCH] Rename virDomainGetRootFilesystem to virDomainGetFilesystemForTarget
by Daniel P. Berrange
The virDomainGetRootFilesystem method can be generalized to allow
any filesystem path to be obtained.
While doing this, start a new test case for purpose of testing various
helper methods in the domain_conf.{c,h} files, such as this one.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
.gitignore | 1 +
src/conf/domain_conf.c | 5 +-
src/conf/domain_conf.h | 3 +-
src/libvirt_private.syms | 2 +-
src/lxc/lxc_container.c | 2 +-
src/lxc/lxc_process.c | 2 +-
tests/Makefile.am | 6 ++
tests/domainconfdata/getfilesystem.xml | 28 ++++++++
tests/domainconftest.c | 120 +++++++++++++++++++++++++++++++++
tests/testutils.c | 57 ++++++++++++++++
tests/testutils.h | 5 ++
11 files changed, 225 insertions(+), 6 deletions(-)
create mode 100644 tests/domainconfdata/getfilesystem.xml
create mode 100644 tests/domainconftest.c
diff --git a/.gitignore b/.gitignore
index d5a6cf5..cbb3e8a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -147,6 +147,7 @@
/tests/commandtest
/tests/conftest
/tests/cputest
+/tests/domainconftest
/tests/domainsnapshotxml2xmltest
/tests/esxutilstest
/tests/eventtest
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0079234..dd36026 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17827,12 +17827,13 @@ virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk,
}
virDomainFSDefPtr
-virDomainGetRootFilesystem(virDomainDefPtr def)
+virDomainGetFilesystemForTarget(virDomainDefPtr def,
+ const char *path)
{
size_t i;
for (i = 0; i < def->nfss; i++) {
- if (STREQ(def->fss[i]->dst, "/"))
+ if (STREQ(def->fss[i]->dst, path))
return def->fss[i];
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 647d115..ea7f1a1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2541,7 +2541,8 @@ int virDiskNameToBusDeviceIndex(virDomainDiskDefPtr disk,
int *busIdx,
int *devIdx);
-virDomainFSDefPtr virDomainGetRootFilesystem(virDomainDefPtr def);
+virDomainFSDefPtr virDomainGetFilesystemForTarget(virDomainDefPtr def,
+ const char *path);
int virDomainFSIndexByName(virDomainDefPtr def, const char *name);
int virDomainVideoDefaultType(const virDomainDef *def);
int virDomainVideoDefaultRAM(const virDomainDef *def, int type);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 2dbb8f8..a870e9c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -225,7 +225,7 @@ virDomainFSTypeFromString;
virDomainFSTypeToString;
virDomainFSWrpolicyTypeFromString;
virDomainFSWrpolicyTypeToString;
-virDomainGetRootFilesystem;
+virDomainGetFilesystemForTarget;
virDomainGraphicsAuthConnectedTypeFromString;
virDomainGraphicsAuthConnectedTypeToString;
virDomainGraphicsDefFree;
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index c6bdc8c..c32b085 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1823,7 +1823,7 @@ static int lxcContainerChild(void *data)
if (lxcContainerSetID(vmDef) < 0)
goto cleanup;
- root = virDomainGetRootFilesystem(vmDef);
+ root = virDomainGetFilesystemForTarget(vmDef, "/");
if (argv->nttyPaths) {
const char *tty = argv->ttyPaths[0];
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index cc9c1a2..f0190a0 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -934,7 +934,7 @@ virLXCProcessReadLogOutput(virDomainObjPtr vm,
static int
virLXCProcessEnsureRootFS(virDomainObjPtr vm)
{
- virDomainFSDefPtr root = virDomainGetRootFilesystem(vm->def);
+ virDomainFSDefPtr root = virDomainGetFilesystemForTarget(vm->def, "/");
if (root)
return 0;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 568b7a0..90fb3a0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -65,6 +65,7 @@ EXTRA_DIST = \
commanddata \
confdata \
cputestdata \
+ domainconfdata \
domainschemadata \
domainschematest \
domainsnapshotschematest \
@@ -141,6 +142,7 @@ test_programs = virshtest sockettest \
virportallocatortest \
sysinfotest \
virstoragetest \
+ domainconftest \
$(NULL)
if WITH_REMOTE
@@ -893,6 +895,10 @@ sysinfotest_SOURCES = \
sysinfotest.c testutils.h testutils.c
sysinfotest_LDADD = $(LDADDS)
+domainconftest_SOURCES = \
+ domainconftest.c testutils.h testutils.c
+domainconftest_LDADD = $(LDADDS)
+
fdstreamtest_SOURCES = \
fdstreamtest.c testutils.h testutils.c
fdstreamtest_LDADD = $(LDADDS)
diff --git a/tests/domainconfdata/getfilesystem.xml b/tests/domainconfdata/getfilesystem.xml
new file mode 100644
index 0000000..2ee78b4
--- /dev/null
+++ b/tests/domainconfdata/getfilesystem.xml
@@ -0,0 +1,28 @@
+<domain type='test'>
+ <name>demo</name>
+ <uuid>8369f1ac-7e46-e869-4ca5-759d51478066</uuid>
+ <memory unit='KiB'>500000</memory>
+ <currentMemory unit='KiB'>500000</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64'>hvm</type>
+ <init>/bin/sh</init>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <filesystem type='mount' accessmode='passthrough'>
+ <source dir='/'/>
+ <target dir='/'/>
+ </filesystem>
+ <filesystem type='mount' accessmode='passthrough'>
+ <source dir='/'/>
+ <target dir='/dev'/>
+ </filesystem>
+ <console type='pty'>
+ <target type='lxc' port='0'/>
+ </console>
+ </devices>
+</domain>
diff --git a/tests/domainconftest.c b/tests/domainconftest.c
new file mode 100644
index 0000000..d38ef5c
--- /dev/null
+++ b/tests/domainconftest.c
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Daniel P. Berrange <berrange(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include "testutils.h"
+#include "virerror.h"
+#include "viralloc.h"
+#include "virlog.h"
+
+#include "domain_conf.h"
+
+#define VIR_FROM_THIS VIR_FROM_NONE
+
+static virCapsPtr caps;
+static virDomainXMLOptionPtr xmlopt;
+
+struct testGetFilesystemData {
+ const char *filename;
+ const char *path;
+ bool expectEntry;
+};
+
+static int testGetFilesystem(const void *opaque)
+{
+ int ret = -1;
+ char *xmlData = NULL;
+ virDomainDefPtr def = NULL;
+ char *filename = NULL;
+ const struct testGetFilesystemData *data = opaque;
+ virDomainFSDefPtr fsdef;
+
+ if (virAsprintf(&filename, "%s/domainconfdata/%s.xml",
+ abs_srcdir, data->filename) < 0)
+ goto cleanup;
+
+ if (virtTestLoadFile(filename, &xmlData) < 0)
+ goto cleanup;
+
+ if (!(def = virDomainDefParseString(xmlData, caps, xmlopt,
+ 1 << VIR_DOMAIN_VIRT_TEST, 0)))
+ goto cleanup;
+
+ fsdef = virDomainGetFilesystemForTarget(def,
+ data->path);
+ if (!fsdef) {
+ if (data->expectEntry) {
+ fprintf(stderr, "Expected FS for path '%s' in '%s'\n",
+ data->path, filename);
+ goto cleanup;
+ }
+ } else {
+ if (!data->expectEntry) {
+ fprintf(stderr, "Unexpected FS for path '%s' in '%s'\n",
+ data->path, filename);
+ goto cleanup;
+ }
+ }
+
+ ret = 0;
+
+cleanup:
+ virDomainDefFree(def);
+ VIR_FREE(xmlData);
+ VIR_FREE(filename);
+ return ret;
+}
+
+static int
+mymain(void)
+{
+ int ret = 0;
+
+ if ((caps = virTestGenericCapsInit()) == NULL)
+ goto cleanup;
+
+ if (!(xmlopt = virTestGenericDomainXMLConfInit()))
+ goto cleanup;
+
+#define DO_TEST_GET_FS(fspath, expect) \
+ do { \
+ struct testGetFilesystemData data = { \
+ .filename = "getfilesystem", \
+ .path = fspath, \
+ .expectEntry = expect, \
+ }; \
+ if (virtTestRun("Get FS " fspath, testGetFilesystem, &data) < 0) \
+ ret = -1; \
+ } while (0)
+
+ DO_TEST_GET_FS("/", true);
+ DO_TEST_GET_FS("/dev", true);
+ DO_TEST_GET_FS("/dev/pts", false);
+ DO_TEST_GET_FS("/doesnotexist", false);
+
+ virObjectUnref(caps);
+ virObjectUnref(xmlopt);
+
+ cleanup:
+ return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+VIRT_TEST_MAIN(mymain)
diff --git a/tests/testutils.c b/tests/testutils.c
index 32fe374..ac2a654 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -645,3 +645,60 @@ int virtTestClearLineRegex(const char *pattern,
return 0;
}
+
+
+virCapsPtr virTestGenericCapsInit(void)
+{
+ virCapsPtr caps;
+ virCapsGuestPtr guest;
+
+ if ((caps = virCapabilitiesNew(VIR_ARCH_X86_64,
+ 0, 0)) == NULL)
+ return NULL;
+
+ if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_I686,
+ "/usr/bin/acme-virt", NULL,
+ 0, NULL)) == NULL)
+ goto error;
+
+ if (!virCapabilitiesAddGuestDomain(guest, "test", NULL, NULL, 0, NULL))
+ goto error;
+
+
+ if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64,
+ "/usr/bin/acme-virt", NULL,
+ 0, NULL)) == NULL)
+ goto error;
+
+ if (!virCapabilitiesAddGuestDomain(guest, "test", NULL, NULL, 0, NULL))
+ goto error;
+
+
+ if (virTestGetDebug()) {
+ char *caps_str;
+
+ caps_str = virCapabilitiesFormatXML(caps);
+ if (!caps_str)
+ goto error;
+
+ fprintf(stderr, "Generic driver capabilities:\n%s", caps_str);
+
+ VIR_FREE(caps_str);
+ }
+
+ return caps;
+
+error:
+ virObjectUnref(caps);
+ return NULL;
+}
+
+static virDomainDefParserConfig virTestGenericDomainDefParserConfig;
+static virDomainXMLPrivateDataCallbacks virTestGenericPrivateDataCallbacks;
+
+virDomainXMLOptionPtr virTestGenericDomainXMLConfInit(void)
+{
+ return virDomainXMLOptionNew(&virTestGenericDomainDefParserConfig,
+ &virTestGenericPrivateDataCallbacks,
+ NULL);
+}
diff --git a/tests/testutils.h b/tests/testutils.h
index 674d3df..8d2048b 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -27,6 +27,8 @@
# include "viralloc.h"
# include "virfile.h"
# include "virstring.h"
+# include "capabilities.h"
+# include "domain_conf.h"
# define EXIT_AM_SKIP 77 /* tell Automake we're skipping a test */
# define EXIT_AM_HARDFAIL 99 /* tell Automake that the framework is broken */
@@ -102,4 +104,7 @@ int virtTestMain(int argc,
return virtTestMain(argc, argv, func); \
}
+virCapsPtr virTestGenericCapsInit(void);
+virDomainXMLOptionPtr virTestGenericDomainXMLConfInit(void);
+
#endif /* __VIT_TEST_UTILS_H__ */
--
1.8.4.2
10 years, 9 months
[libvirt] help debugging event timing
by Eric Blake
In my recent work on events, I'm running into something where I'm
stumped on timing behavior. I'm using
virEventRegisterDefaultImpl()/virEventRunDefaultImpl() as my event loop,
and trying to test that an event is firing correctly.
With the test:///default (or any other local URI), if I register an
event callback function, the callback gets invoked almost right after
the event happens. This is the same behavior under test in our
testsuite (in objecteventtest.c). But with qemu:///system (or any other
remote URI), when I register an event callback function, my callback
does not get invoked until I make some other RPC call on the connection.
At first, I thought the events were not being wired up at all, and that
I was just blocking forever because I missed something, but while
stepping through gdb on the client side, I noticed that calling
virConnectDomainEventDeregisterAny() in my shutdown code then indeed
proceeded to go through the entire backlog of events that had been
generated, but at that point I was no longer registered so my callback
was not called. So I ended up using virEventAddTimeout() to set up a
periodic interrupt (at 10 seconds, slow enough to see the delays), where
in the handler I called virConnectGetLibVersion() as a way to force RPC
traffic and at least get events as a result of my timer. If it matters,
I was initially using keepalive_interval=-1 in
/etc/libvirt/libvirtd.conf in order to avoid killing my debug sessions;
but even when I switched to keepalive_interval=3, I'm still seeing the
same delayed behavior (if the keepalive were to make a difference, I
would have expected seeing the event at 3 seconds instead of my timer at
10 seconds).
I thought that the RPC protocol was supposed to allow asynchronous
events, and with minimal downtime. gdb in libvirtd says that
remoteDispatchObjectEventSend() is called in a timely manner, but that
merely queues things up, and I got lost trying to follow where
virNetSocketUpdateIOCallback() turned into something that wakes up the
actual write() to the socket. On the other side, I don't see a call to
virDomainEventDispatchDefaultFunc() which then calls my callback until
the next RPC call/response, but again, I got lost on trying to trace
whether a read() of the socket was getting data in a timely manner but
just not firing anything in my event loop, or whether things were
getting stuck client side after the read but with nothing waking up my
event loop. Any advice on how to better debug where things are getting
stuck, to determine whether the holdup is in the server not sending or
in the client not being responsive to the send? Is it something where
systemtap might give me a better picture? Or better yet, a patch to fix
the problem would be nice.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
10 years, 9 months
[libvirt] [PATCH 0/2] Introduce max_anonymous_clients
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=981729
So far we can limit how many clients are connected,
how many are waiting in accept() line but we could
not control the count of accepted but not
authenticated yet.
Michal Privoznik (2):
virNetServer: Introduce unauth clients counter
daemon: Introduce max_anonymous_clients
daemon/libvirtd-config.c | 1 +
daemon/libvirtd-config.h | 1 +
daemon/libvirtd.aug | 1 +
daemon/libvirtd.c | 1 +
daemon/libvirtd.conf | 3 ++
daemon/remote.c | 21 ++++++++-----
daemon/test_libvirtd.aug.in | 1 +
src/locking/lock_daemon.c | 4 +--
src/lxc/lxc_controller.c | 2 +-
src/rpc/virnetserver.c | 73 +++++++++++++++++++++++++++++++++++++++++----
src/rpc/virnetserver.h | 3 ++
11 files changed, 95 insertions(+), 16 deletions(-)
--
1.8.5.1
10 years, 9 months
[libvirt] [PATCHv6 0/5] Handling of undefine and redefine snapshots with VirtualBox 4.2
by Manuel VIVES
Hi,
This is a serie of patches in order to support undefining and redefining
snapshots with VirtualBox 4.2.
The serie of patches is rather big, and adds among other things some utility
functions unrelated to VirtualBox in patches 1 & 2.
The code review could be done in several parts: e.g. patches 1 & 2 separately to
validate the utility functions.
The VirtualBox API provides only high level operations to manipulate snapshots,
so it not possible to support flags like VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE and
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY with only API calls.
Following an IRC talk with Eric Blake, the decision was taken to emulate these
behaviours by manipulating directly the .vbox XML files.
The first two patches are some util methods for handling regexp and strings that
will be used after.
The third patch brings more details in the snapshot XML returned by libvirt.
We will need those modifications in order to redefine the snapshots.
The fourth patch brings the support of the VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE
and VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT flags in virDomainSnapshotCreateXML.
The fifth and last patch brings the support of the
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY
flag in virDomainSnapshotDelete.
The patches are only tested with Virtualbox 4.2 but the code is
compliant with Virtualbox 4.3 API.
Regards,
Manuel VIVES
v6:
* Rebased because of a massive change in vbox_tmpl.c due to changes in
the handling of different versions of VirtualBox
v5:
* The patches are modified according to a first review by Laine Stump:
* renamed virSearchUuid to virSearchRegex and moved it from
viruuid.{c,h} to virstring.{c,h}.
* Various fixes.
V4:
* The code is compliant with Virtualbox 4.3 API
* Some minor modifications in order to satisfy "make syntax-check"
V3:
* Use of STREQ_NULLABLE instead of STREQ in one case
* Fix the method for finding uuids according to Ján Tomko review
V2:
* Fix a licence problem with the method for string replacement
Manuel VIVES (5):
virstring.h/c: Util method for finding regexp patterns in some
strings
virstring.h/c: Util method for making some find and replace in
strings
vbox_tmpl.c: Better XML description for snapshots
vbox_tmpl.c: Patch for redefining snapshots
vbox_tmpl.c: Add methods for undefining snapshots
po/POTFILES.in | 1 +
src/libvirt_private.syms | 2 +
src/util/virstring.c | 163 +++-
src/util/virstring.h | 4 +
src/vbox/vbox_tmpl.c | 2346 ++++++++++++++++++++++++++++++++++++++++++----
5 files changed, 2346 insertions(+), 170 deletions(-)
--
1.7.10.4
10 years, 9 months
[libvirt] Exposing and calculating CPU APIC IDs (was Re: [Qemu-devel] [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn())
by Eduardo Habkost
On Wed, Jan 15, 2014 at 03:37:04PM +0100, Igor Mammedov wrote:
> On Wed, 15 Jan 2014 20:24:01 +0800
> Chen Fan <chen.fan.fnst(a)cn.fujitsu.com> wrote:
> > On Tue, 2014-01-14 at 11:40 +0100, Igor Mammedov wrote:
> > > On Tue, 14 Jan 2014 17:27:20 +0800
> > > Chen Fan <chen.fan.fnst(a)cn.fujitsu.com> wrote:
> > >
> > > > the intend of this patch is to register cpu vmstates with apic id instead of cpu
> > > > index, due to the property setting of apic_id is behind the cpu initialization. so
> > > > we move the registers of cpu vmstate from cpu_exec_init() to x86_cpu_realizefn() to
> > > > let the set apicid as the parameter.
> > > >
> > > > Signed-off-by: Chen Fan <chen.fan.fnst(a)cn.fujitsu.com>
> > > > ---
> > > > exec.c | 5 +++++
> > > > target-i386/cpu.c | 9 +++++++++
> > > > 2 files changed, 14 insertions(+)
> > > >
> > > > diff --git a/exec.c b/exec.c
> > > > index 7e49e8e..9be5855 100644
> > > > --- a/exec.c
> > > > +++ b/exec.c
> > > > @@ -438,7 +438,9 @@ CPUState *qemu_get_cpu(int index)
> > > > void cpu_exec_init(CPUArchState *env)
> > > > {
> > > > CPUState *cpu = ENV_GET_CPU(env);
> > > > +#if !defined(TARGET_I386)
> > > > CPUClass *cc = CPU_GET_CLASS(cpu);
> > > > +#endif
> > > > CPUState *some_cpu;
> > > > int cpu_index;
> > > >
> > > > @@ -460,6 +462,8 @@ void cpu_exec_init(CPUArchState *env)
> > > > #if defined(CONFIG_USER_ONLY)
> > > > cpu_list_unlock();
> > > > #endif
> > > > +
> > > > +#if !defined(TARGET_I386)
> > > > if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
> > > > vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu);
> > > > }
> > > > @@ -472,6 +476,7 @@ void cpu_exec_init(CPUArchState *env)
> > > > if (cc->vmsd != NULL) {
> > > > vmstate_register(NULL, cpu_index, cc->vmsd, cpu);
> > > > }
> > > > +#endif /* !TARGET_I386 */
> > > > }
> > > >
> > > > #if defined(TARGET_HAS_ICE)
> > > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> > > > index 967529a..dada6f6 100644
> > > > --- a/target-i386/cpu.c
> > > > +++ b/target-i386/cpu.c
> > > > @@ -2552,6 +2552,7 @@ static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp)
> > > > static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
> > > > {
> > > > CPUState *cs = CPU(dev);
> > > > + CPUClass *cc = CPU_GET_CLASS(cs);
> > > > X86CPU *cpu = X86_CPU(dev);
> > > > X86CPUClass *xcc = X86_CPU_GET_CLASS(dev);
> > > > CPUX86State *env = &cpu->env;
> > > > @@ -2615,6 +2616,14 @@ static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
> > > > cpu_reset(cs);
> > > >
> > > > xcc->parent_realize(dev, &local_err);
> > > > +
> > > > + if (qdev_get_vmsd(DEVICE(cs)) == NULL) {
> > > > + vmstate_register(NULL, env->cpuid_apic_id, &vmstate_cpu_common, cs);
> > > > + }
> > > > +
> > > > + if (cc->vmsd != NULL) {
> > > > + vmstate_register(NULL, env->cpuid_apic_id, cc->vmsd, cs);
> > > > + }
> > > how about doing it in common CPUclass.realize()
> > > you can use get_arch_id() for getting CPU id, it returns cpu_index by default
> > > and apic_id for target-i386.
> >
> > Thanks for your kind suggestion, does this mean we can directly move
> > vmstate_register to cpu_common_realizefn()?
> yep, that is a gist of it.
>
> There is more to the issue with discontinuous CPUs, a lot of code still
> use cpu_index and the way it's allocated is not compatible with discontinuous
> CPUs, so this issue should be fixed as well.
>
> Also you propose to use a raw apic id with CLI/user interface.
> I recall there were objections to it since APIC ID contains topology
> information and it's not trivial for user to get it right.
> The last idea that was discussed to fix it was not expose APIC ID to
> user but rather introduce QOM hierarchy like:
> /machine/node/N/socket/X/core/Y/thread/Z
> and use it in user interface as a means to specify an arbitrary CPU
> and let QEMU calculate APIC ID based on this path.
>
> But nobody took on implementing it yet.
We're taking so long to get a decent interface implemented, that part of
me is considering exposing the APIC ID directly like suggested before,
and requiring libvirt to calculate topology-aware APIC IDs[1] to
properly implement CPU hotplug (and possibly for other tasks).
Another part of me is hoping that the libvirt developers ask us to
please not do that, so I can use it as argument against exposing the
APIC IDs directly the next time we discuss this. :)
[1] See target-i386/topology.h for references
--
Eduardo
10 years, 9 months
[libvirt] [PATCH 0/5] fix query-command-line-options
by Amos Kong
This patchset fixed some issues of query-command-line-options:
* some new options haven't arguments can't be queried. (eg: -enable-fips)
* some legcy options have arguments can't be queried. (eg: -vnc display)
More discussion:
http://marc.info/?l=qemu-devel&m=139081830416684&w=2
Amos Kong (5):
qmp: rename query_option_descs() to get_param_infolist()
introduce two marcos to dump the options info
query-command-line-options: query all the options in qemu-options.hx
introduce QEMU_OPTIONS_GENERATE_HELPMSG
query-command-line-options: return help message for legacy options
qapi-schema.json | 5 ++++-
qemu-options-wrapper.h | 27 +++++++++++++++++++++++++++
util/qemu-config.c | 50 +++++++++++++++++++++++++++++++++++++++++---------
3 files changed, 72 insertions(+), 10 deletions(-)
--
1.8.4.2
10 years, 9 months
[libvirt] [PATCHv2 0/6] server-side domain event filtering
by Eric Blake
v1 was here: https://www.redhat.com/archives/libvir-list/2014-January/msg00689.html
Since then, I've rebased it on top of this patch which still
needs review: https://www.redhat.com/archives/libvir-list/2014-January/msg01406.html
as well as added patch 6 so that we don't have to repeat the
exercise of adding a new RPC down the road.
Eric Blake (6):
event: dynamically manage server-side RPC domain events
event: server RPC protocol tweaks for domain lifecycle events
event: prepare client to track domain callbackID
event: client RPC protocol tweaks for domain lifecycle events
event: convert remaining domain events to new style
event: pass reason for PM events
daemon/libvirtd.h | 3 +-
daemon/remote.c | 665 ++++++++++++++++++++++++++-------
src/conf/domain_event.c | 184 ++++++++--
src/conf/domain_event.h | 28 +-
src/conf/network_event.c | 6 +-
src/conf/object_event.c | 35 +-
src/conf/object_event_private.h | 6 +-
src/libvirt_internal.h | 7 +-
src/remote/remote_driver.c | 796 ++++++++++++++++++++++++++++++++--------
src/remote/remote_protocol.x | 195 +++++++++-
src/remote_protocol-structs | 95 +++++
11 files changed, 1679 insertions(+), 341 deletions(-)
--
1.8.5.3
10 years, 9 months