[libvirt] The problems of default settings
Hi all, I am recently considering about the default setting for different platforms. Currently, there is no good way to fix the default setting for PPC64 platform. For example, we prefer pseries on PPC64 as the default machine type users don't need to specify it. I am thinking about the solutions. 1. One solution I am thinking about is to create template xml files for different platforms. But if users give their own configuration XML files, how to keep the preferred configurations in domain definition. I think this solution should be better in management tools, for example, ovirt or openstack. After management tools can generate its own configuration files with different default settings, libvirt can help create according to XML files. 2. Another solution is to use hook in libvirt. But it seems that we need to use hook daemon. Is it complex to use? I am not familiar with hook. Any suggestion is appreciated. Thanks. :) --Li -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-glib] config: Fix 2 leaks in domain memory setters
Sorry, sent twice to the list by mistake, both versions are identical. Christophe On Thu, Mar 28, 2013 at 05:41:54PM +0100, Christophe Fergeau wrote: --- 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 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list pgpDsNugUvnAp.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-glib] build: Replace obsolete macro in configure.ac
From: Stefano Facchini stefano.facch...@gmail.com Fix the build for newer automake --- AUTHORS | 1 + configure.ac | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 6cec5d7..db05f64 100644 --- a/AUTHORS +++ b/AUTHORS @@ -17,5 +17,6 @@ Patches have been received from: Timo Juhani Lindfors timo.lindf...@iki.fi Alexander Larsson al...@redhat.com Claudio Bley cb...@av-test.de + Stefano Facchini stefano.facch...@gmail.com ... send patches to get your name added ... diff --git a/configure.ac b/configure.ac index 96dbf5a..2bf9c1b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_INIT(libvirt-glib, 0.1.7) AC_CONFIG_SRCDIR(libvirt-glib/libvirt-glib-main.c) AC_CONFIG_AUX_DIR([build-aux]) -AM_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS(config.h) AC_CONFIG_MACRO_DIR([m4]) dnl Make automake keep quiet about wildcards other GNUmake-isms AM_INIT_AUTOMAKE([-Wno-portability]) -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-glib] build: Replace obsolete macro in configure.ac
On Fri, Mar 29, 2013 at 09:34:51AM +0100, Christophe Fergeau wrote: From: Stefano Facchini stefano.facch...@gmail.com diff --git a/configure.ac b/configure.ac index 96dbf5a..2bf9c1b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_INIT(libvirt-glib, 0.1.7) AC_CONFIG_SRCDIR(libvirt-glib/libvirt-glib-main.c) AC_CONFIG_AUX_DIR([build-aux]) -AM_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS(config.h) AC_CONFIG_MACRO_DIR([m4]) dnl Make automake keep quiet about wildcards other GNUmake-isms AM_INIT_AUTOMAKE([-Wno-portability]) ACK from me, though I'll wait a bit before pushing in case there are some autoconf/automake subtleties I'm not aware of at play here :) Christophe pgpJJMfDM5SPF.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-designer 2/2] Fix leaks of libosinfo data
On 28.03.2013 12:16, Christophe Fergeau wrote: --- examples/virtxml.c | 3 +++ libvirt-designer/libvirt-designer-domain.c | 2 ++ 2 files changed, 5 insertions(+) ACK series. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-designer 2/2] Fix leaks of libosinfo data
On Fri, Mar 29, 2013 at 10:51:01AM +0100, Michal Privoznik wrote: On 28.03.2013 12:16, Christophe Fergeau wrote: --- examples/virtxml.c | 3 +++ libvirt-designer/libvirt-designer-domain.c | 2 ++ 2 files changed, 5 insertions(+) ACK series. Thanks, pushed, I've squashed the 2nd patch from this series with https://www.redhat.com/archives/libvir-list/2013-March/msg01626.html as they were both fixing libosinfo-related leaks. Christophe pgpiitorK13mz.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] storage: Avoid double virCommandFree in virStorageBackendLogicalDeletePool
On 03/28/2013 05:13 PM, Michal Privoznik wrote: On 28.03.2013 17:06, Martin Kletzander wrote: 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 mklet...@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;= Alternatively, you can just remove a few lines: diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index 8cce978..d911cf3 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -667,11 +667,11 @@ virStorageBackendLogicalDeletePool(virConnectPtr conn ATTRIBUTE_UNUSED, NULL); if (virCommandRun(cmd, NULL) 0) goto cleanup; -virCommandFree(cmd); /* now remove the pv devices and clear them out */ ret = 0; for (i = 0 ; i pool-def-source.ndevice ; i++) { +virCommandFree(cmd); cmd = virCommandNewArgList(PVREMOVE, pool-def-source.devices[i].path, NULL); @@ -679,8 +679,6 @@ virStorageBackendLogicalDeletePool(virConnectPtr conn ATTRIBUTE_UNUSED, ret = -1; break; } -virCommandFree(cmd); -cmd = NULL; } cleanup: However, your approach works as well. ACK. Thanks, I pushed my clumsy version as I had it prepared, but feel free to change that. Martin -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix the stdout in print_job_progress()
Signed-off-by: Yanbing Du y...@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 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix the stdout in print_job_progress()
On 03/29/2013 04:33 AM, Yanbing Du wrote: Signed-off-by: Yanbing Du y...@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); NACK. Progress is intentionally reported to stderr (hence flushing stdout before printing progress, and flushing stderr after). -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: don't call virSecretFree on NULL
On 03/29/13 13:04, Ján Tomko wrote: 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(-) Ah, shame on me. ACK and 1.0.4-worth. Peter -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] virsh: don't call virSecretFree on NULL
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 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: don't call virSecretFree on NULL
On 03/29/2013 01:10 PM, Peter Krempa wrote: On 03/29/13 13:04, Ján Tomko wrote: 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(-) Ah, shame on me. ACK and 1.0.4-worth. Peter Thanks, pushed now. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] docs: Fix truncated sentence in RDP 'multiUser' attribute
--- 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 codereplaceUser/code attribute is a boolean deciding whether multiple simultaneous connections to the VM are permitted. -The codemultiUser/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 codemultiUser/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 dtcodedesktop/code/dt dd -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-glib] build: Replace obsolete macro in configure.ac
On Fri, Mar 29, 2013 at 10:41:36AM +0100, Christophe Fergeau wrote: On Fri, Mar 29, 2013 at 09:34:51AM +0100, Christophe Fergeau wrote: From: Stefano Facchini stefano.facch...@gmail.com diff --git a/configure.ac b/configure.ac index 96dbf5a..2bf9c1b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_INIT(libvirt-glib, 0.1.7) AC_CONFIG_SRCDIR(libvirt-glib/libvirt-glib-main.c) AC_CONFIG_AUX_DIR([build-aux]) -AM_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS(config.h) AC_CONFIG_MACRO_DIR([m4]) dnl Make automake keep quiet about wildcards other GNUmake-isms AM_INIT_AUTOMAKE([-Wno-portability]) ACK from me, though I'll wait a bit before pushing in case there are some autoconf/automake subtleties I'm not aware of at play here :) Actually I'd tend to squash this in: -AC_CONFIG_HEADERS(config.h) +AC_CONFIG_HEADERS([config.h]) Christophe pgpktOCc1hhc2.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] docs: Fix truncated sentence in RDP 'multiUser' attribute
On 03/29/2013 06:55 AM, Christophe Fergeau wrote: --- 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. Trivial doc fixes can't break code, so they are always valid even in freeze. ACK. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix the stdout in print_job_progress()
- Original Message - From: Eric Blake ebl...@redhat.com To: Yanbing Du y...@redhat.com Cc: libvir-list@redhat.com Sent: Friday, March 29, 2013 7:14:41 PM Subject: Re: [libvirt] [PATCH] Fix the stdout in print_job_progress() On 03/29/2013 04:33 AM, Yanbing Du wrote: Signed-off-by: Yanbing Du y...@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); NACK. Progress is intentionally reported to stderr (hence flushing stdout before printing progress, and flushing stderr after). OK, i see. Thanks for your reply. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv4 3/9] virCaps: get rid of defaultInitPath value in the virCaps struct
On 03/15/2013 09:26 AM, Peter Krempa wrote: This gets rid of the parameter in favor of using the new callback infrastructure to do the same stuff. This patch implements the domain adjustment callback in the openVZ driver and moves the check from the parser to a new validation method in the callback infrastructure. --- Notes: Version 4: - tweaked naming do comply with other changes - v3 ACKed +++ b/src/conf/domain_conf.c @@ -2506,6 +2522,7 @@ virDomainDeviceDefPostParse(virDomainXMLConfPtr xmlconf, } + struct virDomainDefPostParseDeviceIteratorData { Spurious newline addition? Other than that, still looks good. I'm assuming this series is waiting until after 1.0.4. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv4 4/9] virCaps: get rid of defaultDiskDriverName
On 03/15/2013 09:26 AM, Peter Krempa wrote: This patch removes the defaultDiskDriverName from the virCaps structure. This particular default value is used only in the qemu driver so this patch uses the recently added callback to fill the driver name if it's needed instead of propagating it through virCaps. --- Notes: Version 4: - tweaked naming to comply - v3 was already ACKed Still looks good. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv4 1/9] conf: Add post XML parse callbacks and prepare for cleaning of virCaps
On 03/25/2013 02:25 PM, Laine Stump wrote: +if (xmlconf xmlconf-config.devicesConfigCallback) { +ret = xmlconf-config.devicesConfigCallback(dev, def, caps, +xmlconf-config.priv); The implementation of these functions in the hypervisor drivers has been changed to xxxPostParsexxx, but you're still calling it devicesConfigCallback in the struct that's setup. I think this struct should have the members called xxxPostParsexxx as well. This is especially confusing because the parser is parsing a domain config (so we have the config for the parser of the config - it makes it a bit difficult to follow whether we're talking about the domain config or parser config sometimes.). + +typedef struct _virDomainDefParserConfig virDomainDefParserConfig; +typedef virDomainDefParserConfig *virDomainDefParserConfigPtr; +struct _virDomainDefParserConfig { +virDomainDefPostParseCallback domainConfigCallback; +virDomainDeviceDefPostParseCallback devicesConfigCallback; Yeah, here's the definition. I think domainConfigCallback should be called domainPostParseCallback and devicesConfigCallback should be called devicesPostParseCallback. That would help quite a lot to un-confuse me. (an aside - I'm still trying to think of something that's less confusing than conf for xmlconf and virDomainXMLConfPtr - this dual usage (for both domain config that we're parsing, and the parser config) requires too much concentration from my brain :-). I haven't come up with a better idea yet, though...) Maybe virDomainXMLOptionPtr. Leave 'conf' for items related to parsing a user's libvirtd.conf and qemu.conf files, and 'xmlopt' instead of 'xmlconf' for items related to options that the driver passed in for impacting xml parsing/validation. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv4 5/9] virCaps: get rid of emulatorRequired
On 03/15/2013 09:26 AM, Peter Krempa wrote: This patch removes the emulatorRequired field and associated infrastructure from the virCaps object. Instead the driver specific callbacks are used as this field isn't enforced by all drivers. This patch implements the appropriate callbacks in the qemu and lxc driver and moves to check to that location. --- Notes: Version 4: - rename virDomainDefDefaultEmulator to virDomainDefGetDefaultEmulator - changed names of functions to comply with the rest Version 3: - new in the series +static int qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, virDomainDefPtr def ATTRIBUTE_UNUSED, virCapsPtr caps ATTRIBUTE_UNUSED, void *opaque) + { Spurious newline addition. ACK with that cleaned up (again, assuming this series is post-release). -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv4 7/9] virCaps: remove defaultDiskDriverType from the struct
On 03/15/2013 09:26 AM, Peter Krempa wrote: Use the qemu specific callback to fill this data in the qemu driver as it's the only place where it was used and fix tests as the qemu test capability object didn't configure the defaults for the tests. --- Notes: Version 4: - new in series src/conf/capabilities.h| 1 - src/conf/domain_conf.c | 5 --- src/qemu/qemu_conf.c | 6 src/qemu/qemu_domain.c | 42 ++ .../qemuxml2argv-disk-drive-network-nbd.args | 5 +-- .../qemuxml2argv-disk-drive-network-nbd.xml| 1 + .../qemuxml2argv-disk-drive-network-rbd-auth.args | 2 +- .../qemuxml2argv-disk-drive-network-rbd-ipv6.args | 2 +- .../qemuxml2argv-disk-drive-network-rbd-ipv6.xml | 1 + .../qemuxml2argv-disk-drive-network-rbd.args | 2 +- .../qemuxml2argv-disk-drive-network-rbd.xml| 1 + .../qemuxml2argv-disk-drive-network-sheepdog.args | 3 +- .../qemuxml2argv-disk-drive-network-sheepdog.xml | 1 + 13 files changed, 47 insertions(+), 25 deletions(-) This plus your followups looks fine. ACK. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] docs: Fix truncated sentence in RDP 'multiUser' attribute
On Fri, Mar 29, 2013 at 08:33:29AM -0600, Eric Blake wrote: On 03/29/2013 06:55 AM, Christophe Fergeau wrote: --- 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. Trivial doc fixes can't break code, so they are always valid even in freeze. ACK. Thanks, pushed! Christophe pgpl5fIPUdm31.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv4 8/9] virCaps: Get rid of hasWideScsiBus
On 03/15/2013 09:26 AM, Peter Krempa wrote: Use the virDomainXMLConf structure to hold this data. --- Notes: Version 4: - new in series src/conf/capabilities.h| 1 - src/conf/domain_conf.c | 13 +++-- src/conf/domain_conf.h | 8 +++- src/esx/esx_driver.c | 12 +--- src/libvirt_vmx.syms | 2 ++ src/qemu/qemu_command.c| 9 + src/vmware/vmware_conf.c | 2 +- src/vmware/vmware_driver.c | 6 +++--- src/vmx/vmx.c | 38 ++ src/vmx/vmx.h | 12 +++- tests/vmx2xmltest.c| 10 +++--- tests/xml2vmxtest.c| 7 +++ 12 files changed, 73 insertions(+), 47 deletions(-) ACK (modulo any naming changes propagating from earlier in the series on a respin). -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv4 9/9] virCaps: get rid of macPrefix field
On 03/15/2013 09:26 AM, Peter Krempa wrote: Use the virDomainXMLConf structure to hold this data and tweak the code to avoid semantic change. Without configuration the KVM mac prefix is used by default. I chose it as it's in the privately administered segment so it should be usable for any purposes. --- Notes: Version 4: - new in series src/conf/capabilities.c | 14 -- src/conf/capabilities.h | 9 - src/conf/domain_conf.c | 26 ++ src/conf/domain_conf.h | 3 +++ src/esx/esx_driver.c | 1 - src/libvirt_private.syms | 3 +-- src/libxl/libxl_conf.c | 2 -- src/libxl/libxl_driver.c | 6 +- src/lxc/lxc_conf.c | 3 --- src/openvz/openvz_conf.c | 2 -- src/openvz/openvz_driver.c | 2 +- src/parallels/parallels_driver.c | 12 src/phyp/phyp_driver.c | 4 src/qemu/qemu_capabilities.c | 3 --- src/qemu/qemu_command.c | 6 +++--- src/vbox/vbox_tmpl.c | 10 +++--- src/vmware/vmware_conf.c | 2 -- src/vmx/vmx.c| 1 + src/xen/xen_driver.c | 7 ++- src/xen/xen_hypervisor.c | 2 -- tests/vmx2xmltest.c | 1 - tests/xml2vmxtest.c | 1 - 22 files changed, 57 insertions(+), 63 deletions(-) +++ b/src/conf/domain_conf.c @@ -800,6 +800,16 @@ virDomainXMLConfNew(virDomainDefParserConfigPtr config, if (xmlns) xmlconf-ns = *xmlns; +/* Technically this forbids to use one of Xerox's MAC address prefixes in + * our hypervisor drivers. This shouldn't ever be a problem. + * + * Use the KVM prefix as default as it's in the privately administered + * range */ +if (memcmp(xmlconf-config.macPrefix, + (unsigned char[]) {0x00, 0x00, 0x00}, 3)) +memcpy(xmlconf-config.macPrefix, + (unsigned char[]) {0x54, 0x52, 0x00}, 3); I don't see this C99 construct used very often; would it be any more straightforward to write: if (xmlconf-conf.macPrefix[0] == 0 xmlconf-conf.macPrefix[1] == 0 xmlconf-conf.macPrefix[2] == 0) { xmlconf-conf.macPrefix[0] = 0x54; xmlconf-conf.macPrefix[1] = 0x52; } But that's bikeshedding, so you don't necessarily have to agree. More importantly, why the magic number '3', instead of... +++ b/src/conf/domain_conf.h @@ -1975,6 +1975,7 @@ struct _virDomainDefParserConfig { /* data */ bool hasWideScsiBus; +unsigned char macPrefix[VIR_MAC_PREFIX_BUFLEN]; ...the symbolic constant VIR_MAC_PREFIX_BUFLEN? +++ b/src/esx/esx_driver.c @@ -598,7 +598,6 @@ esxCapsInit(esxPrivate *priv) return NULL; } -virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x00, 0x0c, 0x29 }); You are removing this prefix from esx://, ... +virDomainDefParserConfig libxlDomainDefParserConfig = { +.macPrefix = { 0x00, 0x16, 0x3e }, +}; + -/* XXX shouldn't 'borrow' KVM's prefix */ -virCapabilitiesSetMacPrefix(caps, (unsigned char []){ 0x52, 0x54, 0x00 }); This is a change to the default lxc:// prefix; since that is a semantic change, it should probably be a separate patch. +++ b/src/vmx/vmx.c @@ -521,6 +521,7 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST, virDomainDefParserConfig virVMXDomainDefParserConfig = { .hasWideScsiBus = true, +.macPrefix = {0x00, 0x0c, 0x29}, }; ...but adding it to vmx://. Are you sure you did this correctly? I think you need to fix the esx vs. vmx issue in v5. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv4 10/9] virCaps: Get rid of defaultConsoleTargetType callback
On 03/25/2013 10:17 AM, Peter Krempa wrote: This patch refactors various places to allow removing of the defaultConsoleTargetType callback from the virCaps structure. A new console character device target type is introduced - VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE - to mark that no type was specified in the XML. This type is at the end converted to the standard VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL. Other types that are different from this default have to be processed separately in the device post parse callback. --- Notes: Version 4: - new in series @@ -2538,6 +2554,91 @@ virDomainDefPostParseInternal(virDomainDefPtr def, return -1; } +/* + * Some really crazy backcompat stuff for consoles No joke! Even it if it is the same comment just moved from elsewhere +/* create the serial port definition from the console definition */ +if (def-nserials == 0) { +if (VIR_APPEND_ELEMENT(def-serials, def-nserials, + def-consoles[0]) 0) +goto no_memory; + +/* modify it to be a serial port */ +def-serials[0]-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL; +def-serials[0]-targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA; +def-serials[0]-target.port = 0; +} else { +/* if the console source does't match */ s/does't/doesn't/ ACK with the typo fix (and modulo any renaming earlier in the series) -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv4 2/9] qemu: Record the default NIC model in the domain XML
On 03/26/2013 12:51 PM, Peter Krempa wrote: On 03/25/13 21:34, Laine Stump wrote: On 03/15/2013 11:26 AM, Peter Krempa wrote: This patch implements the devices post parse cllback and uses it to fill the default qemu network card model into the XML if none is specified. Libvirt assumes that the network card model for qemu is the rtl8139. Record this in the XML using the new callback to avoid user confusion. As I recall (from a previous Fedora-specific patch I had to make that forced all fedora-13 machinetypes in configs to be changed to pc-0.14), just causing the parser to fill this in will not cause the default value to actually be written to the config files. So when we get to the point where we want to change the default, we won't have actually addressed the issue of making sure that existing configs continue to use rtl8139 rather than abruptly changing the guest's hardware at next boot (or when migrated to another host). This isn't an issue in this case. The default is and always was to use the realtek card. We can't change that unfortunately for anything better :(. This is just to notify the user what is the actual model we are using in this case so I think it isn't that important to rewrite the XML file. In case it's missing in the config, it will be always parsed to the default value and when the config will be saved in the future it will be written. But the value will still be used. If we want to assure that existing guests have their default netdev model written to config, we'll need to actually force the config to be rewritten to disk. Take a look at the patch named I don't think this is really needed, but I will have a look if this is feasible in this case. Actually, I think this *is* necessary, because part of the reason for explicitly adding the model to the config even when it is the default is that there is talk afloat to *change* libvirt's default interface model from rtl8139 to e1000. When/if this happens, existing domains will need to continue using the old default after upgrading libvirt and restarting the guest. In order for that to work, the model needs to be written to the persistent config on disk. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirtd segfault
Op woensdag 20 maart 2013 08:42:52 schreef Jim Fehlig: AL13N wrote: Thread 1 (Thread 0x7fdef683b800 (LWP 20522)): #0 0x in ?? () #1 0x7fdee9a72dc7 in libxl_osevent_occurred_timeout (ctx=optimized out, for_libxl=0x7fdedc001608) at libxl_event.c:1039 #2 0x7fdee9c9ff87 in libxlTimerCallback (timer=optimized out, timer_info=0x7fdedc001730) at libxl/libxl_driver.c:259 #3 0x7fdef5dd0f1a in virEventPollDispatchTimeouts () at util/vireventpoll.c:450 #4 virEventPollRunOnce () at util/vireventpoll.c:643 #5 0x7fdef5dcf88d in virEventRunDefaultImpl () at util/virevent.c:273 #6 0x7fdef5ec96c5 in virNetServerRun (srv=0x1146220) at rpc/virnetserver.c:1108 #7 0x0040c8e0 in main (argc=optimized out, argv=optimized out) at libvirtd.c:1481 I received a similar report on #xendevel just yesterday. I'll take a look at this in the next few days after finishing my current project. Regards, Jim thanks a lot... did you get somewhere, do you need some more information? -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] test: Return Libvirt logo as domain screenshot
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 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] test: Return Libvirt logo as domain screenshot
On 03/29/2013 03:52 PM, Michal Privoznik wrote: 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. Cute idea, and handy for easier testing of screenshot API. +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); Missing an OOM check, in which case you also end up leaking an incomplete stream. I'd swap the strdup to happen first so you don't have to clean up a stream. @@ -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 */ That's pushing it; this is probably post-release material. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-glib 0/4] Add missing GVirConfigDomainGraphics* API
Hey, This series adds various missing setters/getters to the GVirConfigDomainGraphics API. It also adds classes for the 'desktop' and 'rdp' graphics elements. Christophe -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-glib 1/4] config: Add gvir_config_domain_graphics_sdl_set_fullscreen()
--- libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c | 12 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h | 2 ++ libvirt-gconfig/libvirt-gconfig.sym | 5 + 3 files changed, 19 insertions(+) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c index 0954b5f..2097383 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c @@ -94,3 +94,15 @@ void gvir_config_domain_graphics_sdl_set_display(GVirConfigDomainGraphicsSdl *gr display, disp, NULL); } + +void gvir_config_domain_graphics_sdl_set_fullscreen(GVirConfigDomainGraphicsSdl *graphics, +gboolean fullscreen) +{ +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SDL(graphics)); + +gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics), + fullscreen, + G_TYPE_BOOLEAN, + fullscreen, + NULL); +} diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h index 7ff8938..5110f1c 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h @@ -65,6 +65,8 @@ void gvir_config_domain_graphics_sdl_set_xauthority(GVirConfigDomainGraphicsSdl const gchar *path); void gvir_config_domain_graphics_sdl_set_display(GVirConfigDomainGraphicsSdl *graphics, const gchar *disp); +void gvir_config_domain_graphics_sdl_set_fullscreen(GVirConfigDomainGraphicsSdl *graphics, +gboolean fullscreen); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index a1b2cc1..ccda4c0 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -512,4 +512,9 @@ LIBVIRT_GCONFIG_0.1.6 { gvir_config_domain_graphics_spice_image_compression_get_type; } LIBVIRT_GCONFIG_0.1.5; +LIBVIRT_GCONFIG_0.1.7 { + global: + gvir_config_domain_graphics_sdl_set_fullscreen; +} LIBVIRT_GCONFIG_0.1.6; + # define new API here using predicted next version number -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-glib 3/4] config: Add GVirConfigDomainGraphicsDesktop class
--- libvirt-gconfig/Makefile.am| 2 + .../libvirt-gconfig-domain-graphics-desktop.c | 98 ++ .../libvirt-gconfig-domain-graphics-desktop.h | 71 libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym| 6 ++ 5 files changed, 178 insertions(+) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index acd5289..68ba39d 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -39,6 +39,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-disk.h \ libvirt-gconfig-domain-filesys.h \ libvirt-gconfig-domain-graphics.h \ + libvirt-gconfig-domain-graphics-desktop.h \ libvirt-gconfig-domain-graphics-rdp.h \ libvirt-gconfig-domain-graphics-sdl.h \ libvirt-gconfig-domain-graphics-spice.h \ @@ -117,6 +118,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-disk.c \ libvirt-gconfig-domain-filesys.c \ libvirt-gconfig-domain-graphics.c \ + libvirt-gconfig-domain-graphics-desktop.c \ libvirt-gconfig-domain-graphics-rdp.c \ libvirt-gconfig-domain-graphics-sdl.c \ libvirt-gconfig-domain-graphics-spice.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c new file mode 100644 index 000..41b1112 --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c @@ -0,0 +1,98 @@ +/* + * libvirt-gconfig-domain-graphics-desktop.c: libvirt domain desktop configuration + * + * Copyright (C) 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 + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * http://www.gnu.org/licenses/. + * + * Author: Daniel P. Berrange berra...@redhat.com + */ + +#include config.h + +#include libvirt-gconfig/libvirt-gconfig.h +#include libvirt-gconfig/libvirt-gconfig-private.h + +#define GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP_GET_PRIVATE(obj) \ +(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP, GVirConfigDomainGraphicsDesktopPrivate)) + +struct _GVirConfigDomainGraphicsDesktopPrivate +{ +gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainGraphicsDesktop, gvir_config_domain_graphics_desktop, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS); + + +static void gvir_config_domain_graphics_desktop_class_init(GVirConfigDomainGraphicsDesktopClass *klass) +{ +g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsDesktopPrivate)); +} + + +static void gvir_config_domain_graphics_desktop_init(GVirConfigDomainGraphicsDesktop *graphics_desktop) +{ +g_debug(Init GVirConfigDomainGraphicsDesktop=%p, graphics_desktop); + +graphics_desktop-priv = GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP_GET_PRIVATE(graphics_desktop); +} + + +GVirConfigDomainGraphicsDesktop *gvir_config_domain_graphics_desktop_new(void) +{ +GVirConfigObject *object; + +object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP, +graphics, NULL); +gvir_config_object_set_attribute(object, type, desktop, NULL); +return GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP(object); +} + +GVirConfigDomainGraphicsDesktop * +gvir_config_domain_graphics_desktop_new_from_xml(const gchar *xml, + GError **error) +{ +GVirConfigObject *object; + +object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP, + graphics, NULL, xml, error); +if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, type), desktop) != 0) { +g_object_unref(G_OBJECT(object)); +return NULL; +} +return GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP(object); +} + +void gvir_config_domain_graphics_desktop_set_display(GVirConfigDomainGraphicsDesktop *graphics, + const gchar *disp) +{ +
[libvirt] [libvirt-glib 2/4] config: Add GVirConfigDomainGraphicsRdp class
--- libvirt-gconfig/Makefile.am| 2 + .../libvirt-gconfig-domain-graphics-rdp.c | 130 + .../libvirt-gconfig-domain-graphics-rdp.h | 79 + libvirt-gconfig/libvirt-gconfig.h | 1 + libvirt-gconfig/libvirt-gconfig.sym| 7 ++ 5 files changed, 219 insertions(+) create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am index 6b3b2cb..acd5289 100644 --- a/libvirt-gconfig/Makefile.am +++ b/libvirt-gconfig/Makefile.am @@ -39,6 +39,7 @@ GCONFIG_HEADER_FILES = \ libvirt-gconfig-domain-disk.h \ libvirt-gconfig-domain-filesys.h \ libvirt-gconfig-domain-graphics.h \ + libvirt-gconfig-domain-graphics-rdp.h \ libvirt-gconfig-domain-graphics-sdl.h \ libvirt-gconfig-domain-graphics-spice.h \ libvirt-gconfig-domain-graphics-vnc.h \ @@ -116,6 +117,7 @@ GCONFIG_SOURCE_FILES = \ libvirt-gconfig-domain-disk.c \ libvirt-gconfig-domain-filesys.c \ libvirt-gconfig-domain-graphics.c \ + libvirt-gconfig-domain-graphics-rdp.c \ libvirt-gconfig-domain-graphics-sdl.c \ libvirt-gconfig-domain-graphics-spice.c \ libvirt-gconfig-domain-graphics-vnc.c \ diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c new file mode 100644 index 000..8a4084e --- /dev/null +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c @@ -0,0 +1,130 @@ +/* + * libvirt-gconfig-domain-graphics-rdp.c: libvirt domain RDP configuration + * + * Copyright (C) 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 + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * http://www.gnu.org/licenses/. + * + * Author: Daniel P. Berrange berra...@redhat.com + */ + +#include config.h + +#include libvirt-gconfig/libvirt-gconfig.h +#include libvirt-gconfig/libvirt-gconfig-private.h + +#define GVIR_CONFIG_DOMAIN_GRAPHICS_RDP_GET_PRIVATE(obj) \ +(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP, GVirConfigDomainGraphicsRdpPrivate)) + +struct _GVirConfigDomainGraphicsRdpPrivate +{ +gboolean unused; +}; + +G_DEFINE_TYPE(GVirConfigDomainGraphicsRdp, gvir_config_domain_graphics_rdp, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS); + + +static void gvir_config_domain_graphics_rdp_class_init(GVirConfigDomainGraphicsRdpClass *klass) +{ +g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsRdpPrivate)); +} + + +static void gvir_config_domain_graphics_rdp_init(GVirConfigDomainGraphicsRdp *graphics_rdp) +{ +g_debug(Init GVirConfigDomainGraphicsRdp=%p, graphics_rdp); + +graphics_rdp-priv = GVIR_CONFIG_DOMAIN_GRAPHICS_RDP_GET_PRIVATE(graphics_rdp); +} + + +GVirConfigDomainGraphicsRdp *gvir_config_domain_graphics_rdp_new(void) +{ +GVirConfigObject *object; + +object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP, +graphics, NULL); +gvir_config_object_set_attribute(object, type, rdp, NULL); +return GVIR_CONFIG_DOMAIN_GRAPHICS_RDP(object); +} + +GVirConfigDomainGraphicsRdp * +gvir_config_domain_graphics_rdp_new_from_xml(const gchar *xml, + GError **error) +{ +GVirConfigObject *object; + +object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP, + graphics, NULL, xml, error); +if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, type), rdp) != 0) { +g_object_unref(G_OBJECT(object)); +return NULL; +} +return GVIR_CONFIG_DOMAIN_GRAPHICS_RDP(object); +} + +void gvir_config_domain_graphics_rdp_set_autoport(GVirConfigDomainGraphicsRdp *graphics, + gboolean autoport) +{ +g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_RDP(graphics)); + +gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics), +
[libvirt] [libvirt-glib 4/4] config: Add GVirConfigDomainChannel getters
--- libvirt-gconfig/libvirt-gconfig-domain-channel.c | 18 ++ libvirt-gconfig/libvirt-gconfig-domain-channel.h | 3 +++ libvirt-gconfig/libvirt-gconfig.sym | 3 +++ 3 files changed, 24 insertions(+) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-channel.c b/libvirt-gconfig/libvirt-gconfig-domain-channel.c index 92dd674..9578bf3 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-channel.c +++ b/libvirt-gconfig/libvirt-gconfig-domain-channel.c @@ -71,6 +71,17 @@ GVirConfigDomainChannel *gvir_config_domain_channel_new_from_xml(const gchar *xm } +GVirConfigDomainChannelTargetType gvir_config_domain_channel_get_target_type(GVirConfigDomainChannel *channel) +{ +g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_CHANNEL(channel), + GVIR_CONFIG_DOMAIN_CHANNEL_TARGET_GUESTFWD); + +return gvir_config_object_get_attribute_genum(GVIR_CONFIG_OBJECT(channel), + target, type, + GVIR_CONFIG_TYPE_DOMAIN_CHANNEL_TARGET_TYPE, + GVIR_CONFIG_DOMAIN_CHANNEL_TARGET_GUESTFWD); +} + void gvir_config_domain_channel_set_target_type(GVirConfigDomainChannel *channel, GVirConfigDomainChannelTargetType type) { @@ -82,6 +93,13 @@ void gvir_config_domain_channel_set_target_type(GVirConfigDomainChannel *channel type); } +const gchar *gvir_config_domain_channel_get_target_name(GVirConfigDomainChannel *channel) +{ +g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_CHANNEL(channel), NULL); + +return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(channel), +target, name); +} void gvir_config_domain_channel_set_target_name(GVirConfigDomainChannel *channel, const gchar *name) diff --git a/libvirt-gconfig/libvirt-gconfig-domain-channel.h b/libvirt-gconfig/libvirt-gconfig-domain-channel.h index 3f3558b..889b09a 100644 --- a/libvirt-gconfig/libvirt-gconfig-domain-channel.h +++ b/libvirt-gconfig/libvirt-gconfig-domain-channel.h @@ -67,8 +67,11 @@ GVirConfigDomainChannel *gvir_config_domain_channel_new(void); GVirConfigDomainChannel *gvir_config_domain_channel_new_from_xml(const gchar *xml, GError **error); +GVirConfigDomainChannelTargetType gvir_config_domain_channel_get_target_type(GVirConfigDomainChannel *channel); void gvir_config_domain_channel_set_target_type(GVirConfigDomainChannel *channel, GVirConfigDomainChannelTargetType type); + +const gchar *gvir_config_domain_channel_get_target_name(GVirConfigDomainChannel *channel); void gvir_config_domain_channel_set_target_name(GVirConfigDomainChannel *channel, const gchar *name); diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 886da2f..553d4fc 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -514,6 +514,9 @@ LIBVIRT_GCONFIG_0.1.6 { LIBVIRT_GCONFIG_0.1.7 { global: + gvir_config_domain_channel_get_target_name; + gvir_config_domain_channel_get_target_type; + gvir_config_domain_graphics_desktop_get_type; gvir_config_domain_graphics_desktop_new; gvir_config_domain_graphics_desktop_new_from_xml; -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list