[libvirt] [libvirt-glib] API to get node information about the connection
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
Mostly just a wrapper around virNodeGetInfo() and virNodeInfo struct.
---
libvirt-gobject/libvirt-gobject-connection.c | 49 ++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-connection.h | 17 +++++++++
libvirt-gobject/libvirt-gobject.sym | 2 +
3 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index cb19e9d..fc8595d 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -71,6 +71,21 @@ gvir_connection_error_quark(void)
return g_quark_from_static_string("gvir-connection");
}
+static GVirNodeInfo *
+gvir_node_info_copy(GVirNodeInfo *info)
+{
+ return g_slice_dup(GVirNodeInfo, info);
+}
+
+static void
+gvir_node_info_free(GVirNodeInfo *info)
+{
+ g_slice_free(GVirNodeInfo, info);
+}
+
+G_DEFINE_BOXED_TYPE(GVirNodeInfo, gvir_node_info,
+ gvir_node_info_copy, gvir_node_info_free)
+
static void gvir_connection_get_property(GObject *object,
guint prop_id,
GValue *value,
@@ -1338,3 +1353,37 @@ GVirStoragePool *gvir_connection_create_storage_pool
return g_object_ref(pool);
}
+
+/**
+ * gvir_connection_get_node_info:
+ * @conn: the connection
+ * @err: return location for any #GError
+ *
+ * Returns: (transfer full): the info
+ */
+GVirNodeInfo *gvir_connection_get_node_info(GVirConnection *conn,
+ GError **err)
+{
+ GVirConnectionPrivate *priv = conn->priv;
+ virNodeInfo info;
+ GVirNodeInfo *ret;
+
+ if (virNodeGetInfo(priv->conn, &info) < 0) {
+ gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
+ 0,
+ "Unable to get node info");
+ return NULL;
+ }
+
+ ret = g_slice_new(GVirNodeInfo);
+ g_utf8_strncpy (ret->model, info.model, sizeof (ret->model));
+ ret->memory = info.memory;
+ ret->cpus = info.cpus;
+ ret->mhz = info.mhz;
+ ret->nodes = info.nodes;
+ ret->sockets = info.sockets;
+ ret->cores = info.cores;
+ ret->threads = info.threads;
+
+ return ret;
+}
diff --git a/libvirt-gobject/libvirt-gobject-connection.h b/libvirt-gobject/libvirt-gobject-connection.h
index 477a0c3..3cc60a2 100644
--- a/libvirt-gobject/libvirt-gobject-connection.h
+++ b/libvirt-gobject/libvirt-gobject-connection.h
@@ -38,6 +38,19 @@ G_BEGIN_DECLS
#define GVIR_TYPE_CONNECTION_HANDLE (gvir_connection_handle_get_type ())
+typedef struct _GVirNodeInfo GVirNodeInfo;
+struct _GVirNodeInfo
+{
+ gchar model[32]; /* string indicating the CPU model */
+ gulong memory; /* memory size in kilobytes */
+ guint cpus; /* the number of active CPUs */
+ guint mhz; /* expected CPU frequency */
+ guint nodes; /* the number of NUMA cell, 1 for unusual NUMA topologies or uniform memo */
+ guint sockets; /* number of CPU sockets per node if nodes > 1, total number of CPU socke */
+ guint cores; /* number of cores per socket */
+ guint threads; /* number of threads per core */
+};
+
typedef struct _GVirConnection GVirConnection;
typedef struct _GVirConnectionPrivate GVirConnectionPrivate;
typedef struct _GVirConnectionClass GVirConnectionClass;
@@ -69,6 +82,7 @@ struct _GVirConnectionClass
GType gvir_connection_get_type(void);
GType gvir_connection_handle_get_type(void);
+GType gvir_node_info_get_type(void);
GVirConnection *gvir_connection_new(const char *uri);
gboolean gvir_connection_open(GVirConnection *conn,
@@ -174,6 +188,9 @@ GVirStoragePool *gvir_connection_create_storage_pool
GVirStream *gvir_connection_get_stream(GVirConnection *conn,
guint flags);
+GVirNodeInfo *gvir_connection_get_node_info(GVirConnection *conn,
+ GError **err);
+
G_END_DECLS
#endif /* __LIBVIRT_GOBJECT_CONNECTION_H__ */
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index a02191e..1ad6b53 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -4,6 +4,7 @@ LIBVIRT_GOBJECT_0.0.4 {
gvir_init_object_check;
gvir_connection_get_type;
+ gvir_node_info_get_type;
gvir_connection_new;
gvir_connection_open;
gvir_connection_open_async;
@@ -29,6 +30,7 @@ LIBVIRT_GOBJECT_0.0.4 {
gvir_connection_create_domain;
gvir_connection_create_storage_pool;
gvir_connection_start_domain;
+ gvir_connection_get_node_info;
gvir_domain_device_get_type;
--
1.7.7.6
12 years, 9 months
[libvirt] [libvirt-glib 1/2] API to get node information about the connection
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
Mostly just a wrapper around virNodeGetInfo() and virNodeInfo struct.
---
libvirt-gobject/libvirt-gobject-connection.c | 49 ++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-connection.h | 17 +++++++++
libvirt-gobject/libvirt-gobject.sym | 1 +
3 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
index cb19e9d..c2691f7 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -71,6 +71,21 @@ gvir_connection_error_quark(void)
return g_quark_from_static_string("gvir-connection");
}
+static GVirNodeInfo *
+gvir_node_info_copy(GVirNodeInfo *info)
+{
+ return g_slice_dup(GVirNodeInfo, info);
+}
+
+static void
+gvir_node_info_free(GVirNodeInfo *info)
+{
+ g_slice_free(GVirNodeInfo, info);
+}
+
+G_DEFINE_BOXED_TYPE(GVirNodeInfo, gvir_node_info,
+ gvir_node_info_copy, gvir_node_info_free)
+
static void gvir_connection_get_property(GObject *object,
guint prop_id,
GValue *value,
@@ -1338,3 +1353,37 @@ GVirStoragePool *gvir_connection_create_storage_pool
return g_object_ref(pool);
}
+
+/**
+ * gvir_connection_get_node_info:
+ * @conn: the connection
+ * @err: return location for any #GError
+ *
+ * Returns: (transfer full): the info
+ */
+GVirNodeInfo *gvir_connection_get_node_info(GVirConnection *conn,
+ GError **err)
+{
+ GVirConnectionPrivate *priv = conn->priv;
+ virNodeInfo info;
+ GVirNodeInfo *ret;
+
+ if (virNodeGetInfo(priv->conn, &info) < 0) {
+ gvir_set_error_literal(err, GVIR_CONNECTION_ERROR,
+ 0,
+ "Unable to get node info");
+ return NULL;
+ }
+
+ ret = g_slice_new(GVirNodeInfo);
+ g_memmove (ret->model, info.model, sizeof (ret->model));
+ ret->memory = info.memory;
+ ret->cpus = info.cpus;
+ ret->mhz = info.mhz;
+ ret->nodes = info.nodes;
+ ret->sockets = info.sockets;
+ ret->cores = info.cores;
+ ret->threads = info.threads;
+
+ return ret;
+}
diff --git a/libvirt-gobject/libvirt-gobject-connection.h b/libvirt-gobject/libvirt-gobject-connection.h
index 477a0c3..3cc60a2 100644
--- a/libvirt-gobject/libvirt-gobject-connection.h
+++ b/libvirt-gobject/libvirt-gobject-connection.h
@@ -38,6 +38,19 @@ G_BEGIN_DECLS
#define GVIR_TYPE_CONNECTION_HANDLE (gvir_connection_handle_get_type ())
+typedef struct _GVirNodeInfo GVirNodeInfo;
+struct _GVirNodeInfo
+{
+ gchar model[32]; /* string indicating the CPU model */
+ gulong memory; /* memory size in kilobytes */
+ guint cpus; /* the number of active CPUs */
+ guint mhz; /* expected CPU frequency */
+ guint nodes; /* the number of NUMA cell, 1 for unusual NUMA topologies or uniform memo */
+ guint sockets; /* number of CPU sockets per node if nodes > 1, total number of CPU socke */
+ guint cores; /* number of cores per socket */
+ guint threads; /* number of threads per core */
+};
+
typedef struct _GVirConnection GVirConnection;
typedef struct _GVirConnectionPrivate GVirConnectionPrivate;
typedef struct _GVirConnectionClass GVirConnectionClass;
@@ -69,6 +82,7 @@ struct _GVirConnectionClass
GType gvir_connection_get_type(void);
GType gvir_connection_handle_get_type(void);
+GType gvir_node_info_get_type(void);
GVirConnection *gvir_connection_new(const char *uri);
gboolean gvir_connection_open(GVirConnection *conn,
@@ -174,6 +188,9 @@ GVirStoragePool *gvir_connection_create_storage_pool
GVirStream *gvir_connection_get_stream(GVirConnection *conn,
guint flags);
+GVirNodeInfo *gvir_connection_get_node_info(GVirConnection *conn,
+ GError **err);
+
G_END_DECLS
#endif /* __LIBVIRT_GOBJECT_CONNECTION_H__ */
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 7a2f65d..9e63773 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -4,6 +4,7 @@ LIBVIRT_GOBJECT_0.0.4 {
gvir_init_object_check;
gvir_connection_get_type;
+ gvir_node_info_get_type;
gvir_connection_new;
gvir_connection_open;
gvir_connection_open_async;
--
1.7.7.6
12 years, 9 months
[libvirt] libvirt-0.9.10.1 maybe?
by Doug Goldstein
Given the issues discovered after 0.9.10's release I was wondering if
you guys wanted to put out a 0.9.10.1. Here's the list of the patches
I've cherry picked based on the list comments and think would qualify.
If not that's ok.
18942b9bea8a5a8a4d52c0cdde253ae91be338a6
e0d4b0db9e4cc045d9660f955ddccfabd098a91b
2ccc4a607f6e122aff2e3b9d133d6e6b4b661a1e
fcdfa31f3cad32f41ef5e7933c58d986ab7fc6c9
c05ec920219dc9fad9230c3cea7c1fb17d29ddc3
4c1c361127b6f5ce56be980ca7ea06f829c53399
15a280bb6d2de16b2f54dd7ca667a5a69363558c
d2728cc24581d8a2f40c7ffed2a10fd2da79015f
--
Doug Goldstein
12 years, 9 months
[libvirt] [PATCH 0/10]virtio-scsi: New device address logic for SCSI devices
by Osier Yang
This patch series completed the support for the first 3 parts
of Paolo's proposal:
http://permalink.gmane.org/gmane.comp.emulators.libvirt/50428
The 3 parts are:
* SCSI controller models
* Stable addressing for SCSI devices
* LUN passthrough: block devices
[PATCH 1/10] and [PATCH 2/10] add two new "scsi" controllers,
"ibmvscsi" and "virtio-scsi".
[PATCH 3/10] is to set the default controller model for scsi
controller when parsing and implicit controller addtion.
[PATCH 4/10] adds a helper functions to get a disk controller's
model.
[PATCH 5/10] introduces attribute "target" for device addressing
XML. "target" is useless for model "lsilogic", for which it's not
printed out when formating XML.
[PATCH 7/10] builds the qemu command line for the new addressing
format. The logic is:
1) If the disk controller model is "lsilogic":
-drive file=/dev/sda,if=none,id=drive-scsi0-0-3,\
format=raw -device scsi-disk,bus=scsi0.0,\
scsi-id=0,drive=drive-scsi0-0-3-0,id=scsi0-0-3-0
libvirt attrs --> qdev properties:
bus=scsi<controller>.0
scsi-id=<unit>
2) If the disk controller model is other else:
The command line will be like:
-drive file=/dev/sda,if=none,id=drive-scsi0-0-3-0,\
format=raw -device scsi-disk,bus=scsi0.0,channel=0,\
scsi-id=3,lun=0,drive=drive-scsi0-0-3-0,id=scsi0-0-3-0
libvirt attrs --> qdev properties:
bus=scsi<controller>.0
channel=<bus>
scsi-id=<target>
lun=<unit>
[PATCH 01/10] qemu: Add ibmvscsi controller model
[PATCH 02/10] qemu: Add virtio-scsi controller model
[PATCH 03/10] conf: Set default scsi controller model when parsing
[PATCH 04/10] conf: Add helper function to look up disk controller
[PATCH 05/10] conf: Introduce new attribute for device address
[PATCH 06/10] qemu: New cap flag to indicate if channel is supported
[PATCH 07/10] qemu: Build command line for the new address format
[PATCH 08/10] tests: Update qemu tests to be consistent with new
[PATCH 09/10] tests: Update vmx tests to be consistent with new
[PATCH 10/10] tests: Add tests for virtio-scsi and ibmvscsi
Regards,
Osier
12 years, 9 months
[libvirt] [libvirt-glib] Add gvir_domain_get_saved()
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
Binding for virDomainHasManagedSaveImage().
---
libvirt-gobject/libvirt-gobject-domain.c | 13 +++++++++++++
libvirt-gobject/libvirt-gobject-domain.h | 1 +
libvirt-gobject/libvirt-gobject.sym | 1 +
3 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-domain.c b/libvirt-gobject/libvirt-gobject-domain.c
index d9e4c00..5f26dcd 100644
--- a/libvirt-gobject/libvirt-gobject-domain.c
+++ b/libvirt-gobject/libvirt-gobject-domain.c
@@ -854,3 +854,16 @@ gboolean gvir_domain_get_persistent(GVirDomain *dom)
return virDomainIsPersistent(dom->priv->handle) == 1;
}
+
+/**
+ * gvir_domain_get_saved:
+ * @dom: the domain
+ *
+ * Returns: TRUE if domain is in a saved state, FALSE otherwise.
+ */
+gboolean gvir_domain_get_saved(GVirDomain *dom)
+{
+ g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
+
+ return virDomainHasManagedSaveImage(dom->priv->handle, 0) == 1;
+}
diff --git a/libvirt-gobject/libvirt-gobject-domain.h b/libvirt-gobject/libvirt-gobject-domain.h
index 20388f2..bdff32e 100644
--- a/libvirt-gobject/libvirt-gobject-domain.h
+++ b/libvirt-gobject/libvirt-gobject-domain.h
@@ -167,6 +167,7 @@ gboolean gvir_domain_save_finish (GVirDomain *dom,
GAsyncResult *result,
GError **err);
gboolean gvir_domain_get_persistent(GVirDomain *dom);
+gboolean gvir_domain_get_saved(GVirDomain *dom);
G_END_DECLS
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 468bf65..7a2f65d 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -64,6 +64,7 @@ LIBVIRT_GOBJECT_0.0.4 {
gvir_domain_set_config;
gvir_domain_get_info;
gvir_domain_get_persistent;
+ gvir_domain_get_saved;
gvir_domain_screenshot;
gvir_domain_snapshot_get_type;
--
1.7.7.6
12 years, 9 months
[libvirt] [PATCH] Don't add SPICE TLS channels when TLS is disabled
by Christophe Fergeau
It's possible to disable SPICE TLS in qemu.conf. When this happens,
libvirt ignores any SPICE TLS port or x509 directory that may have
been set when it builds the qemu command line to use. However, it's
not ignoring the secure channels that may have been set and adds
tls-channel arguments to qemu command line.
Current qemu versions don't report an error when this happens, and try to use
TLS for the specified channels.
Before this patch
<domain type='kvm'>
<name>auto-tls-port</name>
<memory>65536</memory>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
</os>
<devices>
<graphics type='spice' port='5900' tlsPort='-1' autoport='yes' listen='0' ke
<listen type='address' address='0'/>
<channel name='main' mode='secure'/>
<channel name='inputs' mode='secure'/>
</graphics>
</devices>
</domain>
generates
-spice port=5900,addr=0,disable-ticketing,tls-channel=main,tls-channel=inputs
and after this patch we get
-spice port=5900,addr=0,disable-ticketing
This fixes bug #790436
---
src/qemu/qemu_command.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 99d7129..30fb3b1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5286,8 +5286,9 @@ qemuBuildCommandLine(virConnectPtr conn,
int mode = def->graphics[0]->data.spice.channels[i];
switch (mode) {
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
- virBufferAsprintf(&opt, ",tls-channel=%s",
- virDomainGraphicsSpiceChannelNameTypeToString(i));
+ if (driver->spiceTLS)
+ virBufferAsprintf(&opt, ",tls-channel=%s",
+ virDomainGraphicsSpiceChannelNameTypeToString(i));
break;
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE:
virBufferAsprintf(&opt, ",plaintext-channel=%s",
--
1.7.7.6
12 years, 9 months
[libvirt] [libvirt-glib 1/2] Add gvir_config_domain_disk_[gs]et_cache
by Christophe Fergeau
---
libvirt-gconfig/libvirt-gconfig-domain-disk.c | 23 +++++++++++++++++++++++
libvirt-gconfig/libvirt-gconfig-domain-disk.h | 12 ++++++++++++
libvirt-gconfig/libvirt-gconfig.sym | 3 +++
libvirt-gconfig/tests/test-domain-create.c | 2 ++
4 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.c b/libvirt-gconfig/libvirt-gconfig-domain-disk.c
index b2861e4..afa7eda 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-disk.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.c
@@ -172,6 +172,18 @@ void gvir_config_domain_disk_set_driver_type(GVirConfigDomainDisk *disk,
"driver", "type", driver_type);
}
+void gvir_config_domain_disk_set_driver_cache(GVirConfigDomainDisk *disk,
+ GVirConfigDomainDiskCacheType cache_type)
+{
+ const char *cache_str;
+
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_DISK(disk));
+ cache_str = gvir_config_genum_get_nick(GVIR_CONFIG_TYPE_DOMAIN_DISK_CACHE_TYPE, cache_type);
+ g_return_if_fail(cache_str != NULL);
+ gvir_config_object_add_child_with_attribute(GVIR_CONFIG_OBJECT(disk),
+ "driver", "cache", cache_str);
+}
+
void gvir_config_domain_disk_set_target_bus(GVirConfigDomainDisk *disk,
GVirConfigDomainDiskBus bus)
{
@@ -269,6 +281,17 @@ gvir_config_domain_disk_get_driver_type(GVirConfigDomainDisk *disk)
"driver", "type");
}
+GVirConfigDomainDiskCacheType
+gvir_config_domain_disk_get_driver_cache(GVirConfigDomainDisk *disk)
+{
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_DISK(disk),
+ GVIR_CONFIG_DOMAIN_DISK_CACHE_DEFAULT);
+
+ return gvir_config_object_get_attribute_genum(GVIR_CONFIG_OBJECT(disk),
+ "driver", "cache",
+ GVIR_CONFIG_TYPE_DOMAIN_DISK_CACHE_TYPE,
+ GVIR_CONFIG_DOMAIN_DISK_CACHE_DEFAULT);
+}
GVirConfigDomainDiskBus
gvir_config_domain_disk_get_target_bus(GVirConfigDomainDisk *disk)
{
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-disk.h b/libvirt-gconfig/libvirt-gconfig-domain-disk.h
index 3359049..4b16b80 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-disk.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-disk.h
@@ -75,6 +75,15 @@ typedef enum {
} GVirConfigDomainDiskBus;
typedef enum {
+ GVIR_CONFIG_DOMAIN_DISK_CACHE_DEFAULT,
+ GVIR_CONFIG_DOMAIN_DISK_CACHE_NONE,
+ GVIR_CONFIG_DOMAIN_DISK_CACHE_WRITETHROUGH,
+ GVIR_CONFIG_DOMAIN_DISK_CACHE_WRITEBACK,
+ GVIR_CONFIG_DOMAIN_DISK_CACHE_DIRECTSYNC,
+ GVIR_CONFIG_DOMAIN_DISK_CACHE_UNSAFE
+} GVirConfigDomainDiskCacheType;
+
+typedef enum {
GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_DISK,
GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_FLOPPY,
GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_CDROM
@@ -100,6 +109,8 @@ void gvir_config_domain_disk_set_snapshot_type(GVirConfigDomainDisk *disk,
GVirConfigDomainDiskSnapshotType type);
void gvir_config_domain_disk_set_source(GVirConfigDomainDisk *disk,
const char *source);
+void gvir_config_domain_disk_set_driver_cache(GVirConfigDomainDisk *disk,
+ GVirConfigDomainDiskCacheType cache_type);
void gvir_config_domain_disk_set_driver_name(GVirConfigDomainDisk *disk,
const char *driver_name);
void gvir_config_domain_disk_set_driver_type(GVirConfigDomainDisk *disk,
@@ -113,6 +124,7 @@ GVirConfigDomainDiskType gvir_config_domain_disk_get_disk_type(GVirConfigDomainD
GVirConfigDomainDiskGuestDeviceType gvir_config_domain_disk_get_guest_device_type(GVirConfigDomainDisk *disk);
GVirConfigDomainDiskSnapshotType gvir_config_domain_disk_get_snapshot_type(GVirConfigDomainDisk *disk);
char *gvir_config_domain_disk_get_source(GVirConfigDomainDisk *disk);
+GVirConfigDomainDiskCacheType gvir_config_domain_disk_get_driver_cache(GVirConfigDomainDisk *disk);
char *gvir_config_domain_disk_get_driver_name(GVirConfigDomainDisk *disk);
char *gvir_config_domain_disk_get_driver_type(GVirConfigDomainDisk *disk);
GVirConfigDomainDiskBus gvir_config_domain_disk_get_target_bus(GVirConfigDomainDisk *disk);
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index ab2c7bf..96ce58f 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -69,11 +69,14 @@ LIBVIRT_GCONFIG_0.0.4 {
gvir_config_domain_disk_get_type;
gvir_config_domain_disk_bus_get_type;
+ gvir_config_domain_disk_cache_type_get_type;
gvir_config_domain_disk_guest_device_type_get_type;
gvir_config_domain_disk_snapshot_type_get_type;
gvir_config_domain_disk_type_get_type;
gvir_config_domain_disk_new;
gvir_config_domain_disk_new_from_xml;
+ gvir_config_domain_disk_get_driver_cache;
+ gvir_config_domain_disk_set_driver_cache;
gvir_config_domain_disk_get_driver_name;
gvir_config_domain_disk_set_driver_name;
gvir_config_domain_disk_get_driver_type;
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index 821e0b0..0cd8304 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -101,6 +101,8 @@ int main(int argc, char **argv)
gvir_config_domain_disk_set_driver_name(disk, "foo");
gvir_config_domain_disk_set_driver_type(disk, "bar");
gvir_config_domain_disk_set_driver_name(disk, "qemu");
+ gvir_config_domain_disk_set_driver_cache(disk, GVIR_CONFIG_DOMAIN_DISK_CACHE_NONE);
+ g_assert(gvir_config_domain_disk_get_driver_cache(disk) == GVIR_CONFIG_DOMAIN_DISK_CACHE_NONE);
gvir_config_domain_disk_set_driver_type(disk, "qcow2");
gvir_config_domain_disk_set_target_bus(disk, GVIR_CONFIG_DOMAIN_DISK_BUS_IDE);
gvir_config_domain_disk_set_target_dev(disk, "hda");
--
1.7.7.6
12 years, 9 months
[libvirt] [libvirt-glib] Fix [gs]et_custom_xml-related leaks
by Christophe Fergeau
I forgot to run the testing code through valgrind before pushing
the patches so a few small memory leaks crept in.
---
libvirt-gconfig/libvirt-gconfig-domain.c | 1 +
libvirt-gconfig/tests/test-domain-create.c | 8 ++++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index d7ac4c6..177c926 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -479,6 +479,7 @@ gboolean gvir_config_domain_set_custom_xml(GVirConfigDomain *domain,
gvir_config_object_delete_children(metadata, NULL, ns_uri);
gvir_config_object_attach_add(metadata, custom_xml);
g_object_unref(G_OBJECT(metadata));
+ g_object_unref(G_OBJECT(custom_xml));
return TRUE;
}
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index 1610587..821e0b0 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -177,8 +177,12 @@ int main(int argc, char **argv)
gvir_config_domain_set_custom_xml(domain, "<foo/>", "ns", "http://bar", NULL);
gvir_config_domain_set_custom_xml(domain, "<bar/>", "ns", "http://foo", NULL);
- g_assert(g_strcmp0(gvir_config_domain_get_custom_xml(domain, "http://foo"), "<ns:bar xmlns:ns=\"http://foo\"/>") == 0);
- g_assert(g_strcmp0(gvir_config_domain_get_custom_xml(domain, "http://bar"), "<ns:foo xmlns:ns=\"http://bar\"/>") == 0);
+ xml = gvir_config_domain_get_custom_xml(domain, "http://foo");
+ g_assert(g_strcmp0(xml, "<ns:bar xmlns:ns=\"http://foo\"/>") == 0);
+ g_free(xml);
+ xml = gvir_config_domain_get_custom_xml(domain, "http://bar");
+ g_assert(g_strcmp0(xml, "<ns:foo xmlns:ns=\"http://bar\"/>") == 0);
+ g_free(xml);
xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(domain));
g_print("%s\n\n", xml);
--
1.7.7.6
12 years, 9 months
[libvirt] [libvirt-glib 1/3] Tell CC to ignore unused macros
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
---
m4/virt-compile-warnings.m4 | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index 6659568..de542cc 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -39,6 +39,8 @@ AC_DEFUN([LIBVIRT_GLIB_COMPILE_WARNINGS],[
dontwarn="$dontwarn -Wdeclaration-after-statement"
# Using long long is fine
dontwarn="$dontwarn -Wlong-long"
+ # Unused macros are ok
+ dontwarn="$dontwarn -Wunused-macros"
# g_clear_object & G_ATOMIC_OP_USE_GCC_BUILTINS causes
--
1.7.7.6
12 years, 9 months