1. 11 5月, 2015 1 次提交
    • P
      util: Make the virDomainListFree helper more universal · a5e89ae1
      Peter Krempa 提交于
      Extend it to a universal helper used for clearing lists of any objects.
      Note that the argument type is specifically void * to allow implicit
      typecasting.
      
      Additionally add a helper that works on non-NULL terminated arrays once
      we know the length.
      a5e89ae1
  2. 05 5月, 2015 2 次提交
    • C
      storage: fs: Don't try to chown directory unless user requested · 28c547ed
      Cole Robinson 提交于
      Currently we try to chown any directory passed to virDirCreate,
      even if the user didn't request any explicit owner/group via the
      pool/vol XML.
      
      This causes issues with qemu:///session: try to build a pool of
      a root owned directory like /tmp, and it fails trying to chown the
      directory to the session user. Instead it should just leave things
      as they are, unless the user requests changing permissions via
      the pool XML.
      
      Similarly this is annoying if creating a storage pool via system
      libvirtd of an existing directory in user $HOME, it's now owned
      by root.
      
      The virDirCreate function is pretty convoluted, since it needs to
      fork off in certain specific cases. Try to document that, to make
      it clear where exactly we are changing behavior.
      28c547ed
    • C
      storage: fs: Don't attempt directory creation if it already exists · 262b3c05
      Cole Robinson 提交于
      The current code attempts to handle this, but it only catches mkdir
      failing with EEXIST. However if say trying to build /tmp for an
      unprivileged qemu:///session, mkdir will fail with EPERM.
      
      Rather than catch any errors, just don't attempt mkdir if the directory
      already exists.
      262b3c05
  3. 27 4月, 2015 2 次提交
  4. 25 4月, 2015 3 次提交
    • J
      virhostdev: Fix comments for virHostdevReAttachPCIDevices · 6f75779e
      John Ferlan 提交于
      Pushed previous patch (commit id 'd45dadae') too quickly...
      
      The patch just updates the patch from Laine's suggestions.
      6f75779e
    • H
      hostdev: fix net config restore error · d45dadae
      Huanle Han 提交于
      Fix for such a case:
      1. Domain A and B xml contain the same SRIOV net hostdev(<interface
      type='hostdev' /> with same pci address).
      2. virsh start A (Successfully, and configure the SRIOV net with
      custom mac)
      3. virsh start B (Fail because of the hostdev used by domain A or other
      reason.)
      In step 3, 'virHostdevNetConfigRestore' is called for the hostdev
      which is still used by domain A. It makes the mac/vlan of the SRIOV net
      change.
      
      Code Change in this fix:
      1. As the pci used by other domain have been removed from
      'pcidevs' in previous loop, we only restore the nic config for
      the hostdev still in 'pcidevs'(used by this domain)
      2. update the comments to make it more clear
      Signed-off-by: NHuanle Han <hanxueluo@gmail.com>
      d45dadae
    • H
      hostdev: Create virHostdevIsPCINetDevice · 7ec3f805
      Huanle Han 提交于
      Refactor some code to create a static function virHostdevIsPCINetDevice
      which will detect whether the hostdev is a pci net device or not.
      Signed-off-by: NHuanle Han <hanxueluo@gmail.com>
      7ec3f805
  5. 24 4月, 2015 2 次提交
  6. 23 4月, 2015 1 次提交
  7. 22 4月, 2015 7 次提交
    • R
      vircommand: fix polling in virCommandProcessIO · e34cccf7
      Roman Bogorodskiy 提交于
      When running on FreeBSD, there's a bug in virCommandProcessIO
      polling that is triggered by the commandtest.
      
      A test that triggers EPIPE in commandtest (named "test20") hungs
      forever on FreeBSD.
      
      Apparently, this happens because FreeBSD sets POLLHUP flag on revents
      when stdin in closed. And as the current implementation only checks for
      POLLOUT and POLLERR, it ends up looping forever inside
      virCommandProcessIO and not trying to do one more write() that would
      trigger EPIPE.
      
      To fix that check for the POLLHUP flag along with POLLOUT and POLLERR.
      e34cccf7
    • P
      util: storage: Improve error message when requesting image above 'start' · dff92b3f
      Peter Krempa 提交于
      When a user would specify a backing chain index that is above the start
      point libvirt would report a rather unhelpful error:
      
      invalid argument: could not find backing store 1 in chain for 'sub/link2'
      
      This patch adds an explicit check that the index is below start point in
      the backing store and reports the following error if not:
      
      invalid argument: requested backing store index 1 is above 'sub/../qcow2' in chain for 'sub/link2'
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1177062
      dff92b3f
    • P
    • P
      util: storage: Fix possible crash when source path is NULL · 62a61d58
      Peter Krempa 提交于
      Some storage protocols allow to have the @path field in struct
      virStorageSource set to NULL. Add NULLSTR() wrappers to handle this
      possibility until I finish the storage source error formatter.
      62a61d58
    • P
      util: command: Deduplicate code in virCommandNewArgList · 64a9d2fa
      Peter Krempa 提交于
      virCommandNewArgList can use virCommandNewVAList.
      64a9d2fa
    • R
      util: fix build on non-Linux · 584db105
      Roman Bogorodskiy 提交于
      Build fails on non-Linux systems with this error:
      
        CC       util/libvirt_util_la-virnetdev.lo
      util/virnetdev.c:364:1: error: unused function 'virNetDevReplaceMacAddress' [-Werror,-Wunused-function]
      virNetDevReplaceMacAddress(const char *linkdev,
      ^
      util/virnetdev.c:406:1: error: unused function 'virNetDevRestoreMacAddress' [-Werror,-Wunused-function]
      virNetDevRestoreMacAddress(const char *linkdev,
      ^
      2 errors generated.
      
      The virNetDev{Restore,Replace}MacAddress() functions are only used
      by VF-related routines that are available on Linux only. So move these
      functions under the same #ifdef.
      584db105
    • L
      util: set MAC address for VF via netlink message to PF+VF# when possible · cb3fe38c
      Laine Stump 提交于
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1113474
      
      When we set the MAC address of a network device as a part of setting
      up macvtap "passthrough" mode (where the domain has an emulated netdev
      connected to a host macvtap device that has exclusive use of the
      physical device, and sets the device MAC address to match its own,
      i.e. "<interface type='direct'> <source mode='passthrough' .../>"), we
      use ioctl(SIOCSIFHWADDR) giving it the name of that device. This is
      true even if it is an SRIOV Virtual Function (VF).
      
      But, when we are setting the MAC address / vlan ID of a VF in
      preparation for "hostdev network" passthrough (this is where we set
      the MAC address and vlan id of the VF after detaching the host net
      driver and before assigning the device to the domain with PCI
      passthrough, i.e. "<interface type='hostdev'>", we do the setting via
      a netlink RTM_SETLINK message for that VF's Physical Function (PF),
      telling it the VF# we want to change. This sets an "administratively
      changed MAC" flag for that VF in the PF's driver, and from that point
      on (until the PF driver is reloaded, *not* merely the VF driver) that
      VF's MAC address can't be changed using ioctl(SIOCSIFHWADDR) - the
      only way to change it is via the PF with RTM_SETLINK.
      
      This means that if a VF is used for hostdev passthrough, it will have
      the admin flag set, and future attempts to use that VF for macvtap
      passthrough will fail.
      
      The solution to this problem is to check if the device being used for
      macvtap passthrough is actually a VF; if so, we use the netlink
      RTM_SETLINK message to the PF to set the VF's mac address instead of
      ioctl(SIOCSIFHWADDR) directly to the VF; if not, behavior does not
      change from previously.
      
      There are three pieces to making this work:
      
      1) virNetDevMacVLan(Create|Delete)WithVPortProfile() now call
         virNetDev(Replace|Restore)NetConfig() rather than
         virNetDev(Replace|Restore)MacAddress() (simply passing -1 for VF#
         and vlanid).
      
      2) virNetDev(Replace|Restore)NetConfig() check to see if the device is
         a VF. If so, they find the PF's name and VF#, allowing them to call
         virNetDev(Replace|Restore)VfConfig().
      
      3) To prevent mixups when detaching a macvtap passthrough device that
         had been attached while running an older version of libvirt,
         virNetDevRestoreVfConfig() is potentially given the preserved name
         of the VF, and if the proper statefile for a VF can't be found in
         the stateDir (${stateDir}/${pfname}_vf${vfid}),
         virNetDevRestoreMacAddress() is called instead (which will look in
         the file named ${stateDir}/${vfname}).
      
      This problem has existed in every version of libvirt that has both
      macvtap passthrough and interface type='hostdev'. Fortunately people
      seem to use one or the other though, so it hasn't caused any real
      world problem reports.
      cb3fe38c
  8. 17 4月, 2015 5 次提交
    • M
      Introduce virNetDevBandwidthUpdateFilter · 176a95fd
      Michal Privoznik 提交于
      This is a simple wrapper around virNetDevBandwidthManipulateFilter() that
      will update the desired filter on an interface (usually a network bridge)
      with a new MAC address. Although, the MAC address in question usually
      refers to some other interface - the one that the filter is constructed
      for. Yeah, hard to parse. Thing is, our NATed network has a bridge where
      some part of QoS takes place. And vNICs from guests are plugged into
      the bridge. However, if a guest decides to change the MAC of its vNIC,
      the corresponding qemu process emits an event which we can use to
      update the QoS configuration based on the new MAC address.. However,
      our QoS hierarchy is currently not notified, therefore it falls apart.
      This function (when called in response to the aforementioned event)
      will update our QoS hierarchy and duct tape it together again.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      176a95fd
    • M
      virnetdevbandwidth.c: Separate tc filter creation to a function · c6f0be2f
      Michal Privoznik 提交于
      Not only this simplifies the code a bit, it prepares the
      environment for upcoming patches. The new
      virNetDevBandwidthManipulateFilter() function is capable of both
      removing a filter and adding a new one. At the same time! Yeah,
      this is not currently used anywhere but look at the next commit
      where you'll see it.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      c6f0be2f
    • M
      virNetDevBandwidthSet: Add priority to filter · 2397be69
      Michal Privoznik 提交于
      Currently, when constructing traffic shaping rules, the ingress
      filter is created without any priority specified on the command
      line. This makes kernel to make up one. While this works, it
      simplifies things a bit if we provide the filter priority. In
      this case, since it's the root filter lets give it the highest
      priority of number 1.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      2397be69
    • L
      lxc: move wireless PHYs to a network namespace · 3a495948
      Lubomir Rintel 提交于
      The 802.11 interfaces can not be moved by themselves, their Phy has to move too.
      
      If there are other interfaces, they have to move too -- hopefully it's not too
      confusing. This is a less-invasive alternative to defining a new hostdev type
      for PHYs.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      3a495948
    • P
      virbuffer: fix build on rhel-6 · 358dbf84
      Pavel Hrdina 提交于
      On rhel-6 is broken gcc that reports this warning:
      
      util/virbuffer.c:500: error: logical '&&' with non-zero constant will
          always evaluate as true [-Wlogical-op]
      
      Move the pragma directive before function virBufferEscapeString because
      since commit aeb5262e this function uses 'strchr' too.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      358dbf84
  9. 16 4月, 2015 4 次提交
  10. 15 4月, 2015 7 次提交
  11. 14 4月, 2015 2 次提交
  12. 13 4月, 2015 2 次提交
  13. 10 4月, 2015 2 次提交