1. 19 11月, 2011 20 次提交
    • D
      Refactor LXC network setup to allow future enhancements · f3b1b9b1
      Daniel P. Berrange 提交于
      The current lxcSetupInterfaces() method directly performs setup
      of the bridge devices. Since it will shortly need to also create
      macvlan devices, move the bridge related code into a separate
      method
      
      * src/lxc/lxc_driver.c: Split lxcSetupInterfaces() to create a
        new lxcSetupInterfaceBridge()
      f3b1b9b1
    • D
      Add missing 'const' annotations for internal domain conf helpers · 914d1b74
      Daniel P. Berrange 提交于
      The virDomainNetGetActualBridgeName and virDomainNetGetActualDirectDev
      methods both return strings that point to data in the virDomainDefPtr
      struct, and should therefore not be freed. The return values should
      thus be 'const char *' not 'char *'.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Mark const
      * src/network/bridge_driver.c: Update to use a const char *
      914d1b74
    • D
      Fix up ordering of private symbols file · 0c1587e1
      Daniel P. Berrange 提交于
      Fix ordering of symbols after re-arranging network device
      management API source files
      
      * src/libvirt_private.syms: Fix ordering
      0c1587e1
    • D
      Move ifaceMacvtapLinkDump and ifaceGetNthParent functions · 91904106
      Daniel P. Berrange 提交于
      Move the ifaceMacvtapLinkDump and ifaceGetNthParent functions
      into virnetdevvportprofile.c since they are specific to that
      code. This avoids polluting the headers with the Linux specific
      netlink data types
      
      * src/util/interface.c, src/util/interface.h: Move
        ifaceMacvtapLinkDump and ifaceGetNthParent functions and delete
        remaining file
      * src/util/virnetdevvportprofile.c: Add ifaceMacvtapLinkDump
        and ifaceGetNthParent functions
      * src/network/bridge_driver.c, src/nwfilter/nwfilter_gentech_driver.c,
        src/nwfilter/nwfilter_learnipaddr.c, src/util/virnetdevmacvlan.c:
        Remove include of interface.h
      91904106
    • D
      Move functions for dealing with physical/virtual devices · 74b32b62
      Daniel P. Berrange 提交于
      Move virNetDevIsVirtualFunction, virNetDevGetVirtualFunctionIndex
      and virNetDevGetPhysicalFunction to virnetdev.c
      
      * src/util/interface.c, src/util/interface.h, src/util/virnetdev.c,
        src/util/virnetdev.h: Move APIs
      74b32b62
    • D
      Rename APIs for dealing with virtual/physical functions · 8f688c85
      Daniel P. Berrange 提交于
      Rename ifaceIsVirtualFunction to virNetDevIsVirtualFunction,
      ifaceGetVirtualFunctionIndex to virNetDevGetVirtualFunctionIndex
      and ifaceGetPhysicalFunction to virNetDevGetPhysicalFunction
      
      * src/util/interface.c, src/util/interface.h: Rename APIs
      * src/util/virnetdevvportprofile.c: Update for API rename
      8f688c85
    • D
      Move virNetDevValidateConfig to virnetdev.c · 5373cb74
      Daniel P. Berrange 提交于
      * src/util/interface.c, src/util/interface.h: Remove virNetDevValidateConfig
      * src/util/virnetdev.c, src/util/virnetdev.h: Add virNetDevValidateConfig
      5373cb74
    • D
      Rename ifaceCheck to virNetDevValidateConfig · 6e0c4dce
      Daniel P. Berrange 提交于
      Rename the ifaceCheck method to virNetDevValidateConfig and change
      so that it always raises an error and returns -1 on error.
      
      * src/util/interface.c, src/util/interface.h: Rename ifaceCheck
        to virNetDevValidateConfig
      * src/nwfilter/nwfilter_gentech_driver.c,
        src/nwfilter/nwfilter_learnipaddr.c: Update for API rename
      6e0c4dce
    • D
      Move virNetDevGetIPv4Address to virnetdev.c · 8e6cd414
      Daniel P. Berrange 提交于
      Move the virNetDevGetIPv4Address function to virnetdev.c
      
      * util/interface.c, util/interface.h: Remove virNetDevGetIPv4Address
      * util/virnetdev.c, util/virnetdev.h: Add virNetDevGetIPv4Address
      8e6cd414
    • D
      Rename ifaceGetIPAddress to virNetDevGetIPv4Address · 50f19085
      Daniel P. Berrange 提交于
      To match up with the existing virNetDevSetIPv4Address, rename
      ifaceGetIPAddress to virNetDevGetIPv4Address
      
      * util/interface.h, util/interface.c: Rename API
      * network/bridge_driver.c: Update for API rename
      50f19085
    • D
      Move virNetDevGetIndex & virNetDevGetVLanID to virnetdev.c · 00bba08d
      Daniel P. Berrange 提交于
      Move virNetDevGetIndex & virNetDevGetVLanID to virnetdev.c to
      suit their functional purpose
      
      * util/interface.c, util/interface.h: Remove virNetDevGetIndex &
        virNetDevGetVLanID
      * util/virnetdev.c, util/virnetdev.h: Add virNetDevGetIndex &
        virNetDevGetVLanID
      00bba08d
    • D
      Rename ifaceGetIndex and ifaceGetVLAN · ebbb6bd1
      Daniel P. Berrange 提交于
      Rename the ifaceGetIndex method to virNetDevGetIndex and
      ifaceGetVlanID to virNetDevGetVLanID. Also change the error
      reporting behaviour to always raise errors and return -1 on
      failure
      
      * util/interface.c, util/interface.h: Rename ifaceGetIndex
        and ifaceGetVLAN
      * nwfilter/nwfilter_gentech_driver.c, nwfilter/nwfilter_learnipaddr.c,
        nwfilter/nwfilter_learnipaddr.c, util/virnetdevvportprofile.c: Update
        for API renames and error handling changes
      ebbb6bd1
    • D
      Move MAC address replacement functions to virnetdev.c · 255917f5
      Daniel P. Berrange 提交于
      Move virNetDevReplaceMacAddress and virNetDevRestoreMacAddress
      to the virnetdev.c file where they naturally belong
      
      * util/interface.c, util/interface.h: Remove
        virNetDevReplaceMacAddress and virNetDevRestoreMacAddress
      * util/virnetdev.c, util/virnetdev.h: Add
        virNetDevReplaceMacAddress and virNetDevRestoreMacAddress
      255917f5
    • D
      Rename interface MAC address replacement APIs · 10462d5c
      Daniel P. Berrange 提交于
      Rename ifaceReplaceMacAddress to virNetDevReplaceMacAddress
      and ifaceRestoreMacAddress to virNetDevRestoreMacAddress.
      
      * util/interface.c, util/interface.h, util/virnetdevmacvlan.c:
        Rename APIs
      10462d5c
    • D
      Move the low level macvlan creation APIs · d2fed854
      Daniel P. Berrange 提交于
      Move the low level macvlan creation APIs into the
      virnetdevmacvlan.c file where they more naturally
      belong
      
      * util/interface.c, util/interface.h: Remove virNetDevMacVLanCreate
        and virNetDevMacVLanDelete
      * util/virnetdevmacvlan.c, util/virnetdevmacvlan.h: Add
        virNetDevMacVLanCreate and virNetDevMacVLanDelete
      d2fed854
    • D
      Rename low level macvlan creation APIs · 57f0de4c
      Daniel P. Berrange 提交于
      Rename ifaceMacvtapLinkAdd to virNetDevMacVLanCreate and
      ifaceLinkDel to virNetDevMacVLanDelete. Strictly speaking
      the latter isn't restricted to macvlan devices, but that's
      the only use libvirt has for it.
      
      * util/interface.c, util/interface.h,
        util/virnetdevmacvlan.c: Rename APIs
      57f0de4c
    • D
      Rename high level macvlan creation APIs · 191090ae
      Daniel P. Berrange 提交于
      Rename virNetDevMacVLanCreate to virNetDevMacVLanCreateWithVPortProfile
      and virNetDevMacVLanDelete to virNetDevMacVLanDeleteWithVPortProfile
      
      To make way for renaming the other macvlan creation APIs in
      interface.c
      
      * util/virnetdevmacvlan.c, util/virnetdevmacvlan.h,
        qemu/qemu_command.c, qemu/qemu_hotplug.c, qemu/qemu_process.c:
        Rename APIs
      191090ae
    • D
      Rename and split the macvtap.c file · 896104c9
      Daniel P. Berrange 提交于
      Rename the macvtap.c file to virnetdevmacvlan.c to reflect its
      functionality. Move the port profile association code out into
      virnetdevvportprofile.c. Make the APIs available unconditionally
      to callers
      
      * src/util/macvtap.h: rename to src/util/virnetdevmacvlan.h,
      * src/util/macvtap.c: rename to src/util/virnetdevmacvlan.c
      * src/util/virnetdevvportprofile.c, src/util/virnetdevvportprofile.h:
        Pull in vport association code
      * src/Makefile.am, src/conf/domain_conf.h, src/qemu/qemu_conf.c,
        src/qemu/qemu_conf.h, src/qemu/qemu_driver.c: Update include
        paths & remove conditional compilation
      896104c9
    • D
      Rename Macvtap management APIs · 43925db7
      Daniel P. Berrange 提交于
      In preparation for code re-organization, rename the Macvtap
      management APIs to have the following patterns
      
        virNetDevMacVLanXXXXX     - macvlan/macvtap interface management
        virNetDevVPortProfileXXXX - virtual port profile management
      
      * src/util/macvtap.c, src/util/macvtap.h: Rename APIs
      * src/conf/domain_conf.c, src/network/bridge_driver.c,
        src/qemu/qemu_command.c, src/qemu/qemu_command.h,
        src/qemu/qemu_driver.c, src/qemu/qemu_hotplug.c,
        src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
        src/qemu/qemu_process.h: Update for renamed APIs
      43925db7
    • D
      Fix use of uninitialized variable in QEMU driver · a7c6ce0d
      Daniel P. Berrange 提交于
      a7c6ce0d
  2. 18 11月, 2011 3 次提交
    • B
      qemu: Generate -numa option · 9b6bb0fe
      Bharata B Rao 提交于
      Add routines to generate -numa QEMU command line option based on
      <numa> ... </numa> XML specifications.
      Signed-off-by: NBharata B Rao <bharata@linux.vnet.ibm.com>
      9b6bb0fe
    • B
      XML definitions for guest NUMA and parsing routines · 5f7b71b4
      Bharata B Rao 提交于
      This patch adds XML definitions for guest NUMA specification and contains
      routines to parse the same. The guest NUMA specification looks like this:
      
      <cpu>
              ...
              <topology sockets='2' cores='4' threads='2'/>
              <numa>
                      <cell cpus='0-7' memory='512000'/>
                      <cell cpus='8-15' memory='512000'/>
              </numa>
              ...
      </cpu>
      Signed-off-by: NBharata B Rao <bharata@linux.vnet.ibm.com>
      5f7b71b4
    • E
      snapshot: refuse to generate names for non-regular backing files · c74b9715
      Eric Blake 提交于
      For whatever reason, the kernel allows you to create a regular
      file named /dev/sdc.12345; although this file will disappear the
      next time devtmpfs is remounted.  If you let libvirt generate
      the name of the external snapshot for a disk image originally
      using the block device /dev/sdc, then the domain will be rendered
      unbootable once the qcow2 file is lost on the next devtmpfs
      remount.  In this case, the user should have used 'virsh
      snapshot-create --xmlfile' or 'virsh snapshot-create-as --diskspec'
      to specify the name for the qcow2 file in a sane location, rather
      than relying on libvirt generating a name that is most likely to
      be wrong.  We can help avoid naive mistakes by enforcing that
      the user provide the external name for any backing file that is
      not a regular file.
      
      * src/conf/domain_conf.c (virDomainSnapshotAlignDisks): Only
      generate names if backing file exists as regular file.
      Reported by MATSUDA Daiki.
      c74b9715
  3. 17 11月, 2011 3 次提交
    • J
      Fix build with polkit0 · d47ab3fe
      Jim Fehlig 提交于
      I missed adding virNetServerGetDBusConn() to libvirtd_private.syms
      in commit b8adfcc6, which didn't cause a problem in 0.9.6 but
      results in this build error in 0.9.7
      
      libvirtd-remote.o: In function `remoteDispatchAuthPolkit':
      remote.c:(.text+0x188dd): undefined reference to `virNetServerGetDBusConn'
      d47ab3fe
    • J
      Revert commit 0f590c62 · e86417e9
      Jim Fehlig 提交于
      As noted by Daniel Berrange [1], the proper fix for the older
      PolicyKit build issue is to add virNetServerGetDBusConn to
      libvirt_private.syms.  Revert unnecessary changes to
      daemon/Makefile.am
      
      [1] https://www.redhat.com/archives/libvir-list/2011-November/msg00852.html
      e86417e9
    • L
      virsh: add iface-bridge and iface-unbridge commands · 1ae8eed1
      Laine Stump 提交于
      One of the top questions by libvirt users is how to create a host
      bridge device so that guests can be directly on the physical
      network. There are several example documents that explain how to do
      this manually, but following them often results in confusion and
      failure. virt-manager does a good job of creating a bridge based on an
      existing network device, but not everyone wants to use virt-manager.
      
      This patch adds a new command, iface-bridge that makes it just about
      as simple as possible to create a new bridge device based on an
      existing ethernet/vlan/bond device (including associating IP
      configuration with the bridge rather than the now-attached device),
      and start that new bridge up ready for action, eg:
      
          virsh iface-bridge eth0 br0
      
      For symmetry's sake, it also adds a command to remove a device from a
      bridge, restoring the IP config to the now-unattached device:
      
          virsh iface-unbridge br0
      
      (I had a short debate about whether to do "iface-unbridge eth0"
      instead, but that would involve searching through all bridge devices
      for the one that contained eth0, which seems like a bit too much
      trouble).
      
      NOTE: These two commands require that the netcf library be available
      on the host. Hopefully this will provide some extra incentive for
      people using suse, debian, ubuntu, and other similar systems to polish
      up (and push downstream) the ports to those distros recently pushed to
      the upstream netcf repo by Dan Berrange. Anyone interested in helping
      with that effort in any way should join the netcf-devel mailing list
      (subscription info at
      https://fedorahosted.org/mailman/listinfo/netcf-devel)
      
      During creation of the bridge, it's possible to specify whether or not
      the STP protocol should be started up on the bridge and, if so, how
      many seconds the bridge should squelch traffic from newly added
      devices while learning new topology (defaults are stp='on' and
      delay='0', which seems to usually work best for bridges used in the
      context of libvirt guests).
      
      There is also an option to not immediately start the bridge (and a
      similar option to not immediately start the un-attached device after
      destroying the bridge. Default is to start the new device, because in
      the case of iface-unbridge not starting is strongly discouraged as it
      will leave the system with no network connectivity on that interface
      (because it's necessary to destroy/undefine the bridge device before
      the unattached device can be defined), and it seemed better to make
      the option for iface-bridge behave consistently.
      
      NOTE TO THOSE TRYING THESE COMMANDS FOR THE FIRST TIME: to guard
      against any "unexpected" change to configuration, it is advisable to
      issue an "virsh iface-begin" command before starting any interface
      config changes, and "virsh iface-commit" only after you've verified
      that everything is working as you expect. If something goes wrong,
      you can always run "virsh iface-rollback" or reboot the system (which
      should automatically do iface-rollback).
      
      Aside from adding the code for these two functions, and the two
      entries into the command table, the only other change to virsh.c was
      to add the option name to vshCommandOptInterfaceBy(), because the
      iface-unbridge command names its interface option as "bridge".
      
      virsh.pod has also been updated with short descriptions of these two
      new commands.
      1ae8eed1
  4. 16 11月, 2011 14 次提交
    • H
      fix a bug in remoteSerializeTypedParameters · f153501e
      Hu Tao 提交于
      This is a fatal typo believed to be very likely to happen when using
      both i and j at the same time for indexing.
      f153501e
    • D
      Don't return a fatal error if receiving unexpected stream data · a38710bd
      Daniel P. Berrange 提交于
      Due to the asynchronous nature of streams, we might continue to
      receive some stream packets from the server even after we have
      shutdown the stream on the client side. These should be discarded
      silently, rather than raising an error in the RPC layer.
      
      * src/rpc/virnetclient.c: Discard stream data silently
      a38710bd
    • D
      Fix handling of stream EOF · 1d46b2e9
      Daniel P. Berrange 提交于
      Very occasionally the sequence of events from poll would result
      in getting a HANGUP on its own, instead of a HANGUP+READABLE
      at the same time. In the former case we would send back an error
      event to the client, but never send the empty packet to indicate
      EOF.
      1d46b2e9
    • D
      Allow non-blocking message sending on virNetClient · ff465ad2
      Daniel P. Berrange 提交于
      Add a new virNetClientSendNonBlock which returns 2 on
      full send, 1 on partial send, 0 on no send, -1 on error
      
      If a partial send occurs, then a subsequent call to any
      of the virNetClientSend* APIs will finish any outstanding
      I/O.
      
      TODO: the virNetClientEvent event handler could be used
      to speed up completion of partial sends if an event loop
      is present.
      
      * src/rpc/virnetsocket.h, src/rpc/virnetsocket.c: Add new
        virNetSocketHasPendingData() API to test for cached
        data pending send.
      * src/rpc/virnetclient.c, src/rpc/virnetclient.h: Add new
        virNetClientSendNonBlock() API to send non-blocking API
      ff465ad2
    • D
      Refactor code for enabling/disabling I/O callback in remote client · b1962203
      Daniel P. Berrange 提交于
      * src/rpc/virnetclient.c: Add helper for setting I/O callback events
      b1962203
    • D
      Split virNetClientSend into 2 methods · 5990f227
      Daniel P. Berrange 提交于
      Stop multiplexing virNetClientSend for two different purposes,
      instead add virNetClientSendWithReply and virNetClientSendNoReply
      
      * src/rpc/virnetclient.c, src/rpc/virnetclient.h: Replace
        virNetClientSend with virNetClientSendWithReply and
        virNetClientSendNoReply
      * src/rpc/virnetclientprogram.c, src/rpc/virnetclientstream.c:
        Update for new API names
      5990f227
    • D
      Refactor code for passing the buck in the remote client · 9f28ad00
      Daniel P. Berrange 提交于
      Remove some duplication by pulling the code for passing the
      buck out into a helper method
      
      * src/rpc/virnetclient.c: Introduce virNetClientIOEventLoopPassTheBuck
      9f28ad00
    • D
      Explicitly track whether the buck is held in remote client · fa959500
      Daniel P. Berrange 提交于
      Instead of inferring whether the buck is held from the waitDispatch
      pointer, use an explicit 'bool haveTheBuck' field
      
      * src/rpc/virnetclient.c: Explicitly track the buck
      fa959500
    • D
      Remove all linked list handling from remote client event loop · 2501d27e
      Daniel P. Berrange 提交于
      Directly messing around with the linked list is potentially
      dangerous. Introduce some helper APIs to deal with list
      manipulating the list
      
      * src/rpc/virnetclient.c: Create linked list handlers
      2501d27e
    • E
      util: Add netdev helper functions to private symbols · d7761700
      Eli Qiao 提交于
      Signed-off-by: NEli Qiao <taget@linux.vnet.ibm.com>
      d7761700
    • S
      qemu/rbd: improve rbd device specification · 5745dc12
      Sage Weil 提交于
      This improves the support for qemu rbd devices by adding support for a few
      key features (e.g., authentication) and cleaning up the way in which
      rbd configuration options are passed to qemu.
      
      An <auth> member of the disk source xml specifies how librbd should
      authenticate. The username attribute is the Ceph/RBD user to authenticate as.
      The usage or uuid attributes specify which secret to use. Usage is an
      arbitrary identifier local to libvirt.
      
      The old RBD support relied on setting an environment variable to
      communicate information to qemu/librbd.  Instead, pass those options
      explicitly to qemu.  Update the qemu argument parsing and tests
      accordingly.
      Signed-off-by: NSage Weil <sage@newdream.net>
      Signed-off-by: NJosh Durgin <josh.durgin@dreamhost.com>
      5745dc12
    • J
      Fix build with polkit0 · 0f590c62
      Jim Fehlig 提交于
      I missed adding libvirt_driver_remote.la to libvirtd_LDADD in
      commit b8adfcc6, which didn't cause a problem in 0.9.6 but
      results in this build error in 0.9.7
      
      libvirtd-remote.o: In function `remoteDispatchAuthPolkit':
      remote.c:(.text+0x188dd): undefined reference to `virNetServerGetDBusConn'
      0f590c62
    • S
      Fix strchr call triggering gcc 4.3 & 4.4 bug · 39d91e9f
      Stefan Berger 提交于
      Replacing the strchr call with two variables through a strstr call.
      Calling strchr with two variables triggers a gcc 4.3/4.4
      bug when used in combination with -Wlogical-op and at least -O1.
      39d91e9f
    • S
      maint: fix build · c2cc02ea
      Stefan Berger 提交于
      include stdint.h to fix the build
      c2cc02ea