[libvirt] wrong warning flags for clang
by Roman Bogorodskiy
Appears that configure doesn't properly detect the case when clang is
used instead of gcc:
CC=clang ./configure runs fine, but produces a long list of warning
flags that clang doesn't support:
configure: Warning Flags: -W -Waddress -Wall -Warray-bounds
-Wattributes -Wbad-function-cast ... trimmed ...
At some point, compilation fails:
CC libvirt_util_la-viralloc.lo
clang: error: unknown warning option '-Wclobbered' [-Werror,-Wunknown-warning-option]
clang: error: unknown warning option '-Wcoverage-mismatch'; did you mean '-Wpointer-type-mismatch'? [-Werror,-Wunknown-warning-option]
and many other similar errors.
Any idea what would be a proper fix for that?
Roman Bogorodskiy
11 years, 6 months
[libvirt] [libvirt PATCH] node_device: Clean up unused macros
by Osier Yang
All of these macros are not used anymore, remove them.
---
src/node_device/node_device_driver.h | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_device_driver.h
index 2dff70f..0f62c83 100644
--- a/src/node_device/node_device_driver.h
+++ b/src/node_device/node_device_driver.h
@@ -28,15 +28,6 @@
# include "driver.h"
# include "node_device_conf.h"
-# define LINUX_SYSFS_SCSI_HOST_PREFIX "/sys/class/scsi_host/"
-# define LINUX_SYSFS_SCSI_HOST_POSTFIX "device"
-# define LINUX_SYSFS_FC_HOST_PREFIX "/sys/class/fc_host/"
-
-# define VPORT_CREATE 0
-# define VPORT_DELETE 1
-# define LINUX_SYSFS_VPORT_CREATE_POSTFIX "/vport_create"
-# define LINUX_SYSFS_VPORT_DELETE_POSTFIX "/vport_delete"
-
# define LINUX_NEW_DEVICE_WAIT_TIME 60
# ifdef WITH_HAL
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH v3] domain: add 'pre-startup' signal and do nodedevs checking
by Guannan Ren
This patch introduces 'pre-start' signal and registers
nodedev checking handler to check duplicate USB devices.
If virt-manager can not identify unique usb device any more
before domain startup, it will throw a tip error to tell it
is time to reattach host USB devices to get updated bus/addr info.
---
virtManager/domain.py | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/virtManager/domain.py b/virtManager/domain.py
index 791f2af..89c226b 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -149,6 +149,7 @@ class vmmDomain(vmmLibvirtObject):
"status-changed": (GObject.SignalFlags.RUN_FIRST, None, [int, int]),
"resources-sampled": (GObject.SignalFlags.RUN_FIRST, None, []),
"inspection-changed": (GObject.SignalFlags.RUN_FIRST, None, []),
+ "pre-startup": (GObject.SignalFlags.RUN_FIRST, None, [object]),
}
def __init__(self, conn, backend, uuid):
@@ -252,7 +253,34 @@ class vmmDomain(vmmLibvirtObject):
self.connect("status-changed", self._update_start_vcpus)
self.connect("config-changed", self._reparse_xml)
+ self.connect("pre-startup", self._prestartup_nodedev_check)
+ def _prestartup_nodedev_check(self, src, ret):
+ ignore = src
+ error = _("These is more than one '%s' device attached to "
+ "your host, and we can't determine which one to "
+ "use for your guest.\n"
+ "To fix this, remove and reattach the USB device "
+ "to your guest using the 'Add Hardware' wizard.")
+
+ for hostdev in self.get_hostdev_devices():
+ devtype = hostdev.type
+
+ if devtype != "usb":
+ continue
+
+ vendor = hostdev.vendor
+ product = hostdev.product
+ bus = hostdev.bus
+ device = hostdev.device
+
+ if vendor and product:
+ count = self.conn.get_nodedevs_number("usb_device",
+ vendor,
+ product)
+ if count > 1 and not (bus and device):
+ prettyname = "%s %s" % (vendor, product)
+ ret.append(error % prettyname)
###########################
# Misc API getter methods #
@@ -1171,6 +1199,13 @@ class vmmDomain(vmmLibvirtObject):
if self.get_cloning():
raise RuntimeError(_("Cannot start guest while cloning "
"operation in progress"))
+
+ pre_startup_ret = []
+ self.emit("pre-startup", pre_startup_ret)
+
+ for error in pre_startup_ret:
+ raise RuntimeError(error)
+
self._backend.create()
self.idle_add(self.force_update_status)
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH v2 0/8] Add user namespace support for libvirt lxc
by Gao feng
This patchset try to add userns support for libvirt lxc.
Since userns is nearly completed in linux-3.9, the old
kernel doesn't support userns, I add some New XML elements
to let people decide if enable userns.The userns is enabled
only when user configure the XML.
The format of user namespace related XML file like below:
<idmap>
<uid start='0' target='1000' count='10'>
<gid start='0' target='1000' count='10'>
</idmap>
it means the user in container (which uid:gid is 0:0) will
be mapped to the user in host (uid:gid is 1000:1000), count
is used to form an u/gid range: The users in container which
uid in [start, start + count -1] will be mapped.
You can have multiple lines to map differnet id ranges,
caution, you must make sure the root user of container has
been mapped.
This patchset also does the below jobs.
1, Because the uninit userns has no right to create devices,
we should create devices for container on host.
2, Changes the owner of fuse and tty device.
Gao feng (8):
LXC: Introduce New XML element for user namespace
LXC: enable user namespace when user set the uidmap
LXC: sort the uidmap/gidmap of domain
LXC: introduce virLXCControllerSetupUserns and lxcContainerSetUserns
LXC: Creating devices for container on host side
LXC: change the owner of devices created on host
LXC: change the owner of tty devices to the root user of container
LXC: fuse: Change files owner to the root user of container
docs/formatdomain.html.in | 23 +++++
docs/schemas/domaincommon.rng | 28 ++++++
src/conf/domain_conf.c | 111 +++++++++++++++++++++
src/conf/domain_conf.h | 19 ++++
src/lxc/lxc_container.c | 120 +++++++++++------------
src/lxc/lxc_controller.c | 218 +++++++++++++++++++++++++++++++++++++++++-
src/lxc/lxc_fuse.c | 6 ++
7 files changed, 455 insertions(+), 70 deletions(-)
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] build: fix use of mmap
by Eric Blake
Commit bfe7721d introduced a regression, but only on platforms
like FreeBSD that lack posix_fallocate and where mmap serves as
a nice fallback for safezero.
util/virfile.c: In function 'safezero':
util/virfile.c:837: error: 'PROT_READ' undeclared (first use in this function)
* src/util/virutil.c (includes): Move use of <sys/mman.h>...
* src/util/virfile.c (includes): ...to the file that uses mmap.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the build-breaker rule.
src/util/virfile.c | 3 +++
src/util/virutil.c | 3 ---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 1491f27..a59d67d 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -39,6 +39,9 @@
# include <mntent.h>
#endif
#include <stdlib.h>
+#if HAVE_MMAP
+# include <sys/mman.h>
+#endif
#if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR
# include <linux/loop.h>
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 43814df..3c0a481 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -36,9 +36,6 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
-#if HAVE_MMAP
-# include <sys/mman.h>
-#endif
#include <string.h>
#include <termios.h>
#include <locale.h>
--
1.8.1.4
11 years, 6 months
[libvirt] [PATCH] build: update to latest gnulib, for syntax-check
by Eric Blake
This picks up a fix for a syntax-check weakness mentioned here:
https://www.redhat.com/archives/libvir-list/2013-May/msg00811.html
* .gnulib: Update to latest, for maint.mk improvement.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the trivial rule.
* .gnulib 0f8ddbf...a363f4e (3):
> maint.mk: catch more abuse of HAVE_DECL in syntax-check
> deps: require Automake >= 1.9.6 in generated Makefile fragments
> autoupdate
.gnulib | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gnulib b/.gnulib
index 0f8ddbf..a363f4e 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 0f8ddbf1a13a93a4584afdd82f0f87e498a0db6f
+Subproject commit a363f4ed4a0e69187c97686ac44502c49c7f4b3d
--
1.8.1.4
11 years, 6 months
[libvirt] patch set for virt-sandbox-service
by dwalsh@redhat.com
The patch will add proper handling of duplicate Generic Sandbox.
It will also add support for adding mount points via virt-sandbox-service
using the same syntax as virt-sandbox.
[sandbox PATCH 1/2] Verify that a created Generic Sandbox does not
[sandbox PATCH 2/2] Add support for virt-sandbox-service to add
11 years, 6 months
[libvirt] [PATCH] Update hellolibvirt to demo virGetLastErrorMessage()
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Update the hellolibvirt example program to demonstrate use of
the virGetLastErrorMessage() API for quick error reporting
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
examples/hellolibvirt/hellolibvirt.c | 64 ++++++++----------------------------
1 file changed, 14 insertions(+), 50 deletions(-)
diff --git a/examples/hellolibvirt/hellolibvirt.c b/examples/hellolibvirt/hellolibvirt.c
index 26dd67f..4ae60fc 100644
--- a/examples/hellolibvirt/hellolibvirt.c
+++ b/examples/hellolibvirt/hellolibvirt.c
@@ -9,42 +9,6 @@
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
-static void
-showError(virConnectPtr conn)
-{
- int ret;
- virErrorPtr err;
-
- err = malloc(sizeof(*err));
- if (!err) {
- printf("Could not allocate memory for error data\n");
- goto out;
- }
-
- ret = virConnCopyLastError(conn, err);
-
- switch (ret) {
- case 0:
- printf("No error found\n");
- break;
-
- case -1:
- printf("Parameter error when attempting to get last error\n");
- break;
-
- default:
- printf("libvirt reported: \"%s\"\n", err->message);
- break;
- }
-
- virResetError(err);
- free(err);
-
-out:
- return;
-}
-
-
static int
showHypervisorInfo(virConnectPtr conn)
{
@@ -59,15 +23,15 @@ showHypervisorInfo(virConnectPtr conn)
hvType = virConnectGetType(conn);
if (!hvType) {
ret = 1;
- printf("Failed to get hypervisor type\n");
- showError(conn);
+ printf("Failed to get hypervisor type: %s\n",
+ virGetLastErrorMessage());
goto out;
}
if (0 != virConnectGetVersion(conn, &hvVer)) {
ret = 1;
- printf("Failed to get hypervisor version\n");
- showError(conn);
+ printf("Failed to get hypervisor version: %s\n",
+ virGetLastErrorMessage());
goto out;
}
@@ -102,16 +66,16 @@ showDomains(virConnectPtr conn)
numActiveDomains = virConnectNumOfDomains(conn);
if (numActiveDomains == -1) {
ret = 1;
- printf("Failed to get number of active domains\n");
- showError(conn);
+ printf("Failed to get number of active domains: %s\n",
+ virGetLastErrorMessage());
goto out;
}
numInactiveDomains = virConnectNumOfDefinedDomains(conn);
if (numInactiveDomains == -1) {
ret = 1;
- printf("Failed to get number of inactive domains\n");
- showError(conn);
+ printf("Failed to get number of inactive domains: %s\n",
+ virGetLastErrorMessage());
goto out;
}
@@ -157,16 +121,16 @@ main(int argc, char *argv[])
if (!conn) {
ret = 1;
- printf("No connection to hypervisor\n");
- showError(conn);
+ printf("No connection to hypervisor: %s\n",
+ virGetLastErrorMessage());
goto out;
}
uri = virConnectGetURI(conn);
if (!uri) {
ret = 1;
- printf("Failed to get URI for hypervisor connection\n");
- showError(conn);
+ printf("Failed to get URI for hypervisor connection: %s\n",
+ virGetLastErrorMessage());
goto disconnect;
}
@@ -185,8 +149,8 @@ main(int argc, char *argv[])
disconnect:
if (0 != virConnectClose(conn)) {
- printf("Failed to disconnect from hypervisor\n");
- showError(conn);
+ printf("Failed to disconnect from hypervisor: %s\n",
+ virGetLastErrorMessage());
ret = 1;
} else {
printf("Disconnected from hypervisor\n");
--
1.8.2.1
11 years, 6 months