[libvirt] [PATCH] AUTHORS: Remove double entry
by Michal Privoznik
I've accidentally added Li Zhang <zhlcindy(a)linux.vnet.ibm.com> to
AUTHORS, even if he already was there.
---
Pushing under trivial rule.
AUTHORS | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 221912d..27c4eda 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -268,7 +268,6 @@ Patches have also been contributed by:
liguang <lig.fnst(a)cn.fujitsu.com>
Chuck Short <zulcss(a)gmail.com>
Alexander Larsson <alexl(a)redhat.com>
- Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
[....send patches to get your name here....]
--
1.7.8.6
12 years, 1 month
[libvirt] [PATCH v2 0/3] Implement CPU model driver for PowerPC
by Li Zhang
CPU model driver is to get host's CPU information and it also provides
one mechanism to expose host's CPU information to guests during migration.
When migrating one guest from one machine to another machine, it will
compare the CPU information. If it is incomptible, it won't start the
guest.
On x86, it uses CPUID instruction to get information. When migrating
the guest, if the CPU defined in guest XML file is incompatible with
host CPU, cpu-baseline will find out best features to expose to guest.
Refer to
[http://berrange.com/posts/2010/02/15
/guest-cpu-model-configuration-in-libvirt-with-qemukvm/].
On PowerPC, it can get CPU version by mfpvr instruction. So, if PVR is
different from definition in guest XML file by cpu-compare, it will fail
to start guest. The CPU infromation can be got by cpu-baseline. But only
CPU vendor and model can be shown, there are no features as x86.
So on PowrePC, it assumes that migration only occurs between the machines
with the same type CPUs on PowerPC.
In this driver, there are definitions of models and PVRs for CPUs supported
on PowerPC. The relationship between models and PVRs are as the following:
For one specific CPU model, its PVR is unique. And also for one PVR code,
the PVR code is also unique.
So from the PVR code of CPU data, it's easy to get model and vendor information.
It is tested on my Power machine which CPU PVR is Power7_v2.3.
* cap.xml has the same definition as the host.
[root@ltckvmopal2 kvm-test]# /bin/virsh cpu-compare cap.xml
CPU described in cap.xml is identical to host CPU
[root@ltckvmopal2 kvm-test]# /bin/virsh cpu-baseline cap.xml
<cpu mode='custom' match='exact'>
<model fallback='allow'>POWER7_v2.3</model>
<vendor>IBM</vendor>
</cpu>
* cap.xml has differnt model as the host.
[root@ltckvmopal2 kvm-test]# /bin/virsh cpu-compare cap.xml
CPU described in cap.xml is incompatible with host CPU
[root@ltckvmopal2 kvm-test]# /bin/virsh cpu-baseline cap.xml
<cpu mode='custom' match='exact'>
<model fallback='allow'>POWER7_v2.1</model>
<vendor>IBM</vendor>
</cpu>
*v1 -> v2:
* Fix coding style's problems in several places.
* Replace while with for loop in 2 places according to Michal Privoznik's suggestion.
* Add powerpc.c to po/PORTFILES.in
Li Zhang (3):
libvirt: Add one file cpu_ppc_data.h to define CPU data for PPC
libvirt: Implement CPU model driver for PowerPC
Doc-fix for PowerPC CPU model driver
po/POTFILES.in | 1 +
src/cpu/cpu.h | 3 +
src/cpu/cpu_map.xml | 14 ++
src/cpu/cpu_powerpc.c | 591 ++++++++++++++++++++++++++++++++++++++++++++++--
src/cpu/cpu_ppc_data.h | 33 +++
5 files changed, 624 insertions(+), 18 deletions(-)
create mode 100644 src/cpu/cpu_ppc_data.h
--
1.7.7.6
12 years, 1 month
[libvirt] [PATCH 1/2] selinux: load and free selinux active file contexts configuration database
by Guannan Ren
If we use matchpathcon() to look up selinux context for specific pathname,
it'd better actively load file contexts database by matchpathcon_init()
and free memory when finished using matchpathcon by matchpathcon_fini().
---
src/security/security_selinux.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 10135ed..b278e2c 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -667,6 +667,10 @@ virSecuritySELinuxSecurityDriverProbe(const char *virtDriver)
static int
virSecuritySELinuxSecurityDriverOpen(virSecurityManagerPtr mgr)
{
+#ifndef HAVE_SELINUX_LABEL_H
+ if (matchpathcon_init(NULL) < 0)
+ VIR_WARN("cannot load selinux active file contexts configuration");
+#endif
return virSecuritySELinuxInitialize(mgr);
}
@@ -685,6 +689,10 @@ virSecuritySELinuxSecurityDriverClose(virSecurityManagerPtr mgr)
VIR_FREE(data->file_context);
VIR_FREE(data->content_context);
+#ifndef HAVE_SELINUX_LABEL_H
+ if (matchpathcon_fini() < 0)
+ VIR_WARN("cannot free allocated memory for selinux");
+#endif
return 0;
}
--
1.7.11.2
12 years, 1 month
[libvirt] [PATCH 1/2] storage: lvm: Don't overwrite lvcreate errors
by Cole Robinson
Before:
$ sudo virsh vol-create-as --pool vgvirt sparsetest --capacity 16M --allocation 0
error: Failed to create vol sparsetest
error: internal error Child process (/usr/sbin/lvchange -aln vgvirt/sparsetest) unexpected exit status 5: One or more specified logical volume(s) not found.
After:
$ sudo virsh vol-create-as --pool vgvirt sparsetest --capacity 16M --allocation 0
error: Failed to create vol sparsetest
error: internal error Child process (/usr/sbin/lvcreate --name sparsetest -L 0K --virtualsize 16384K vgvirt) unexpected exit status 5: Unable to create new logical volume with no extents
---
src/storage/storage_backend_logical.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index a9d785c..eebeec1 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -699,6 +699,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
{
int fdret, fd = -1;
virCommandPtr cmd = NULL;
+ virErrorPtr err;
if (vol->target.encryption != NULL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -775,9 +776,11 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
return 0;
cleanup:
+ err = virSaveLastError();
VIR_FORCE_CLOSE(fd);
virStorageBackendLogicalDeleteVol(conn, pool, vol, 0);
virCommandFree(cmd);
+ virSetError(err);
return -1;
}
--
1.7.11.7
12 years, 1 month
[libvirt] [PATCH v10] support offline migration
by liguang
original migration did not aware of offline case,
so, try 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_*.
if you want a persistent migration,
you should do "virsh migrate --persistent" youself.
Signed-off-by: liguang <lig.fnst(a)cn.fujitsu.com>
---
include/libvirt/libvirt.h.in | 1 +
src/qemu/qemu_driver.c | 10 ++++++++
src/qemu/qemu_migration.c | 52 +++++++++++++++++++++++++++++++++++++-----
src/qemu/qemu_migration.h | 3 +-
tools/virsh-domain.c | 6 +++++
5 files changed, 65 insertions(+), 7 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 81f12a4..1cebc21 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 97ad23e..6189bbe 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9622,6 +9622,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;
@@ -9634,6 +9643,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
if (qemuDomainCheckEjectableMedia(driver, vm, asyncJob) < 0)
goto endjob;
+offline:
if (!(xml = qemuMigrationBegin(driver, vm, xmlin, dname,
cookieout, cookieoutlen,
flags)))
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index db69a0a..6845a97 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;
@@ -1168,6 +1182,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,
@@ -1331,6 +1352,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
*/
@@ -1873,7 +1903,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;
@@ -2389,6 +2420,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;
@@ -2494,7 +2527,7 @@ finish:
vm->def->name);
cleanup:
- if (ddomain) {
+ if (ddomain || (flags & VIR_MIGRATE_OFFLINE)) {
virObjectUnref(ddomain);
ret = 0;
} else {
@@ -2571,7 +2604,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;
@@ -2634,7 +2667,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;
@@ -2958,6 +2991,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;
@@ -2973,6 +3008,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
goto endjob;
}
+ offline:
if (flags & VIR_MIGRATE_PERSIST_DEST) {
virDomainDefPtr vmdef;
if (vm->persistent)
@@ -3020,7 +3056,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
event = NULL;
}
- if (!(flags & VIR_MIGRATE_PAUSED)) {
+ if (!(flags & VIR_MIGRATE_PAUSED) && !(flags & VIR_MIGRATE_OFFLINE)) {
/* run 'cont' on the destination, which allows migration on qemu
* >= 0.10.6 to work properly. This isn't strictly necessary on
* older qemu's, but it also doesn't hurt anything there
@@ -3091,6 +3127,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
endjob:
if (qemuMigrationJobFinish(driver, vm) == 0) {
vm = NULL;
+ } else if (flags & VIR_MIGRATE_OFFLINE) {
} else if (!vm->persistent && !virDomainObjIsActive(vm)) {
qemuDomainRemoveInactive(driver, vm);
vm = NULL;
@@ -3137,6 +3174,8 @@ int qemuMigrationConfirm(struct qemud_driver *driver,
if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen, 0)))
return -1;
+ if (flags & VIR_MIGRATE_OFFLINE)
+ goto offline;
/* Did the migration go as planned? If yes, kill off the
* domain object, but if no, resume CPUs
@@ -3173,6 +3212,7 @@ int qemuMigrationConfirm(struct qemud_driver *driver,
}
}
+offline:
qemuMigrationCookieFree(mig);
rv = 0;
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 7a2269a..b4f6a77 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 505169b..2218379 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6647,6 +6647,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}
};
@@ -6713,6 +6714,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, 1 month
[libvirt] LIBVIRT_DEBUG=1 libvirtd regression
by Cole Robinson
Hey Dan,
This commit changes the behavior of LIBVIRT_DEBUG=1 libvirtd:
$ git show 7022b09111d4322d21396a70d58320a9ad773962
commit 7022b09111d4322d21396a70d58320a9ad773962
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Thu Sep 27 13:13:09 2012 +0100
Automatically enable systemd journal logging
Probe to see if the systemd journal is accessible, and if
so enable logging to the journal by default, rather than
stderr (current default under systemd).
It still prints some output to stderr but it's extremely limited compared to
before. Surprised me at least, but I didn't dig too deeply for a solution.
Thanks,
Cole
12 years, 1 month
[libvirt] [PATCH] spec: Require newer sanlock on recent distros 2
by Jiri Denemark
The previous commit was incomplete. We need to also add explicit
Requires for the newer version since RPM's automatic dependencies won't
work with sanlock.
---
libvirt.spec.in | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 15c6b39..a0dc560 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1027,7 +1027,11 @@ Include header files & development libraries for the libvirt C library.
%package lock-sanlock
Summary: Sanlock lock manager plugin for QEMU driver
Group: Development/Libraries
+%if 0%{?fedora} >= 17 || 0%{?rhel} >= 6
+Requires: sanlock >= 2.4
+%else
Requires: sanlock >= 1.8
+%endif
#for virt-sanlock-cleanup require augeas
Requires: augeas
Requires: %{name}-daemon = %{version}-%{release}
--
1.7.12.3
12 years, 1 month
[libvirt] [PATCHv2] spec: Add runtime requirement for libssh2
by Peter Krempa
libssh2 unfortunately doesn't support symbol versioning so RPM can't
figure out what version is needed for the currently installed libvirt
package. This patch adds a runtime requirement, so that the correct
version of libssh2 can be installed along with libvirt.
---
Diff to v1:
- be more specific with the requirement
libvirt.spec.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 75623eb..a651394 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1002,6 +1002,9 @@ Requires: cyrus-sasl
# work correctly & doesn't have onerous dependencies
Requires: cyrus-sasl-md5
%endif
+%if %{with_libssh2_transport}
+Requires: libssh2 >= 1.3.0
+%endif
%description client
Shared libraries and client binaries needed to access to the
--
1.7.12.3
12 years, 1 month
[libvirt] [PATCH v3 1/4] monitor: Allow add-fd to any specified fd set
by Corey Bryant
The first call to add an fd to an fd set was previously not
allowed to choose the fd set ID. The ID was generated as
the first available and ensuing calls could add more fds by
specifying the fd set ID. This change allows users to
choose the fd set ID on the first call.
Signed-off-by: Corey Bryant <coreyb(a)linux.vnet.ibm.com>
---
v2:
-This patch is new in v2
v3:
-Added fdset-id bounds checking (eblake(a)redhat.com)
-Move 'if (!mon_fdset_cur)' change to this patch
(kwolf(a)redhat.com)
-Add break from for loop if fdset_id is less than mon_fdset->id
(eblake(a)redhat.com)
monitor.c | 54 +++++++++++++++++++++++++++++++++++++-----------------
qapi-schema.json | 2 +-
2 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/monitor.c b/monitor.c
index 131b325..2e3248f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2135,7 +2135,7 @@ AddfdInfo *qmp_add_fd(bool has_fdset_id, int64_t fdset_id, bool has_opaque,
{
int fd;
Monitor *mon = cur_mon;
- MonFdset *mon_fdset;
+ MonFdset *mon_fdset = NULL;
MonFdsetFd *mon_fdset_fd;
AddfdInfo *fdinfo;
@@ -2147,34 +2147,54 @@ AddfdInfo *qmp_add_fd(bool has_fdset_id, int64_t fdset_id, bool has_opaque,
if (has_fdset_id) {
QLIST_FOREACH(mon_fdset, &mon_fdsets, next) {
- if (mon_fdset->id == fdset_id) {
+ /* Break if match found or match impossible due to ordering by ID */
+ if (fdset_id <= mon_fdset->id) {
+ if (fdset_id < mon_fdset->id) {
+ mon_fdset = NULL;
+ }
break;
}
}
- if (mon_fdset == NULL) {
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdset-id",
- "an existing fdset-id");
- goto error;
- }
- } else {
+ }
+
+ if (mon_fdset == NULL) {
int64_t fdset_id_prev = -1;
MonFdset *mon_fdset_cur = QLIST_FIRST(&mon_fdsets);
- /* Use first available fdset ID */
- QLIST_FOREACH(mon_fdset, &mon_fdsets, next) {
- mon_fdset_cur = mon_fdset;
- if (fdset_id_prev == mon_fdset_cur->id - 1) {
- fdset_id_prev = mon_fdset_cur->id;
- continue;
+ if (has_fdset_id) {
+ if (fdset_id < 0) {
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdset-id",
+ "a non-negative value");
+ goto error;
+ }
+ /* Use specified fdset ID */
+ QLIST_FOREACH(mon_fdset, &mon_fdsets, next) {
+ mon_fdset_cur = mon_fdset;
+ if (fdset_id < mon_fdset_cur->id) {
+ break;
+ }
+ }
+ } else {
+ /* Use first available fdset ID */
+ QLIST_FOREACH(mon_fdset, &mon_fdsets, next) {
+ mon_fdset_cur = mon_fdset;
+ if (fdset_id_prev == mon_fdset_cur->id - 1) {
+ fdset_id_prev = mon_fdset_cur->id;
+ continue;
+ }
+ break;
}
- break;
}
mon_fdset = g_malloc0(sizeof(*mon_fdset));
- mon_fdset->id = fdset_id_prev + 1;
+ if (has_fdset_id) {
+ mon_fdset->id = fdset_id;
+ } else {
+ mon_fdset->id = fdset_id_prev + 1;
+ }
/* The fdset list is ordered by fdset ID */
- if (mon_fdset->id == 0) {
+ if (!mon_fdset_cur) {
QLIST_INSERT_HEAD(&mon_fdsets, mon_fdset, next);
} else if (mon_fdset->id < mon_fdset_cur->id) {
QLIST_INSERT_BEFORE(mon_fdset_cur, mon_fdset, next);
diff --git a/qapi-schema.json b/qapi-schema.json
index f9dbdae..12cdb74 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2611,7 +2611,7 @@
#
# Returns: @AddfdInfo on success
# If file descriptor was not received, FdNotSupplied
-# If @fdset-id does not exist, InvalidParameterValue
+# If @fdset-id is a negative value, InvalidParameterValue
#
# Notes: The list of fd sets is shared by all monitor connections.
#
--
1.7.11.4
12 years, 1 month
[libvirt] [PATCH] spec: Require newer sanlock on recent distros
by Jiri Denemark
Make sure libvirt is build with sanlock >= 2.4 on distros that are new
enough to provide it.
---
libvirt.spec.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 75623eb..15c6b39 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -410,8 +410,14 @@ BuildRequires: libpciaccess-devel >= 0.10.9
BuildRequires: yajl-devel
%endif
%if %{with_sanlock}
+# make sure libvirt is built with new enough sanlock on
+# distros that have it; required for on_lockfailure
+%if 0%{?fedora} >= 17 || 0%{?rhel} >= 6
+BuildRequires: sanlock-devel >= 2.4
+%else
BuildRequires: sanlock-devel >= 1.8
%endif
+%endif
%if %{with_libpcap}
BuildRequires: libpcap-devel
%endif
--
1.7.12.3
12 years, 1 month