[libvirt] [libvirt-test-api][PATCH] fix imperfect cleanup cause the case will always fail
by Luyao Huang
Remove call undefined function.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
repos/virconn/connection_getMemoryParameters.py | 4 ----
1 file changed, 4 deletions(-)
diff --git a/repos/virconn/connection_getMemoryParameters.py b/repos/virconn/connection_getMemoryParameters.py
index 9b88fc3..d110b35 100644
--- a/repos/virconn/connection_getMemoryParameters.py
+++ b/repos/virconn/connection_getMemoryParameters.py
@@ -16,7 +16,6 @@ node_memory = ['full_scans',
'sleep_millisecs']
SYSFS_MEMORY_SHARED_PATH = '/sys/kernel/mm/ksm/'
-LIBVIRT_API_PATH = '/usr/share/libvirt/api/libvirt-api.xml'
flags=0
def check_memory_parameter(libvirt_dict, parameter_name):
@@ -47,9 +46,6 @@ def connection_getMemoryParameters(params):
logger.info("get connection to libvirtd")
- if utils.check_flags('getMemoryParameters', LIBVIRT_API_PATH) == 1:
- return 1
-
param_dict=conn.getMemoryParameters()
for n in node_memory:
--
1.8.3.1
9 years, 3 months
[libvirt] [PATCH] maint: update to latest gnulib
by Eric Blake
Incorporates fixes for cross-compiling to mingw on rawhide, where
gcc 5.1 changes detection of how to properly determine PRIdMAX.
* .gnulib: Update to latest, for mingw.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
I've missed the freeze for rc1, but confirmed that this update
is rather minimal and should only affect mingw (in particular, it
will fix cross-compilation failure under rawhide with gcc 5.1).
As such, I won't push without review, but I also argue that the
changeset is small enough that it should be safe if we agree to
take it before rc2.
* .gnulib 875ec93...c26527c (5):
> stdio: limit __gnu_printf__ witness to gcc 4.4+
> error: use correct printf attributes on mingw
> update from texinfo
> inttypes: force correct mingw PRIdMAX even without <stdio.h>
> stdio: fix probe on mingw under gcc 5.1
.gnulib | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gnulib b/.gnulib
index 875ec93..c26527c 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 875ec93e1501d2d2a8bab1b64fa66b8ceb51dc67
+Subproject commit c26527cebbbf42ed1dbc50df0074861e0ebe33dc
--
2.1.0
9 years, 3 months
[libvirt] [PATCH] test: fix IP address range failure test
by Laine Stump
This was revealed when I made a cut-paste mistake in an upgrade to
virSocketAddrGetRange(), leading to failure to check for the end
address being outside of the defined network, but a negative test case
that should have caught the error instead returned success.
The problem was that testRange in sockettest.c was written so that
when it expected a failure, even an "unexpected success" would be
considered as an "expected failure" because of the way the check in
testRange was done. testRange had this:
if (gotsize < 0 || gotsize != size) {
return pass ? -1 : 0;
} else {
return pass ? 0 : -1;
}
but all the tests that expected a failure give "-1" as the expected
size. So in a case where we expect a failure, we would have pass ==
false and size == -1. If virSocketAddrGetRange() was incorrectly
*successful* (returned some positive number), then "gotsize != size"
would be, e.g. "276 != -1", so we would take the if clause and, since
pass == false, we would return 0 (success i.e. expected failure).
The solution is that in the case where we expect failure, we should
just ignore size - virSocketAddrGetRange() must return -1 in order for
us to report "expected failure == success".
---
Here's the email where jferlan points out the typo and asks about the
apparent lack of a proper negative test case:
https://www.redhat.com/archives/libvir-list/2015-May/msg01166.html
tests/sockettest.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/sockettest.c b/tests/sockettest.c
index 84170d5..292edb6 100644
--- a/tests/sockettest.c
+++ b/tests/sockettest.c
@@ -103,10 +103,12 @@ testRange(const char *saddrstr, const char *eaddrstr,
int gotsize = virSocketAddrGetRange(&saddr, &eaddr, &netaddr, prefix);
VIR_DEBUG("Size want %d vs got %d", size, gotsize);
- if (gotsize < 0 || gotsize != size) {
- return pass ? -1 : 0;
+ if (pass) {
+ /* fail if virSocketAddrGetRange returns failure, or unexpected size */
+ return (gotsize < 0 || gotsize != size) ? -1 : 0;
} else {
- return pass ? 0 : -1;
+ /* succeed if virSocketAddrGetRange fails, otherwise fail. */
+ return gotsize < 0 ? 0 : -1;
}
}
--
2.1.0
9 years, 3 months
[libvirt] [PATCH] spec: fixes for recently introduced libxl conf files
by Jim Fehlig
Commit 198cc1d3 introduced libxl-lockd and libxl-sanlock config
files but forgot to add them to the spec file. Follow-up commit
62b18d98 added the files to daemon-driver-libxl, but missed adding
them to the daemon package when configuring libvirt
--without-driver-modules. In addition, commit 62b18d98 added
libxl-sanlock to daemon-driver-libxl, but it should be included
in lock-sanlock when libvirt is configured --with-sanlock.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
Given the problems I've caused with the original commit 198cc1d3,
I'm reluctant to push this as a build-breaker without another
set of eyes reviewing it.
libvirt.spec.in | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index f95e31f..0c343d6 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -2007,6 +2007,7 @@ exit 0
%endif
%if %{with_libxl}
%config(noreplace) %{_sysconfdir}/libvirt/libxl.conf
+%config(noreplace) %{_sysconfdir}/libvirt/libxl-lockd.conf
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
%ghost %dir %{_localstatedir}/run/libvirt/libxl/
%dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/libxl/
@@ -2130,7 +2131,6 @@ exit 0
%defattr(-, root, root)
%config(noreplace) %{_sysconfdir}/libvirt/libxl.conf
%config(noreplace) %{_sysconfdir}/libvirt/libxl-lockd.conf
-%config(noreplace) %{_sysconfdir}/libvirt/libxl-sanlock.conf
%{_datadir}/augeas/lenses/libvirtd_libxl.aug
%{_datadir}/augeas/lenses/tests/test_libvirtd_libxl.aug
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/libxl/
@@ -2183,6 +2183,9 @@ exit 0
%if %{with_qemu}
%config(noreplace) %{_sysconfdir}/libvirt/qemu-sanlock.conf
%endif
+ %if %{with_libxl}
+%config(noreplace) %{_sysconfdir}/libvirt/libxl-sanlock.conf
+ %endif
%attr(0755, root, root) %{_libdir}/libvirt/lock-driver/sanlock.so
%{_datadir}/augeas/lenses/libvirt_sanlock.aug
%{_datadir}/augeas/lenses/tests/test_libvirt_sanlock.aug
--
1.8.4.5
9 years, 3 months
[libvirt] virt-manager - applicability
by poma
Applicability of the changes in configuration is broken, at least to some extent.
e.g.
Controller USB - USB2 to USB3 and vice versa,
etc.
$ rpm -q virt-manager
virt-manager-1.2.0-1.fc22.noarch
$ rpm -q virt-manager
virt-manager-1.2.0-1.fc23.noarch
However it is resolved upstream.
Tested with commit:
$ git log -1
commit b02cb7ffa04cf40d66b69cfb4c52b755b90470ed
Author: Cole Robinson <crobinso(a)redhat.com>
Date: Wed May 20 17:42:45 2015 -0400
delete: Improve dialog sizing and scrolling
Drop horizontal scrolling, since with gtk3 hidden scrollbars it might
mean users don't realize there's info that is scrolled off.
Adjust the default sizing to match that pattern
The new release will follow soon?
9 years, 3 months
[libvirt] [PATCH v2] libxl: load on FreeBSD
by Roman Bogorodskiy
The libxl tries to check if it's running in dom0 by parsing
/proc/xen/capabilities and if that fails it doesn't load.
There's no procfs interface in Xen on FreeBSD, so this check always
fails.
In addition to checking procfs, check if /dev/xen/xenstored, that's enough to
check if we're running in dom0 in FreeBSD case.
---
src/libxl/libxl_driver.c | 42 ++++++++++++++++++++++--------------------
1 file changed, 22 insertions(+), 20 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 12be816..fddafa1 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -74,6 +74,7 @@ VIR_LOG_INIT("libxl.libxl_driver");
#define LIBXL_CONFIG_FORMAT_SEXPR "xen-sxpr"
#define HYPERVISOR_CAPABILITIES "/proc/xen/capabilities"
+#define HYPERVISOR_XENSTORED "/dev/xen/xenstored"
/* Number of Xen scheduler parameters */
#define XEN_SCHED_CREDIT_NPARAM 2
@@ -427,8 +428,6 @@ static bool
libxlDriverShouldLoad(bool privileged)
{
bool ret = false;
- int status;
- char *output = NULL;
/* Don't load if non-root */
if (!privileged) {
@@ -436,24 +435,27 @@ libxlDriverShouldLoad(bool privileged)
return ret;
}
- if (!virFileExists(HYPERVISOR_CAPABILITIES)) {
- VIR_INFO("Disabling driver as " HYPERVISOR_CAPABILITIES
- " does not exist");
- return ret;
- }
- /*
- * Don't load if not running on a Xen control domain (dom0). It is not
- * sufficient to check for the file to exist as any guest can mount
- * xenfs to /proc/xen.
- */
- status = virFileReadAll(HYPERVISOR_CAPABILITIES, 10, &output);
- if (status >= 0)
- status = strncmp(output, "control_d", 9);
- VIR_FREE(output);
- if (status) {
- VIR_INFO("No Xen capabilities detected, probably not running "
- "in a Xen Dom0. Disabling libxenlight driver");
-
+ if (virFileExists(HYPERVISOR_CAPABILITIES)) {
+ int status;
+ char *output = NULL;
+ /*
+ * Don't load if not running on a Xen control domain (dom0). It is not
+ * sufficient to check for the file to exist as any guest can mount
+ * xenfs to /proc/xen.
+ */
+ status = virFileReadAll(HYPERVISOR_CAPABILITIES, 10, &output);
+ if (status >= 0)
+ status = strncmp(output, "control_d", 9);
+ VIR_FREE(output);
+ if (status) {
+ VIR_INFO("No Xen capabilities detected, probably not running "
+ "in a Xen Dom0. Disabling libxenlight driver");
+
+ return ret;
+ }
+ } else if (!virFileExists(HYPERVISOR_XENSTORED)) {
+ VIR_INFO("Disabling driver as neither " HYPERVISOR_CAPABILITIES
+ " nor " HYPERVISOR_CAPABILITIES " exist");
return ret;
}
--
2.3.7
9 years, 3 months
[libvirt] [libvirt-glib] gconfig: Don't try to return value from gvir_config_domain_set_memory
by Christophe Fergeau
gvir_config_domain_set_memory() is a void function, so using
g_return_val_if_fail() is not correct. This causes a warning/compilation
failure on CentOS CI framework:
https://ci.centos.org/view/libvirt-project/job/libvirt-glib-build/systems...
---
Pushed under the build breaker rule.
Christophe
libvirt-gconfig/libvirt-gconfig-domain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index 000d4eb..8a6c676 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -462,7 +462,7 @@ void gvir_config_domain_set_memory(GVirConfigDomain *domain, guint64 memory)
{
GVirConfigObject *node;
- g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(domain), 0);
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN(domain));
node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(domain), "memory");
gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(node), NULL, memory);
--
2.4.2
9 years, 3 months
[libvirt] [PATCH v3 0/3] qemu: Deal with panic device on pSeries
by Andrea Bolognani
Currently, having the <panic> element in a domain XML prevents it from
starting on pSeries. The error message in this case is not very accurate,
and the first commit improves it.
Since the guest firmware provides the same features as the pvpanic
device for pSeries guests, the element should be allowed. The second
commit implements this change.
It being part of the firmware, the <panic> element should actually
always be present in the domain XML: the third commit makes sure
this is the case.
Andrea Bolognani (3):
qemu: Improve error message for missing QEMU_CAPS_DEVICE_PANIC.
qemu: Allow panic device for pSeries guests
qemu: Automatically add <panic> element for pSeries guests.
docs/formatdomain.html.in | 8 ++++-
src/qemu/qemu_command.c | 34 ++++++++++++++++------
src/qemu/qemu_domain.c | 14 +++++++++
.../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 1 +
.../qemuxml2argv-pseries-nvram.xml | 1 +
.../qemuxml2argv-pseries-panic-address.xml | 32 ++++++++++++++++++++
.../qemuxml2argv-pseries-panic-missing.args | 7 +++++
.../qemuxml2argv-pseries-panic-missing.xml | 29 ++++++++++++++++++
.../qemuxml2argv-pseries-panic-no-address.args | 7 +++++
.../qemuxml2argv-pseries-panic-no-address.xml | 30 +++++++++++++++++++
tests/qemuxml2argvtest.c | 6 ++++
.../qemuxml2xmlout-pseries-panic-missing.xml | 30 +++++++++++++++++++
tests/qemuxml2xmltest.c | 2 ++
13 files changed, 191 insertions(+), 10 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-address.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-missing.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-missing.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-no-address.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-panic-no-address.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml
--
2.1.0
9 years, 3 months
[libvirt] [v2] storage-pool: API to get/set autostart flag
by Zeeshan Ali (Khattak)
Add binding for virStoragePoolGetAutostart & virStoragePoolSetAutostart.
---
libvirt-gobject/libvirt-gobject-storage-pool.c | 51 ++++++++++++++++++++++++++
libvirt-gobject/libvirt-gobject-storage-pool.h | 5 +++
libvirt-gobject/libvirt-gobject.sym | 6 +++
3 files changed, 62 insertions(+)
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
index f3eac0d..7f26b1b 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.c
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
@@ -1048,6 +1048,57 @@ gboolean gvir_storage_pool_delete (GVirStoragePool *pool,
return TRUE;
}
+/**
+ * gvir_storage_pool_get_autostart:
+ * @pool: the storage pool
+ * @err: return location for any #GError
+ *
+ * Return value: #True if autostart is enabled, #False otherwise.
+ */
+gboolean gvir_storage_pool_get_autostart(GVirStoragePool *pool,
+ GError **err)
+{
+ int ret;
+
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ if (virStoragePoolGetAutostart(pool->priv->handle, &ret)) {
+ gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
+ 0,
+ "Failed to get autostart flag from storage pool");
+ }
+
+ return !!ret;
+}
+
+/**
+ * gvir_storage_pool_set_autostart:
+ * @pool: the storage pool
+ * @autostart: Whether or not to autostart
+ * @err: return location for any #GError
+ *
+ * Sets whether or not storage pool @pool is started automatically on boot.
+ *
+ * Return value: #TRUE on success, #FALSE otherwise.
+ */
+gboolean gvir_storage_pool_set_autostart(GVirStoragePool *pool,
+ gboolean autostart,
+ GError **err)
+{
+ g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
+
+ if (virStoragePoolSetAutostart(pool->priv->handle, autostart)) {
+ gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR,
+ 0,
+ "Failed to set autostart flag on storage pool");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static void
gvir_storage_pool_delete_helper(GSimpleAsyncResult *res,
GObject *object,
diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.h b/libvirt-gobject/libvirt-gobject-storage-pool.h
index f8529f0..f7f879c 100644
--- a/libvirt-gobject/libvirt-gobject-storage-pool.h
+++ b/libvirt-gobject/libvirt-gobject-storage-pool.h
@@ -166,6 +166,11 @@ void gvir_storage_pool_delete_async (GVirStoragePool *pool,
gboolean gvir_storage_pool_delete_finish(GVirStoragePool *pool,
GAsyncResult *result,
GError **err);
+gboolean gvir_storage_pool_get_autostart(GVirStoragePool *pool,
+ GError **err);
+gboolean gvir_storage_pool_set_autostart(GVirStoragePool *pool,
+ gboolean autostart,
+ GError **err);
G_END_DECLS
diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym
index 927cad9..dcda675 100644
--- a/libvirt-gobject/libvirt-gobject.sym
+++ b/libvirt-gobject/libvirt-gobject.sym
@@ -265,4 +265,10 @@ LIBVIRT_GOBJECT_0.2.0 {
gvir_domain_open_graphics_fd;
} LIBVIRT_GOBJECT_0.1.9;
+LIBVIRT_GOBJECT_0.2.1 {
+ global:
+ gvir_storage_pool_get_autostart;
+ gvir_storage_pool_set_autostart;
+} LIBVIRT_GOBJECT_0.2.0;
+
# .... define new API here using predicted next version number ....
--
2.1.0
9 years, 3 months
[libvirt] [libvirt-glib] gconfig: Add precondition checks to some public entry points
by Christophe Fergeau
It's currently possible to trigger a crash by passing eg NULL to these
functions. Better to return a prominent warning to the caller without
crashing.
---
libvirt-gconfig/libvirt-gconfig-domain.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
index 064f307..000d4eb 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain.c
@@ -258,18 +258,24 @@ void gvir_config_domain_set_virt_type(GVirConfigDomain *domain, GVirConfigDomain
const char *gvir_config_domain_get_name(GVirConfigDomain *domain)
{
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(domain), NULL);
+
return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
"name");
}
const char *gvir_config_domain_get_uuid(GVirConfigDomain *domain)
{
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(domain), NULL);
+
return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
"uuid");
}
const char *gvir_config_domain_get_title(GVirConfigDomain *domain)
{
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(domain), NULL);
+
return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
"title");
}
@@ -281,6 +287,8 @@ const char *gvir_config_domain_get_title(GVirConfigDomain *domain)
*/
void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name)
{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN(domain));
+
gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
"name", name);
g_object_notify(G_OBJECT(domain), "name");
@@ -293,6 +301,8 @@ void gvir_config_domain_set_name(GVirConfigDomain *domain, const char *name)
*/
void gvir_config_domain_set_uuid(GVirConfigDomain *domain, const char *uuid)
{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN(domain));
+
gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
"uuid", uuid);
g_object_notify(G_OBJECT(domain), "uuid");
@@ -308,6 +318,8 @@ void gvir_config_domain_set_uuid(GVirConfigDomain *domain, const char *uuid)
*/
void gvir_config_domain_set_title(GVirConfigDomain *domain, const char *title)
{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN(domain));
+
gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
"title", title);
g_object_notify(G_OBJECT(domain), "title");
@@ -315,6 +327,8 @@ void gvir_config_domain_set_title(GVirConfigDomain *domain, const char *title)
const char *gvir_config_domain_get_description(GVirConfigDomain *domain)
{
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(domain), NULL);
+
return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain),
"description");
}
@@ -327,6 +341,8 @@ const char *gvir_config_domain_get_description(GVirConfigDomain *domain)
void gvir_config_domain_set_description(GVirConfigDomain *domain,
const char *description)
{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN(domain));
+
gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(domain),
"description", description);
g_object_notify(G_OBJECT(domain), "description");
@@ -400,6 +416,8 @@ guint64 gvir_config_domain_get_memory(GVirConfigDomain *domain)
guint64 unit_base;
guint64 memory;
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(domain), 0);
+
unit = gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(domain), "memory", "unit");
unit_base = get_unit_base(unit, 1024);
@@ -421,6 +439,8 @@ guint64 gvir_config_domain_get_current_memory(GVirConfigDomain *domain)
guint64 unit_base;
guint64 memory;
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(domain), 0);
+
unit = gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(domain), "currentMemory", "unit");
unit_base = get_unit_base(unit, 1024);
@@ -442,6 +462,8 @@ void gvir_config_domain_set_memory(GVirConfigDomain *domain, guint64 memory)
{
GVirConfigObject *node;
+ g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN(domain), 0);
+
node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(domain), "memory");
gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(node), NULL, memory);
gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(node),
@@ -468,6 +490,8 @@ void gvir_config_domain_set_current_memory(GVirConfigDomain *domain,
{
GVirConfigObject *node;
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN(domain));
+
node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(domain), "currentMemory");
gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(node), NULL, memory);
gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(node),
@@ -485,6 +509,8 @@ guint64 gvir_config_domain_get_vcpus(GVirConfigDomain *domain)
void gvir_config_domain_set_vcpus(GVirConfigDomain *domain, guint64 vcpu_count)
{
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN(domain));
+
gvir_config_object_set_node_content_uint64(GVIR_CONFIG_OBJECT(domain),
"vcpu", vcpu_count);
g_object_notify(G_OBJECT(domain), "vcpu");
@@ -530,6 +556,8 @@ void gvir_config_domain_set_features(GVirConfigDomain *domain,
GVirConfigObject *features_node;
GStrv it;
+ g_return_if_fail(GVIR_CONFIG_IS_DOMAIN(domain));
+
features_node = gvir_config_object_replace_child(GVIR_CONFIG_OBJECT(domain),
"features");
g_return_if_fail(GVIR_CONFIG_IS_OBJECT(features_node));
--
2.4.2
9 years, 3 months