[libvirt] [PATCH v2 resend 0/4]use VIR_ENUM_DECL for domain NIC model and add usb-net

Guannan Ren gren at redhat.com
Mon Feb 25 11:07:33 UTC 2013


v1 to v2
   *removed i8* NIC models support for QEMU/KVM
   *updated docs
   *rebased

This patchset uses VIR_ENUM_DECL and VIR_ENUM_IMPL macros for NIC models
and changes the related codes to use them.
All of NIC models supported by various hypervisors comprise of the enum,
so the problem is that we need to do further checking in hypervisor-specific
implementation. Fortunately, VMX and Vbox did this checking very well already.
In 4/4, a similar job is performed for QEMU/KVM.

And, adds usb-net support.
The vendorId and productID of is 0525:a4a2. The corresponding item in
usb-ids is as follows:

0525  Netchip Technology, Inc.
a4a2  Linux-USB Ethernet/RNDIS Gadget

In my opinion, using usb-net directly is good enough, so I keep it.
Any other idea is welcome.

Libvirt XML sample:
  <devices>
    <interface type='user'>
      <mac address='52:54:00:32:6a:91'/>
      <model type='usb-net'/>
      <alias name='net1'/>
      <address type='usb' bus='0' port='1'/>
    </interface>
  </devices>

qemu commandline:

qemu ${other_vm_args}
    -netdev user,id=hostnet1 \
    -device usb-net,netdev=hostnet1,id=net1,\
      mac=52:54:00:32:6a:91,bus=usb.0,port=1

Guannan Ren(4)
 [PATCH v2 resend 1/4] add domain NIC model enum macro
 [PATCH v2 resend 2/4] net: use virDomainNICModelType{From|To}String functions
 [PATCH v2 resend 3/4] qemu: add NIC model checking for qemu hypervisor
 [PATCH v2 resend 4/4] qemu: add usb-net support

 docs/formatdomain.html.in        | 29 +++++++++++------------------
 src/conf/domain_conf.c           | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
 src/conf/domain_conf.h           | 32 +++++++++++++++++++++++++++++++-
 src/libvirt_private.syms         |  2 ++
 src/libxl/libxl_conf.c           |  5 +++--
 src/parallels/parallels_driver.c |  2 +-
 src/qemu/qemu_command.c          | 41 +++++++++++++++++++++++++++--------------
 src/qemu/qemu_driver.c           |  2 +-
 src/qemu/qemu_hotplug.c          | 10 ++++++----
 src/qemu/qemu_process.c          | 14 +++++++-------
 src/vbox/vbox_tmpl.c             | 57 +++++++++++++++++++++++++++------------------------------
 src/vmx/vmx.c                    | 31 ++++++++++++++++---------------
 src/xenxs/xen_sxpr.c             | 21 +++++++++++----------
 src/xenxs/xen_xm.c               | 21 +++++++++++----------
 14 files changed, 208 insertions(+), 137 deletions(-)




More information about the libvir-list mailing list