[Libvirt-cim] [PATCH 4 of 6] Add NetworkPort functionality to SettingsDefineCapabilities. All static, max may become dynamic

Dan Smith danms at us.ibm.com
Thu Nov 8 23:58:26 UTC 2007


JG> +        uint16_t num_nics = 6;
JG> +        struct sdc_rasd_prop *rasd = NULL;
JG> + 
JG> +        struct sdc_rasd_prop tmp[] = {
JG> +                {"InstanceID", (CMPIValue *)"Maximum", CMPI_chars},
JG> +                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint16},
JG> +                PROP_END
JG> +        };

The maximum NIC count is probably different for KVM and Xen, and I
imagine this function should be intelligent in the future.  Could we
at least pull the '6' out to a constant like XEN_MAX_VIF or something?

JG> +static struct sdc_rasd_prop *net_def(const CMPIObjectPath *ref,
JG> +                                     CMPIStatus *s)
JG> +{
JG> +        bool ret;
JG> +        uint16_t num_nics = 1;
JG> +        struct sdc_rasd_prop *rasd = NULL;
JG> + 
JG> +        struct sdc_rasd_prop tmp[] = {
JG> +                {"InstanceID", (CMPIValue *)"Default", CMPI_chars},
JG> +                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint16},
JG> +                PROP_END
JG> +        };
JG> + 
JG> +        ret = dup_rasd_prop_list(tmp, &rasd);
JG> +        if (ret)
JG> +                return rasd;
JG> +        else
JG> +                return NULL;
JG> +}
JG> + 
JG> +static struct sdc_rasd_prop *net_inc(const CMPIObjectPath *ref,
JG> +                                     CMPIStatus *s)
JG> +{
JG> +        bool ret;
JG> +        uint16_t num_nics = 1;
JG> +        struct sdc_rasd_prop *rasd = NULL;
JG> + 
JG> +        struct sdc_rasd_prop tmp[] = {
JG> +                {"InstanceID", (CMPIValue *)"Increment", CMPI_chars},
JG> +                {"VirtualQuantity", (CMPIValue *)&num_nics, CMPI_uint16},
JG> +                PROP_END
JG> +        };
JG> + 
JG> +        ret = dup_rasd_prop_list(tmp, &rasd);
JG> +        if (ret)
JG> +                return rasd;
JG> +        else
JG> +                return NULL;
JG> +}

I think "default" and "increment" in the network case are probably
safe to leave hardcoded to '1' and buried :)

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20071108/086692e9/attachment.sig>


More information about the Libvirt-cim mailing list