<div dir="ltr"><br>2014/1/5 Livnat Peer <span dir="ltr"><<a href="mailto:lpeer@redhat.com" target="_blank">lpeer@redhat.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 01/05/2014 12:05 PM, Assaf Muller wrote:<br>
> Whichever way we decide to do this, I think the important bit is documentation - We have<br>
> to make sure to update the oVirt wiki hooks pages. If users aren't aware of how to retrieve<br>
> the networking config then we might as well not implement it.<br>
><br>
> That being said, I'd expose three dictionaries: What's currently configure,<br>
> the current request, as well as the proposed end result. It's easy to add<br>
> and I see how it would be useful to hook writers. And just to state the obvious,<br>
> just like how traditional hooks can change the VM or device XML,<br>
> the hook should be able to rewrite the current request contents.<br>
> For example, if a user would like to take over host networking configuration,<br>
> he could just write a before_setup_networks hook that would configure<br>
> networking however he wants, then writes the empty dictionary to the current request,<br>
> meaning that VDSM wouldn't do anything further with the current setup networks request.<br>
><br>
<br></div></blockquote><div><br></div><div>I'm not sure if it's easy to get the final state without actually applying it, it's easy<br>to get an approximate final state (just aggregating dictionaries to networks and bondings,<br>
and erasing the removed ones), but I suppose that'd be good enough :-)<br><br><br></div><div>May be it's good if you can provide a use case for this third "expected" final state,<br></div><div>I can't come up with one. :-)<br>
</div><div><br><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
</div>+1,<br>
I think the API above would be easy to consume.<br>
<br>
Livnat<br>
<div><div class="h5"><br>
<br>
><br>
> Assaf Muller, Cloud Networking Engineer<br>
> Red Hat<br>
><br>
> ----- Original Message -----<br>
> From: "Miguel Angel" <<a href="mailto:miguelangel@ajo.es">miguelangel@ajo.es</a>><br>
> To: "Adam Litke" <<a href="mailto:alitke@redhat.com">alitke@redhat.com</a>><br>
> Cc: <a href="mailto:dsulliva@redhat.com">dsulliva@redhat.com</a>, <a href="mailto:arch@ovirt.org">arch@ovirt.org</a>, <a href="mailto:vdsm-devel@fedorahosted.org">vdsm-devel@fedorahosted.org</a><br>
> Sent: Saturday, January 4, 2014 9:08:17 PM<br>
> Subject: Re: [vdsm] Smarter network_setup hooks<br>
><br>
> Hi Adam<br>
><br>
> Thanks for the feedback<br>
><br>
> 2014/1/3 Adam Litke < <a href="mailto:alitke@redhat.com">alitke@redhat.com</a> ><br>
><br>
><br>
><br>
> On 03/01/14 12:20 +0000, Dan Kenigsberg wrote:<br>
><br>
><br>
> Recently, Miguel Angel Ajo (CCed) has added a nice functionality to the<br>
> implementation of setupNetworks in Vdsm: two hook points where added:<br>
> before and after the setupNetworks verb takes place.<br>
> [....]<br>
> Seems like a logical thing to do. What specific mechanism do you<br>
> suggest for passing the JSON strings to the hook script? If passed as<br>
> arguments to the hook script we would need to consider shell escaping<br>
> and argv length restrictions.<br>
><br>
> As for the libvirt domain xml we pass to other hooks, we write a temporary file<br>
> and we set an environment variable pointing to it before calling the script<br>
><br>
><br>
> What about writing these out to a special file and adding a new<br>
> getContext() call to the hooking module. A script that is unconcerned<br>
> with the context would not require any changes. But a script that<br>
> wants access would simply do:<br>
><br>
> ctx = hooking.getContext()<br>
><br>
> and ctx would be the contents of the special file already decoded into<br>
> a native Python object for easy consumption. This could easily be<br>
> extended to any hook which may want to provide some context to<br>
> implementors.<br>
><br>
> That would be nice, so scripts written in python wouldn't need to look for, and parse<br>
> the file.<br>
><br>
> This is an example of a simple hook:<br>
><br>
> <a href="http://gerrit.ovirt.org/#/c/20330/7/tests/functional/networkTests.py" target="_blank">http://gerrit.ovirt.org/#/c/20330/7/tests/functional/networkTests.py</a> (look inside the ValidatesHook decorator)<br>
><br>
> It'd be quite simplified. We would also need a "setContext()..." to update context with changes.<br>
><br>
><br>
><br>
> One more question comes to mind: Are there any pieces of information<br>
> that we would need to redact from the context (passwords or other<br>
> sensitive information)?<br>
><br>
><br>
> I think there is no sensitive information as far as I know.<br>
><br>
> Greetings,<br>
> Miguel Ángel.<br>
><br>
> _______________________________________________<br>
> vdsm-devel mailing list<br>
> <a href="mailto:vdsm-devel@lists.fedorahosted.org">vdsm-devel@lists.fedorahosted.org</a><br>
> <a href="https://lists.fedorahosted.org/mailman/listinfo/vdsm-devel" target="_blank">https://lists.fedorahosted.org/mailman/listinfo/vdsm-devel</a><br>
</div></div>> _______________________________________________<br>
> Arch mailing list<br>
> <a href="mailto:Arch@ovirt.org">Arch@ovirt.org</a><br>
> <a href="http://lists.ovirt.org/mailman/listinfo/arch" target="_blank">http://lists.ovirt.org/mailman/listinfo/arch</a><br>
><br>
<br>
</blockquote></div><br></div></div>