1 /*
2 * libvirt-gconfig-capabilities-guest-domain.c: libvirt guest domain capabilities
3 *
4 * Copyright (C) 2008 Daniel P. Berrange
5 * Copyright (C) 2010-2012 Red Hat, Inc.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 * Authors: Zeeshan Ali <zeenix@redhat.com>
22 * Daniel P. Berrange <berrange@redhat.com>
23 */
24
25 #include <config.h>
26
27 #include "libvirt-gconfig/libvirt-gconfig.h"
28 #include "libvirt-gconfig/libvirt-gconfig-private.h"
29
30 #define GVIR_CONFIG_CAPABILITIES_GUEST_DOMAIN_GET_PRIVATE(obj) \
31 (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_CAPABILITIES_GUEST_DOMAIN, GVirConfigCapabilitiesGuestDomainPrivate))
32
33 struct _GVirConfigCapabilitiesGuestDomainPrivate
34 {
35 gboolean unused;
36 };
37
38 G_DEFINE_TYPE_WITH_PRIVATE(GVirConfigCapabilitiesGuestDomain, gvir_config_capabilities_guest_domain, GVIR_CONFIG_TYPE_OBJECT);
39
40
gvir_config_capabilities_guest_domain_class_init(GVirConfigCapabilitiesGuestDomainClass * klass G_GNUC_UNUSED)41 static void gvir_config_capabilities_guest_domain_class_init(GVirConfigCapabilitiesGuestDomainClass *klass G_GNUC_UNUSED)
42 {
43 }
44
gvir_config_capabilities_guest_domain_init(GVirConfigCapabilitiesGuestDomain * domain)45 static void gvir_config_capabilities_guest_domain_init(GVirConfigCapabilitiesGuestDomain *domain)
46 {
47 domain->priv = GVIR_CONFIG_CAPABILITIES_GUEST_DOMAIN_GET_PRIVATE(domain);
48 }
49
50 const gchar *
gvir_config_capabilities_guest_domain_get_emulator(GVirConfigCapabilitiesGuestDomain * domain)51 gvir_config_capabilities_guest_domain_get_emulator(GVirConfigCapabilitiesGuestDomain *domain)
52 {
53 g_return_val_if_fail(GVIR_CONFIG_IS_CAPABILITIES_GUEST_DOMAIN(domain), NULL);
54
55 return gvir_config_object_get_node_content(GVIR_CONFIG_OBJECT(domain), "emulator");
56 }
57
58 GVirConfigDomainVirtType
gvir_config_capabilities_guest_domain_get_virt_type(GVirConfigCapabilitiesGuestDomain * domain)59 gvir_config_capabilities_guest_domain_get_virt_type(GVirConfigCapabilitiesGuestDomain *domain)
60 {
61 g_return_val_if_fail(GVIR_CONFIG_IS_CAPABILITIES_GUEST_DOMAIN(domain),
62 GVIR_CONFIG_DOMAIN_VIRT_QEMU);
63
64 return gvir_config_object_get_attribute_genum
65 (GVIR_CONFIG_OBJECT(domain),
66 NULL,
67 "type",
68 GVIR_CONFIG_TYPE_DOMAIN_VIRT_TYPE,
69 GVIR_CONFIG_DOMAIN_VIRT_QEMU);
70 }
71