Exemplo n.º 1
0
CMPIStatus enum_profiles(const CMPIBroker *broker,
                         const CMPIObjectPath *reference,
                         const char **properties,
                         struct inst_list *list)
{
        CMPIStatus s = {CMPI_RC_OK, NULL};
        virConnectPtr conn = NULL;
        int i;

        conn = connect_by_classname(broker, CLASSNAME(reference), &s);
        if (conn == NULL)
                goto out;

        for (i = 0; profiles[i] != NULL; i++) {
                CMPIInstance *inst = NULL;

                s = get_profile(broker,
                                reference, 
                                properties,
                                pfx_from_conn(conn),
                                profiles[i],
                                &inst);

                if (s.rc != CMPI_RC_OK)
                        continue;

                inst_list_add(list, inst);
        }

 out:
        virConnectClose(conn);

        return s;
}
Exemplo n.º 2
0
svc_t * rpc_svc_to_svc (rpc_svc_t * rsvc)
{
    RETURN_IF_NULL (rsvc);
    register unsigned i_index;
    svc_t * newSvc = s16_svc_new ();

    newSvc->id = rsvc->id;
    newSvc->name = s16mem_strdup (rsvc->name);
    newSvc->properties = rpc_property_array_to_property_list (
        rsvc->properties.properties_val, rsvc->properties.properties_len);
    newSvc->instances = 0;

    if (rsvc->instances.instances_len > 0)
    {
        for (i_index = 0; i_index < rsvc->instances.instances_len; i_index++)
            inst_list_add (newSvc->instances,
                           rpc_svc_instance_to_svc_instance (
                               &rsvc->instances.instances_val[i_index]));
    }

    return newSvc;
}