예제 #1
0
/**
 * gvir_config_domain_set_devices:
 * @domain: a #GVirConfigDomain
 * @devices: (in) (element-type LibvirtGConfig.DomainDevice):
 */
void gvir_config_domain_set_devices(GVirConfigDomain *domain,
                                    GList *devices)
{
    GVirConfigObject *devices_node;
    GList *it;

    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN(domain));

    if (devices == NULL) {
        gvir_config_object_delete_children(GVIR_CONFIG_OBJECT(domain),
                                           "devices",
                                           NULL);
        return;
    }
    devices_node = gvir_config_object_new(GVIR_CONFIG_TYPE_OBJECT,
                                          "devices", NULL);

    for (it = devices; it != NULL; it = it->next) {
        if (!GVIR_CONFIG_IS_DOMAIN_DEVICE(it->data)) {
            g_warn_if_reached();
            continue;
        }
        gvir_config_object_attach_add(devices_node,
                                      GVIR_CONFIG_OBJECT(it->data));
    }

    gvir_config_object_attach_replace(GVIR_CONFIG_OBJECT(domain),
                                      "devices",
                                      devices_node);
    g_object_unref(G_OBJECT(devices_node));
}
GVirConfigStorageVolBackingStore *gvir_config_storage_vol_backing_store_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_STORAGE_VOL_BACKING_STORE,
                                    "backingStore", NULL);
    return GVIR_CONFIG_STORAGE_VOL_BACKING_STORE(object);
}
GVirConfigDomainConsole *gvir_config_domain_console_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_CONSOLE,
                                    "console", NULL);
    return GVIR_CONFIG_DOMAIN_CONSOLE(object);
}
GVirConfigStoragePoolSource *gvir_config_storage_pool_source_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_STORAGE_POOL_SOURCE,
                                    "source", NULL);
    return GVIR_CONFIG_STORAGE_POOL_SOURCE(object);
}
GVirConfigDomainParallel *gvir_config_domain_parallel_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_PARALLEL,
                                    "parallel", NULL);
    return GVIR_CONFIG_DOMAIN_PARALLEL(object);
}
GVirConfigDomainVideo *gvir_config_domain_video_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_VIDEO,
                                    "video", NULL);
    return GVIR_CONFIG_DOMAIN_VIDEO(object);
}
GVirConfigDomainGraphicsVnc *gvir_config_domain_graphics_vnc_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_VNC,
                                    "graphics", NULL);
    gvir_config_object_set_attribute(object, "type", "vnc", NULL);
    return GVIR_CONFIG_DOMAIN_GRAPHICS_VNC(object);
}
GVirConfigStorageVol *gvir_config_storage_vol_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_STORAGE_VOL,
                                    "volume",
                                    DATADIR "/libvirt/schemas/storage_vol.rng");
    return GVIR_CONFIG_STORAGE_VOL(object);
}
GVirConfigInterface *gvir_config_interface_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_INTERFACE,
                                    "interface",
                                    DATADIR "/libvirt/schemas/interface.rng");
    return GVIR_CONFIG_INTERFACE(object);
}
예제 #10
0
GVirConfigDomain *gvir_config_domain_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN,
                                    "domain",
                                    DATADIR "/libvirt/schemas/domain.rng");
    return GVIR_CONFIG_DOMAIN(object);
}
GVirConfigDomainTimerRtc *gvir_config_domain_timer_rtc_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_TIMER_RTC,
                                    "timer", NULL);
    gvir_config_object_set_attribute(object, "name", "rtc", NULL);
    return GVIR_CONFIG_DOMAIN_TIMER_RTC(object);
}
GVirConfigDomainInterfaceBridge *gvir_config_domain_interface_bridge_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_BRIDGE,
                                    "interface", NULL);
    gvir_config_object_set_attribute(object, "type", "bridge", NULL);
    return GVIR_CONFIG_DOMAIN_INTERFACE_BRIDGE(object);
}
GVirConfigDomainAddressPci *gvir_config_domain_address_pci_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_ADDRESS_PCI,
                                    "address", NULL);
    gvir_config_object_set_attribute(object, "type", "pci", NULL);
    return GVIR_CONFIG_DOMAIN_ADDRESS_PCI(object);
}
GVirConfigDomainGraphicsSdl *gvir_config_domain_graphics_sdl_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_SDL,
                                    "graphics", NULL);
    gvir_config_object_set_attribute(object, "type", "sdl", NULL);
    return GVIR_CONFIG_DOMAIN_GRAPHICS_SDL(object);
}
GVirConfigCapabilities *gvir_config_capabilities_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_CAPABILITIES,
                                    "capabilities",
                                    DATADIR "/libvirt/schemas/capability.rng");
    return GVIR_CONFIG_CAPABILITIES(object);
}
GVirConfigDomainInterfaceUser *gvir_config_domain_interface_user_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_INTERFACE_USER,
                                    "interface", NULL);
    gvir_config_object_set_attribute(object, "type", "user", NULL);
    return GVIR_CONFIG_DOMAIN_INTERFACE_USER(object);
}
/**
 * gvir_config_domain_controller_usb_new:
 *
 * Creates a new #GVirConfigDomainControllerUsb with a reference count of 1.
 * gvir_config_domain_controller_set_index() must be called before
 * this controller is usable.
 *
 * Returns: a new #GVirConfigDomainControllerUsb
 */
GVirConfigDomainControllerUsb *gvir_config_domain_controller_usb_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_CONTROLLER_USB,
                                    "controller", NULL);
    gvir_config_object_set_attribute(object, "type", "usb", NULL);
    return GVIR_CONFIG_DOMAIN_CONTROLLER_USB(object);
}
GVirConfigDomainTimerHpet *gvir_config_domain_timer_hpet_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_TIMER_HPET,
                                    "timer", NULL);
    gvir_config_object_set_attribute(object, "name", "hpet", NULL);
    return GVIR_CONFIG_DOMAIN_TIMER_HPET(object);
}
GVirConfigDomainCpuFeature *gvir_config_domain_cpu_feature_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_CPU_FEATURE,
                                    "feature",
                                    NULL);

    return GVIR_CONFIG_DOMAIN_CPU_FEATURE(object);
}
GVirConfigCapabilitiesCpuTopology *gvir_config_capabilities_cpu_topology_new(void)
{
    GVirConfigObject *object;

    object = gvir_config_object_new(GVIR_CONFIG_TYPE_CAPABILITIES_CPU_TOPOLOGY,
                                    "topology",
                                    NULL);

    return GVIR_CONFIG_CAPABILITIES_CPU_TOPOLOGY(object);
}
GVirConfigDomainChardevSourceSpiceVmc *gvir_config_domain_chardev_source_spicevmc_new(void)
{
    GVirConfigObject *object;

    /* the name of the root node is just a placeholder, it will be
     * overwritten when the GVirConfigDomainChardevSourceSpiceVmc is attached to a
     * GVirConfigDomainChardevSourceSpiceVmc
     */
    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_CHARDEV_SOURCE_SPICE_VMC, "dummy", NULL);
    gvir_config_object_set_attribute(object, "type", "spicevmc", NULL);
    return GVIR_CONFIG_DOMAIN_CHARDEV_SOURCE_SPICE_VMC(object);
}