[Ovirt-devel] [PATCH server] Revised attempt at refactoring the vm_controller using the service layer.

Scott Seago sseago at redhat.com
Wed Apr 22 18:24:56 UTC 2009


David Lutterkort wrote:
> On Wed, 2009-04-22 at 11:06 -0700, Ian Main wrote:
>   
>> Otherwise you have to load the VM active record and make a hash from it
>> (?? maybe that's easy?) and then call svc_update() with the new hash..
>> maybe it would be possible to just have the permission check callable
>> directly?  Not sure what is best..
>>     
>
> Yeah, for single-property updates we want some more generic way to do
> that, on the ovirt agent side, I'd think something like
>
>         def description(new_desc)
>           ar_id = ... from QMF objectID ...
>           user = ... QMF user ...
>           svc_property!(user, ar_id, :description, new_desc)
>         end
>
> and have svc_property! do the permission check, load the AR model,
> change its description attribute, and save! it back.
>
> Given how that is just a lot of boilerplate, I'd imagine that with a
> tiny bit of metaprogramming, we can reduce that to
>
>         property_setter :description
>         
> David
>
>   
Yeah I'm unclear on exactly what metaprogramming we need for 
property_setter, but svc_property itself can be based off the existing 
svc_update:
    def svc_property!(ar_id, property, value)
       svc_update(ar_id, {property => value})
    end

Note we don't need to pass in user since the svc_foo methods all call 
get_login_user for that.

Scott




More information about the ovirt-devel mailing list