Add a method to get the model of the CPU from capabilities. --- libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c | 23 ++++++++++++++++++++++ libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h | 3 +++ libvirt-gconfig/libvirt-gconfig.sym | 2 ++ 3 files changed, 28 insertions(+) diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c index f4753ff..a2d5c3e 100644 --- a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c +++ b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c @@ -185,3 +185,26 @@ gvir_config_capabilities_cpu_set_topology(GVirConfigCapabilitiesCpu *cpu, "topology", GVIR_CONFIG_OBJECT(topology)); } + +/** + * gvir_config_capabilities_cpu_get_model: + * + * Gets the model of the cpu. + * + * Returns: (transfer full): a new #GVirConfigCapabilitiesCpuModel. + */ +GVirConfigCapabilitiesCpuModel * +gvir_config_capabilities_cpu_get_model(GVirConfigCapabilitiesCpu *cpu) +{ + GVirConfigObject *object; + + g_return_val_if_fail(GVIR_CONFIG_IS_CAPABILITIES_CPU(cpu), NULL); + + object = gvir_config_object_get_child_with_type + (GVIR_CONFIG_OBJECT(cpu), + "model", + GVIR_CONFIG_TYPE_CAPABILITIES_CPU_MODEL); + + return GVIR_CONFIG_CAPABILITIES_CPU_MODEL(object); +} + diff --git a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h index ce3613f..57ad48b 100644 --- a/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h +++ b/libvirt-gconfig/libvirt-gconfig-capabilities-cpu.h @@ -30,6 +30,7 @@ #include "libvirt-gconfig-capabilities-cpu-topology.h" #include "libvirt-gconfig-capabilities-cpu-feature.h" +#include "libvirt-gconfig-capabilities-cpu-model.h" G_BEGIN_DECLS @@ -75,6 +76,8 @@ gvir_config_capabilities_cpu_get_topology(GVirConfigCapabilitiesCpu *cpu); void gvir_config_capabilities_cpu_set_topology(GVirConfigCapabilitiesCpu *cpu, GVirConfigCapabilitiesCpuTopology *topology); +GVirConfigCapabilitiesCpuModel * +gvir_config_capabilities_cpu_get_model(GVirConfigCapabilitiesCpu *cpu); G_END_DECLS diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym index 76dde70..76b0d03 100644 --- a/libvirt-gconfig/libvirt-gconfig.sym +++ b/libvirt-gconfig/libvirt-gconfig.sym @@ -689,6 +689,8 @@ global: LIBVIRT_GCONFIG_0.1.9 { global: + gvir_config_capabilities_cpu_get_model; + gvir_config_capabilities_cpu_model_get_name; gvir_config_capabilities_cpu_model_get_type; gvir_config_capabilities_cpu_model_new; -- 1.9.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list