[libvirt] [PATCH] util: Add virFileAccessibleAs to private symbols
by Michal Privoznik
Commit 458b7099b2e791b58f1286002974927d3e8bcc80 introduced this
function. However it was not added into libvirt_private.syms so
the compilation may not succeed on some hosts.
---
Pushing under trivial & build breaker rules.
src/libvirt_private.syms | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 3f97e23..a81966d 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1094,6 +1094,7 @@ virEnumToString;
virEventAddHandle;
virEventRemoveHandle;
virFileAbsPath;
+virFileAccessibleAs;
virFileBuildPath;
virFileExists;
virFileFindMountPoint;
--
1.7.3.4
13 years, 1 month
[libvirt] [PATCH 0/3] Restrict saved-state and core-dump files in controlled directories
by Hong Xiang
This patch series tries to address the issue discussed in:
https://www.redhat.com/archives/libvir-list/2011-September/msg01025.html
In this series:
. The filename parameter for virDomainSave[Flags], virDomainRestore[Flags],
virDomainSaveImageGetXMLDesc, virDomainSaveImageDefineXML, and
virDomainCoreDump, is interpreted as an ID;
. The file ID is later translated to a real filesystem pathname by
corresponding drivers;
. The real file system paths are under controlled directories, different
for saved-state-files and core-dumps, respectively;
Hong Xiang (3):
New util API virBase64EncodePathname/virBase64DecodePathname
Remove virFileAbsPath() from virDomainSave*() and virDomainCoreDump()
calls
Encode input file id in qemuDomainSave/Restore and
qemudDomainCoreDump
src/libvirt.c | 84 +++------------------------------------
src/libvirt_private.syms | 2 +
src/qemu/qemu_conf.h | 3 +
src/qemu/qemu_driver.c | 98 +++++++++++++++++++++++++++++++++++++++++++--
src/util/util.c | 73 ++++++++++++++++++++++++++++++++++
src/util/util.h | 4 ++
6 files changed, 182 insertions(+), 82 deletions(-)
13 years, 1 month
[libvirt] [PATCH v4 0/5] Allow to make disk optional on migration
by Michal Privoznik
This is a 4rd version of patches [1].
Diff to v3 includes Daniel's review and some other improvements.
The aim of these patches is to mark CDROM and floppy optional,
thus they might get dropped during migration, domain startup,
restore, etc. The granularity is set on disk level, so user
can decide which cd-roms are important and which not.
There are 3 levels of optionality:
- mandatory - fail if missing for any reason (the default)
- requisite - fail if missing on boot up, drop if missing on
migrate/restore/revert
- optional - drop if missing at any start attempt.
To assign a disk one of these, just append 'startupPolicy' attribute
to its <source>.
If a domain is then eventually started (migrated, restored, whatever),
we check for source path being accessible (currently only qemu driver
is supported) from hypervisor's POV. This is done by virFileAccessibleAs()
function. Currently, only uid+gid are considered. Ideally, this
should be extended to SElinux labeling and cgroups.
1: https://www.redhat.com/archives/libvir-list/2011-October/msg00896.html
Michal Privoznik (5):
conf: Introduce optional startupPolicy attribute for cdrom and floppy
util: Create virFileAccessibleAs function
qemu: Move device alias assigning before command line construction
qemu: implement startupPolicy
on_missing: Emit event on disk source dropping
daemon/remote.c | 39 ++++++++++
docs/formatdomain.html.in | 26 ++++++-
docs/schemas/domaincommon.rng | 22 +++++-
examples/domain-events/events-c/event-test.c | 28 +++++++-
examples/domain-events/events-python/event-test.py | 4 +
include/libvirt/libvirt.h.in | 29 +++++++
python/libvirt-override-virConnect.py | 9 ++
python/libvirt-override.c | 52 +++++++++++++
src/conf/domain_conf.c | 43 ++++++++++-
src/conf/domain_conf.h | 11 +++
src/conf/domain_event.c | 61 +++++++++++++++
src/conf/domain_event.h | 9 ++
src/libvirt_private.syms | 4 +
src/qemu/qemu_command.c | 5 +-
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_domain.c | 73 ++++++++++++++++++
src/qemu/qemu_domain.h | 4 +
src/qemu/qemu_driver.c | 3 +
src/qemu/qemu_process.c | 7 ++
src/remote/remote_driver.c | 35 +++++++++
src/remote/remote_protocol.x | 10 ++-
src/remote_protocol-structs | 6 ++
src/util/util.c | 78 ++++++++++++++++++++
src/util/util.h | 3 +
tests/qemuxml2argvtest.c | 3 +
.../qemuxml2xmlout-disk-cdrom-empty.xml | 31 ++++++++
tests/qemuxmlnstest.c | 3 +
27 files changed, 585 insertions(+), 14 deletions(-)
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-disk-cdrom-empty.xml
--
1.7.3.4
13 years, 1 month
[libvirt] [PATCH 1/2] storage: plug iscsi memory leak
by Eric Blake
Detected by Coverity. virStoragePoolSourceFree does not free the
actual passed-in pointer. A bigger patch would be to rename it
virStoragePoolSourceClear to match behavior, or even split it into
two functions depending on needed behavior; but this is the minimal
fix to the one location out of eight that leaked memory.
* src/storage/storage_backend_iscsi.c
(virStorageBackendISCSIFindPoolSources): Free memory.
---
src/storage/storage_backend_iscsi.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index 99e69c9..c6e782d 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -611,6 +611,7 @@ cleanup:
VIR_FREE(targets);
VIR_FREE(portal);
virStoragePoolSourceFree(source);
+ VIR_FREE(source);
return ret;
}
--
1.7.4.4
13 years, 1 month
[libvirt] libvirt and clustered volume group problems
by Rommer
Hello,
Description of problem:
a) libvirt should use vgchange -aly/-aln instead of vgchange -ay/-an for
clustered volume groups
b) libvirt should skip not activated/suspended volumes during
pool-create/pool-refresh for logical pools
Version-Release number of selected component (if applicable):
libvirt-0.9.6
How reproducible:
always
Steps to Reproduce:
a) vgchange -ay/-an
1. Build 2-node cluster
2. Create clustered volume group
3. Create logical storage pool in libvirt
4. Open/mount any volume on the first node
5. Try to destroy storage pool on the second node
b) not activated volumes:
1. Build 2-node cluster
2. Create clustered volume group
3. Activate exclusively any volume on the first node
4. Try to create pool on the second node
Actual results:
a) vgchange -ay/-an
# virsh pool-destroy vg
error: Failed to destroy pool vg
error: internal error '/sbin/vgchange -an vg' exited with non-zero
status 5 and
signal 0: Error locking on node node1: LV vg/lv1 in use: not deactivating
b) not activated volumes:
# virsh pool-create vg.xml
error: Failed to create pool from vg.xml
error: internal error lvs command failed
Expected results:
a) vgchange -ay/-an
# virsh pool-destroy vg
Pool vg destroyed
b) not activated volumes:
# virsh pool-create vg.xml
Pool vg created from vg.xml
Additional info:
Attached patch fix problem for me.
Original bug report: https://bugzilla.redhat.com/show_bug.cgi?id=748437
a) https://bugzilla.redhat.com/show_bug.cgi?id=748248
b) https://bugzilla.redhat.com/show_bug.cgi?id=748282
--
С уважением,
Роман Шишнёв,
CTO | ActiveCloud | http://www.active.by
Т +375 17 2 911 511 доб. 308 | rommer(a)active.by
Облачные решения | Серверы и инфраструктура | IaaS | SaaS | Хостинг
13 years, 1 month
[libvirt] How to use "virsh migrat" with p2p option?
by Guangya Liu
Hi libvirt support,
Can you please give me some example of how to use "virsh migrate --live" with p2p option including both source host and target host?
I try to get some info from your website, but no info with migrate.
[root@vmoactive02 qemu]# virsh help migrate
NAME
migrate - migrate domain to another host
SYNOPSIS
migrate [--live] [--p2p] [--direct] [--tunnelled] [--persistent] [--undefinesource] [--suspend] [--copy-storage-all] [--copy-storage-inc] <domain> <desturi> [<migrateuri>] [<dname>]
DESCRIPTION
Migrate domain to another host. Add --live for live migration.
OPTIONS
--live live migration
--p2p peer-2-peer migration
--direct direct migration
--tunnelled tunnelled migration
--persistent persist VM on destination
--undefinesource undefine VM on source
--suspend do not restart the domain on the destination host
--copy-storage-all migration with non-shared storage with full disk copy
--copy-storage-inc migration with non-shared storage with incremental copy (same base image shared between source and destination)
[--domain] <string> domain name, id or uuid
[--desturi] <string> connection URI of the destination host
[--migrateuri] <string> migration URI, usually can be omitted
[--dname] <string> rename to new name during migration (if supported)
Thanks,
Guangya
13 years, 1 month
[libvirt] [PATCH] lxc: check for waitpid failure
by Eric Blake
Detected by Coverity. waitpid() can leak resources if it fails with
EINTR, so it should never be used without checking return status.
* src/lxc/lxc_container.c (lxcContainerAvailable): Use safer
virWaitPid.
---
src/lxc/lxc_container.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index e9891f7..06ccf7e 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1229,7 +1229,6 @@ int lxcContainerAvailable(int features)
int cpid;
char *childStack;
char *stack;
- int childStatus;
if (features & LXC_CONTAINER_FEATURE_USER)
flags |= CLONE_NEWUSER;
@@ -1251,8 +1250,8 @@ int lxcContainerAvailable(int features)
VIR_DEBUG("clone call returned %s, container support is not enabled",
virStrerror(errno, ebuf, sizeof ebuf));
return -1;
- } else {
- waitpid(cpid, &childStatus, 0);
+ } else if (virPidWait(cpid, NULL) < 0) {
+ return -1;
}
VIR_DEBUG("Mounted all filesystems");
--
1.7.4.4
13 years, 1 month
[libvirt] [PATCH] qemu: avoid leaking uninit data from hotplug to dumpxml
by Eric Blake
Detected by Coverity. Both text and JSON monitors set only the
bus and unit fields, which means driveAddr.controller spends
life as garbage on the stack, and is then memcpy()'d into the
in-memory representation which the user can see via dumpxml.
* src/qemu/qemu_hotplug.c (qemuDomainAttachSCSIDisk): Only copy
defined fields.
---
I have to admit that Coverity is good - it took me several minutes
to follow the trail down to qemu_monitor_{text,json}.c and prove to
myself that driveAddr.controller really is untouched on success.
I didn't actually try to exploit this one - it depends on whatever
is already on the stack, and your compiler optimization levels,
before you would ever see dumpxml giving bogus information in
the <address controller='garbage'> field of the hotplugged <disk>.
src/qemu/qemu_hotplug.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index bfa524b..037f4aa 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -505,7 +505,8 @@ int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
/* XXX we should probably validate that the addr matches
* our existing defined addr instead of overwriting */
disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE;
- memcpy(&disk->info.addr.drive, &driveAddr, sizeof(driveAddr));
+ disk->info.addr.drive.bus = driveAddr.bus;
+ disk->info.addr.drive.unit = driveAddr.unit;
}
}
qemuDomainObjExitMonitorWithDriver(driver, vm);
--
1.7.4.4
13 years, 1 month
[libvirt] [PATCH] Report 'errno' in int1 field of virErrorPtr
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
When reporting a system error (VIR_ERR_SYSTEM_ERROR) via
virReportSystemError, we should copy the errno value into
the 'int1' field of the virErrorPtr struct. This allows
callers to detect certain errno conditions & discard the
error
* src/util/virterror.c: Place errno value in int1 field
---
src/util/virterror.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 5006fa2..a9d4d38 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -1327,7 +1327,7 @@ void virReportSystemErrorFull(int domcode,
virRaiseErrorFull(filename, funcname, linenr,
domcode, VIR_ERR_SYSTEM_ERROR, VIR_ERR_ERROR,
- msg, msgDetail, NULL, -1, -1, msg, msgDetail);
+ msg, msgDetail, NULL, theerrno, -1, msg, msgDetail);
errno = save_errno;
}
--
1.7.6.4
13 years, 1 month
[libvirt] [PATCH] Fix off-by-one printing month in logging code
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The field 'mon' in 'struct tm' gives months 0-11, where as
humans tend to expect months 1-12. Thus the month number
needing adjusting by 1
* src/util/logging.c: Use human friendly month number
---
src/util/logging.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/util/logging.c b/src/util/logging.c
index 9df9003..17c7e84 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -628,6 +628,7 @@ virLogFormatTimestamp(void)
gettimeofday(&cur_time, NULL);
localtime_r(&cur_time.tv_sec, &time_info);
time_info.tm_year += 1900;
+ time_info.tm_mon += 1;
if (virAsprintf(&str, "%4d-%02d-%02d %02d:%02d:%02d.%03d",
time_info.tm_year, time_info.tm_mon, time_info.tm_mday,
--
1.7.6.4
13 years, 1 month