[libvirt] [PATCH] qemu: Avoid holding the driver lock in trivial snapshot API's
by Peter Krempa
In most of the snapshot API's there's no need to hold the driver lock
the whole time.
This patch adds helper functions that get the domain object in functions
that don't require the driver lock and simplifies call paths from
snapshot-related API's.
---
src/conf/domain_conf.c | 3 +-
src/qemu/qemu_driver.c | 306 +++++++++++++++----------------------------------
2 files changed, 94 insertions(+), 215 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4aa08d0..2e1c86b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14372,7 +14372,8 @@ void virDomainObjLock(virDomainObjPtr obj)
void virDomainObjUnlock(virDomainObjPtr obj)
{
- virMutexUnlock(&obj->lock);
+ if (obj)
+ virMutexUnlock(&obj->lock);
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6848924..e237cb5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -187,6 +187,60 @@ struct qemuAutostartData {
virConnectPtr conn;
};
+
+/* Looks up the domain obj and unlocks the driver */
+static virDomainObjPtr
+qemuDomObjFromDomain(virDomainPtr domain)
+{
+ struct qemud_driver *driver = domain->conn->privateData;
+ virDomainObjPtr vm;
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+ qemuDriverLock(driver);
+ vm = virDomainFindByUUID(&driver->domains, domain->uuid);
+ qemuDriverUnlock(driver);
+ if (!vm) {
+ virUUIDFormat(domain->uuid, uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
+ }
+
+ return vm;
+}
+
+
+/* Looks up domain obj from snapshot and unlocks the driver */
+static virDomainObjPtr
+qemuDomObjFromSnapshot(virDomainSnapshotPtr snapshot)
+{
+ return qemuDomObjFromDomain(snapshot->domain);
+}
+
+
+/* Looks up snapshot obj from VM and name */
+static virDomainSnapshotObjPtr
+qemuSnapObjFromName(virDomainObjPtr vm,
+ const char *name)
+{
+ virDomainSnapshotObjPtr snap = NULL;
+ snap = virDomainSnapshotFindByName(vm->snapshots, name);
+ if (!snap)
+ virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
+ _("no domain snapshot with matching name '%s'"),
+ name);
+
+ return snap;
+}
+
+
+/* Looks up snapshot obj from VM and snapshotPtr */
+static virDomainSnapshotObjPtr
+qemuSnapObjFromSnapshot(virDomainObjPtr vm,
+ virDomainSnapshotPtr snapshot)
+{
+ return qemuSnapObjFromName(vm, snapshot->name);
+}
+
static void
qemuAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED,
void *opaque)
@@ -11305,59 +11359,39 @@ static int qemuDomainSnapshotListNames(virDomainPtr domain, char **names,
int nameslen,
unsigned int flags)
{
- struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm = NULL;
int n = -1;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_ROOTS |
VIR_DOMAIN_SNAPSHOT_FILTERS_ALL, -1);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(domain->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromDomain(domain)))
goto cleanup;
- }
n = virDomainSnapshotObjListGetNames(vm->snapshots, NULL, names, nameslen,
flags);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return n;
}
static int qemuDomainSnapshotNum(virDomainPtr domain,
unsigned int flags)
{
- struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm = NULL;
int n = -1;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_ROOTS |
VIR_DOMAIN_SNAPSHOT_FILTERS_ALL, -1);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(domain->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromDomain(domain)))
goto cleanup;
- }
n = virDomainSnapshotObjListNum(vm->snapshots, NULL, flags);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return n;
}
@@ -11365,29 +11399,19 @@ static int
qemuDomainListAllSnapshots(virDomainPtr domain, virDomainSnapshotPtr **snaps,
unsigned int flags)
{
- struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm = NULL;
int n = -1;
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_ROOTS |
VIR_DOMAIN_SNAPSHOT_FILTERS_ALL, -1);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(domain->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromDomain(domain)))
goto cleanup;
- }
n = virDomainListSnapshots(vm->snapshots, NULL, domain, snaps, flags);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return n;
}
@@ -11397,7 +11421,6 @@ qemuDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
int nameslen,
unsigned int flags)
{
- struct qemud_driver *driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
int n = -1;
@@ -11405,31 +11428,17 @@ qemuDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
VIR_DOMAIN_SNAPSHOT_FILTERS_ALL, -1);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(snapshot->domain->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromSnapshot(snapshot)))
goto cleanup;
- }
- snap = virDomainSnapshotFindByName(vm->snapshots, snapshot->name);
- if (!snap) {
- virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("no domain snapshot with matching name '%s'"),
- snapshot->name);
+ if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
goto cleanup;
- }
n = virDomainSnapshotObjListGetNames(vm->snapshots, snap, names, nameslen,
flags);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return n;
}
@@ -11437,7 +11446,6 @@ static int
qemuDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
- struct qemud_driver *driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
int n = -1;
@@ -11445,30 +11453,16 @@ qemuDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot,
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
VIR_DOMAIN_SNAPSHOT_FILTERS_ALL, -1);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(snapshot->domain->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromSnapshot(snapshot)))
goto cleanup;
- }
- snap = virDomainSnapshotFindByName(vm->snapshots, snapshot->name);
- if (!snap) {
- virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("no domain snapshot with matching name '%s'"),
- snapshot->name);
+ if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
goto cleanup;
- }
n = virDomainSnapshotObjListNum(vm->snapshots, snap, flags);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return n;
}
@@ -11477,7 +11471,6 @@ qemuDomainSnapshotListAllChildren(virDomainSnapshotPtr snapshot,
virDomainSnapshotPtr **snaps,
unsigned int flags)
{
- struct qemud_driver *driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
virDomainSnapshotObjPtr snap = NULL;
int n = -1;
@@ -11485,31 +11478,17 @@ qemuDomainSnapshotListAllChildren(virDomainSnapshotPtr snapshot,
virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS |
VIR_DOMAIN_SNAPSHOT_FILTERS_ALL, -1);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(snapshot->domain->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromSnapshot(snapshot)))
goto cleanup;
- }
- snap = virDomainSnapshotFindByName(vm->snapshots, snapshot->name);
- if (!snap) {
- virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("no domain snapshot with matching name '%s'"),
- snapshot->name);
+ if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
goto cleanup;
- }
n = virDomainListSnapshots(vm->snapshots, snap, snapshot->domain, snaps,
flags);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return n;
}
@@ -11517,64 +11496,40 @@ static virDomainSnapshotPtr qemuDomainSnapshotLookupByName(virDomainPtr domain,
const char *name,
unsigned int flags)
{
- struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm;
virDomainSnapshotObjPtr snap = NULL;
virDomainSnapshotPtr snapshot = NULL;
virCheckFlags(0, NULL);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(domain->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromDomain(domain)))
goto cleanup;
- }
- snap = virDomainSnapshotFindByName(vm->snapshots, name);
- if (!snap) {
- virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("no snapshot with matching name '%s'"), name);
+ if (!(snap = qemuSnapObjFromName(vm, name)))
goto cleanup;
- }
snapshot = virGetDomainSnapshot(domain, snap->def->name);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return snapshot;
}
static int qemuDomainHasCurrentSnapshot(virDomainPtr domain,
unsigned int flags)
{
- struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm;
int ret = -1;
virCheckFlags(0, -1);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(domain->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromDomain(domain)))
goto cleanup;
- }
ret = (vm->current_snapshot != NULL);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return ret;
}
@@ -11582,30 +11537,17 @@ static virDomainSnapshotPtr
qemuDomainSnapshotGetParent(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
- struct qemud_driver *driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm;
virDomainSnapshotObjPtr snap = NULL;
virDomainSnapshotPtr parent = NULL;
virCheckFlags(0, NULL);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(snapshot->domain->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromSnapshot(snapshot)))
goto cleanup;
- }
- snap = virDomainSnapshotFindByName(vm->snapshots, snapshot->name);
- if (!snap) {
- virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("no domain snapshot with matching name '%s'"),
- snapshot->name);
+ if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
goto cleanup;
- }
if (!snap->def->parent) {
virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
@@ -11617,30 +11559,20 @@ qemuDomainSnapshotGetParent(virDomainSnapshotPtr snapshot,
parent = virGetDomainSnapshot(snapshot->domain, snap->def->parent);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return parent;
}
static virDomainSnapshotPtr qemuDomainSnapshotCurrent(virDomainPtr domain,
unsigned int flags)
{
- struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm;
virDomainSnapshotPtr snapshot = NULL;
virCheckFlags(0, NULL);
- qemuDriverLock(driver);
- vm = virDomainFindByUUID(&driver->domains, domain->uuid);
- if (!vm) {
- char uuidstr[VIR_UUID_STRING_BUFLEN];
- virUUIDFormat(domain->uuid, uuidstr);
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromDomain(domain)))
goto cleanup;
- }
if (!vm->current_snapshot) {
virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT, "%s",
@@ -11651,16 +11583,13 @@ static virDomainSnapshotPtr qemuDomainSnapshotCurrent(virDomainPtr domain,
snapshot = virGetDomainSnapshot(domain, vm->current_snapshot->def->name);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return snapshot;
}
static char *qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
- struct qemud_driver *driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
char *xml = NULL;
virDomainSnapshotObjPtr snap = NULL;
@@ -11668,29 +11597,18 @@ static char *qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL);
- qemuDriverLock(driver);
- virUUIDFormat(snapshot->domain->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
- if (!vm) {
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromSnapshot(snapshot)))
goto cleanup;
- }
- snap = virDomainSnapshotFindByName(vm->snapshots, snapshot->name);
- if (!snap) {
- virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("no domain snapshot with matching name '%s'"),
- snapshot->name);
+ if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
goto cleanup;
- }
+
+ virUUIDFormat(snapshot->domain->uuid, uuidstr);
xml = virDomainSnapshotDefFormat(uuidstr, snap->def, flags, 0);
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return xml;
}
@@ -11698,38 +11616,23 @@ static int
qemuDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
- struct qemud_driver *driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
int ret = -1;
virDomainSnapshotObjPtr snap = NULL;
- char uuidstr[VIR_UUID_STRING_BUFLEN];
virCheckFlags(0, -1);
- qemuDriverLock(driver);
- virUUIDFormat(snapshot->domain->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
- if (!vm) {
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromSnapshot(snapshot)))
goto cleanup;
- }
- snap = virDomainSnapshotFindByName(vm->snapshots, snapshot->name);
- if (!snap) {
- virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("no domain snapshot with matching name '%s'"),
- snapshot->name);
+ if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
goto cleanup;
- }
ret = (vm->current_snapshot &&
STREQ(snapshot->name, vm->current_snapshot->def->name));
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return ret;
}
@@ -11738,30 +11641,17 @@ static int
qemuDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
unsigned int flags)
{
- struct qemud_driver *driver = snapshot->domain->conn->privateData;
virDomainObjPtr vm = NULL;
int ret = -1;
virDomainSnapshotObjPtr snap = NULL;
- char uuidstr[VIR_UUID_STRING_BUFLEN];
virCheckFlags(0, -1);
- qemuDriverLock(driver);
- virUUIDFormat(snapshot->domain->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, snapshot->domain->uuid);
- if (!vm) {
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromSnapshot(snapshot)))
goto cleanup;
- }
- snap = virDomainSnapshotFindByName(vm->snapshots, snapshot->name);
- if (!snap) {
- virReportError(VIR_ERR_NO_DOMAIN_SNAPSHOT,
- _("no domain snapshot with matching name '%s'"),
- snapshot->name);
+ if (!(snap = qemuSnapObjFromSnapshot(vm, snapshot)))
goto cleanup;
- }
/* XXX Someday, we should recognize internal snapshots in qcow2
* images that are not tied to a libvirt snapshot; if we ever do
@@ -11769,9 +11659,7 @@ qemuDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot,
ret = 1;
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
- qemuDriverUnlock(driver);
+ virDomainObjUnlock(vm);
return ret;
}
@@ -12439,9 +12327,7 @@ qemuDomainOpenConsole(virDomainPtr dom,
virStreamPtr st,
unsigned int flags)
{
- struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm = NULL;
- char uuidstr[VIR_UUID_STRING_BUFLEN];
int ret = -1;
int i;
virDomainChrDefPtr chr = NULL;
@@ -12450,15 +12336,8 @@ qemuDomainOpenConsole(virDomainPtr dom,
virCheckFlags(VIR_DOMAIN_CONSOLE_SAFE |
VIR_DOMAIN_CONSOLE_FORCE, -1);
- qemuDriverLock(driver);
- virUUIDFormat(dom->uuid, uuidstr);
- vm = virDomainFindByUUID(&driver->domains, dom->uuid);
- qemuDriverUnlock(driver);
- if (!vm) {
- virReportError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ if (!(vm = qemuDomObjFromDomain(dom)))
goto cleanup;
- }
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_OPERATION_INVALID,
@@ -12516,8 +12395,7 @@ qemuDomainOpenConsole(virDomainPtr dom,
}
cleanup:
- if (vm)
- virDomainObjUnlock(vm);
+ virDomainObjUnlock(vm);
return ret;
}
--
1.7.12
12 years, 2 months
[libvirt] Release of libvirt-0.10.2
by Daniel Veillard
Since there was no negative feedback since rc2, I have rolled the
release a bit earlier this morning, it is tagged in git and available
as usual at:
ftp://libvirt.org/libvirt/
Quite a bit of new APIs and some other features, this also includes
a fairly large amount of bug fixes and improvements (250+ commits in
4 weeks so quite an active month !):
Features:
- network: define new API virNetworkUpdate (Laine Stump)
- add support for QEmu sandbox support (Ján Tomko)
- blockjob: add virDomainBlockCommit (Eric Blake)
- node_memory: Define the APIs to get/set memory parameters (Osier Yang)
- list: Define new API virConnectListAllSecrets (Osier Yang)
- list: Define new API virConnectListAllNWFilters (Osier Yang)
- list: Define new API virConnectListAllNodeDevices (Osier Yang)
- parallels: add support of containers to the driver (Dmitry Guryanov)
- list: Define new API virConnectListAllInterfaces (Osier Yang)
- list: Define new API virConnectListAllNetworks (Osier Yang)
- list: Define new API virStoragePoolListAllVolumes (Osier Yang)
- Add PMSUSPENDED life cycle event (Jiri Denemark)
- list: Define new API virStorageListAllStoragePools (Osier Yang)
- Add per-guest S3/S4 state configuration (Martin Kletzander)
- qemu: Support for Block Device IO Limits (Viktor Mihajlovski)
Documentation:
- locking: Remove README file in favor of internals/locking.html (Jiri Denemark)
- fix typo in filesystem docs (Eric Blake)
- include article about libvirt+audit in relatedlinks.html (Marcelo Cerri)
- virsh: Clarify behavior of domain list filtering. (Peter Krempa)
- update usb redirection filter infomation on formatdomain.html (Guannan Ren)
- mention another iaas app built on libvirt (Eric Blake)
- page.xsl: fix FAQ link in subdirectories (Ján Tomko)
- hacking.html.in: fix table of contents (Ján Tomko)
- point out git send-email location, be more stern about make check (Laine Stump)
- examples: Fix event detail printing in python test (Jiri Denemark)
- virsh: Improve the document for pool-list (Osier Yang)
- conf: describe security_driver behavior (Martin Kletzander)
- correct dompmwakeup description (Martin Kletzander)
Portability:
- build: fix nodeinfo build on non-Linux platforms (Eric Blake)
- virBitmap: fix build without HAVE_NUMACTL (Ján Tomko)
- build: Fix build failure on non-linux platform (Osier Yang)
- build: fix missing include (Dwight Engen)
- Look in Debian's multiarch libs too (Guido Günther)
- build: don't fail if libnl-3 is not found (Eric Blake)
- build: Fix typo which causes build failure (Osier Yang)
- build: force libnl1 if netcf also used libnl1 (Eric Blake)
- build: fix build on older gcc (Eric Blake)
- Fix location of SELinux mount during RPM builds (Daniel P. Berrange)
- nwfilter: drop use of awk (Eric Blake)
- build: improved handling of <execinfo.h>, BSD <net/if.h> (Eric Blake)
- Define DYNLIB_NAME on OpenBSD. (Jasper Lievisse Adriaanse)
- build: avoid test failure when sasl was not compiled in (Eric Blake)
- build: avoid check-symfile on non-Linux (Eric Blake)
- build: require netcf-0.2.2 when installing on Fedora18+ (Laine Stump)
- build: don't fail when xsltproc is missing (Eric Blake)
- build: avoid warnings from gcc 4.2.1 (Eric Blake)
- Remove explicit dependency on ceph RPM (Daniel P. Berrange)
- Pass a correct pointer type to localtime_r(3). (Paul Eggert)
- build: use correct libraries for clock_gettime (Eric Blake)
- Include an extra header needed for OpenBSD. (Jasper Lievisse Adriaanse)
- Fix mingw64 build by using intptr_t for int->void* casts (Daniel P. Berrange)
Bug Fixes:
- network: don't "refresh" iptables rules on rule-less networks (Laine Stump)
- qemu: Fix failure path in disk hotplug (Jiri Denemark)
- Ensure existing selinux mount is removed before mounting new one in LXC (Daniel P. Berrange)
- Fix crash accessing a NULL URI when looking up auth credentials (Daniel P. Berrange)
- Ensure autogen.sh exists if bootstrap fails (Daniel P. Berrange)
- security: Don't ignore errors when parsing DAC security labels (Peter Krempa)
- qemu: Transition domain to PAUSED after 'stop' command (Michal Privoznik)
- network: fix element size / length in memmove (Laine Stump)
- network: fix incorrect VIR_NETWORK_UPDATE_COMMAND_* values (Laine Stump)
- virsh: Fix resource leaks when editing files. (Peter Krempa)
- util: don't print free'd dmidecode path (Eric Blake)
- rpc: Fix name of member in remote_protocol-structs (Peter Krempa)
- qemu: Avoid deadlock on HandleAgentEOF (Michal Privoznik)
- conf: avoid freeing network object with undestroyed mutex (Laine Stump)
- Add missing 'goto error' in QEMU command line building (Daniel P. Berrange)
- Fix initialization of virCommandPtr when creating QEMU argv (Daniel P. Berrange)
- Fix 3 broken test cases which were mistakenly raising errors (Daniel P. Berrange)
- qemu: fix uninitialized variable in qemuParseCommandLine (Ján Tomko)
- security: Fix libvirtd crash possibility (Martin Kletzander)
- snapshot: fix rollback failure in transaction mode (Guannan Ren)
- conf: avoid libvirt crash with empty address guestfwd channel (Alex Jia)
- Wait to receive QMP greeting before sending any monitor commands (Daniel P. Berrange)
- parallels: fix parallelsDomainDefineXML for domains with VNC and autoport (Dmitry Guryanov)
- parallels: fix parallelsDoCmdRun in case of command failure (Dmitry Guryanov)
- Backcompt for console devices in virDomainDeviceInfoIterate (Li Zhang)
- fix bug in qemuSetupCgroupForEmulator (Hu Tao)
- python: Initialize new_params in virDomainSetSchedulerParameters (Federico Simoncelli)
- Don't invoke the auth callback if all credentials were in config file (Daniel P. Berrange)
- Call virResetLastError in all virConnectOpen* functions (Daniel P. Berrange)
- Check against python None type when filling in auth parameters (Daniel P. Berrange)
- Fix crash passing an empty list to python openAuth() API (Daniel P. Berrange)
- Fix unwanted closing of libvirt client connection (Christophe Fergeau)
- Fix RPM spec conditional when %{rhel} is not defined (Daniel P. Berrange)
- events: Fix domain event race on client disconnect (Christophe Fergeau)
- Don't assume use of /sys/fs/cgroup (Daniel P. Berrange)
- remove dnsmasq command line parameter "--filterwin2k" (Gene Czarcinski)
- network: prevent infinite hang if ovs-vswitchd isn't running (Laine Stump)
- qemu: don't pin all the cpus (Martin Kletzander)
- build: use re-entrant functions in virsh (Eric Blake)
- qemu: Do not require auth scheme in graphics events (Jiri Denemark)
- qemu: Fix reboot with guest agent (Jiri Denemark)
- qemu: Don't update graphic definitions on password change failure (Peter Krempa)
- python: don't mask libvirt errors (Eric Blake)
- command: shell-quote when logging commands (Eric Blake)
- qemu: fix remote port searching (Martin Kletzander)
- schemas: Fix wwn pattern (Osier Yang)
Improvements:
- Don't install legacy initscripts at same time as systemd ones (Daniel P. Berrange)
- network: log error for unknown virNetworkUpdate command codes (Laine Stump)
- network: make virNetworkObjUpdate error detection/recovery better (Laine Stump)
- Drop unused return value of virLogOutputFunc (Miloslav Trmač)
- Add <seclabel> to character devices. (Richard W.M. Jones)
- Make virSecurityDeviceLabelDefParseXML into generic device <seclabel> parser. (Richard W.M. Jones)
- Improve some debugging log messages in LXC mount setup (Daniel P. Berrange)
- network: backend for virNetworkUpdate of portgroups (Laine Stump)
- network: backend for virNetworkUpdate of dhcp range (Laine Stump)
- virsh: new net-update command (Laine Stump)
- tests: Add tests for dump-core option (Martin Kletzander)
- qemu: add support for dump-guest-core option (Martin Kletzander)
- Add support for limiting guest coredump (Martin Kletzander)
- QEMU Tests for reboot-timeout (Martin Kletzander)
- qemu: Add support for reboot-timeout (Martin Kletzander)
- Add support for reboot-timeout (Martin Kletzander)
- simplify xenXMDomainPinVcpu function (liguang)
- Cleanup of domain_conf sentinels (Martin Kletzander)
- qemu: Cleanup boot parameter building (Martin Kletzander)
- virsh: Move daemon to misc since its not a network (Doug Goldstein)
- build: define WITH_INTERFACE for the driver (Doug Goldstein)
- virsh: Rename QEmu to QEMU to match upstream (Doug Goldstein)
- bitmap: fix problems in previous commit (Eric Blake)
- build: avoid non-portable byte-swapping (Eric Blake)
- Fix minor details not only in apic eoi (Martin Kletzander)
- secret: Fix error for private secrets (Martin Kletzander)
- virNetDevBandwidthClear: Improve error handling (Martin Kletzander)
- syntax-check: fix run.in (Martin Kletzander)
- Add a ./run script for running programs from the local directory. (Richard W.M. Jones)
- daemon: Fix error message when libvirtd is missing. (Richard W.M. Jones)
- gitignore: Ignore .gdb_history file. (Richard W.M. Jones)
- Fix the augea test for qemu libvirtd options (Daniel Veillard)
- network: implement backend of virNetworkUpdate(IP_DHCP_HOST) (Laine Stump)
- network: restart radvd/dnsmasq if needed when libvirtd is restarted (Laine Stump)
- network: implement virNetworkUpdate for test_driver (Laine Stump)
- network: implement virNetworkUpdate for bridge_driver (Laine Stump)
- network: reorganize dnsmasq and radvd config file / startup (Laine Stump)
- conf: implement NetworkObj backend of virNetworkUpdate API (Laine Stump)
- network: utility functions for updating network config (Laine Stump)
- network: implement RPC calls for virNetworkUpdate (Laine Stump)
- tests: add qemu-1.2.0 help data (Ján Tomko)
- qemu: add -sandbox to command line if requested (Ján Tomko)
- qemu: conf: add seccomp_sandbox option (Ján Tomko)
- qemu: add capability flag for seccomp sandbox (Ján Tomko)
- qemu: Use disk wwn in qemu command line (Osier Yang)
- qemu: Add caps to indentify if setting wwn is supported by qemu (Osier Yang)
- conf: Parse and format disk <wwn> (Osier Yang)
- schema: Add schema for disk <wwn> (Osier Yang)
- blockjob: add blockcommit support to rpc (Eric Blake)
- blockjob: add virsh blockcommit (Eric Blake)
- conf: separate functions to parse DHCPHostDef and DHCPRangeDef (Laine Stump)
- remove virDomainCpuSetFormat and virDomainCpuSetParse (Hu Tao)
- xen: eliminate remaining uses of virDomainCpuSetParse (Laine Stump)
- use virBitmap to store nodeinfo. (Hu Tao)
- use virBitmap to store cells' cpumask info. (Hu Tao)
- use virBitmap to store cpumask info. (Hu Tao)
- use virBitmap to store numa nodemask info. (Hu Tao)
- use virBitmap to store cpu affinity info (Hu Tao)
- use virBitmap to store cpupin info (Hu Tao)
- New functions for virBitmap (Hu Tao)
- bitmap: new member variable and function renaming (Hu Tao)
- Build: Fix typos which cause build failure (Osier Yang)
- node_memory: Expose the APIs to Python bindings (Osier Yang)
- node_memory: Expose the APIs to virsh (Osier Yang)
- node_memory: Support get/set memory parameters for drivers (Osier Yang)
- node_memory: Implement the internal APIs (Osier Yang)
- node_memory: Wire up the RPC protocol (Osier Yang)
- list: Use virConnectListAllSecrets in virsh (Osier Yang)
- list: Expose virConnectListAllSecrets to Python binding (Osier Yang)
- list: Implement listAllSecrets (Osier Yang)
- list: Implement RPC calls for virConnectListAllSecrets (Osier Yang)
- list: Use virConnectListAllNWFilters in virsh (Osier Yang)
- list: Expose virConnectListAllNWFilters to Python binding (Osier Yang)
- list: Implement listAllNWFilters (Osier Yang)
- list: Implement RPC calls for virConnectListAllNWFilters (Osier Yang)
- list: Use virConnectListAllNodeDevices in virsh (Osier Yang)
- virsh: Don't motify the const string (Osier Yang)
- list: Expose virConnectListAllNodeDevices to Python binding (Osier Yang)
- list: Implement listAllNodeDevices (Osier Yang)
- list: Add helpers for listing node devices (Osier Yang)
- list: Implement RPC calls for virConnectListAllNodeDevices (Osier Yang)
- Introduce a API for creating QEMU capabilities for a binary (Daniel P. Berrange)
- Remove upfront check for hmp - just try it cope with failure (Daniel P. Berrange)
- Don't overwrite errors raised by qemuMonitorHMPCommand (Daniel P. Berrange)
- qemu: Add support for EOI with APIC (Martin Kletzander)
- Add support for EOI with APIC (Martin Kletzander)
- Improve virTypedParameterValidateSet (Osier Yang)
- parallels: implement containers creation (Dmitry Guryanov)
- parallels: fix parallelsDomainDefineXML for existing containers (Dmitry Guryanov)
- parallels: handle unlimited cpus on containers (Dmitry Guryanov)
- Fix data types used for list sizes in QEMU capabilities (Daniel P. Berrange)
- Add API for copying instances of the qemuCapsPtr object (Daniel P. Berrange)
- Add ability to store other metadata in the qemu capabilities object (Daniel P. Berrange)
- Make qemuCapsProbeCommand static (Daniel P. Berrange)
- Turn QEMU capabilities object into a full virObjectPtr (Daniel P. Berrange)
- Allow caps to be NULL when creating virDomainObjPtr instances (Daniel P. Berrange)
- Add a virBitmapCopy API (Daniel P. Berrange)
- test: add xml2argvtest for usb-redir filter and update xml schema (Guannan Ren)
- qemu: build USB redirection filter qemu command line (Guannan Ren)
- qemu: define and parse USB redirection filter XML (Guannan Ren)
- virsh: Fix version numbers in comments (Osier Yang)
- qemu: add usb-redir.filter qemu capability flag (Guannan Ren)
- maint: fix missing spaces in message (Eric Blake)
- build: avoid confusing make with raw name 'undefine' (Eric Blake)
- Add API for opening a QEMU monitor from a socket FD (Daniel P. Berrange)
- list: Expose virConnectListAllInterfaces to Python binding (Osier Yang)
- list: Use virConnectListAllInterfaces in virsh (Osier Yang)
- list: Implement listAllInterfaces (Osier Yang)
- list: Implemente RPC calls for virConnectListAllInterfaces (Osier Yang)
- build: avoid dirty docs on fresh bootstrap (Eric Blake)
- Print any exception that occurs in authentication callback (Daniel P. Berrange)
- virsh: Fix the typos (Osier Yang)
- list: Expose virConnectListAllNetworks to Python binding (Osier Yang)
- list: Use virConnectListAllNetworks in virsh (Osier Yang)
- list: Implement listAllNetworks for test driver (Osier Yang)
- list: Implement listAllNetworks for network driver (Osier Yang)
- list: Add helpers to list network objects (Osier Yang)
- list: Implement RPC calls for virConnectListAllNetworks (Osier Yang)
- list: Expose virStoragePoolListAllVolumes to Python binding (Osier Yang)
- list: Use virStoragePoolListAllVolumes in virsh (Osier Yang)
- list: Implement virStoragePoolListAllVolumes for test driver (Osier Yang)
- list: Implement virStoragePoolListAllVolumes for storage driver (Osier Yang)
- list: Implement RPC calls for virStoragePoolListAllVolumes (Osier Yang)
- Introduce a test suite for the JSON monitor (Daniel P. Berrange)
- Add helper library for testing the qemu monitor code (Daniel P. Berrange)
- Add non-null annotations to qemuMonitorOpen (Daniel P. Berrange)
- Fix PMSuspend and PMWakeup events (Jiri Denemark)
- virsh: Update only changed scheduler tunables (Peter Krempa)
- util: Add helper to assign typed params from string (Peter Krempa)
- qemu: Add range checking for scheduler tunables when changed by API (Peter Krempa)
- qemu: clean up qemuSetSchedulerParametersFlags() (Peter Krempa)
- list: fix typo in virsh patch (Eric Blake)
- Remove duplicate symbols and add test case (Daniel P. Berrange)
- python: Expose virStorageListAllStoragePools to python binding (Osier Yang)
- list: Use virConnectListAllStoragePools in virsh (Osier Yang)
- list: Change MATCH for common use in virsh (Osier Yang)
- virsh: Fix the wrong doc for pool-list (Osier Yang)
- list: Add helper to convert strings separated by ', ' to array (Osier Yang)
- list: Implement listAllStoragePools for test driver (Osier Yang)
- list: Implement listAllStoragePools for storage driver (Osier Yang)
- list: Implement the RPC calls for virConnectListAllStoragePools (Osier Yang)
- list: Add helpers for listing storage pool objects (Osier Yang)
- esx: Add implementation for virConnectListAllDomains() (Peter Krempa)
- hyperv: Add implementation for virConnectListAllDomains() (Peter Krempa)
- maint: avoid doubled name in syntax check failures (Eric Blake)
- Rename iolimit to blockio. (Viktor Mihajlovski)
- tests: Add tests for qemu S3/S4 state configuration (Martin Kletzander)
- qemu: Add support for S3/S4 state configuration (Martin Kletzander)
- conf: Support for Block Device IO Limits (Viktor Mihajlovski)
- virsh: Improve checking for connection when running commands (Peter Krempa)
- util: Update the inconsistent and outdated comments (Osier Yang)
Cleanups:
- Remove redundant lines in src/qemu/qemu_driver.c (Tang Chen)
- Remove a redundant line in src/qemu/qemu_driver.c (Tang Chen)
- maint: fix up copyright notice inconsistencies (Eric Blake)
- build: avoid unused symbol (Eric Blake)
- Adhere to copyright_address check (Guido Günther)
- qemuhelptest: convert runaway tab to spaces (Ján Tomko)
- qemu: drop unused arguments for dump-guest-memory (Eric Blake)
- Build: Fix typos which cause build failure (Osier Yang)
- esx: Remove unused variable from esxDomainGetAutostart (Matthias Bolte)
- build: avoid tabs that failed syntax-check (Eric Blake)
- virsh: remove unneeded usage of vshConnectionUsability() (Peter Krempa)
Thanks everybody for the help on this release, with bug reports,
ideas and patches ! I would expect the next release to happen at the end
of October, i.e. keep the monthly release schedule,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
12 years, 2 months
[libvirt] libvirt qemu-kvm installation into custom directories
by Onkar N Mahajan
I am configuring upstream libvirt, qemu-kvm for development
purpose in non-default directories. I want my upstream libvirt
installation to use upstream qemu-kvm (and not the qemu-kvm supplied
by the distro). How can I make libvirt to use this qemu-kvm
for guest installations ? The Host contains other libvirt/qemu-kvm
supplied by-default by the distro which I am not running but which
I *do not* want to disturb. Please give me some pointers as to to do
this.
-- Onkar
12 years, 2 months
[libvirt] Fw: Enabling Freescale PowerPC Architecture support for Libvirt
by VeeraReddy
Hi ,
We want to enable Freescale PowerPC Architecture support for
Libvirt. So that Libvirt can be run on Freescale Platforms.
Please let us know how do we proceed on this.
Do we need to implement our architecture driver for this and
send it to you so that further releases of Libvirt will have Freescale
Architecture support or do we need to follow any other approach.
Please let us know.
Regards,
Veera.
12 years, 2 months
[libvirt] [PATCH] build: fix detection of netcf linked with libnl1
by Christophe Fergeau
Commit 9298bfbcb introduced code to detect if netcf is linked with
libnl1, and to prefer libnl1 over libnl3 when this is the case.
This behaviour can be disabled by setting LIBNL_CFLAGS to any value,
including the empty string.
However, configure.ac sets LIBNL_CFLAGS to "" before attempting
libnl detection, so the libnl1 detection code is always disabled.
This caused issues on my f17 system where netcf is linked with libnl1
but libvirt got built with libnl3.
This commit removes the setting of the LIBNL_* variables to "" as
this does not appear to be needed. After this change, libnl1 is
used when building libvirt on my f17 system.
---
configure.ac | 4 ----
1 file changed, 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3e90672..2cedc3f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2925,10 +2925,6 @@ AM_CONDITIONAL([WITH_VIRTUALPORT], [test "$with_virtualport" = "yes"])
dnl netlink library
-LIBNL_ROUTE3_CFLAGS=""
-LIBNL_ROUTE3_LIBS=""
-LIBNL_CFLAGS=""
-LIBNL_LIBS=""
have_libnl=no
if test "$with_linux" = "yes"; then
--
1.7.11.4
12 years, 2 months
[libvirt] [libvirt-php] add API function 'libvirt_domain_reset' to support 'virsh reset' command since libvirt 0.9.7
by icez network
I'm implementing a php interface to libvirt which uses libvirt-php as an
api but i found that there's missing command in the libvirt-php module that
use to hard reset the vm (from command 'virsh reset') so I have to add it
using the same process as the 'libvirt_domain_reboot' function. Here is the
patch for it:
diff -ur libvirt-php-0.4.6.orig/src/libvirt-php.c
libvirt-php-0.4.6/src/libvirt-php.c
--- libvirt-php-0.4.6.orig/src/libvirt-php.c 2012-08-20 11:22:39.000000000
+0700
+++ libvirt-php-0.4.6/src/libvirt-php.c 2012-09-24 13:50:34.751140249 +0700
@@ -102,6 +102,7 @@
PHP_FE(libvirt_domain_managedsave, NULL)
PHP_FE(libvirt_domain_undefine, NULL)
PHP_FE(libvirt_domain_reboot, NULL)
+ PHP_FE(libvirt_domain_reset, NULL)
PHP_FE(libvirt_domain_define_xml, NULL)
PHP_FE(libvirt_domain_create_xml, NULL)
PHP_FE(libvirt_domain_memory_peek,NULL)
@@ -4910,6 +4911,28 @@
}
/*
+ Function name: libvirt_domain_reset
+ Since version: 0.4.6-iz
+ Description: Function is used to reset the domain identified by it's
resource
+ Arguments: @res [resource]: libvirt domain resource, e.g. from
libvirt_domain_lookup_by_*()
+ Returns: TRUE for success, FALSE on error
+*/
+PHP_FUNCTION(libvirt_domain_reset)
+{
+ php_libvirt_domain *domain=NULL;
+ zval *zdomain;
+ int retval;
+ long flags=0;
+
+ GET_DOMAIN_FROM_ARGS("r|l",&zdomain,&flags);
+
+ retval=virDomainReset(domain->domain,flags);
+ DPRINTF("%s: virDomainReset(%p) returned %d\n", PHPFUNC, domain->domain,
retval);
+ if (retval != 0) RETURN_FALSE;
+ RETURN_TRUE;
+}
+
+/*
Function name: libvirt_domain_define_xml
Since version: 0.4.1(-1)
Description: Function is used to define the domain from XML string
diff -ur libvirt-php-0.4.6.orig/src/libvirt-php.h
libvirt-php-0.4.6/src/libvirt-php.h
--- libvirt-php-0.4.6.orig/src/libvirt-php.h 2012-08-07 22:11:25.000000000
+0700
+++ libvirt-php-0.4.6/src/libvirt-php.h 2012-09-24 13:49:05.428130682 +0700
@@ -314,6 +314,7 @@
PHP_FUNCTION(libvirt_domain_managedsave);
PHP_FUNCTION(libvirt_domain_undefine);
PHP_FUNCTION(libvirt_domain_reboot);
+PHP_FUNCTION(libvirt_domain_reset);
PHP_FUNCTION(libvirt_domain_define_xml);
PHP_FUNCTION(libvirt_domain_create_xml);
PHP_FUNCTION(libvirt_domain_memory_peek);
--
Personal hosting by icez network
http://www.thzhost.com
12 years, 2 months
[libvirt] [PATCH] Don't install legacy initscripts at same time as systemd ones
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The Fedora policies don't want us installing the legacy initscripts
in parallel with the systemd ones, so switch to only install the
systemd unit
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt.spec.in | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 1192739..a392663 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1217,9 +1217,7 @@ of recent versions of Linux (and other OSes).
%define with_packager_version --with-packager-version="%{release}"
%if %{with_systemd}
-# We use 'systemd+redhat', so if someone installs upstart or
-# legacy init scripts, they can still start libvirtd, etc
-%define init_scripts --with-init_script=systemd+redhat
+%define init_scripts --with-init_script=systemd
%else
%define init_scripts --with-init_script=redhat
%endif
--
1.7.11.2
12 years, 2 months
[libvirt] [PATCH v8][re-send] support offline migration
by liguang
original migration did not aware of offline case
so, add code to support offline migration quietly
(did not disturb original migration) by pass
VIR_MIGRATE_OFFLINE flag to migration APIs if only
the domain is really inactive, and
migration process will not puzzled by domain
offline and exit unexpectedly.
these changes did not take care of disk images the
domain required, for them could be transferred by
other APIs as suggested, then VIR_MIGRATE_OFFLINE
should not combined with VIR_MIGRATE_NON_SHARED_*.
so, this migration result is just make domain
definition alive at target side.
Signed-off-by: liguang <lig.fnst(a)cn.fujitsu.com>
---
include/libvirt/libvirt.h.in | 1 +
src/qemu/qemu_driver.c | 15 ++++++++++++
src/qemu/qemu_migration.c | 52 ++++++++++++++++++++++++++++++++++++-----
src/qemu/qemu_migration.h | 3 +-
tools/virsh-domain.c | 6 +++++
5 files changed, 69 insertions(+), 8 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index cfe5047..77df2ab 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -995,6 +995,7 @@ typedef enum {
* whole migration process; this will be used automatically
* when supported */
VIR_MIGRATE_UNSAFE = (1 << 9), /* force migration even if it is considered unsafe */
+ VIR_MIGRATE_OFFLINE = (1 << 10), /* offline migrate */
} virDomainMigrateFlags;
/* Domain migration. */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b12d9bc..2380ccc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9641,6 +9641,15 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
}
if (!virDomainObjIsActive(vm)) {
+ if (flags & VIR_MIGRATE_OFFLINE) {
+ if (flags & (VIR_MIGRATE_NON_SHARED_DISK|
+ VIR_MIGRATE_NON_SHARED_INC)) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("migrating storage handled by volume APIs"));
+ goto endjob;
+ }
+ goto offline;
+ }
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto endjob;
@@ -9653,6 +9662,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
if (qemuDomainCheckEjectableMedia(driver, vm, asyncJob) < 0)
goto endjob;
+offline:
if (!(xml = qemuMigrationBegin(driver, vm, xmlin, dname,
cookieout, cookieoutlen,
flags)))
@@ -9888,6 +9898,11 @@ qemuDomainMigrateConfirm3(virDomainPtr domain,
goto cleanup;
}
+ if (flags & VIR_MIGRATE_OFFLINE) {
+ ret = 0;
+ goto cleanup;
+ }
+
if (!qemuMigrationJobIsActive(vm, QEMU_ASYNC_JOB_MIGRATION_OUT))
goto cleanup;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 1b21ef6..cb63264 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -70,6 +70,7 @@ enum qemuMigrationCookieFlags {
QEMU_MIGRATION_COOKIE_FLAG_GRAPHICS,
QEMU_MIGRATION_COOKIE_FLAG_LOCKSTATE,
QEMU_MIGRATION_COOKIE_FLAG_PERSISTENT,
+ QEMU_MIGRATION_COOKIE_FLAG_OFFLINE,
QEMU_MIGRATION_COOKIE_FLAG_LAST
};
@@ -77,12 +78,13 @@ enum qemuMigrationCookieFlags {
VIR_ENUM_DECL(qemuMigrationCookieFlag);
VIR_ENUM_IMPL(qemuMigrationCookieFlag,
QEMU_MIGRATION_COOKIE_FLAG_LAST,
- "graphics", "lockstate", "persistent");
+ "graphics", "lockstate", "persistent", "offline");
enum qemuMigrationCookieFeatures {
QEMU_MIGRATION_COOKIE_GRAPHICS = (1 << QEMU_MIGRATION_COOKIE_FLAG_GRAPHICS),
QEMU_MIGRATION_COOKIE_LOCKSTATE = (1 << QEMU_MIGRATION_COOKIE_FLAG_LOCKSTATE),
QEMU_MIGRATION_COOKIE_PERSISTENT = (1 << QEMU_MIGRATION_COOKIE_FLAG_PERSISTENT),
+ QEMU_MIGRATION_COOKIE_OFFLINE = (1 << QEMU_MIGRATION_COOKIE_FLAG_OFFLINE),
};
typedef struct _qemuMigrationCookieGraphics qemuMigrationCookieGraphics;
@@ -439,6 +441,9 @@ qemuMigrationCookieXMLFormat(struct qemud_driver *driver,
virBufferAdjustIndent(buf, -2);
}
+ if (mig->flags & QEMU_MIGRATION_COOKIE_OFFLINE)
+ virBufferAsprintf(buf, " <offline/>\n");
+
virBufferAddLit(buf, "</qemu-migration>\n");
return 0;
}
@@ -662,6 +667,11 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
VIR_FREE(nodes);
}
+ if ((flags & QEMU_MIGRATION_COOKIE_OFFLINE)) {
+ if (virXPathBoolean("count(./offline) > 0", ctxt))
+ mig->flags |= QEMU_MIGRATION_COOKIE_OFFLINE;
+ }
+
return 0;
error:
@@ -721,6 +731,10 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig,
qemuMigrationCookieAddPersistent(mig, dom) < 0)
return -1;
+ if (flags & QEMU_MIGRATION_COOKIE_OFFLINE) {
+ mig->flags |= QEMU_MIGRATION_COOKIE_OFFLINE;
+ }
+
if (!(*cookieout = qemuMigrationCookieXMLFormatStr(driver, mig)))
return -1;
@@ -1151,6 +1165,13 @@ char *qemuMigrationBegin(struct qemud_driver *driver,
QEMU_MIGRATION_COOKIE_LOCKSTATE) < 0)
goto cleanup;
+ if (flags & VIR_MIGRATE_OFFLINE) {
+ if (qemuMigrationBakeCookie(mig, driver, vm,
+ cookieout, cookieoutlen,
+ QEMU_MIGRATION_COOKIE_OFFLINE) < 0)
+ goto cleanup;
+ }
+
if (xmlin) {
if (!(def = virDomainDefParseString(driver->caps, xmlin,
QEMU_EXPECTED_VIRT_TYPES,
@@ -1314,6 +1335,15 @@ qemuMigrationPrepareAny(struct qemud_driver *driver,
goto endjob;
}
+ if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen,
+ QEMU_MIGRATION_COOKIE_OFFLINE)))
+ return ret;
+
+ if (mig->flags & QEMU_MIGRATION_COOKIE_OFFLINE) {
+ ret = 0;
+ goto cleanup;
+ }
+
/* Start the QEMU daemon, with the same command-line arguments plus
* -incoming $migrateFrom
*/
@@ -1856,7 +1886,8 @@ qemuMigrationRun(struct qemud_driver *driver,
virLockManagerPluginGetName(driver->lockManager));
return -1;
}
-
+ if (flags & VIR_MIGRATE_OFFLINE)
+ return 0;
if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen,
QEMU_MIGRATION_COOKIE_GRAPHICS)))
goto cleanup;
@@ -2372,6 +2403,8 @@ static int doPeer2PeerMigrate3(struct qemud_driver *driver,
qemuDomainObjExitRemoteWithDriver(driver, vm);
}
VIR_FREE(dom_xml);
+ if (flags & VIR_MIGRATE_OFFLINE)
+ goto cleanup;
if (ret == -1)
goto cleanup;
@@ -2477,7 +2510,7 @@ finish:
vm->def->name);
cleanup:
- if (ddomain) {
+ if (ddomain || (flags & VIR_MIGRATE_OFFLINE)) {
virObjectUnref(ddomain);
ret = 0;
} else {
@@ -2554,7 +2587,7 @@ static int doPeer2PeerMigrate(struct qemud_driver *driver,
}
/* domain may have been stopped while we were talking to remote daemon */
- if (!virDomainObjIsActive(vm)) {
+ if (!virDomainObjIsActive(vm) && !(flags & VIR_MIGRATE_OFFLINE)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("guest unexpectedly quit"));
goto cleanup;
@@ -2617,7 +2650,7 @@ qemuMigrationPerformJob(struct qemud_driver *driver,
if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
goto cleanup;
- if (!virDomainObjIsActive(vm)) {
+ if (!virDomainObjIsActive(vm) && !(flags & VIR_MIGRATE_OFFLINE)) {
virReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
goto endjob;
@@ -2941,6 +2974,8 @@ qemuMigrationFinish(struct qemud_driver *driver,
*/
if (retcode == 0) {
if (!virDomainObjIsActive(vm)) {
+ if (flags & VIR_MIGRATE_OFFLINE)
+ goto offline;
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("guest unexpectedly quit"));
goto endjob;
@@ -3038,7 +3073,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
goto endjob;
}
}
-
+ offline:
dom = virGetDomain (dconn, vm->def->name, vm->def->uuid);
event = virDomainEventNewFromObj(vm,
@@ -3120,7 +3155,10 @@ int qemuMigrationConfirm(struct qemud_driver *driver,
if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen, 0)))
return -1;
-
+ if (flags & VIR_MIGRATE_OFFLINE) {
+ rv = 0;
+ goto cleanup;
+ }
/* Did the migration go as planned? If yes, kill off the
* domain object, but if no, resume CPUs
*/
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 1740204..2bcaea0 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -36,7 +36,8 @@
VIR_MIGRATE_NON_SHARED_DISK | \
VIR_MIGRATE_NON_SHARED_INC | \
VIR_MIGRATE_CHANGE_PROTECTION | \
- VIR_MIGRATE_UNSAFE)
+ VIR_MIGRATE_UNSAFE | \
+ VIR_MIGRATE_OFFLINE)
enum qemuMigrationJobPhase {
QEMU_MIGRATION_PHASE_NONE = 0,
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 4684466..ec25043 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6525,6 +6525,7 @@ static const vshCmdOptDef opts_migrate[] = {
{"dname", VSH_OT_DATA, 0, N_("rename to new name during migration (if supported)")},
{"timeout", VSH_OT_INT, 0, N_("force guest to suspend if live migration exceeds timeout (in seconds)")},
{"xml", VSH_OT_STRING, 0, N_("filename containing updated XML for the target")},
+ {"offline", VSH_OT_BOOL, 0, N_("for offline migration")},
{NULL, 0, 0, NULL}
};
@@ -6591,6 +6592,11 @@ doMigrate(void *opaque)
if (vshCommandOptBool(cmd, "unsafe"))
flags |= VIR_MIGRATE_UNSAFE;
+ if (vshCommandOptBool(cmd, "offline")) {
+ if (!virDomainIsActive(dom))
+ flags |= VIR_MIGRATE_OFFLINE;
+ }
+
if (xmlfile &&
virFileReadAll(xmlfile, 8192, &xml) < 0) {
vshError(ctl, _("file '%s' doesn't exist"), xmlfile);
--
1.7.2.5
12 years, 2 months
[libvirt] Submitting a patch
by Shawn Furrow
Hi all,
I feel really bad sending this through the libvirt-list but the email
provided at the bottom of the patch page is rejecting my email.
I have a patch for Libvirt but I am unsure how to go about doing it. I saw that
on the patches page it says to submit the patch using Mercurial's patchbomb
extension. However, I have the current libvirt directory using git. Is
there not a way for me to just send an email directly to the libvirt
mailing list? I have not submitted a patch before so I do not know all of
the in's and out's. Any guidance would be appreciated. Again sorry for
spamming the development list.
Thanks,
Shawn
--
Virginia Tech
Bradley Department of Electrical and Computer Engineering
B.S. Electrical Engineering
B.S. Computer Engineering
12 years, 2 months
[libvirt] [PATCH 0/4] virNetworkUpdate bugfixes
by Laine Stump
The 4 patches here are in decreasing order of importance. The first:
[PATCH 1/4] network: don't refresh iptables rules on networks
prevents proper behavior with a valid request when modifying the
interface pool list of a macvtap or hostdev network (because it tries
to refresh non-existent iptables rules, fails, then aborts the update).
The second:
[PATCH 2/4] network: make virNetworkObjUpdate error
detection/recovery better
fixes two problems that would crop up when attempting an invalid
update to a network.
The third was pointed out by DV in his review of the dhcp-range and
portgroup update backends:
[PATCH 3/4] network: log error for unknown virNetworkUpdate command
would allow a call to the virNetworkUpdate() API with an unknown
command number to succeed (it wouldn't do anything, but might provide
the illusion that it *had*).
The fourth:
[PATCH 4/4] network: backend for virNetworkUpdate of interface list
is the last of the networkUpdate section backends that I was
explicitly/specifically asked to implement.
12 years, 2 months