mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
network: convert hook script to take a network port XML
When (un)plugging an interface into a network, the 'plugged' and 'unplugged' operations are invoked in the hook script. The data provided to the script contains the network XML, the domain XML and the domain interface XML. When we strictly split the drivers up this will no longer be possible and thus breakage is unavoidable. The hook scripts are not considered to be covered by the API guarantee so this is OK. To avoid existing scripts taking the wrong action, the existing operations are changed to 'port-created' and 'port-deleted' instead. These will receive the network XML and the network port XML. Reviewed-by: Laine Stump <laine@laine.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -91,10 +91,8 @@
|
||||
</network>
|
||||
</hookData></pre>
|
||||
|
||||
<p>In the case of an interface
|
||||
being plugged/unplugged to/from the network, the network XML will be
|
||||
followed with the full XML description of the domain containing the
|
||||
interface that is being plugged/unplugged:</p>
|
||||
<p>In the case of an network port being created / deleted, the network
|
||||
XML will be followed with the full XML description of the port:</p>
|
||||
|
||||
<pre><hookData>
|
||||
<network>
|
||||
@@ -102,11 +100,11 @@
|
||||
<uuid>afca425a-2c3a-420c-b2fb-dd7b4950d722</uuid>
|
||||
...
|
||||
</network>
|
||||
<domain type='$domain_type' id='$domain_id'>
|
||||
<name>$domain_name</name>
|
||||
<uuid>afca425a-2c3a-420c-b2fb-dd7b4950d722</uuid>
|
||||
...
|
||||
</domain>
|
||||
<networkport>
|
||||
<uuid>5d744f21-ba4a-4d6e-bdb2-30a35ff3207d</uuid>
|
||||
...
|
||||
<plug type='direct' dev='ens3' mode='vepa'/>
|
||||
</networkport>
|
||||
</hookData></pre>
|
||||
|
||||
<p>Please note that this approach is different from other cases such as
|
||||
@@ -296,15 +294,15 @@
|
||||
<pre>/etc/libvirt/hooks/network network_name stopped end -</pre></li>
|
||||
<li>Later, when network is started and there's an interface from a
|
||||
domain to be plugged into the network, the hook script is called as:<br/>
|
||||
<pre>/etc/libvirt/hooks/network network_name plugged begin -</pre>
|
||||
<pre>/etc/libvirt/hooks/network network_name port-created begin -</pre>
|
||||
Please note, that in this case, the script is passed both network and
|
||||
domain XMLs on its stdin.</li>
|
||||
port XMLs on its stdin.</li>
|
||||
<li>When network is updated, the hook script is called as:<br/>
|
||||
<pre>/etc/libvirt/hooks/network network_name updated begin -</pre></li>
|
||||
<li>When the domain from previous case is shutting down, the interface
|
||||
is unplugged. This leads to another script invocation:<br/>
|
||||
<pre>/etc/libvirt/hooks/network network_name unplugged begin -</pre>
|
||||
And again, as in previous case, both network and domain XMLs are passed
|
||||
<pre>/etc/libvirt/hooks/network network_name port-deleted begin -</pre>
|
||||
And again, as in previous case, both network and port XMLs are passed
|
||||
onto script's stdin.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user