Re: [PATCH 01/10] linkstate: XML for modification of interface's link state.

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

 



On Thu, Aug 11, 2011 at 05:27:39PM +0200, Peter Krempa wrote:
> Adds a optional element to XML definition of domains for
> modification of link state of network interfaces.
> ---
>  docs/formatdomain.html.in |   21 +++++++++++++++++++++
>  docs/schemas/domain.rng   |   11 +++++++++++
>  2 files changed, 32 insertions(+), 0 deletions(-)
> 
> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
> index 7d2ba8a..dc4cecb 100644
> --- a/docs/formatdomain.html.in
> +++ b/docs/formatdomain.html.in
> @@ -1997,6 +1997,27 @@ qemu-kvm -net nic,model=? /dev/null
>        <span class="since">Since 0.9.4</span>
>      </p>
> 
> +    <h5><a name="elementLink">Modyfing virtual link state</a></h5>
> +<pre>
> +  ...
> +  &lt;devices&gt;
> +    &lt;interface type='network'&gt;
> +      &lt;source network='default'/&gt;
> +      &lt;target dev='vnet0'/&gt;
> +      <b>&lt;link state='down'/&gt;</b>
> +    &lt;/interface&gt;
> +  &lt;devices&gt;
> +  ...</pre>
> +
> +    <p>
> +      This element provides means of setting state of the virtual network link.
> +      Possible values for atrribute <code>state</code> are <code>up</code> and
> +      <code>down</code>. If <code>down</code> is specified as the value, the interface
> +      behaves as if it had the network cable disconnected. Default behaviour, if this
> +      element is unspecified is to have the link state <code>up</code>.
> +      <span class="since">Since 0.9.5</span>
> +    </p>
> +
>      <h4><a name="elementsInput">Input devices</a></h4>
> 
>      <p>
> diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
> index 6ccbeed..a4282eb 100644
> --- a/docs/schemas/domain.rng
> +++ b/docs/schemas/domain.rng
> @@ -1192,6 +1192,17 @@
>        <optional>
>          <ref name="bandwidth"/>
>        </optional>
> +      <optional>
> +        <element name="link">
> +          <attribute name="state">
> +            <choice>
> +              <value>up</value>
> +              <value>down</value>
> +            </choice>
> +          </attribute>
> +          <empty/>
> +        </element>
> +      </optional>
>      </interleave>
>    </define>
>    <!--

Once we add link state to the XML, it ought to be possible to enable
changes of the link state using the existing virDomainUpdateDevice()
API call. We already use this for changing CDROM media, changing the
VNC/SPICE graphics configuration, etc, so IMHO it should also be used
for NIC device configuration changes. This lets you do more than just
change link state. It will be possible to actually change the NIC
device backend entirely.

For example, you might want to take a guest with bridged
networking and disconnect it entirely

  <interface type='bridge'>
    <source bridge='br0'/>
    <link state='up'/>
  </interface>

By changing to type=none (does not exist yet, but could) issuing
this to the virDomaniUpdateDevice:

  <interface type='none'>
    <link state='down'/>
  </interface>

We'd do this by using the monitor to set the link state
down, and then remove the network device backend, leaving
only the guest device.

Some time later we might want to connect the guest to a
new LAN, but issuing virDomainUpdateDevice with:

  <interface type='network'>
    <source network='default'/>
    <link state='up'/>
  </interface>

So I think it is more flexible todo this via virDomainUpdateDevice
than to have special case APIs for link state.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]