[libvirt] [PATCH] fix a ambiguous output of the command:'virsh vol-create-as'
by Hongwei Bi
I created a storage volume(eg: test) from a storage pool(eg:vg10) using
the following command:"virsh vol-create-as --pool vg10 --name test --capacity 300M."
When I re-executed the above command, the output was as the following:
"error: Failed to create vol test
error: Storage volume not found: storage vol 'test' already exists"
I think the output "Storage volume not found" is not appropriate. Because in fact storage
vol test has been found at this time. And then I think virErrorNumber should includes
VIR_ERR_STORAGE_EXIST which can also be used elsewhere. So I make this patch. The result
is as following:
"error: Failed to create vol test
error: storage volume 'test' exists already"
---
include/libvirt/virterror.h | 1 +
src/storage/storage_driver.c | 4 ++--
src/util/virerror.c | 6 ++++++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index c1960c8..28ef30a 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -296,6 +296,7 @@ typedef enum {
VIR_ERR_ACCESS_DENIED = 88, /* operation on the object/resource
was denied */
VIR_ERR_DBUS_SERVICE = 89, /* error from a dbus service */
+ VIR_ERR_STORAGE_EXIST = 90, /* the storage vol already exist */
} virErrorNumber;
/**
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 6c39284..aa5a144 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1538,8 +1538,8 @@ storageVolCreateXML(virStoragePoolPtr obj,
goto cleanup;
if (virStorageVolDefFindByName(pool, voldef->name)) {
- virReportError(VIR_ERR_NO_STORAGE_VOL,
- _("storage vol '%s' already exists"), voldef->name);
+ virReportError(VIR_ERR_STORAGE_EXIST,
+ _("'%s'"), voldef->name);
goto cleanup;
}
diff --git a/src/util/virerror.c b/src/util/virerror.c
index ca25678..35bb017 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -1004,6 +1004,12 @@ virErrorMsg(virErrorNumber error, const char *info)
else
errmsg = _("Storage volume not found: %s");
break;
+ case VIR_ERR_STORAGE_EXIST:
+ if (info == NULL)
+ errmsg = _("this storage volume exists already");
+ else
+ errmsg = _("storage volume %s exists already");
+ break;
case VIR_ERR_STORAGE_PROBE_FAILED:
if (info == NULL)
errmsg = _("Storage pool probe failed");
--
1.7.1
11 years, 2 months
[libvirt] [PATCH] fix a ambiguous output of the command:'virsh vol-create-as'
by Hongwei Bi
I created a storage volume(eg: test) from a storage pool(eg:vg10) using the
following command:"virsh vol-create-as --pool vg10 --name test --capacity 300M."
When I re-executed the above command, the output was as the following:
"error: Failed to create vol test
error: Storage volume not found: storage vol 'test' already exists"
I think the output "Storage volume not found" is not appropriate. Because in fact storage
vol test has been found at this time. And then I think virErrorNumber should includes
VIR_ERR_STORAGE_VOL_EXISTS which can also be used elsewhere. So I make this patch. The result
is as following:
"error: Failed to create vol test
error: storage volume 'test' exists already"
---
include/libvirt/virterror.h | 1 +
src/storage/storage_driver.c | 4 ++--
src/util/virerror.c | 6 ++++++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index c1960c8..fd14237 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -296,6 +296,7 @@ typedef enum {
VIR_ERR_ACCESS_DENIED = 88, /* operation on the object/resource
was denied */
VIR_ERR_DBUS_SERVICE = 89, /* error from a dbus service */
+ VIR_ERR_STORAGE_VOL_EXISTS = 90, /* the storage vol already exists */
} virErrorNumber;
/**
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 6c39284..d419a36 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1538,8 +1538,8 @@ storageVolCreateXML(virStoragePoolPtr obj,
goto cleanup;
if (virStorageVolDefFindByName(pool, voldef->name)) {
- virReportError(VIR_ERR_NO_STORAGE_VOL,
- _("storage vol '%s' already exists"), voldef->name);
+ virReportError(VIR_ERR_STORAGE_VOL_EXISTS,
+ _("'%s'"), voldef->name);
goto cleanup;
}
diff --git a/src/util/virerror.c b/src/util/virerror.c
index ca25678..3f55cec 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -1004,6 +1004,12 @@ virErrorMsg(virErrorNumber error, const char *info)
else
errmsg = _("Storage volume not found: %s");
break;
+ case VIR_ERR_STORAGE_VOL_EXISTS:
+ if (info == NULL)
+ errmsg = _("this storage volume exists already");
+ else
+ errmsg = _("storage volume %s exists already");
+ break;
case VIR_ERR_STORAGE_PROBE_FAILED:
if (info == NULL)
errmsg = _("Storage pool probe failed");
--
1.7.1
11 years, 2 months
[libvirt] error: server response too large
by Claudio Bley
Hi.
When trying to do a screenshot of a remote domain connected via
qemu+tcp (for testing purposes only), I receive this error:
----------------------------------------------------------------------
virsh -c qemu+tcp://dev/system
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # version
Compiled against library: libvir 0.9.8
Using library: libvir 0.9.8
Using API: QEMU 0.9.8
Running hypervisor: QEMU 1.5.1
virsh # screenshot 2 /tmp/screendump
error: could not receive data from domain 2
error: packet 1048600 bytes received from server too large, want 262144
virsh # 2013-09-30 14:47:05.158+0000: 21646: info : libvirt version: 0.9.8
2013-09-30 14:47:05.158+0000: 21646: warning : virNetClientIncomingEvent:1660 : Something went wrong during async message processing
----------------------------------------------------------------------
I'm using Ubuntu LTS 12.04.3, latest version in the repo which is
0.9.8-2ubuntu17.13.
On the server side, I'm using a self-compiled libvirt from git master.
On the server, I receive:
2013-09-30 14:41:10.075+0000: 1203: info : libvirt version: 1.1.2
2013-09-30 14:41:10.075+0000: 1203: error : virNetSocketWriteWire:1446 : Cannot write data: Connection reset by peer
2013-09-30 14:41:10.077+0000: 1203: error : virFDStreamCloseInt:315 : internal error: I/O helper exited abnormally
2013-09-30 14:41:10.078+0000: 1203: error : virFDStreamUpdateCallback:133 : internal error: stream is not open
I've uploaded the logs produced with LIBVIRT_DEBUG=1 to sendspace:
http://www.sendspace.com/file/tevueo (libvirtd.log.gz) [1MB]
http://www.sendspace.com/file/rdpmrh (virsh.log.gz) [5KB]
When using a non-async virStream with client library version 1.1.2, it
works OK.
Is this a bug in libvirt 0.9.8 or is this a regression in >= 1.1.2?
I started to git bisect but ran out of time, I'm out of office till
next week.
Any help would be great. Thanks.
Claudio
--
AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany
Phone: +49 341 265 310 19
Web:<http://www.av-test.org>
Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern
11 years, 2 months
Re: [libvirt] [libvirt-users] (Xen + libvirt) Installing and workin with xen -4.2.1 and libvirt 1.1.2
by Dario Faggioli
On lun, 2013-10-07 at 13:58 +0530, cooldharma06 wrote:
> hi,
>
>
> i removed all libvirt things form my system and i installed
> libvirt-0.9.12 frm my repository.
>
>
> then i installed libvirt-1.1.2 from the source with following
> commands.
>
Does this mean that you have two copies of libvirt installed, one from
the distro packages (0.9.12) and one from sources (1.1.2) at the same
time on the same box?
Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
11 years, 2 months
[libvirt] [PATCH] build: be smarter about building documentation
by Eric Blake
I'm tired of cryptic reports on IRC from people who build from
git, then type 'make install' and have it fail quite a ways down
the road because the documentation wasn't built. It's a feature
that documentation is not built during development if the toolchain
is not present (not all git developers build tarballs, and the
tarballs already contain pre-built docs); but this only works as
long as you don't try to install or make a tarball from that
setup. With this patch in place, and without xhtml1-dtds, I now
get this nice failure:
$ make install
cfg.mk:109: *** ERROR: missing doc toolchain (install xhtml1-dtds and xmllint). Stop.
and all with no impact to regular 'make' or 'make check'.
Along the way, I tried to discover why 'yum-builddeps libvirt'
doesn't always tell developers to install xhtml1-dtds - my conclusion
was that if the .srpm is unavailable, then yum-builddeps can't
figure out anything that is required. The spec file already has
a BuildRequires on the doc toolchain (and therefore, the docs shipped
with an rpm are up-to-date, even if the spec file applied patches
that affect the docs). So thankfully I don't have to make any
spec file changes in this patch.
* cfg.mk: Let 'make install' and 'make dist' error much earlier if
we detect a build from git without doc toolchain.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Heavily influenced by code in gnulib's GNUMakefile :)
cfg.mk | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/cfg.mk b/cfg.mk
index e6584e8..7e17b5c 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -88,6 +88,29 @@ else
distdir: sc_vulnerable_makefile_CVE-2012-3386.z
endif
+# We intentionally don't require the doc toolchain during 'make' during
+# development, but 'make dist' must ship pre-built docs, and 'make install'
+# from a git build fails if docs weren't built, both with awkward error
+# messages if we let the build run that far. Therefore, bail loud and
+# early if we detect a git tree but no doc toolchain.
+ifeq ($(MAKELEVEL),0)
+ _is-dist-target ?= $(filter-out %clean, \
+ $(filter maintainer-% dist% alpha beta stable,$(MAKECMDGOALS)))
+ _is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
+ ifneq (,$(_is-dist-target)$(_is-install-target))
+ ifeq ($(shell \
+ if test -e $(srcdir)/.git; then \
+ if test -x $(XMLLINT) && test -x $(XMLCATALOG) && \
+ $(XMLCATALOG) '$(XML_CATALOG_FILE)' \
+ "-//W3C//DTD XHTML 1.0 Strict//EN" >/dev/null; then \
+ echo works; \
+ else echo oops; fi;\
+ else echo tarball; fi),oops)
+ $(error ERROR: missing doc toolchain (install xhtml1-dtds and xmllint))
+ endif
+ endif
+endif
+
# Files that should never cause syntax check failures.
VC_LIST_ALWAYS_EXCLUDE_REGEX = \
(^(HACKING|docs/(news\.html\.in|.*\.patch))|\.po)$$
--
1.8.3.1
11 years, 2 months
[libvirt] [PATCH]doc: fix typo in HACKING
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
s/installion/installation
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
HACKING | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/HACKING b/HACKING
index f9f8381..f8797cc 100644
--- a/HACKING
+++ b/HACKING
@@ -45,7 +45,7 @@ post your patches:
--to=libvir-list(a)redhat.com master
(Note that the "git send-email" subcommand may not be in the main git package
-and using it may require installion of a separate package, for example the
+and using it may require installation of a separate package, for example the
"git-email" package in Fedora.) For a single patch you can omit
"--cover-letter", but a series of two or more patches needs a cover letter. If
you get tired of typing "--to=libvir-list(a)redhat.com" designation you can set
--
1.8.2.1
11 years, 2 months
[libvirt] [PATCH v2] LXC: Detect fs support. Mount only supported filesystems
by Bogdan Purcareata
Kept ((access(dstpath, R_OK) < 0) || (!lxcCheckFSSupport(mnt->type)))
when determining support for the mount. Even if the filesystem type is
supported, there is still a chance to fail when building the dstpath
(virFileMakePath). If that call fails, starting the container will fail.
Specifically encountered this problem for securityfs, as I was unable
to mkdir /sys/kernel/security.
Signed-off-by: Bogdan Purcareata <bogdan.purcareata(a)freescale.com>
---
src/lxc/lxc_container.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 989e920..496443d 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -509,6 +509,67 @@ static int lxcContainerChildMountSort(const void *a, const void *b)
# define MS_SLAVE (1<<19)
#endif
+/*
+ * This function attempts to detect kernel support
+ * for a specific filesystem type. This is done by
+ * inspecting /proc/filesystems.
+ */
+static int lxcCheckFSSupport(const char *fs_type)
+{
+ FILE *fp = NULL;
+ int ret = -1;
+ const char *fslist = "/proc/filesystems";
+ char *line = NULL;
+ char *type;
+ size_t n;
+
+ /* there should be no problem mounting an entry
+ * with NULL fs type, hence NULL fs types are
+ * supported */
+ if (!fs_type) {
+ ret = 1;
+ goto out;
+ }
+
+ VIR_DEBUG("Checking kernel support for %s in %s", fs_type, fslist);
+
+ if (!(fp = fopen(fslist, "r"))) {
+ virReportSystemError(errno,
+ _("Unable to read %s"),
+ fslist);
+ goto out;
+ }
+
+ while(getline(&line, &n, fp) > 0) {
+ type = strstr(line, fs_type);
+
+ if (!type)
+ continue;
+
+ if (!strncmp(type, fs_type, strlen(type))) {
+ ret = 1;
+ goto cleanup;
+ }
+ }
+
+ if (ferror(fp)) {
+ virReportSystemError(errno,
+ _("Error reading line from %s"),
+ fslist);
+ goto cleanup;
+ }
+
+ VIR_DEBUG("No kernel support for %s", fs_type);
+
+ ret = 0;
+
+cleanup:
+ VIR_FREE(line);
+ VIR_FORCE_FCLOSE(fp);
+out:
+ return ret;
+}
+
static int lxcContainerGetSubtree(const char *prefix,
char ***mountsret,
size_t *nmountsret)
@@ -789,17 +850,23 @@ static int lxcContainerMountBasicFS(bool userns_enabled)
for (i = 0; i < ARRAY_CARDINALITY(lxcBasicMounts); i++) {
virLXCBasicMountInfo const *mnt = &lxcBasicMounts[i];
const char *srcpath = NULL;
+ const char *dstpath = NULL;
VIR_DEBUG("Processing %s -> %s",
mnt->src, mnt->dst);
srcpath = mnt->src;
+ dstpath = mnt->dst;
/* Skip if mount doesn't exist in source */
if ((srcpath[0] == '/') &&
(access(srcpath, R_OK) < 0))
continue;
+ if ((access(dstpath, R_OK) < 0) || /* mount is not present on host */
+ (!lxcCheckFSSupport(mnt->type))) /* no fs support in kernel */
+ continue;
+
#if WITH_SELINUX
if (STREQ(mnt->src, SELINUX_MOUNT) &&
(!is_selinux_enabled() || userns_enabled))
--
1.7.11.7
11 years, 2 months
[libvirt] [PATCH v2]lxc: do cleanup when failed to bind fs as read-only
by Chen Hanxiao
From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
We forgot to do cleanup when lxcContainerMountFSTmpfs
failed to bind fs as read-only.
v2: fix an indentation issue
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/lxc/lxc_container.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index c60f5d8..b1f429c 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1451,6 +1451,7 @@ static int lxcContainerMountFSTmpfs(virDomainFSDefPtr fs,
virReportSystemError(errno,
_("Failed to make directory %s readonly"),
fs->dst);
+ goto cleanup;
}
}
--
1.8.2.1
11 years, 2 months
[libvirt] [PATCH 1/2] free cmd in virNetDevVethDelete
by Gao feng
Signed-off-by: Gao feng <gaofeng(a)cn.fujitsu.com>
---
src/util/virnetdevveth.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
index 403961b..1085217 100644
--- a/src/util/virnetdevveth.c
+++ b/src/util/virnetdevveth.c
@@ -196,6 +196,7 @@ int virNetDevVethDelete(const char *veth)
{
virCommandPtr cmd = virCommandNewArgList("ip", "link", "del", veth, NULL);
int status;
+ int ret = -1;
if (virCommandRun(cmd, &status) < 0)
return -1;
@@ -203,11 +204,16 @@ int virNetDevVethDelete(const char *veth)
if (status != 0) {
if (!virNetDevExists(veth)) {
VIR_DEBUG("Device %s already deleted (by kernel namespace cleanup)", veth);
- return 0;
+ ret = 0;
+ goto cleanup;
}
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to delete veth device %s"), veth);
- return -1;
+ goto cleanup;
}
- return 0;
+
+ ret = 0;
+cleanup:
+ virCommandFree(cmd);
+ return ret;
}
--
1.8.3.1
11 years, 2 months