[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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 :-)

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


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.