WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

Re: [Xen-API] [PATCH]add strict check to VCPUs-params param-key

To: Jonathan Ludlam <Jonathan.Ludlam@xxxxxxxxxxxxx>
Subject: Re: [Xen-API] [PATCH]add strict check to VCPUs-params param-key
From: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
Date: Tue, 20 Apr 2010 11:47:25 +0800
Cc: "xen-api@xxxxxxxxxxxxxxxxxxx" <xen-api@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 19 Apr 2010 20:45:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C22E89FD-9B0C-4266-A106-ECF20D1432DA@xxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <4BCC20C7.4080700@xxxxxxxxxxxxxx> <C22E89FD-9B0C-4266-A106-ECF20D1432DA@xxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.23 (X11/20090817)
Hi Jonathan,

Thank you for your reply!

Jonathan Ludlam wrote:
> Hi Yang,
> 
> Looks good. Along the same lines, it would be a nice idea if the 
> bash-completion script got updated to autocomplete these keys. We have a 
> precedent for that, too, in the form of the device-config completion which is 
> dependent on SR type, though that's a little more dynamic, so the cpu stuff 
> would probably be a little easier :-)
> 

I'll do that and send another patch to accomplish this:)

> Cheers,
> 
> Jon
> 
> 
> On 19 Apr 2010, at 10:22, Yang Hongyang wrote:
> 
>> Add strict check to VCPUs-params param-key,according to Xen Cloud Platform
>> Administrator's Guide,there's only 'weight','cap' or 'mask' param-key 
>> available.
>>
>> current:
>> # xe vm-param-set VCPUs-params:test=33 
>> uuid=b7ca170b-c017-046e-116c-8d4c4d778195
>> # xe vm-list params=VCPUs-params uuid=b7ca170b-c017-046e-116c-8d4c4d778195
>> VCPUs-params (MRW)    : test: 33
>>
>> after patch:
>> # xe vm-param-set VCPUs-params:test=33 
>> uuid=b7ca170b-c017-046e-116c-8d4c4d778195 
>> Error: Failed to add parameter 'test': expecting 'weight','cap' or 'mask'
>> # xe vm-list params=VCPUs-params uuid=b7ca170b-c017-046e-116c-8d4c4d778195
>> VCPUs-params (MRW)    :
>>
>> Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
>>
>> diff -r ad754527bddd ocaml/client_records/records.ml
>> --- a/ocaml/client_records/records.ml        Fri Apr 16 11:44:32 2010 +0100
>> +++ b/ocaml/client_records/records.ml        Mon Apr 19 11:53:48 2010 -0400
>> @@ -619,7 +619,9 @@ let vm_record rpc session_id vm =
>>                              ~get:(fun () -> get_uuid_from_ref (x 
>> ()).API.vM_suspend_VDI) ();
>>                      make_field ~name:"VCPUs-params"
>>                              ~get:(fun () -> Record_util.s2sm_to_string "; " 
>> (x ()).API.vM_VCPUs_params)
>> -                            ~add_to_map:(fun k v -> 
>> Client.VM.add_to_VCPUs_params rpc session_id vm k v)
>> +                            ~add_to_map:(fun k v -> match k with
>> +                                            | "weight" | "cap" | "mask" -> 
>> Client.VM.add_to_VCPUs_params rpc session_id vm k v
>> +                                            | _ -> raise 
>> (Record_util.Record_failure ("Failed to add parameter '"^k^"': expecting 
>> 'weight','cap' or 'mask'")))
>>                              ~remove_from_map:(fun k -> 
>> Client.VM.remove_from_VCPUs_params rpc session_id vm k) 
>>                              ~get_map:(fun () -> (x ()).API.vM_VCPUs_params) 
>> ();
>>                      make_field ~name:"VCPUs-max"
>>
>> -- 
>> Regards
>> Yang Hongyang
>> <xen-api.patch>_______________________________________________
>> xen-api mailing list
>> xen-api@xxxxxxxxxxxxxxxxxxx
>> http://lists.xensource.com/mailman/listinfo/xen-api
> 
> 
> 


-- 
Regards
Yang Hongyang

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

<Prev in Thread] Current Thread [Next in Thread>