[Libvirt-cim] [PATCH 2 of 2] Remove old functions and structs

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Sep 30 21:47:04 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1222810804 25200
# Node ID 3e9ae5caaf705d0eebabadebf9b4bcfb06623aab
# Parent  5da8358fed0dd5c2bd376ca84af8970fbcbc4694
Remove old functions and structs

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 5da8358fed0d -r 3e9ae5caaf70 src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c	Tue Sep 30 14:40:03 2008 -0700
+++ b/src/Virt_SettingsDefineCapabilities.c	Tue Sep 30 14:40:04 2008 -0700
@@ -354,102 +354,6 @@
         return rasd;
 }
 
-static struct sdc_rasd_prop *mem_max(const CMPIObjectPath *ref,
-                                     CMPIStatus *s)
-{
-        bool ret;
-        struct sdc_rasd_prop *rasd = NULL;
-        uint64_t max_vq = MAX_MEM;
-
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Maximum", CMPI_chars},
-                {"AllocationUnits", (CMPIValue *)"KiloBytes", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&max_vq, CMPI_uint64},
-                PROP_END
-        };
-        
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
-static struct sdc_rasd_prop *mem_min(const CMPIObjectPath *ref,
-                                     CMPIStatus *s)
-{
-        bool ret;
-        struct sdc_rasd_prop *rasd = NULL;
-        uint64_t min_vq = 64 << 10;
-
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Minimum", CMPI_chars},
-                {"AllocationUnits", (CMPIValue *)"KiloBytes", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&min_vq, CMPI_uint64},
-                PROP_END
-        };
-
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
-static struct sdc_rasd_prop *mem_def(const CMPIObjectPath *ref,
-                                     CMPIStatus *s)
-{
-        bool ret;
-        struct sdc_rasd_prop *rasd = NULL;
-        uint64_t def_vq = 256 << 10;
-
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Default", CMPI_chars},
-                {"AllocationUnits", (CMPIValue *)"KiloBytes", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&def_vq, CMPI_uint64},
-                PROP_END
-        };
-
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
-static struct sdc_rasd_prop *mem_inc(const CMPIObjectPath *ref,
-                                     CMPIStatus *s)
-{
-        bool ret;
-        struct sdc_rasd_prop *rasd = NULL;
-        uint64_t inc_vq = 1 << 10;
-
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Increment", CMPI_chars},
-                {"AllocationUnits", (CMPIValue *)"KiloBytes", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&inc_vq, CMPI_uint64},
-                PROP_END
-        };
-
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
 static bool get_max_procs(const CMPIObjectPath *ref,
                           uint64_t *num_procs,
                           CMPIStatus *s)
@@ -523,140 +427,6 @@
         }
 
  out:
-
-        return rasd;
-}
-
-static struct sdc_rasd_prop *proc_min(const CMPIObjectPath *ref,
-                                      CMPIStatus *s)
-{
-        bool ret;
-        uint64_t num_procs = 1;
-        struct sdc_rasd_prop *rasd = NULL;
- 
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Minimum", CMPI_chars},
-                {"AllocationUnits", (CMPIValue *)"Processors", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&num_procs, CMPI_uint64},
-                PROP_END
-        };
- 
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
-static struct sdc_rasd_prop *proc_max(const CMPIObjectPath *ref,
-                                      CMPIStatus *s)
-{
-        bool ret;
-        virConnectPtr conn;
-        uint64_t num_procs = 0;
-        struct sdc_rasd_prop *rasd = NULL;
-        
-        CU_DEBUG("In proc_max()");
-
-        conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
-        if (conn == NULL) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not connect to hypervisor");
-                goto out;
-        }
-
-        num_procs = virConnectGetMaxVcpus(conn, NULL);
-        CU_DEBUG("libvirt says %d max vcpus", num_procs);
-
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Maximum", CMPI_chars},
-                {"AllocationUnits", (CMPIValue *)"Processors", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&num_procs, CMPI_uint64},
-                PROP_END
-        };
- 
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
- out:
-        return rasd;
-}
-
-static struct sdc_rasd_prop *proc_def(const CMPIObjectPath *ref,
-                                      CMPIStatus *s)
-{
-        bool ret;
-        uint64_t num_procs = 1;
-        struct sdc_rasd_prop *rasd = NULL;
- 
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Default", CMPI_chars},
-                {"AllocationUnits", (CMPIValue *)"Processors", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&num_procs, CMPI_uint64},
-                PROP_END
-        };
- 
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
-static struct sdc_rasd_prop *proc_inc(const CMPIObjectPath *ref,
-                                      CMPIStatus *s)
-{
-        bool ret;
-        uint64_t num_procs = 1;
-        struct sdc_rasd_prop *rasd = NULL;
- 
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Increment", CMPI_chars},
-                {"AllocationUnits", (CMPIValue *)"Processors", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&num_procs, CMPI_uint64},
-                PROP_END
-        };
- 
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
-static struct sdc_rasd_prop *net_min(const CMPIObjectPath *ref,
-                                     CMPIStatus *s)
-{
-        bool ret;
-        uint64_t num_nics = 0;
-        struct sdc_rasd_prop *rasd = NULL;
- 
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Minimum", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint64},
-                PROP_END
-        };
- 
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
 
         return rasd;
 }
@@ -790,103 +560,6 @@
         return rasd;
 }
  
-static struct sdc_rasd_prop *net_max(const CMPIObjectPath *ref,
-                                     CMPIStatus *s)
-{
-        bool ret;
-        char *prefix;
-        uint64_t num_nics;
-        struct sdc_rasd_prop *rasd = NULL;
-
-        prefix = class_prefix_name(CLASSNAME(ref));
-        if (prefix == NULL) {
-                cu_statusf(_BROKER, s,
-                           CMPI_RC_ERR_FAILED,
-                           "Could not get prefix from reference");
-                goto out;
-        }
-
-        if (STREQC(prefix, "Xen")) {
-                num_nics = net_max_xen(ref, s);
-        } else if (STREQC(prefix, "KVM")) {
-                num_nics = net_max_kvm(ref, s);
-        } else {
-                cu_statusf(_BROKER, s,
-                           CMPI_RC_ERR_NOT_SUPPORTED,
-                           "Unsupported hypervisor: '%s'", prefix);
-                goto out;
-        }
-                
-
-        if (s->rc != CMPI_RC_OK) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not get max nic count");
-                goto out;
-        }
- 
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Maximum", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint64},
-                PROP_END
-        };
- 
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
- out:
-        free(prefix);
-        return rasd;
-}
-
-static struct sdc_rasd_prop *net_def(const CMPIObjectPath *ref,
-                                     CMPIStatus *s)
-{
-        bool ret;
-        uint64_t num_nics = 1;
-        struct sdc_rasd_prop *rasd = NULL;
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Default", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint64},
-                PROP_END
-        };
-
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
- 
-static struct sdc_rasd_prop *net_inc(const CMPIObjectPath *ref,
-                                     CMPIStatus *s)
-{
-        bool ret;
-        uint64_t num_nics = 1;
-        struct sdc_rasd_prop *rasd = NULL;
- 
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Increment", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint64},
-                PROP_END
-        };
- 
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
 static int get_disk_freespace(const CMPIObjectPath *ref,
                               CMPIStatus *s,
                               uint64_t *free_space)
@@ -985,177 +658,6 @@
  out:
         return rasd;
 }
-
-static struct sdc_rasd_prop *disk_min(const CMPIObjectPath *ref,
-                                      CMPIStatus *s)
-{
-        bool ret;
-        uint64_t disk_size = SDC_DISK_MIN;
-        struct sdc_rasd_prop *rasd = NULL;
-
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Minimum", CMPI_chars},
-                {"AllocationQuantity", (CMPIValue *)"MegaBytes", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&disk_size, CMPI_uint64},
-                PROP_END
-        };
-
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
-static struct sdc_rasd_prop *disk_max(const CMPIObjectPath *ref,
-                                      CMPIStatus *s)
-{
-        bool ret;
-        const char *inst_id;
-        CMPIrc prop_ret;
-        uint64_t free_space;
-        virConnectPtr conn;
-        CMPIInstance *pool_inst;
-        struct sdc_rasd_prop *rasd = NULL;
-        
-        if (cu_get_str_path(ref, "InstanceID", &inst_id) != CMPI_RC_OK) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not get InstanceID");
-                goto out;
-        }
-
-        conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
-        if (s->rc != CMPI_RC_OK) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not get connection");
-                goto out;
-        }
-
-        /* Getting the relevant resource pool directly finds the free space 
-           for us.  It is in the Capacity field. */
-        *s = get_pool_by_name(_BROKER, ref, inst_id, &pool_inst);
-        if (s->rc != CMPI_RC_OK)
-                goto out;
-
-        prop_ret = cu_get_u64_prop(pool_inst, "Capacity", &free_space);
-        if (prop_ret != CMPI_RC_OK) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not get capacity from instance");
-                goto out;
-        }
-        CU_DEBUG("Got capacity from pool_inst: %lld", free_space);
-
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Maximum", CMPI_chars},
-                {"AllocationQuantity", (CMPIValue *)"MegaBytes", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&free_space, CMPI_uint64},
-                PROP_END
-        };
-
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
- out:
-        return rasd;
-}
-
-static struct sdc_rasd_prop *disk_def(const CMPIObjectPath *ref,
-                                      CMPIStatus *s)
-{
-        bool ret;
-        uint64_t disk_size = SDC_DISK_DEF;
-        struct sdc_rasd_prop *rasd = NULL;
-
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Default", CMPI_chars},
-                {"AllocationQuantity", (CMPIValue *)"MegaBytes", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&disk_size, CMPI_uint64},
-                PROP_END
-        };
-
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
-static struct sdc_rasd_prop *disk_inc(const CMPIObjectPath *ref,
-                                      CMPIStatus *s)
-{
-        bool ret;
-        uint64_t disk_size = SDC_DISK_INC;
-        struct sdc_rasd_prop *rasd = NULL;
-
-        struct sdc_rasd_prop tmp[] = {
-                {"InstanceID", (CMPIValue *)"Increment", CMPI_chars},
-                {"AllocationQuantity", (CMPIValue *)"MegaBytes", CMPI_chars},
-                {"VirtualQuantity", (CMPIValue *)&disk_size, CMPI_uint64},
-                PROP_END
-        };
-
-        ret = dup_rasd_prop_list(tmp, &rasd);
-        if (!ret) {
-                cu_statusf(_BROKER, s, 
-                           CMPI_RC_ERR_FAILED,
-                           "Could not copy RASD");
-        }
-
-        return rasd;
-}
-
-static struct sdc_rasd mem = {
-        .resource_type = CIM_RES_TYPE_MEM,
-        .min = mem_min,
-        .max = mem_max,
-        .def = mem_def,
-        .inc = mem_inc
-};
-
-static struct sdc_rasd processor = {
-         .resource_type = CIM_RES_TYPE_PROC,
-         .min = proc_min,
-         .max = proc_max,
-         .def = proc_def,
-         .inc = proc_inc
-};
-
-static struct sdc_rasd network = {
-        .resource_type = CIM_RES_TYPE_NET,
-        .min = net_min,
-        .max = net_max,
-        .def = net_def,
-        .inc = net_inc
-};
-
-static struct sdc_rasd disk = {
-        .resource_type = CIM_RES_TYPE_DISK,
-        .min = disk_min,
-        .max = disk_max,
-        .def = disk_def,
-        .inc = disk_inc
-};
-
-static struct sdc_rasd *sdc_rasd_list[] = {
-        &mem,
-        &processor,
-        &network,
-        &disk,
-        NULL
-};
 
 static CMPIInstance *sdc_rasd_inst(CMPIStatus *s,
                                    const CMPIObjectPath *ref,
diff -r 5da8358fed0d -r 3e9ae5caaf70 src/Virt_SettingsDefineCapabilities.h
--- a/src/Virt_SettingsDefineCapabilities.h	Tue Sep 30 14:40:03 2008 -0700
+++ b/src/Virt_SettingsDefineCapabilities.h	Tue Sep 30 14:40:04 2008 -0700
@@ -50,17 +50,6 @@
         CMPIType type;
 };
 
-typedef struct sdc_rasd_prop *(*rasd_prop_func_t)(const CMPIObjectPath *ref,
-                                                  CMPIStatus *s);
-
-struct sdc_rasd {
-        uint16_t resource_type;
-        rasd_prop_func_t min;
-        rasd_prop_func_t max;
-        rasd_prop_func_t def;
-        rasd_prop_func_t inc;
-};
-
 /*
  * Local Variables:
  * mode: C




More information about the Libvirt-cim mailing list