[Libvir] [RFC] Device attach/detach on virsh

Masayuki Sunou fj1826dm at aa.jp.fujitsu.com
Thu May 10 09:50:53 UTC 2007


I want to add I/F to do attach/detatch of VIF and VBD to virsh with
virDomainAttachDevice()/virDomainDetachDevice(). 
And, I have two proposals about I/F for virsh to do attach/detach of VIF and VBD.

proposal 1:
  Virsh catches MAC, bridge name, device name (physical,virtual), and another 
  by the command option.

  ex)
    ------------------------------------------------------------------
    # virsh help attach(detach)-vif(vbd)
      NAME
        attach(detach)-vif(vbd) - attach(detach) vif(vbd)

      SYNOPSIS
        * VIF
        attach(detach)-vif <domain> <MAC> <bridge> ...
          or
        * VBD
        attach(detach)-vbd <domain> <virt-dev> ...

      DESCRIPTION
        Attach(Detach) vif(vbd) device

      OPTIONS
        <domain>         domain name, id or uuid

        * VIF
        <MAC>            MAC address of vif
        <bridge>         bridge name of vif
        ...

        * VBD
        <virt-dev>       virtual device name of vbd
        <phy-dev>        physical device name of vbd
        ...
    ------------------------------------------------------------------

  <advantage>
    - I/F is easy to use than proposal 1. (Because the user does not have to
      make XML)
  <disadvantage>
    - I/F increases because I/F of VIF and VBD becomes separate. (So, the
      addition of I/F is necessary at any time for supporting devices other
      than VIF and VBD. )
    - Handling of optional analysis, handling of XML making are necessary
      in virsh.c, and processing becomes complicated.


proposal 2:
  virsh catches a definition of a device by XML 

  ex)
    ------------------------------------------------------------------
    # virsh help attach(detach)-device
      NAME
        attach(detach)-device - attach(detach) device from an XML file

      SYNOPSIS
        attach(detach)-device <domain> <file>

      DESCRIPTION
        Attach(Detach) device from an XML <file>

      OPTIONS
        <domain>         domain name, id or uuid
        <file>           XML file of device description
    ------------------------------------------------------------------

  <advantage>
    - I/F is unified without affecting a device type. (I/F is simple)
    - Handling of virsh.c is simple. (Optional analysis is not necessary)
  <disadvantage>
    - The user has to describe XML.(It is troublesome) 


I think that specifications that a user is easy to use (proposal 1)
are better.
Please, give me an opinion which proposal is better.

Thanks,
Masayuki Sunou




More information about the libvir-list mailing list