[libvirt] Regression in allocating ports for serial/parallel devs
by Cole Robinson
Hi Michal,
The following commit introduced a regression:
http://libvirt.org/git/?p=libvirt.git;a=commit;h=79c3fe4d1681cd94598d2bd4...
Now, defining a guest with XML like
<serial type='pty'/>
<serial type='null'/>
<serial type='stdio'/>
Will allocate <target port='0'/> to all 3. The reason is that
target.port is never set to -1 unless the user specified some <target>
XML. A simple fix is:
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3265,6 +3265,8 @@ virDomainChrDefParseXML(virCapsPtr caps,
return NULL;
}
+ def->target.port = -1;
+
type = virXMLPropString(node, "type");
if (type == NULL) {
def->source.type = VIR_DOMAIN_CHR_TYPE_PTY;
But that doesn't solve the problem for users who are building ChrDef's
by hand, like when converting between formats as xen and vmware drivers
do. I didn't look at those users so they may be safe, but the interface
should be improved. Maybe add a ChrDefNew function that sets the -1 default.
Additionally we should add a qemuxml2xml test for this to prevent
against future regressions.
Thanks,
Cole
13 years, 8 months
[libvirt] [libvirt-php] Fix get_xml when xpath is null
by Lyre
Hi all:
To my surprise, it seems that passing null to php as a string parameter,
will set the pointer which retrive it to an empty string "" , but not NULL.
get_xml_from_xpath() doesn't work correctly since an empty string is
passed as the xpath argument, and libxml will complain "Invalid expression"
I know seldom about xpath, I'm not sure if it is the correct way to fix it.
BTW, what xpath shall I pass to get the entire xml?
---
src/libvirt-php.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index ce9d0b9..2a77423 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -1205,6 +1205,11 @@ char *get_string_from_xpath(char *xml, char *xpath, zval **val, int *retVal)
int ret = 0, i;
char *value, key[8] = { 0 };
+ if ((xpath == NULL) || (xml == NULL))
+ {
+ return NULL;
+ }
+
xp = xmlCreateDocParserCtxt( (xmlChar *)xml );
if (!xp) {
if (retVal)
@@ -1691,6 +1696,10 @@ PHP_FUNCTION(libvirt_domain_get_xml_desc)
int retval = -1;
GET_DOMAIN_FROM_ARGS("rs|l",&zdomain,&xpath,&xpath_len,&flags);
+ if (xpath_len < 1)
+ {
+ xpath = NULL;
+ }
xml=virDomainGetXMLDesc(domain->domain,flags);
if (xml==NULL) {
@@ -3123,6 +3132,10 @@ PHP_FUNCTION(libvirt_storagevolume_get_xml_desc)
int retval = -1;
GET_VOLUME_FROM_ARGS("rs|l",&zvolume,&xpath,&xpath_len,&flags);
+ if (xpath_len < 1)
+ {
+ xpath = NULL;
+ }
xml=virStorageVolGetXMLDesc(volume->volume,flags);
if (xml==NULL) {
@@ -3338,6 +3351,10 @@ PHP_FUNCTION(libvirt_storagepool_get_xml_desc)
int retval = -1;
GET_STORAGEPOOL_FROM_ARGS("rs|l", &zpool, &xpath, &xpath_len, &flags);
+ if (xpath_len < 1)
+ {
+ xpath = NULL;
+ }
xml = virStoragePoolGetXMLDesc (pool->pool, flags);
if (xml == NULL)
@@ -4136,6 +4153,10 @@ PHP_FUNCTION(libvirt_nodedev_get_xml_desc)
int retval = -1;
GET_NODEDEV_FROM_ARGS("r|s",&znodedev,&xpath,&xpath_len);
+ if (xpath_len < 1)
+ {
+ xpath = NULL;
+ }
xml=virNodeDeviceGetXMLDesc(nodedev->device, 0);
if ( xml == NULL ) {
@@ -4576,6 +4597,10 @@ PHP_FUNCTION(libvirt_network_get_xml_desc)
int retval = -1;
GET_NETWORK_FROM_ARGS("r|s",&znetwork,&xpath,&xpath_len);
+ if (xpath_len < 1)
+ {
+ xpath = NULL;
+ }
xml=virNetworkGetXMLDesc(network->network, 0);
--
1.7.3.4
13 years, 8 months
[libvirt] [PATCH] virsh: Add --name and --description options to snapshot-create
by Matthias Bolte
This options are shortcuts to set name and description of a snapshot.
Suggested by Elias Probst
---
I'm not sure if this is be best approach. In case of the vol-* commands there
is vol-create that takes and XML file and vol-create-as that takes a set of
arguments.
So, should there actually be a snapshot-create-as to takes --name and
--description options?
Matthias
tools/virsh.c | 39 ++++++++++++++++++++++++++++++++++++---
tools/virsh.pod | 6 ++++--
2 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 2e35021..2ddb2f7 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -10214,6 +10214,8 @@ static const vshCmdInfo info_snapshot_create[] = {
static const vshCmdOptDef opts_snapshot_create[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"xmlfile", VSH_OT_DATA, 0, N_("domain snapshot XML")},
+ {"name", VSH_OT_DATA, 0, N_("snapshot name")},
+ {"description", VSH_OT_DATA, 0, N_("snapshot description")},
{NULL, 0, 0, NULL}
};
@@ -10223,6 +10225,8 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom = NULL;
int ret = FALSE;
const char *from = NULL;
+ const char *suggested_name = NULL;
+ const char *description = NULL;
char *buffer = NULL;
virDomainSnapshotPtr snapshot = NULL;
xmlDocPtr xml = NULL;
@@ -10237,9 +10241,38 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd)
if (dom == NULL)
goto cleanup;
- if (vshCommandOptString(cmd, "xmlfile", &from) <= 0)
- buffer = vshStrdup(ctl, "<domainsnapshot/>");
- else {
+ if (vshCommandOptString(cmd, "xmlfile", &from) <= 0) {
+ if (vshCommandOptString(cmd, "name", &suggested_name) < 0 ||
+ vshCommandOptString(cmd, "description", &description) < 0) {
+ goto cleanup;
+ }
+
+ if (suggested_name != NULL || description != NULL) {
+ virBuffer tmp = VIR_BUFFER_INITIALIZER;
+
+ virBufferAddLit(&tmp, "<domainsnapshot>\n");
+
+ if (suggested_name != NULL)
+ virBufferEscapeString(&tmp, " <name>%s</name>\n",
+ suggested_name);
+
+ if (description != NULL)
+ virBufferEscapeString(&tmp, " <description>%s</description>\n",
+ description);
+
+ virBufferAddLit(&tmp, "</domainsnapshot>");
+
+ if (virBufferError(&tmp)) {
+ virBufferFreeAndReset(&tmp);
+ vshPrint(ctl, "%s", _("Failed to allocate XML buffer"));
+ goto cleanup;
+ }
+
+ buffer = virBufferContentAndReset(&tmp);
+ } else {
+ buffer = vshStrdup(ctl, "<domainsnapshot/>");
+ }
+ } else {
if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0) {
/* we have to report the error here because during cleanup
* we'll run through virDomainFree(), which loses the
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 9c42008..aa238d9 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1223,12 +1223,14 @@ used to represent properties of snapshots.
=over 4
-=item B<snapshot-create> I<domain> I<xmlfile>
+=item B<snapshot-create> I<domain> I<xmlfile> optional I<name> I<description>
Create a snapshot for domain I<domain> with the properties specified in
I<xmlfile>. The only properties settable for a domain snapshot are the
<name> and <description>; the rest of the fields are ignored, and
-automatically filled in by libvirt. If I<xmlfile> is completely omitted,
+automatically filled in by libvirt. The values for <name> and <description>
+can also be specified using I<name> and I<description> when I<xmlfile> is
+ommited. If I<xmlfile>, I<name> and I<description> are completely omitted,
then libvirt will choose a value for all fields.
=item B<snapshot-current> I<domain>
--
1.7.0.4
13 years, 8 months
[libvirt] Time to think about the next release 0.9.1
by Daniel Veillard
I think keeping with the monthly schedule for new release is a good
thing considering the current amount of changes and patches being
pushed. So if we plan 0.9.1 by the month end, this means entering freeze
around the week-end of the 23rd, i.e. in 10 days, a rough estimate is
that the new release would embed 200-250 commits which is plenty enough :-)
Opinions ?
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
13 years, 8 months
[libvirt] [PATCH] Fix possible infinite loop in remote driver
by Michal Privoznik
When we take out completed calls from queue we might end up
in circular pointer. We don't want pointer to previous item
point to element taken out.
---
src/remote/remote_driver.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 9310ddf..ec10010 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -10672,8 +10672,9 @@ remoteIOEventLoop(virConnectPtr conn,
*/
VIR_DEBUG("Waking up sleep %d %p %p", tmp->proc_nr, tmp, priv->waitDispatch);
virCondSignal(&tmp->cond);
+ } else {
+ prev = tmp;
}
- prev = tmp;
tmp = tmp->next;
}
--
1.7.4.2
13 years, 8 months
[libvirt] [PATCH] maint: fix grammar errors
by Eric Blake
Jim recently improved gnulib to catch various grammar errors
during 'make syntax-check'.
* .gnulib: Update to latest, for syntax-check improvements.
* include/libvirt/libvirt.h.in (virConnectAuthCallbackPtr): Use
cannot rather than two words.
* src/driver.c: Likewise.
* src/driver.h (VIR_SECRET_GET_VALUE_INTERNAL_CALL): Likewise.
* src/remote/remote_driver.c (initialize_gnutls): Likewise.
* src/util/pci.c (pciBindDeviceToStub): Likewise.
* src/storage/storage_backend.c (virStorageBackendCreateQemuImg):
Likewise.
(virStorageBackendUpdateVolTargetInfoFD): Avoid doubled word.
* docs/formatdomain.html.in: Likewise.
* src/qemu/qemu_process.c (qemuProcessStart): Likewise.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_can_not)
(exclude_file_name_regexp--sc_prohibit_doubled_word): Exclude
existing translation problems.
---
* .gnulib 4a1579d...ca6143b (40):
> autoupdate
> maint.mk: prohibit doubled words
> maint: fix doubled-word typo in comments
> maint: remove doubled word: s/it it/it/
> maint.mk: remove useless semicolon and backslash
> stdint test: Fix compilation failure on OSF/1 with DTK compiler.
> autoupdate
> maint: remove doubled words in comments, e.g., s/a a/a/
> test-chown.h: correct a cast
> fix typo in ChangeLog entry
> getaddrinfo: Fix test for sa_len member.
> maint: change "can not" to "cannot"
> maint: change "a a" to "a"
> maint.mk: prohibit \<the the\>
> maint: fix "the the" in comment
> maint: change "can not" to "cannot"
> maint.mk: prohibit use of "can not"
> careadlinkat: Guard against misuse of careadlinkatcwd.
> careadlinkat: Use common coding style.
> careadlinkat: Clarify specification.
> areadlinkat: Avoid link error on many platforms.
> allocator, careadlinkat: Fix double-inclusion guard.
> relocatable-prog-wrapper: Update after module 'areadlink' changed.
> relocatable-prog-wrapper: Update after module 'areadlink' changed.
> strftime: silence gnulib-tool warning
> verify: Fix syntax error with GCC 4.6 in C++ mode.
> autoupdate
> allocator: New module.
> * lib/stdlib.in.h (malloc, realloc): Limit this change to a smaller scope.
> * lib/realloc.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise.
> * lib/malloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
> * lib/relocwrapper.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
> * lib/relocatable.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
> * lib/canonicalize-lgpl.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
> * lib/setenv.c (_GL_USE_STDLIB_ALLOC, malloc, realloc): Likewise.
> * lib/progreloc.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
> * lib/malloca.c (_GL_USE_STDLIB_ALLOC, malloc): Likewise.
> * lib/careadlinkat.c (_GL_USE_STDLIB_ALLOC): Define.
> stdlib: let modules use system malloc, realloc
> careadlinkat: rename members to avoid problem
.gnulib | 2 +-
cfg.mk | 4 ++++
docs/formatdomain.html.in | 2 +-
include/libvirt/libvirt.h.in | 2 +-
src/driver.c | 4 ++--
src/driver.h | 2 +-
src/qemu/qemu_process.c | 2 +-
src/remote/remote_driver.c | 2 +-
src/storage/storage_backend.c | 4 ++--
src/util/pci.c | 6 +++---
10 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/.gnulib b/.gnulib
index 4a1579d..ca6143b 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 4a1579d7560659ef5723325726eda14490a967f6
+Subproject commit ca6143b425589c3a64bd28efd7af14463f96d576
diff --git a/cfg.mk b/cfg.mk
index 4ed0d96..94db937 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -573,9 +573,13 @@ exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
exclude_file_name_regexp--sc_prohibit_asprintf = \
^(bootstrap.conf$$|po/|src/util/util\.c$$|examples/domain-events/events-c/event-test\.c$$)
+exclude_file_name_regexp--sc_prohibit_can_not = ^po/
+
exclude_file_name_regexp--sc_prohibit_close = \
(\.py$$|^docs/|(src/util/files\.c|src/libvirt\.c)$$)
+exclude_file_name_regexp--sc_prohibit_doubled_word = ^po/
+
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
(^docs/api_extension/|^tests/qemuhelpdata/|\.(gif|ico|png)$$)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 574fee5..3c4c656 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -774,7 +774,7 @@
<span class="since">Since 0.0.3; "device" attribute since 0.1.4;
"network" attribute since 0.8.7</span></dd>
<dt><code>source</code></dt>
- <dd>If the disk <code>type</code> is "file", then the
+ <dd>If the disk <code>type</code> is "file", then
the <code>file</code> attribute specifies the fully-qualified
path to the file holding the disk. If the disk
<code>type</code> is "block", then the <code>dev</code>
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 04b7fbf..5783303 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -505,7 +505,7 @@ typedef virConnectCredential *virConnectCredentialPtr;
* When authentication requires one or more interactions, this callback
* is invoked. For each interaction supplied, data must be gathered
* from the user and filled in to the 'result' and 'resultlen' fields.
- * If an interaction can not be filled, fill in NULL and 0.
+ * If an interaction cannot be filled, fill in NULL and 0.
*
* Returns 0 if all interactions were filled, or -1 upon error
*/
diff --git a/src/driver.c b/src/driver.c
index f882ea1..579c2b3 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -1,7 +1,7 @@
/*
* driver.c: Helpers for loading drivers
*
- * Copyright (C) 2006-2010 Red Hat, Inc.
+ * Copyright (C) 2006-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -32,7 +32,7 @@
#define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver"
-/* Make sure ... INTERNAL_CALL can not be set by the caller */
+/* Make sure ... INTERNAL_CALL cannot be set by the caller */
verify((VIR_SECRET_GET_VALUE_INTERNAL_CALL &
VIR_SECRET_GET_VALUE_FLAGS_MASK) == 0);
diff --git a/src/driver.h b/src/driver.h
index e5f91ca..a8b79e6 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -1063,7 +1063,7 @@ struct _virDeviceMonitor {
enum {
/* This getValue call is inside libvirt, override the "private" flag.
- This flag can not be set by outside callers. */
+ This flag cannot be set by outside callers. */
VIR_SECRET_GET_VALUE_INTERNAL_CALL = 1 << 16
};
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9ada24d..7295f9e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2326,7 +2326,7 @@ int qemuProcessStart(virConnectPtr conn,
ret = virCommandRun(cmd, NULL);
VIR_FREE(pidfile);
- /* wait for qemu process to to show up */
+ /* wait for qemu process to show up */
if (ret == 0) {
if (virFileReadPid(driver->stateDir, vm->def->name, &vm->pid)) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 9310ddf..5cb4f4c 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1223,7 +1223,7 @@ initialize_gnutls(char *pkipath, int flags)
goto out_of_memory;
/* Use default location as long as one of CA certificate,
- * client key, and client certificate can not be found in
+ * client key, and client certificate cannot be found in
* $HOME/.pki/libvirt, we don't want to make user confused
* with one file is here, the other is there.
*/
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 8af2878..97a7e4b 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -703,7 +703,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
(!inputBackingPath ||
STRNEQ(inputBackingPath, vol->backingStore.path))) {
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("a different backing store can not "
+ "%s", _("a different backing store cannot "
"be specified."));
return -1;
}
@@ -1188,7 +1188,7 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
*capacity = sb.st_size;
} else {
off_t end;
- /* XXX this is POSIX compliant, but doesn't work for for CHAR files,
+ /* XXX this is POSIX compliant, but doesn't work for CHAR files,
* only BLOCK. There is a Linux specific ioctl() for getting
* size of both CHAR / BLOCK devices we should check for in
* configure
diff --git a/src/util/pci.c b/src/util/pci.c
index 248afd3..ff950d1 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2010 Red Hat, Inc.
+ * Copyright (C) 2009-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1073,7 +1073,7 @@ remove_id:
* ID table so that 'drivers_probe' works below.
*/
if (pciDriverFile(&path, driver, "remove_id") < 0) {
- /* We do not remove PCI ID from pci-stub, and we can not reprobe it */
+ /* We do not remove PCI ID from pci-stub, and we cannot reprobe it */
if (dev->reprobe) {
VIR_WARN("Could not remove PCI ID '%s' from %s, and the device "
"cannot be probed again.", dev->id, driver);
@@ -1087,7 +1087,7 @@ remove_id:
_("Failed to remove PCI ID '%s' from %s"),
dev->id, driver);
- /* remove PCI ID from pci-stub failed, and we can not reprobe it */
+ /* remove PCI ID from pci-stub failed, and we cannot reprobe it */
if (dev->reprobe) {
VIR_WARN("Failed to remove PCI ID '%s' from %s, and the device "
"cannot be probed again.", dev->id, driver);
--
1.7.4.2
13 years, 8 months
[libvirt] [libvirt-php 0/2] Fixed some memory leaks
by Lyre
Hi all:
This patch fixed some memory leaks
Lyre (2):
Fix memory leak when connection failed
Fix memory leak when releasing connection & domain
src/libvirt-php.c | 36 +++++++++++++++++++++++++++---------
1 files changed, 27 insertions(+), 9 deletions(-)
--
1.7.3.4
C
13 years, 8 months
[libvirt] Add filesystem pool formatting (v4)
by Osier Yang
This patch series are based on Dave Allan's previous posts:
https://www.redhat.com/archives/libvir-list/2010-June/msg00040.html
I rebased them and make changes per last feedback from Eric, and
also other some small changes.
<QUOTE>
The following patches add the ability to format filesystem pools when
the appropriate flags are passed to pool build. As before, I have
implemented two new flags:
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE causes the build to probe for an
existing pool of the requested type. The build operation formats the
filesystem if it does not find an existing filesystem of that type.
VIR_STORAGE_POOL_BUILD_OVERWRITE causes the build to format unconditionally.
These patches incorporate all the feedback received on earlier versions.
The incremental is pretty unhelpful, so these are complete replacement patches.
Dave
</QUOTE>
13 years, 8 months
[libvirt] [BUG] qemu: snapshots no longer shown after migration^2
by Philipp Hahn
Hello,
when a domain is migrated to another host and than back again, snapshots of
this domain are no longer shown.
I think that is because qemuDomainSnapshotLoad() is only called once from
qemudStartup() during startup, but not after migration (or re-definition of a
previously deleted domain, e.g. offline-migration)
No patch yet, but this is tracked at our German bugzilla at
<https://forge.univention.org/bugzilla/show_bug.cgi?id=22072>
Sincerely
Philipp Hahn
--
Philipp Hahn Open Source Software Engineer hahn(a)univention.de
Univention GmbH Linux for Your Business fon: +49 421 22 232- 0
Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99
http://www.univention.de/
13 years, 8 months
[libvirt] [PATCH v2 0/3] configure inactive domains' maximum memory size
by Taku Izumi
Hi all,
This patchset enables us to configure inactive domain's maximum memory
size.
v1 -> v2:
- recreate based on 0.9.0
- fix some typo
*[PATCH 1/3] maxmem: introduces VIR_DOMAIN_MEM_MAXIMUM flag
*[PATCH 2/3] maxmem: implement virDomainSetMaxMemory API of the qemu driver
*[PATCH 3/3] setmaxmem: add the new options to "virsh setmaxmem" command
Best regards,
Taku Izumi
13 years, 8 months