[libvirt] [PATCH] Move lxcContainerUnmountSubtree further up in file
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Ensure lxcContainerUnmountSubtree is at the top of the
lxc_container.c file so it is easily referenced from
any other method. No functional change
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/lxc/lxc_container.c | 214 ++++++++++++++++++++++++------------------------
1 file changed, 107 insertions(+), 107 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index e59bfdf..b4ad0c5 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -409,6 +409,113 @@ static int lxcContainerChildMountSort(const void *a, const void *b)
# define MS_SLAVE (1<<19)
#endif
+static int lxcContainerGetSubtree(const char *prefix,
+ char ***mountsret,
+ size_t *nmountsret)
+{
+ FILE *procmnt;
+ struct mntent mntent;
+ char mntbuf[1024];
+ int ret = -1;
+ char **mounts = NULL;
+ size_t nmounts = 0;
+
+ VIR_DEBUG("prefix=%s", prefix);
+
+ *mountsret = NULL;
+ *nmountsret = 0;
+
+ if (!(procmnt = setmntent("/proc/mounts", "r"))) {
+ virReportSystemError(errno, "%s",
+ _("Failed to read /proc/mounts"));
+ return -1;
+ }
+
+ while (getmntent_r(procmnt, &mntent, mntbuf, sizeof(mntbuf)) != NULL) {
+ VIR_DEBUG("Got %s", mntent.mnt_dir);
+ if (!STRPREFIX(mntent.mnt_dir, prefix))
+ continue;
+
+ if (VIR_REALLOC_N(mounts, nmounts+1) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ if (!(mounts[nmounts] = strdup(mntent.mnt_dir))) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ nmounts++;
+ VIR_DEBUG("Grabbed %s", mntent.mnt_dir);
+ }
+
+ if (mounts)
+ qsort(mounts, nmounts, sizeof(mounts[0]),
+ lxcContainerChildMountSort);
+
+ ret = 0;
+cleanup:
+ *mountsret = mounts;
+ *nmountsret = nmounts;
+ endmntent(procmnt);
+ return ret;
+}
+
+static int lxcContainerUnmountSubtree(const char *prefix,
+ bool isOldRootFS)
+{
+ char **mounts = NULL;
+ size_t nmounts = 0;
+ size_t i;
+ int saveErrno;
+ const char *failedUmount = NULL;
+ int ret = -1;
+
+ VIR_DEBUG("Unmount subtreee from %s", prefix);
+
+ if (lxcContainerGetSubtree(prefix, &mounts, &nmounts) < 0)
+ goto cleanup;
+ for (i = 0 ; i < nmounts ; i++) {
+ VIR_DEBUG("Umount %s", mounts[i]);
+ if (umount(mounts[i]) < 0) {
+ char ebuf[1024];
+ failedUmount = mounts[i];
+ saveErrno = errno;
+ VIR_WARN("Failed to unmount '%s', trying to detach subtree '%s': %s",
+ failedUmount, mounts[nmounts-1],
+ virStrerror(errno, ebuf, sizeof(ebuf)));
+ break;
+ }
+ }
+
+ if (failedUmount) {
+ /* This detaches the subtree */
+ if (umount2(mounts[nmounts-1], MNT_DETACH) < 0) {
+ virReportSystemError(saveErrno,
+ _("Failed to unmount '%s' and could not detach subtree '%s'"),
+ failedUmount, mounts[nmounts-1]);
+ goto cleanup;
+ }
+ /* This unmounts the tmpfs on which the old root filesystem was hosted */
+ if (isOldRootFS &&
+ umount(mounts[nmounts-1]) < 0) {
+ virReportSystemError(saveErrno,
+ _("Failed to unmount '%s' and could not unmount old root '%s'"),
+ failedUmount, mounts[nmounts-1]);
+ goto cleanup;
+ }
+ }
+
+ ret = 0;
+
+cleanup:
+ for (i = 0 ; i < nmounts ; i++)
+ VIR_FREE(mounts[i]);
+ VIR_FREE(mounts);
+
+ return ret;
+}
+
+
static int lxcContainerPrepareRoot(virDomainDefPtr def,
virDomainFSDefPtr root)
{
@@ -1624,113 +1731,6 @@ static int lxcContainerSetupAllHostdevs(virDomainDefPtr vmDef,
}
-static int lxcContainerGetSubtree(const char *prefix,
- char ***mountsret,
- size_t *nmountsret)
-{
- FILE *procmnt;
- struct mntent mntent;
- char mntbuf[1024];
- int ret = -1;
- char **mounts = NULL;
- size_t nmounts = 0;
-
- VIR_DEBUG("prefix=%s", prefix);
-
- *mountsret = NULL;
- *nmountsret = 0;
-
- if (!(procmnt = setmntent("/proc/mounts", "r"))) {
- virReportSystemError(errno, "%s",
- _("Failed to read /proc/mounts"));
- return -1;
- }
-
- while (getmntent_r(procmnt, &mntent, mntbuf, sizeof(mntbuf)) != NULL) {
- VIR_DEBUG("Got %s", mntent.mnt_dir);
- if (!STRPREFIX(mntent.mnt_dir, prefix))
- continue;
-
- if (VIR_REALLOC_N(mounts, nmounts+1) < 0) {
- virReportOOMError();
- goto cleanup;
- }
- if (!(mounts[nmounts] = strdup(mntent.mnt_dir))) {
- virReportOOMError();
- goto cleanup;
- }
- nmounts++;
- VIR_DEBUG("Grabbed %s", mntent.mnt_dir);
- }
-
- if (mounts)
- qsort(mounts, nmounts, sizeof(mounts[0]),
- lxcContainerChildMountSort);
-
- ret = 0;
-cleanup:
- *mountsret = mounts;
- *nmountsret = nmounts;
- endmntent(procmnt);
- return ret;
-}
-
-static int lxcContainerUnmountSubtree(const char *prefix,
- bool isOldRootFS)
-{
- char **mounts = NULL;
- size_t nmounts = 0;
- size_t i;
- int saveErrno;
- const char *failedUmount = NULL;
- int ret = -1;
-
- VIR_DEBUG("Unmount subtreee from %s", prefix);
-
- if (lxcContainerGetSubtree(prefix, &mounts, &nmounts) < 0)
- goto cleanup;
- for (i = 0 ; i < nmounts ; i++) {
- VIR_DEBUG("Umount %s", mounts[i]);
- if (umount(mounts[i]) < 0) {
- char ebuf[1024];
- failedUmount = mounts[i];
- saveErrno = errno;
- VIR_WARN("Failed to unmount '%s', trying to detach subtree '%s': %s",
- failedUmount, mounts[nmounts-1],
- virStrerror(errno, ebuf, sizeof(ebuf)));
- break;
- }
- }
-
- if (failedUmount) {
- /* This detaches the subtree */
- if (umount2(mounts[nmounts-1], MNT_DETACH) < 0) {
- virReportSystemError(saveErrno,
- _("Failed to unmount '%s' and could not detach subtree '%s'"),
- failedUmount, mounts[nmounts-1]);
- goto cleanup;
- }
- /* This unmounts the tmpfs on which the old root filesystem was hosted */
- if (isOldRootFS &&
- umount(mounts[nmounts-1]) < 0) {
- virReportSystemError(saveErrno,
- _("Failed to unmount '%s' and could not unmount old root '%s'"),
- failedUmount, mounts[nmounts-1]);
- goto cleanup;
- }
- }
-
- ret = 0;
-
-cleanup:
- for (i = 0 ; i < nmounts ; i++)
- VIR_FREE(mounts[i]);
- VIR_FREE(mounts);
-
- return ret;
-}
-
-
struct lxcContainerCGroup {
const char *dir;
const char *linkDest;
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH] Unmount existing filesystems under user specified mounts in LXC
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
If the user requests a mount for /run, this may hide any existing
mounts that are lower down in /run. The result is that the
container still sees the mounts in /proc/mounts, but cannot
access them
sh-4.2# df
df: '/run/user/501/gvfs': No such file or directory
df: '/run/media/berrange/LIVE': No such file or directory
df: '/run/media/berrange/SecureDiskA1': No such file or directory
df: '/run/libvirt/lxc/sandbox': No such file or directory
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_t500wlan-lv_root 151476396 135390200 8384900 95% /
tmpfs 1970888 3204 1967684 1% /run
/dev/sda1 194241 155940 28061 85% /boot
devfs 64 0 64 0% /dev
tmpfs 64 0 64 0% /sys/fs/cgroup
tmpfs 1970888 1200 1969688 1% /etc/libvirt-sandbox/scratch
Before mounting any filesystem at a particular location, we
must recursively unmount anything at or below the target mount
point
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/lxc/lxc_container.c | 218 ++++++++++++++++++++++++------------------------
1 file changed, 111 insertions(+), 107 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index e59bfdf..30738bb 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -409,6 +409,113 @@ static int lxcContainerChildMountSort(const void *a, const void *b)
# define MS_SLAVE (1<<19)
#endif
+static int lxcContainerGetSubtree(const char *prefix,
+ char ***mountsret,
+ size_t *nmountsret)
+{
+ FILE *procmnt;
+ struct mntent mntent;
+ char mntbuf[1024];
+ int ret = -1;
+ char **mounts = NULL;
+ size_t nmounts = 0;
+
+ VIR_DEBUG("prefix=%s", prefix);
+
+ *mountsret = NULL;
+ *nmountsret = 0;
+
+ if (!(procmnt = setmntent("/proc/mounts", "r"))) {
+ virReportSystemError(errno, "%s",
+ _("Failed to read /proc/mounts"));
+ return -1;
+ }
+
+ while (getmntent_r(procmnt, &mntent, mntbuf, sizeof(mntbuf)) != NULL) {
+ VIR_DEBUG("Got %s", mntent.mnt_dir);
+ if (!STRPREFIX(mntent.mnt_dir, prefix))
+ continue;
+
+ if (VIR_REALLOC_N(mounts, nmounts+1) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ if (!(mounts[nmounts] = strdup(mntent.mnt_dir))) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ nmounts++;
+ VIR_DEBUG("Grabbed %s", mntent.mnt_dir);
+ }
+
+ if (mounts)
+ qsort(mounts, nmounts, sizeof(mounts[0]),
+ lxcContainerChildMountSort);
+
+ ret = 0;
+cleanup:
+ *mountsret = mounts;
+ *nmountsret = nmounts;
+ endmntent(procmnt);
+ return ret;
+}
+
+static int lxcContainerUnmountSubtree(const char *prefix,
+ bool isOldRootFS)
+{
+ char **mounts = NULL;
+ size_t nmounts = 0;
+ size_t i;
+ int saveErrno;
+ const char *failedUmount = NULL;
+ int ret = -1;
+
+ VIR_DEBUG("Unmount subtreee from %s", prefix);
+
+ if (lxcContainerGetSubtree(prefix, &mounts, &nmounts) < 0)
+ goto cleanup;
+ for (i = 0 ; i < nmounts ; i++) {
+ VIR_DEBUG("Umount %s", mounts[i]);
+ if (umount(mounts[i]) < 0) {
+ char ebuf[1024];
+ failedUmount = mounts[i];
+ saveErrno = errno;
+ VIR_WARN("Failed to unmount '%s', trying to detach subtree '%s': %s",
+ failedUmount, mounts[nmounts-1],
+ virStrerror(errno, ebuf, sizeof(ebuf)));
+ break;
+ }
+ }
+
+ if (failedUmount) {
+ /* This detaches the subtree */
+ if (umount2(mounts[nmounts-1], MNT_DETACH) < 0) {
+ virReportSystemError(saveErrno,
+ _("Failed to unmount '%s' and could not detach subtree '%s'"),
+ failedUmount, mounts[nmounts-1]);
+ goto cleanup;
+ }
+ /* This unmounts the tmpfs on which the old root filesystem was hosted */
+ if (isOldRootFS &&
+ umount(mounts[nmounts-1]) < 0) {
+ virReportSystemError(saveErrno,
+ _("Failed to unmount '%s' and could not unmount old root '%s'"),
+ failedUmount, mounts[nmounts-1]);
+ goto cleanup;
+ }
+ }
+
+ ret = 0;
+
+cleanup:
+ for (i = 0 ; i < nmounts ; i++)
+ VIR_FREE(mounts[i]);
+ VIR_FREE(mounts);
+
+ return ret;
+}
+
+
static int lxcContainerPrepareRoot(virDomainDefPtr def,
virDomainFSDefPtr root)
{
@@ -1254,6 +1361,10 @@ static int lxcContainerMountAllFS(virDomainDefPtr vmDef,
STREQ(vmDef->fss[i]->dst, "/"))
continue;
+ if (lxcContainerUnmountSubtree(vmDef->fss[i]->dst,
+ false) < 0)
+ return -1;
+
if (lxcContainerMountFS(vmDef->fss[i], dstprefix, sec_mount_options) < 0)
return -1;
}
@@ -1624,113 +1735,6 @@ static int lxcContainerSetupAllHostdevs(virDomainDefPtr vmDef,
}
-static int lxcContainerGetSubtree(const char *prefix,
- char ***mountsret,
- size_t *nmountsret)
-{
- FILE *procmnt;
- struct mntent mntent;
- char mntbuf[1024];
- int ret = -1;
- char **mounts = NULL;
- size_t nmounts = 0;
-
- VIR_DEBUG("prefix=%s", prefix);
-
- *mountsret = NULL;
- *nmountsret = 0;
-
- if (!(procmnt = setmntent("/proc/mounts", "r"))) {
- virReportSystemError(errno, "%s",
- _("Failed to read /proc/mounts"));
- return -1;
- }
-
- while (getmntent_r(procmnt, &mntent, mntbuf, sizeof(mntbuf)) != NULL) {
- VIR_DEBUG("Got %s", mntent.mnt_dir);
- if (!STRPREFIX(mntent.mnt_dir, prefix))
- continue;
-
- if (VIR_REALLOC_N(mounts, nmounts+1) < 0) {
- virReportOOMError();
- goto cleanup;
- }
- if (!(mounts[nmounts] = strdup(mntent.mnt_dir))) {
- virReportOOMError();
- goto cleanup;
- }
- nmounts++;
- VIR_DEBUG("Grabbed %s", mntent.mnt_dir);
- }
-
- if (mounts)
- qsort(mounts, nmounts, sizeof(mounts[0]),
- lxcContainerChildMountSort);
-
- ret = 0;
-cleanup:
- *mountsret = mounts;
- *nmountsret = nmounts;
- endmntent(procmnt);
- return ret;
-}
-
-static int lxcContainerUnmountSubtree(const char *prefix,
- bool isOldRootFS)
-{
- char **mounts = NULL;
- size_t nmounts = 0;
- size_t i;
- int saveErrno;
- const char *failedUmount = NULL;
- int ret = -1;
-
- VIR_DEBUG("Unmount subtreee from %s", prefix);
-
- if (lxcContainerGetSubtree(prefix, &mounts, &nmounts) < 0)
- goto cleanup;
- for (i = 0 ; i < nmounts ; i++) {
- VIR_DEBUG("Umount %s", mounts[i]);
- if (umount(mounts[i]) < 0) {
- char ebuf[1024];
- failedUmount = mounts[i];
- saveErrno = errno;
- VIR_WARN("Failed to unmount '%s', trying to detach subtree '%s': %s",
- failedUmount, mounts[nmounts-1],
- virStrerror(errno, ebuf, sizeof(ebuf)));
- break;
- }
- }
-
- if (failedUmount) {
- /* This detaches the subtree */
- if (umount2(mounts[nmounts-1], MNT_DETACH) < 0) {
- virReportSystemError(saveErrno,
- _("Failed to unmount '%s' and could not detach subtree '%s'"),
- failedUmount, mounts[nmounts-1]);
- goto cleanup;
- }
- /* This unmounts the tmpfs on which the old root filesystem was hosted */
- if (isOldRootFS &&
- umount(mounts[nmounts-1]) < 0) {
- virReportSystemError(saveErrno,
- _("Failed to unmount '%s' and could not unmount old root '%s'"),
- failedUmount, mounts[nmounts-1]);
- goto cleanup;
- }
- }
-
- ret = 0;
-
-cleanup:
- for (i = 0 ; i < nmounts ; i++)
- VIR_FREE(mounts[i]);
- VIR_FREE(mounts);
-
- return ret;
-}
-
-
struct lxcContainerCGroup {
const char *dir;
const char *linkDest;
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH 00/18] Re-arrange the way cgroups are setup
by Daniel P. Berrange
This is a greatly expanded version of a previous series I posted
https://www.redhat.com/archives/libvir-list/2013-March/msg01373.html
Currently libvirt creates a cgroups hiearchy at
$LOCATION-OF-LIBVIRTD/libvirt/{qemu,lxc}/$GUEST-NAME
eg
/sys/fs/cgroup
├── blkio
│ └── libvirt
│ ├── lxc
│ │ └── busy
│ └── qemu
│ └── vm1
├── cpu,cpuacct
│ ├── libvirt
│ │ ├── lxc
│ │ │ └── busy
│ │ └── qemu
│ │ └── vm1
│ │ ├── emulator
│ │ └── vcpu0
│ └── system
│ ├── abrtd.service
│ ....snip....
│ └── upower.service
├── cpuset
│ └── libvirt
│ ├── lxc
│ │ └── busy
│ └── qemu
│ └── vm1
│ ├── emulator
│ └── vcpu0
├── devices
│ └── libvirt
│ ├── lxc
│ │ └── busy
│ └── qemu
│ └── vm1
├── freezer
│ └── libvirt
│ ├── lxc
│ │ └── busy
│ └── qemu
│ └── vm1
├── memory
│ └── libvirt
│ ├── lxc
│ │ └── busy
│ └── qemu
│ └── vm1
├── net_cls
├── perf_event
This series changes it so that libvirt creates cgroups at
/system/$VMNAME.{qemu,lxc}.libvirt
and allows configuration of the "resource partition" (ie the
"/system" bit) via the XML. So we get a layout like this:
/sys/fs/cgroup
├── blkio
│ └── system
│ ├── demo.lxc.libvirt
│ └── vm1.qemu.libvirt
├── cpu,cpuacct
│ └── system
│ ├── abrtd.service
│ ....snip....
│ ├── demo.lxc.libvirt
│ ....snip....
│ └── vm1.qemu.libvirt
│ ├── emulator
│ └── vcpu0
├── cpuset
│ └── system
│ ├── demo.lxc.libvirt
│ └── vm1.qemu.libvirt
│ ├── emulator
│ └── vcpu0
├── devices
│ └── system
│ ├── demo.lxc.libvirt
│ └── vm1.qemu.libvirt
├── freezer
│ └── system
│ ├── demo.lxc.libvirt
│ └── vm1.qemu.libvirt
├── memory
│ └── system
│ ├── demo.lxc.libvirt
│ └── vm1.qemu.libvirt
├── net_cls
├── perf_event
Flattening out the libvirt created hiearchy has serious
performance wins, due to poor kernel scalability with
deep hierarchies. It also makes it easier to configure
system wide policy for resource usage across system
services and virtual machines / containers, since they
all live at the top level in comon resource partitions.
11 years, 7 months
[libvirt] [libvirt-designer] Add myself to AUTHORS file
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
---
Pushed under trivial rule.
AUTHORS | 1 +
1 file changed, 1 insertion(+)
diff --git a/AUTHORS b/AUTHORS
index db9d798..79812d7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -9,5 +9,6 @@ Patches have been received from:
Christophe Fergeau <cfergeau(a)redhat.com>
Michal Privoznik <mprivozn(a)redhat.com>
+ Zeeshan Ali (Khattak) <zeeshanak(a)gnome.org>
... send patches to get your name added ...
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH v2 00/10] add support for scsi-generic for virtio-scsi
by Han Cheng
This patch series tried to add support for scsi-generic for virtio-scsi.
Changes from v1:
- Mv readonly to virDomainHostdevDef as Osier advises.
- Use scsi adaper definition from storagepool.
- Limit scsi hostdev to add one live guest.
- Create some util function for scsi hostdev.
- Add hotplug support for scsi hostdev.
The v1 could be found at:
https://www.redhat.com/archives/libvir-list/2013-March/msg00073.html
We may do some code refactoring to reduce code in pci/usb/sci hostdev later.
Han Cheng (10):
conf: Introduce readonly to hostdev and change helper function
docs/schemas: split storagepool.rng for scsi hostdev
conf: Introduce scsi hostdev
qemu: New cap flag for scsi-generic
utils: util functions for scsi hostdev
qemu: Build qemu command line for scsi-generic
qemu: Basic management functions for scsi hostdev
qemu: cgroup and selinux for scsi hostdev
qemu: hotplug support for scsi hostdev
tests: tests for scsi hostdev
docs/formatdomain.html.in | 37
docs/schemas/domaincommon.rng | 35
docs/schemas/storagepool.rng | 18
docs/schemas/storagepoolcommon.rng | 21
po/POTFILES.in | 1
src/Makefile.am | 1
src/conf/domain_audit.c | 10
src/conf/domain_conf.c | 198 ++++
src/conf/domain_conf.h | 13
src/libvirt_private.syms | 24
src/qemu/qemu_capabilities.c | 15
src/qemu/qemu_capabilities.h | 2
src/qemu/qemu_cgroup.c | 67 +
src/qemu/qemu_cgroup.h | 3
src/qemu/qemu_command.c | 133 +++
src/qemu/qemu_command.h | 6
src/qemu/qemu_conf.h | 2
src/qemu/qemu_driver.c | 3
src/qemu/qemu_hostdev.c | 227 +++++
src/qemu/qemu_hostdev.h | 10
src/qemu/qemu_hotplug.c | 211 ++++-
src/qemu/qemu_process.c | 3
src/security/security_selinux.c | 56 +
src/util/virscsi.c | 399 ++++++++++
src/util/virscsi.h | 83 ++
tests/qemuhelpdata/qemu-1.0-device | 10
tests/qemuhelpdata/qemu-1.1.0-device | 10
tests/qemuhelpdata/qemu-1.2.0-device | 5
tests/qemuhelpdata/qemu-kvm-1.2.0-device | 5
tests/qemuhelptest.c | 19
tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-boot.args | 10
tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-boot.xml | 34
tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-readonly.args | 10
tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-readonly.xml | 35
tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi.args | 10
tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi.xml | 34
tests/qemuxml2argvtest.c | 12
tests/qemuxml2xmltest.c | 4
38 files changed, 1677 insertions(+), 99 deletions(-)
11 years, 7 months
[libvirt] [PATCH] spec: Require pod2man when running autoreconf
by Jiri Denemark
Since commit b8a32e0e94d75702714167539310f0df4d268e0f, all man pages
depend on configure.ac so that they are properly regenerated whenever
libvirt version changes. Thus libvirt.spec needs to have a build
dependency on pod2man when %{enable_autotools} is set.
---
libvirt.spec.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 34b3f9c..328b009 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -392,10 +392,11 @@ Requires: libvirt-client = %{version}-%{release}
%if 0%{?enable_autotools}
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gettext-devel
BuildRequires: libtool
+BuildRequires: /usr/bin/pod2man
%endif
BuildRequires: python-devel
%if %{with_systemd}
BuildRequires: systemd-units
%endif
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH] fix compilation failure under tests/
by Serge Hallyn
Without this, I get errors like
/usr/bin/ld: virnettlscontexttest.o: undefined reference to symbol 'gnutls_x509_crt_set_activation_time@@GNUTLS_1_4'
/usr/bin/ld: note: 'gnutls_x509_crt_set_activation_time@@GNUTLS_1_4' is defined in DSO /usr/lib/x86_64-linux-gnu/libgnutls.so.26 so try adding it to the linker command line
/usr/lib/x86_64-linux-gnu/libgnutls.so.26: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
(and onward in sequence) - since at least 1.0.2 on Ubuntu systems.
(Oddly, only if gnutls is installed - uninstalling it allows the
compilation to complete, so it hasn't been crucial on our builders,
just annoying when building by hand).
Signed-off-by: Serge Hallyn <serge.hallyn(a)ubuntu.com>
---
tests/Makefile.am | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3abd698..99d70d2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -36,7 +36,8 @@ PROBES_O += ../src/libvirt_probes.lo
endif
LDADDS = \
- $(WARN_CFLAGS) \
+ $(GNUTLS_LIBS) $(LIBXML_LIBS) $(DBUS_LIBS) \
+ $(WARN_CFLAGS) \
$(PROBES_O) \
../src/libvirt.la \
../gnulib/lib/libgnu.la
--
1.8.1.2
11 years, 7 months
[libvirt] [PATCH] Add error handling to optional arguments in cmdCPUStats
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=907732
Also added informational message when count value is larger than number
of CPUs present. Original code commit '31047e2b' quietly changes it and
continues on.
Prior to this patch, no errors were seen for following sequences
virsh cpu-stats guest xyz
virsh cpu-stats guest --start xyz
virsh cpu-stats guest --count xyz
virsh cpu-stats guest --count 99999999999
With this patch, the following errors are displayed
error: Invalid value for start CPU
error: Invalid value for start CPU
error: Invalid value for number of CPUs to show
error: Invalid value for number of CPUs to show
Passing a value such as 9 to count will display the following:
Only 4 CPUs available to show
CPU0:
cpu_time 19.860859202 seconds
vcpu_time 17.551435620 seconds
...
---
tools/virsh-domain.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index c088468..3dbfa53 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6111,7 +6111,7 @@ static const vshCmdInfo info_cpu_stats[] = {
{.name = "desc",
.data = N_("Display per-CPU and total statistics about the domain's CPUs")
},
- {.name = NULL},
+ {.name = NULL}
};
static const vshCmdOptDef opts_cpu_stats[] = {
@@ -6132,7 +6132,7 @@ static const vshCmdOptDef opts_cpu_stats[] = {
.type = VSH_OT_INT,
.help = N_("Number of shown CPUs at most")
},
- {.name = NULL},
+ {.name = NULL}
};
static bool
@@ -6149,9 +6149,18 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
return false;
show_total = vshCommandOptBool(cmd, "total");
- if (vshCommandOptInt(cmd, "start", &cpu) > 0)
+ if (vshCommandOptInt(cmd, "start", &cpu) < 0) {
+ vshError(ctl, "%s", _("Invalid value for start CPU"));
+ goto cleanup;
+ }
+ if (cpu >= 0)
show_per_cpu = true;
- if (vshCommandOptInt(cmd, "count", &show_count) > 0)
+
+ if (vshCommandOptInt(cmd, "count", &show_count) < 0) {
+ vshError(ctl, "%s", _("Invalid value for number of CPUs to show"));
+ goto cleanup;
+ }
+ if (show_count >= 0)
show_per_cpu = true;
/* default show per_cpu and total */
@@ -6170,8 +6179,10 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
/* get number of cpus on the node */
if ((max_id = virDomainGetCPUStats(dom, NULL, 0, 0, 0, flags)) < 0)
goto failed_stats;
- if (show_count < 0 || show_count > max_id)
+ if (show_count < 0 || show_count > max_id) {
+ vshPrint(ctl, _("Only %d CPUs available to show\n"), max_id);
show_count = max_id;
+ }
/* get percpu information */
if ((nparams = virDomainGetCPUStats(dom, NULL, 0, 0, 1, flags)) < 0)
--
1.8.1.4
11 years, 7 months
[libvirt] [libvirt-designer] build: No need to set PKG_CONFIG_PATH for g-ir-scanner
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
I don't see any need for this and it actually breaks the build here:
GEN LibvirtDesigner-1.0.gir
Package libvirt-gconfig-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libvirt-gconfig-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libvirt-gconfig-1.0' found
In file included from <stdin>:4:0:
/extra-data/checkout/gnome/libvirt-designer/libvirt-designer/libvirt-designer.h:27:45:
fatal error: libvirt-gconfig/libvirt-gconfig.h: No such file or
directory
compilation terminated.
Error while processing the source.
make[3]: *** [LibvirtDesigner-1.0.gir] Error 1
---
libvirt-designer/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-designer/Makefile.am b/libvirt-designer/Makefile.am
index 8f10c41..7becfd2 100644
--- a/libvirt-designer/Makefile.am
+++ b/libvirt-designer/Makefile.am
@@ -103,7 +103,7 @@ test_designer_domain_LDFLAGS = \
if WITH_INTROSPECTION
LibvirtDesigner-1.0.gir: libvirt-designer-1.0.la $(G_IR_SCANNER) Makefile.am
- $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir) $(G_IR_SCANNER) \
+ $(AM_V_GEN) $(G_IR_SCANNER) \
--quiet \
--warn-all \
--namespace LibvirtDesigner \
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH] qemu: fix qemuCgroupControllerActive
by Ján Tomko
Since 56f27b3 it always returned false.
---
src/qemu/qemu_cgroup.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 2cdc2b7..9e11a05 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -58,6 +58,8 @@ bool qemuCgroupControllerActive(virQEMUDriverPtr driver,
if (!virCgroupMounted(driver->cgroup, controller))
goto cleanup;
+ ret = true;
+
cleanup:
virObjectUnref(cfg);
return ret;
--
1.8.1.5
11 years, 7 months