[libvirt] [PATCH] test: Return Libvirt logo as domain screenshot
by Michal Privoznik
This is just a bare Easter Egg. Whenever user run virDomainScreenshot
over a domain in test driver, he'll get the Libvirt PNG logo in return.
---
docs/Makefile.am | 1 +
src/test/test_driver.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 7583772..b5d7575 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -287,6 +287,7 @@ install-data-local:
for file in $(devhelphtml) $(devhelppng) $(devhelpcss); do \
$(INSTALL) -m 0644 $(srcdir)/$${file} $(DESTDIR)$(DEVHELP_DIR) ; \
done
+ $(INSTALL_DATA) $(srcdir)/../docs/libvirtLogo.png $(DESTDIR)$(pkgdatadir)
uninstall-local:
for h in $(apihtml); do rm $(DESTDIR)$(HTML_DIR)/$$h; done
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index c5fffb9..ad683f7 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -39,11 +39,13 @@
#include "virutil.h"
#include "viruuid.h"
#include "capabilities.h"
+#include "configmake.h"
#include "viralloc.h"
#include "network_conf.h"
#include "interface_conf.h"
#include "domain_conf.h"
#include "domain_event.h"
+#include "fdstream.h"
#include "storage_conf.h"
#include "node_device_conf.h"
#include "virxml.h"
@@ -5773,6 +5775,25 @@ cleanup:
return ret;
}
+static char *
+testDomainScreenshot(virDomainPtr dom ATTRIBUTE_UNUSED,
+ virStreamPtr st,
+ unsigned int screen ATTRIBUTE_UNUSED,
+ unsigned int flags)
+{
+ char *ret = NULL;
+
+ virCheckFlags(0, NULL);
+
+ if (virFDStreamOpenFile(st, PKGDATADIR "/libvirtLogo.png", 0, 0, O_RDONLY < 0))
+ goto cleanup;
+
+ ret = strdup("image/png");
+
+cleanup:
+ return ret;
+}
+
static virDriver testDriver = {
.no = VIR_DRV_TEST,
@@ -5843,6 +5864,7 @@ static virDriver testDriver = {
.domainEventDeregisterAny = testDomainEventDeregisterAny, /* 0.8.0 */
.isAlive = testIsAlive, /* 0.9.8 */
.nodeGetCPUMap = testNodeGetCPUMap, /* 1.0.0 */
+ .domainScreenshot = testDomainScreenshot, /* 1.0.4 */
};
static virNetworkDriver testNetworkDriver = {
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH] docs: Fix truncated sentence in RDP 'multiUser' attribute
by Christophe Fergeau
---
Usually I'd push this under the trivial rule, but I don't know if this is a
valid thing to do during freezes, hence I'm posting it for review first.
Christophe
docs/formatdomain.html.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 8bf0736..cf382e8 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3506,10 +3506,10 @@ qemu-kvm -net nic,model=? /dev/null
the TCP port to use. The <code>replaceUser</code>
attribute is a boolean deciding whether multiple
simultaneous connections to the VM are permitted.
- The <code>multiUser</code> whether the existing connection
- must be dropped and a new connection must be established
- by the VRDP server, when a new client connects in single
- connection mode.
+ The <code>multiUser</code> attribute is a boolean deciding
+ whether the existing connection must be dropped and a new
+ connection must be established by the VRDP server, when a
+ new client connects in single connection mode.
</dd>
<dt><code>"desktop"</code></dt>
<dd>
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH] Fix the stdout in print_job_progress()
by Yanbing Du
Signed-off-by: Yanbing Du <ydu(a)redhat.com>
---
tools/virsh-domain.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index d1e6f9d..10b646f 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1407,7 +1407,7 @@ print_job_progress(const char *label, unsigned long long remaining,
/* see comments in vshError about why we must flush */
fflush(stdout);
- fprintf(stderr, "\r%s: [%3d %%]", label, progress);
+ fprintf(stdout, "\r%s: [%3d %%]", label, progress);
fflush(stderr);
}
--
1.7.1
11 years, 7 months
[libvirt] [PATCH] virsh: don't call virSecretFree on NULL
by Ján Tomko
Since the refactoring in fbe2d49 we call virSecretFree even if
virSecretDefineXML fails, which leads to overwriting the error
message with:
error: Invalid secret: virSecretFree
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=929045
---
tools/virsh-secret.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index ea0b0c3..7201522 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -117,7 +117,8 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd)
cleanup:
VIR_FREE(buffer);
- virSecretFree(res);
+ if (res)
+ virSecretFree(res);
return ret;
}
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH] storage: Avoid double virCommandFree in virStorageBackendLogicalDeletePool
by Martin Kletzander
When logical pool has no PVs associated with itself (user-created),
virCommandFree(cmd) is called twice with the same pointer and that
causes a segfault in daemon.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Worth v1.0.4 IMHO.
---
src/storage/storage_backend_logical.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index bce407f..4cf6647 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -1,7 +1,7 @@
/*
* storage_backend_logical.c: storage backend for logical volume handling
*
- * Copyright (C) 2007-2009, 2011 Red Hat, Inc.
+ * Copyright (C) 2007-2009, 2011, 2013 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -667,6 +667,7 @@ virStorageBackendLogicalDeletePool(virConnectPtr conn ATTRIBUTE_UNUSED,
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
virCommandFree(cmd);
+ cmd = NULL;
/* now remove the pv devices and clear them out */
ret = 0;
--
1.8.1.5
11 years, 7 months
[libvirt] [libvirt-designer 1/2] Fix several leaks of libvirt-gconfig data
by Christophe Fergeau
---
libvirt-designer/libvirt-designer-domain.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/libvirt-designer/libvirt-designer-domain.c b/libvirt-designer/libvirt-designer-domain.c
index 49e8068..c3a5ce3 100644
--- a/libvirt-designer/libvirt-designer-domain.c
+++ b/libvirt-designer/libvirt-designer-domain.c
@@ -352,14 +352,19 @@ gvir_designer_domain_get_arch_native(GVirDesignerDomain *design)
gvir_config_capabilities_host_get_cpu(host) : NULL;
const gchar *arch = cpu ?
gvir_config_capabilities_cpu_get_arch(cpu) : NULL;
+ gchar *arch_native;
if (arch) {
- return gvir_designer_domain_get_arch_normalized(arch);
+ arch_native = gvir_designer_domain_get_arch_normalized(arch);
} else {
struct utsname ut;
uname(&ut);
- return gvir_designer_domain_get_arch_normalized(ut.machine);
+ arch_native = gvir_designer_domain_get_arch_normalized(ut.machine);
}
+ g_object_unref(G_OBJECT(cpu));
+ g_object_unref(G_OBJECT(host));
+
+ return arch_native;
}
@@ -372,7 +377,7 @@ gvir_designer_domain_get_guest(GVirDesignerDomain *design,
GList *tmp = guests;
GVirConfigCapabilitiesGuest *ret = NULL;
- while (tmp) {
+ while (tmp && !ret) {
GVirConfigCapabilitiesGuest *guest =
GVIR_CONFIG_CAPABILITIES_GUEST(tmp->data);
GVirConfigCapabilitiesGuestArch *arch =
@@ -388,13 +393,13 @@ gvir_designer_domain_get_guest(GVirDesignerDomain *design,
guestos == GVIR_CONFIG_DOMAIN_OS_TYPE_XEN ||
guestos == GVIR_CONFIG_DOMAIN_OS_TYPE_UML)) {
ret = g_object_ref(guest);
- goto cleanup;
}
+ g_object_unref(G_OBJECT(arch));
+
tmp = tmp->next;
}
-cleanup:
g_list_foreach(guests, (GFunc)g_object_unref, NULL);
g_list_free(guests);
return ret;
@@ -561,7 +566,7 @@ gvir_designer_domain_setup_guest(GVirDesignerDomain *design,
GVirConfigDomainOs *os = gvir_config_domain_os_new();
GVirConfigCapabilitiesGuestArch *arch =
gvir_config_capabilities_guest_get_arch(guest);
- GVirConfigCapabilitiesGuestDomain *domain;
+ GVirConfigCapabilitiesGuestDomain *domain = NULL;
gboolean ret = FALSE;
if (!(domain = gvir_designer_domain_best_guest_domain(arch,
@@ -581,6 +586,9 @@ gvir_designer_domain_setup_guest(GVirDesignerDomain *design,
ret = TRUE;
cleanup:
+ if (domain != NULL)
+ g_object_unref(domain);
+ g_object_unref(arch);
g_object_unref(os);
return ret;
}
--
1.8.1.4
11 years, 7 months
[libvirt] [libvirt-glib] config: Fix 2 leaks in domain memory setters
by Christophe Fergeau
---
libvirt-gconfig/libvirt-gconfig-domain.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index be572ab..7ef0be8 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -414,6 +414,7 @@ void gvir_config_domain_set_memory(GVirConfigDomain *domain, guint64 memory)
gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(node),
"unit", "KiB",
NULL);
+ g_object_unref(G_OBJECT(node));
g_object_notify(G_OBJECT(domain), "memory");
}
@@ -439,6 +440,7 @@ void gvir_config_domain_set_current_memory(GVirConfigDomain *domain,
gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(node),
"unit", "KiB",
NULL);
+ g_object_unref(G_OBJECT(node));
g_object_notify(G_OBJECT(domain), "current-memory");
}
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH] nodedev: invert virIsCapableFCHost return value
by Ján Tomko
Both virIsCapableFCHost and virIsCapableVport return 0 when the
respective sysfs path is accessible.
---
src/node_device/node_device_linux_sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index a1c3637..fd91430 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -46,7 +46,7 @@ detect_scsi_host_caps_linux(union _virNodeDevCapData *d)
VIR_DEBUG("Checking if host%d is an FC HBA", d->scsi_host.host);
- if (virIsCapableFCHost(NULL, d->scsi_host.host)) {
+ if (virIsCapableFCHost(NULL, d->scsi_host.host) == 0) {
d->scsi_host.flags |= VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST;
if (virReadFCHost(NULL,
--
1.8.1.5
11 years, 7 months
[libvirt] Network definition questions
by Gene Czarcinski
If an IPv4 address is *not* specified, then the IPv4 network is isolated
and, by default, internal (internal to the specific interface) IPv4
routing is enabled..
If an IPv6 address is *not* specified, then the IPv6 network is isolated
and, by default, internal IPv6 routing is disabled but can be enabled if
ipv6='yes' is specified on <network>.
If an IPv6 address is specified, then it is routed.
If an IPv4 address is specified, then it can be
Network-Address-Translated or routed. Not having a <forward> explicitly
specified does not mean that a route is not established.
Do I understand thing correctly?
Gene
11 years, 7 months