[libvirt] [PATCH] qemu: Improve error if setmem fails for lacking of balloon support
by Osier Yang
"cannot set memory of an active domain" is misleading, it sounds
like setting memory of active domain is not supported.
---
src/qemu/qemu_driver.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5713650..bb33fd5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2037,7 +2037,8 @@ static int qemudDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
/* Lack of balloon support is a fatal error */
if (r == 0) {
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot set memory of an active domain"));
+ _("Lacks of balloon support, perhaps"
+ " the balloon device is disabled"));
goto endjob;
}
}
--
1.7.7.3
12 years, 5 months
[libvirt] This patch creates a mount point for libvirt-lxc containers to mount on the destination system if it does not exist.
by Daniel J Walsh
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Currently libvirt-lxc checks to see if the destination exists and is a
directory. If it is not a directory then the mount fails. Since libvirt-lxc
can bind mount files on an inode, this patch is needed to allow us to bind
mount files on files. Currently we want to bind mount on top of
/etc/machine-id, and /etc/adjtime
If the destination of the mount point does not exists, it checks if the src is
a directory and then attempts to create a directory, otherwise it creates an
empty file for the destination. The code will then bind mount over the
destination.
Current code blows up if the destination was not a directory. We want to be
able to bind mount files on files.
Sorry if you are seeing this patch for the second time, since I sent it to the
wrong list.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk/kel4ACgkQrlYvE4MpobP7uwCfXUPMJP4bNZiBGTwnJ70dezVf
KPwAnjt3MYSlHxkcwZCe5H1X4C0P4ky/
=1te/
-----END PGP SIGNATURE-----
12 years, 5 months
[libvirt] [PATCH libvirt-gconfig] Add support for domain filesystems with type=bind|ram
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
This adds support for filesystems with type=bind or type=ram,
eg
<filesystem type='bind'>
<source dir="/some/guest/file"/>
<target dir=/other/guest/file"/>
</filesystem>
And
<filesystem type='ram'>
<source usage='102400'/>
<target dir='/run'/>
</filesystem>
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
libvirt-gconfig/libvirt-gconfig-domain-filesys.c | 19 +++++++++++++++++++
libvirt-gconfig/libvirt-gconfig-domain-filesys.h | 4 ++++
2 files changed, 23 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-filesys.c b/libvirt-gconfig/libvirt-gconfig-domain-filesys.c
index c9c7aa8..54f124a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-filesys.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-filesys.c
@@ -146,6 +146,7 @@ void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys,
switch (filesys->priv->type) {
case GVIR_CONFIG_DOMAIN_FILESYS_MOUNT:
+ case GVIR_CONFIG_DOMAIN_FILESYS_BIND:
attribute_name = "dir";
break;
case GVIR_CONFIG_DOMAIN_FILESYS_FILE:
@@ -157,6 +158,9 @@ void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys,
case GVIR_CONFIG_DOMAIN_FILESYS_TEMPLATE:
attribute_name = "name";
break;
+ case GVIR_CONFIG_DOMAIN_FILESYS_RAM:
+ g_return_if_reached();
+
default:
g_return_if_reached();
}
@@ -166,6 +170,21 @@ void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys,
attribute_name, source);
}
+void gvir_config_domain_filesys_set_ram_usage(GVirConfigDomainFilesys *filesys,
+ guint64 bytes)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_FILESYS(filesys));
+ GVirConfigObject *src;
+
+ src = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(filesys),
+ "source");
+
+ gvir_config_object_set_attribute_with_type(src,
+ "usage", G_TYPE_UINT64, bytes,
+ "units", G_TYPE_STRING, "bytes",
+ NULL);
+
+}
void gvir_config_domain_filesys_set_target(GVirConfigDomainFilesys *filesys,
const char *path)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-filesys.h b/libvirt-gconfig/libvirt-gconfig-domain-filesys.h
index 2ceb2a8..e4b7c20 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-filesys.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-filesys.h
@@ -61,6 +61,8 @@ typedef enum {
GVIR_CONFIG_DOMAIN_FILESYS_BLOCK,
GVIR_CONFIG_DOMAIN_FILESYS_FILE,
GVIR_CONFIG_DOMAIN_FILESYS_TEMPLATE,
+ GVIR_CONFIG_DOMAIN_FILESYS_RAM,
+ GVIR_CONFIG_DOMAIN_FILESYS_BIND,
} GVirConfigDomainFilesysType;
typedef enum {
@@ -89,6 +91,8 @@ void gvir_config_domain_filesys_set_driver_type(GVirConfigDomainFilesys *filesys
GVirConfigDomainFilesysDriverType type);
void gvir_config_domain_filesys_set_source(GVirConfigDomainFilesys *filesys,
const char *source);
+void gvir_config_domain_filesys_set_ram_usage(GVirConfigDomainFilesys *filesys,
+ guint64 bytes);
void gvir_config_domain_filesys_set_target(GVirConfigDomainFilesys *filesys,
const char *target);
void gvir_config_domain_filesys_set_readonly(GVirConfigDomainFilesys *filesys,
--
1.7.10.2
12 years, 5 months
[libvirt] [PATCH] conf: Fill listenAddr from driver if none set
by Michal Privoznik
Currently, if domain's graphic has no listenAddr set we provide
the one from qemu.conf. However, we must make this transient to
not overwrite future changes to the config file. Moreover, we
have to store this into domain state XML so we remain consistent
on eventual config file edits.
---
Since users will never see new 'driverListenAddress' attribute
I don't think update of RNG schema is necessary.
src/conf/domain_conf.c | 14 ++++++++++++++
src/conf/domain_conf.h | 6 ++++++
src/qemu/qemu_command.c | 18 ++++++++++++++++--
3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4651765..29fa215 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -909,6 +909,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
for (ii = 0; ii < def->nListens; ii++)
virDomainGraphicsListenDefClear(&def->listens[ii]);
VIR_FREE(def->listens);
+ VIR_FREE(def->driverListenAddress);
VIR_FREE(def);
}
@@ -5976,6 +5977,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
int nListens;
xmlNodePtr *listenNodes = NULL;
char *listenAddr = NULL;
+ char *driverListenAddress = NULL;
xmlNodePtr save = ctxt->node;
if (VIR_ALLOC(def) < 0) {
@@ -5999,6 +6001,12 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
goto error;
}
+ if (flags & VIR_DOMAIN_XML_INTERNAL_STATUS) {
+ driverListenAddress = virXMLPropString(node, "driverListenAddress");
+ if (driverListenAddress)
+ def->driverListenAddress = driverListenAddress;
+ }
+
if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ||
def->type == VIR_DOMAIN_GRAPHICS_TYPE_RDP ||
def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
@@ -12323,9 +12331,15 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
break;
}
}
+ if (!listenAddr && !(flags & VIR_DOMAIN_XML_INACTIVE))
+ listenAddr = def->driverListenAddress;
virBufferAsprintf(buf, " <graphics type='%s'", type);
+ if (flags & VIR_DOMAIN_XML_INTERNAL_STATUS && def->driverListenAddress)
+ virBufferAsprintf(buf, " driverListenAddress='%s'",
+ def->driverListenAddress);
+
switch (def->type) {
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
if (def->data.vnc.socket) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3712785..6ad48fd 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1273,6 +1273,12 @@ struct _virDomainGraphicsDef {
* simplify parsing code.*/
size_t nListens;
virDomainGraphicsListenDefPtr listens;
+
+ /* In qemu driver if none of 'listens' contain usable listen address,
+ * the one from qemu.conf file is taken. However, we cannot store it
+ * into inactive XML as it would discard all future changes made to
+ * the config file. */
+ char * driverListenAddress;
};
enum virDomainRedirdevBus {
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6549f57..9878a66 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5496,8 +5496,15 @@ qemuBuildCommandLine(virConnectPtr conn,
break;
}
- if (!listenAddr)
+ if (!listenAddr) {
listenAddr = driver->vncListen;
+ if (listenAddr &&
+ !(def->graphics[0]->driverListenAddress =
+ strdup(listenAddr))) {
+ virReportOOMError();
+ goto error;
+ }
+ }
escapeAddr = strchr(listenAddr, ':') != NULL;
if (escapeAddr)
@@ -5647,8 +5654,15 @@ qemuBuildCommandLine(virConnectPtr conn,
break;
}
- if (!listenAddr)
+ if (!listenAddr) {
listenAddr = driver->spiceListen;
+ if (listenAddr &&
+ !(def->graphics[0]->driverListenAddress =
+ strdup(listenAddr))) {
+ virReportOOMError();
+ goto error;
+ }
+ }
if (listenAddr)
virBufferAsprintf(&opt, ",addr=%s", listenAddr);
--
1.7.8.5
12 years, 5 months
[libvirt] [libvirt-glib] mainloop integration fixes
by Christophe Fergeau
Hey,
While testing Boxes, I've noticed that if I started a VM and then
let it in the background for a while, it usually crashed after
a while. When this happens, the backtrace is:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6671898 in gvir_event_handle_dispatch (source=0x7fffdc001f60,
condition=G_IO_IN, opaque=0x7fffdc0021a0) at libvirt-glib-event.c:135
135 (data->cb)(data->watch, data->fd, events, data->opaque);
(gdb) bt
#0 0x00007ffff6671898 in gvir_event_handle_dispatch (source=0x7fffdc001f60,
condition=G_IO_IN, opaque=0x7fffdc0021a0) at libvirt-glib-event.c:135
#1 0x00007ffff231dcb4 in g_io_unix_dispatch (source=0x40e34a0,
callback=0x7ffff66717d8 <gvir_event_handle_dispatch>,
user_data=0x7fffdc0021a0) at giounix.c:166
#2 0x00007ffff22cef15 in g_main_dispatch (context=0x7007f0) at gmain.c:2539
#3 0x00007ffff22cfbda in g_main_context_dispatch (context=0x7007f0)
at gmain.c:3075
#4 0x00007ffff22cfdbd in g_main_context_iterate (context=0x7007f0, block=1,
dispatch=1, self=0x15d3180) at gmain.c:3146
#5 0x00007ffff22cfe81 in g_main_context_iteration (context=0x7007f0,
may_block=1) at gmain.c:3207
#6 0x00007ffff2ad7e7c in g_application_run (application=0x70b890, argc=0,
argv=0x0) at gapplication.c:1607
#7 0x000000000041df98 in boxes_app_run (self=0x1527010) at app.c:1254
#8 0x0000000000450134 in _vala_main (args=0x7fffffffd708, args_length1=1)
at main.c:729
#9 0x000000000045019e in main (argc=1, argv=0x7fffffffd708) at main.c:740
and the corresponding gvir_event_handle structure is corrupted:
(gdb) p *data
$3 = {watch = 0, fd = 0, events = 1886417008, enabled = 1886417008,
channel = 0x7070707070707070, source = 1886417008, cb = 0x7070707070707070,
opaque = 0x7070707070707070, ff = 0x7ffff60cfba0 <virNetSocketEventFree>}
(gdb) p/x *data
$4 = {watch = 0x0, fd = 0x0, events = 0x70707070, enabled = 0x70707070,
channel = 0x7070707070707070, source = 0x70707070, cb = 0x7070707070707070,
opaque = 0x7070707070707070, ff = 0x7ffff60cfba0}
(I'm running with MALLOC_PERTURB_ set so the 0x70707070 pattern
indicates uninitialized memory).
Right before this happens, the libvirt-glib event debugging log has:
(gnome-boxes:29577): Libvirt.GLib-DEBUG: Remove handle 0x7fffdc0021a0 1 27
(gnome-boxes:29577): Libvirt.GLib-DEBUG: Update handle 0x7fffdc0021a0 1 27
1
(gnome-boxes:29577): Libvirt.GLib-DEBUG: Update for missing handle watch 1
(gnome-boxes:29577): Libvirt.GLib-DEBUG: Dispatch handler 0x7fffdc0021a0 0
0 1 0x7070707070707070
that is, libvirt removes a handle watch, and then updates this handle (in
other words, it calls virEventPollUpdateHandle after having called
virEventPollRemoveHandle on the same handle).
I don't know if it's legit for libvirt to do that, but we can make
libvirt-glib robust against this situation, which is what patch 5/5 does.
The first 3 patches are small cleanups, and 4/5 fixes a potential race
which I found while looking at this code.
Christophe
12 years, 5 months
[libvirt] [libvirt-glib 1/8] Setters/adders for GVirConfigCapabilitiesCpu props
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
- gvir_config_capabilities_cpu_add_feature
- gvir_config_capabilities_cpu_set_topology
---
libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c | 32 ++++++++++++++++++++
libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h | 6 ++++
libvirt-gconfig/libvirt-gconfig.sym | 2 ++
3 files changed, 40 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c
index df77364..e517a20 100644
--- a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c
+++ b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c
@@ -56,6 +56,21 @@ gvir_config_capabilities_cpu_get_arch(GVirConfigCapabilitiesCpu *cpu)
return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(cpu), "arch");
}
+/**
+ * gvir_config_capabilities_cpu_add_feature:
+ *
+ * Adds a new feature to CPU.
+ */
+void gvir_config_capabilities_cpu_add_feature(GVirConfigCapabilitiesCpu *cpu,
+ GVirConfigCapabilitiesCpuFeature *feature)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_CAPABILITIES_CPU(cpu));
+ g_return_if_fail(GVIR_CONFIG_IS_CAPABILITIES_CPU_FEATURE(feature));
+
+ gvir_config_object_attach_add(GVIR_CONFIG_OBJECT(cpu),
+ GVIR_CONFIG_OBJECT(feature));
+}
+
struct GetFeatureData {
GVirConfigXmlDoc *doc;
const gchar *schema;
@@ -133,3 +148,20 @@ gvir_config_capabilities_cpu_get_topology(GVirConfigCapabilitiesCpu *cpu)
return GVIR_CONFIG_CAPABILITIES_CPU_TOPOLOGY(object);
}
+
+/**
+ * gvir_config_capabilities_cpu_set_topology:
+ *
+ * Sets the topology of the cpu.
+ */
+void
+gvir_config_capabilities_cpu_set_topology(GVirConfigCapabilitiesCpu *cpu,
+ GVirConfigCapabilitiesCpuTopology *topology)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_CAPABILITIES_CPU(cpu));
+ g_return_if_fail(GVIR_CONFIG_IS_CAPABILITIES_CPU_TOPOLOGY(topology));
+
+ gvir_config_object_attach_replace(GVIR_CONFIG_OBJECT(cpu),
+ "topology",
+ GVIR_CONFIG_OBJECT(topology));
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h
index 4d896ef..67fe607 100644
--- a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h
+++ b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h
@@ -29,6 +29,7 @@
#define __LIBVIRT_GCONFIG_CAPABILITIES_CPU_H__
#include "libvirt-gconfig-capabilities-cpu-topology.h"
+#include "libvirt-gconfig-capabilities-cpu-feature.h"
G_BEGIN_DECLS
@@ -63,10 +64,15 @@ GType gvir_config_capabilities_cpu_get_type(void);
const gchar *
gvir_config_capabilities_cpu_get_arch(GVirConfigCapabilitiesCpu *cpu);
+void gvir_config_capabilities_cpu_add_feature(GVirConfigCapabilitiesCpu *cpu,
+ GVirConfigCapabilitiesCpuFeature *feature);
GList *
gvir_config_capabilities_cpu_get_features(GVirConfigCapabilitiesCpu *cpu);
GVirConfigCapabilitiesCpuTopology *
gvir_config_capabilities_cpu_get_topology(GVirConfigCapabilitiesCpu *cpu);
+void
+gvir_config_capabilities_cpu_set_topology(GVirConfigCapabilitiesCpu *cpu,
+ GVirConfigCapabilitiesCpuTopology *topology);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 5473148..a9e5da5 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -389,9 +389,11 @@ LIBVIRT_GCONFIG_0.0.9 {
gvir_config_capabilities_get_guests;
gvir_config_capabilities_cpu_get_type;
+ gvir_config_capabilities_cpu_add_feature;
gvir_config_capabilities_cpu_get_arch;
gvir_config_capabilities_cpu_get_features;
gvir_config_capabilities_cpu_get_topology;
+ gvir_config_capabilities_cpu_set_topology;
gvir_config_capabilities_cpu_feature_get_type;
gvir_config_capabilities_cpu_feature_get_name;
--
1.7.10.4
12 years, 5 months
[libvirt] [PATCH v2] storage: Introduce --inactive for pool-dumpxml
by Michal Privoznik
Storage is one of the last domains in libvirt where we don't fully
utilize inactive and live XML. Okay, it might be because we don't
have support for that. So implement such support. However, we need
to fallback when talking to old daemon which doesn't support this
new flag called VIR_STORAGE_XML_INACTIVE.
---
include/libvirt/libvirt.h.in | 4 ++++
src/libvirt.c | 2 +-
src/storage/storage_driver.c | 10 ++++++++--
tools/virsh.c | 24 ++++++++++++++++++++++--
tools/virsh.pod | 4 +++-
5 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 024c4ec..6e8d5dd 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -2445,6 +2445,10 @@ struct _virStorageVolInfo {
typedef virStorageVolInfo *virStorageVolInfoPtr;
+typedef enum {
+ VIR_STORAGE_XML_INACTIVE = (1 << 0), /* dump inactive pool/volume information */
+} virStorageXMLFlags;
+
/*
* Get connection from pool.
*/
diff --git a/src/libvirt.c b/src/libvirt.c
index 0aa50cb..ef5ac47 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -12169,7 +12169,7 @@ error:
/**
* virStoragePoolGetXMLDesc:
* @pool: pointer to storage pool
- * @flags: bitwise-OR of virDomainXMLFlags
+ * @flags: bitwise-OR of virStorageXMLFlags
*
* Fetch an XML document describing all aspects of the
* storage pool. This is suitable for later feeding back
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 3b95c70..fbc630d 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -960,9 +960,10 @@ storagePoolGetXMLDesc(virStoragePoolPtr obj,
{
virStorageDriverStatePtr driver = obj->conn->storagePrivateData;
virStoragePoolObjPtr pool;
+ virStoragePoolDefPtr def;
char *ret = NULL;
- virCheckFlags(0, NULL);
+ virCheckFlags(VIR_STORAGE_XML_INACTIVE, NULL);
storageDriverLock(driver);
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
@@ -974,7 +975,12 @@ storagePoolGetXMLDesc(virStoragePoolPtr obj,
goto cleanup;
}
- ret = virStoragePoolDefFormat(pool->def);
+ if ((flags & VIR_STORAGE_XML_INACTIVE) && pool->newDef)
+ def = pool->newDef;
+ else
+ def = pool->def;
+
+ ret = virStoragePoolDefFormat(def);
cleanup:
if (pool)
diff --git a/tools/virsh.c b/tools/virsh.c
index 567a5f6..2b4cb2c 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -10807,6 +10807,7 @@ static const vshCmdInfo info_pool_dumpxml[] = {
static const vshCmdOptDef opts_pool_dumpxml[] = {
{"pool", VSH_OT_DATA, VSH_OFLAG_REQ, N_("pool name or uuid")},
+ {"inactive", VSH_OT_BOOL, 0, N_("show inactive defined XML")},
{NULL, 0, 0, NULL}
};
@@ -10815,15 +10816,20 @@ cmdPoolDumpXML(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
bool ret = true;
+ bool inactive = vshCommandOptBool(cmd, "inactive");
+ unsigned int flags = 0;
char *dump;
+ if (inactive)
+ flags |= VIR_STORAGE_XML_INACTIVE;
+
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", NULL)))
return false;
- dump = virStoragePoolGetXMLDesc(pool, 0);
+ dump = virStoragePoolGetXMLDesc(pool, flags);
if (dump != NULL) {
vshPrint(ctl, "%s", dump);
VIR_FREE(dump);
@@ -16127,7 +16133,8 @@ cmdPoolEdit(vshControl *ctl, const vshCmd *cmd)
bool ret = false;
virStoragePoolPtr pool = NULL;
virStoragePoolPtr pool_edited = NULL;
- unsigned int flags = 0;
+ unsigned int flags = VIR_STORAGE_XML_INACTIVE;
+ char *tmp_desc = NULL;
if (!vshConnectionUsability(ctl, ctl->conn))
goto cleanup;
@@ -16136,6 +16143,19 @@ cmdPoolEdit(vshControl *ctl, const vshCmd *cmd)
if (pool == NULL)
goto cleanup;
+ /* Some old daemons don't support _INACTIVE flag */
+ if (!(tmp_desc = virStoragePoolGetXMLDesc(pool, flags))) {
+ if (last_error->code == VIR_ERR_INVALID_ARG) {
+ flags &= ~VIR_STORAGE_XML_INACTIVE;
+ virFreeError(last_error);
+ last_error = NULL;
+ } else {
+ goto cleanup;
+ }
+ } else {
+ VIR_FREE(tmp_desc);
+ }
+
#define EDIT_GET_XML virStoragePoolGetXMLDesc(pool, flags)
#define EDIT_NOT_CHANGED \
vshPrint(ctl, _("Pool %s XML configuration not changed.\n"), \
diff --git a/tools/virsh.pod b/tools/virsh.pod
index f83a29d..191c9f2 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2112,9 +2112,11 @@ Destroy the resources used by a given I<pool> object. This operation
is non-recoverable. The I<pool> object will still exist after this
command, ready for the creation of new storage volumes.
-=item B<pool-dumpxml> I<pool-or-uuid>
+=item B<pool-dumpxml> [I<--inactive>] I<pool-or-uuid>
Returns the XML information about the I<pool> object.
+I<--inactive> tells virsh to dump pool configuration that will be used
+on next start of the pool as opposed to the current pool configuration.
=item B<pool-edit> I<pool-or-uuid>
--
1.7.8.5
12 years, 5 months
[libvirt] [PATCH] sanlock: Properly indent
by Michal Privoznik
One of latest patches (0fce94fe) didn't properly indented #define
making syntax-check fail.
---
Pushed under build-breaker rule.
src/locking/lock_driver_sanlock.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 9668ca9..26bdde8 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -60,7 +60,7 @@
* too old to provide that define, and probably the functionality too
*/
#ifndef SANLK_RES_SHARED
-#define SANLK_RES_SHARED 0x4
+# define SANLK_RES_SHARED 0x4
#endif
typedef struct _virLockManagerSanlockDriver virLockManagerSanlockDriver;
--
1.7.8.5
12 years, 5 months
[libvirt] [PATCH] Fix compilation on older sanlock
by Daniel Veillard
This is clearly not ideal, but we ought to check the version of sanlock
and act accordingly. We may end up with autoconf.ac and libvirt.spec.in
change for the real fix.
Pushing under the build breaker rule
Temporary fix since compilation broke with older version of
sanlock following acbd4965c44c4dbc676dfe89aff970052e376073
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 16941c9..9668ca9 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -55,6 +55,14 @@
#define VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE "__LIBVIRT__DISKS__"
+/*
+ * temporary fix for the case where the sanlock devel package is
+ * too old to provide that define, and probably the functionality too
+ */
+#ifndef SANLK_RES_SHARED
+#define SANLK_RES_SHARED 0x4
+#endif
+
typedef struct _virLockManagerSanlockDriver virLockManagerSanlockDriver;
typedef virLockManagerSanlockDriver *virLockManagerSanlockDriverPtr;
--
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/
12 years, 5 months
[libvirt] This patch mounts /run and /var/run before running a sandbox container
by Daniel J Walsh
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
We do not want to share /run between containers and the host. This patch
mounts a tmpfs on /run and then bind mounts /run on /var/run.
Reason this is pach 0003 is that this is a part of a previous patch set that
was never applied.
Sorry to those who are receiving this patch for the second time, as I sent it
first to the wrong list.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk/keZcACgkQrlYvE4MpobNnagCgyHc9igEYxPT/Bblf1XVPkwMX
EM0Anj9xzzf9k88He1gkoXKBEAija52U
=4Uny
-----END PGP SIGNATURE-----
12 years, 5 months