[Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData does not conform to profile

Wayne Xia xiawenc at linux.vnet.ibm.com
Mon Aug 8 03:04:49 UTC 2011


Tried to changing all allocation unit in the libvirt-cim, but it seems
these changes would be exposed to the user, so I think this may have
impact to existing user case.
I thought it would be better to waiting for a profile updating, what's
your ideas?


> 于 2011-7-22 9:19, Gareth S Bestor 写道:
>>
>> So long as this new VM memory RASD AllocationUnits ("byte*2^10") will
>> match that of the MemoryPool capabilities' RASDs, and the new 'augmented
>> BNF' string is parsed ok when passed as an embedded instance to the
>> cimom (pegasus, sfcb) then I'm okay with this one-off too. Both these
>> are required otherwise existing usecases will break.
>>
>> - G
> Searching the project , I do find another place using the old string:
> Virt_SettingsDefineCapabilities.c:354:
>
> CMSetProperty(inst, "AllocationUnits",
> (CMPIValue *)"KiloBytes", CMPI_chars);
>
> After this is changed, I thought the libvirt-cim would have no more
> "KiloBytes". But I don't understand the BNF' string you refered, could
> u give more tips about that?
>
>>
>> Dr. Gareth S. Bestor
>> IBM Senior Software Engineer
>> Systems & Technology Group - Systems Management Standards
>> 971-285-6375 (mobile)
>> bestor at us.ibm.com
>>
>>
>>
>> *Re: [Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData
>> does not conform to profile*
>>
>>
>> *Chip Vincent * to: libvirt-cim
>> 07/21/11 05:50 PM
>>
>>
>> Sent by: *libvirt-cim-bounces at redhat.com*
>>
>>
>> *Please respond to cvincent, List for discussion and development of
>> libvirt CIM *
>>
>>
>>
>>
>>
>>
>>
>> We do have a schema update planned for this year. I think the origianl
>> plan was just to update the schema but perhaps we should rebase some of
>> the profiles as a follow on. If everyone agrees we should rebase the
>> profiles as part of the schema update, then I'm okay with this as a
>> 'one-off' change for now.
>>
>> Comments?
>>
>> On 07/21/2011 11:52 AM, Gareth S Bestor wrote:
>> >
>> > } else if (dev->type == CIM_RES_TYPE_MEM) {
>> > - const char *units = "KiloBytes";
>> > + const char *units = "byte*2^10";
>> >
>> >
>> > If we're doing this sorta change here then we should probably do it
>> > everywhere, since users may be checking AllocationUnits between CIM
>> > classes. Specifically, these should match the units being returned from
>> > memory pool capabilities, and we need to check these new units will be
>> > correctly parsed when passed as embedded instances (eg DefineSystem(),
>> > ModifyResourceSettings(), etc)... Alternatively, we might want to
>> > consider going thru the entire libvirt-cim suite and upgrading all
>> > classes from DSP0004v2.4 to DSP0004 2.5+ conformance level (ie using
>> > Augmented BNFeverywhere its relevant) rather than having in old and new
>> > units sprinkled around.
>> >
>> > Basically, doing this change here and now may have much wider
>> implications.
>> >
>> > - Gareth
>> >
>> > Dr. Gareth S. Bestor
>> > IBM Senior Software Engineer
>> > Systems & Technology Group - Systems Management Standards
>> > 971-285-6375 (mobile)
>> > bestor at us.ibm.com
>> >
>> >
>> >
>> > *[Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData
>> > does not conform to profile*
>> >
>> >
>> > *Wayne Xia * to: List for discussion and development of libvirt CIM
>> > 07/21/11 12:34 AM
>> >
>> >
>> > Sent by: *libvirt-cim-bounces at redhat.com*
>> >
>> >
>> > *Please respond to List for discussion and development of libvirt CIM *
>> >
>> >
>> >
>> >
>> >
>> ------------------------------------------------------------------------
>> >
>> >
>> >
>> > # HG changeset patch
>> > # User Wayne Xia <xiawenc at linux.vnet.ibm.com>
>> > # Date 1311231387 -28800
>> > # Node ID 677867c3d2a16a97591bde2828808f9f39b859a7
>> > # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41
>> > changed a bit to make it conform to CIM profile
>> >
>> > According to the discuss and profile, the reserved property means the
>> > memory actually allocated to support the VM running, and the unit
>> > should be byte*2^10. This patch added some code to retrieve VM's state,
>> > and the report the memory status according to that.
>> > https://bugzilla.linux.ibm.com/show_bug.cgi?id=72759
>> >
>> > Signed-off-by: Wayne Xia <xiawenc at linux.vnet.ibm.com>
>> >
>> > diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.c
>> > --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300
>> > +++ b/libxkutil/device_parsing.c Thu Jul 21 14:56:27 2011 +0800
>> > @@ -792,6 +792,7 @@
>> > } else if (dev->type == CIM_RES_TYPE_MEM) {
>> > dev->dev.mem.size = _dev->dev.mem.size;
>> > dev->dev.mem.maxsize = _dev->dev.mem.maxsize;
>> > + dev->dev.mem.reserved = _dev->dev.mem.reserved;
>> > } else if (dev->type == CIM_RES_TYPE_PROC) {
>> > dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity;
>> > } else if (dev->type == CIM_RES_TYPE_EMU) {
>> > @@ -885,8 +886,22 @@
>> > if (xml == NULL)
>> > return 0;
>> >
>> > - if (type == CIM_RES_TYPE_MEM)
>> > + if (type == CIM_RES_TYPE_MEM) {
>> > ret = _get_mem_device(xml, list);
>> > + if (*list != NULL) {
>> > + virDomainInfo dom_info;
>> > + if (virDomainGetInfo(dom, &dom_info) == 0) {
>> > + (*list)->dev.mem.reserved = dom_info.memory;
>> > + if (dom_info.state == 5) { /* VM not active */
>> > + (*list)->dev.mem.reserved = 0;
>> > + }
>> > + }
>> > + else {
>> > + CU_DEBUG("failed to get dom state for mem");
>> > + ret = -1;
>> > + }
>> > + }
>> > + }
>> > else if (type == CIM_RES_TYPE_PROC)
>> > ret = _get_proc_device(xml, list);
>> > else
>> > diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.h
>> > --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300
>> > +++ b/libxkutil/device_parsing.h Thu Jul 21 14:56:27 2011 +0800
>> > @@ -71,6 +71,7 @@
>> > struct mem_device {
>> > uint64_t size;
>> > uint64_t maxsize;
>> > + uint64_t reserved;
>> > };
>> >
>> > struct vcpu_device {
>> > diff -r 3c90a88a5199 -r 677867c3d2a1 src/Virt_RASD.c
>> > --- a/src/Virt_RASD.c Mon Jul 18 11:13:40 2011 -0300
>> > +++ b/src/Virt_RASD.c Thu Jul 21 14:56:27 2011 +0800
>> > @@ -576,14 +576,14 @@
>> > inst);
>> >
>> > } else if (dev->type == CIM_RES_TYPE_MEM) {
>> > - const char *units = "KiloBytes";
>> > + const char *units = "byte*2^10";
>> >
>> > CMSetProperty(inst, "AllocationUnits",
>> > (CMPIValue *)units, CMPI_chars);
>> > CMSetProperty(inst, "VirtualQuantity",
>> > (CMPIValue *)&dev->dev.mem.size,
>> > CMPI_uint64);
>> > CMSetProperty(inst, "Reservation",
>> > - (CMPIValue *)&dev->dev.mem.size,
>> > CMPI_uint64);
>> > + (CMPIValue *)&dev->dev.mem.reserved,
>> > CMPI_uint64);
>> > CMSetProperty(inst, "Limit",
>> > (CMPIValue *)&dev->dev.mem.maxsize,
>> > CMPI_uint64);
>> > } else if (dev->type == CIM_RES_TYPE_PROC) {
>> >
>> > _______________________________________________
>> > Libvirt-cim mailing list
>> > Libvirt-cim at redhat.com
>> > https://www.redhat.com/mailman/listinfo/libvirt-cim
>> >
>> >
>> >
>> > _______________________________________________
>> > Libvirt-cim mailing list
>> > Libvirt-cim at redhat.com
>> > https://www.redhat.com/mailman/listinfo/libvirt-cim
>>
>> --
>> Chip Vincent
>> Open Virtualization
>> IBM Linux Technology Center
>> cvincent at linux.vnet.ibm.com
>>
>> _______________________________________________
>> Libvirt-cim mailing list
>> Libvirt-cim at redhat.com
>> https://www.redhat.com/mailman/listinfo/libvirt-cim
>>
>>
>>
>> _______________________________________________
>> Libvirt-cim mailing list
>> Libvirt-cim at redhat.com
>> https://www.redhat.com/mailman/listinfo/libvirt-cim
>
>


-- 
Best Regards

Wayne Xia
mail:xiawenc at linux.vnet.ibm.com
tel:86-010-82450803




More information about the Libvirt-cim mailing list