1. 26 6月, 2013 1 次提交
    • L
      network: allow <vlan> in type='hostdev' networks · 4b42e3b9
      Laine Stump 提交于
      Although SRIOV network cards support setting a vlan tag on their
      virtual functions, and although setting this vlan tag via a <vlan>
      element in a domain's <interface> works, setting a vlan tag for these
      devices in a <network> definition, or in a network <portgroup>
      definition is also supposed to work (and the comment that validates
      <vlan> usage even says that!). However, the check to allow it only
      checked for an openvswitch network, so attempts to add <vlan> to a
      network of type='hostdev' would fail.
      4b42e3b9
  2. 24 6月, 2013 1 次提交
  3. 21 6月, 2013 1 次提交
    • L
      network: increase max number of routes · 2bdf548f
      Laine Stump 提交于
      This fixes the problem reported in:
      
         https://bugzilla.redhat.com/show_bug.cgi?id=972690
      
      When checking for a collision of a new libvirt network's subnet with
      any existing routes, we read all of /proc/net/route into memory, then
      parse all the entries. The function that we use to read this file
      requires a "maximum length" parameter, which had previously been set
      to 64*1024. As each line in /proc/net/route is 128 bytes, this would
      allow for a maximum of 512 entries in the routing table.
      
      This patch increases that number to 128 * 100000, which allows for
      100,000 routing table entries. This means that it's possible that 12MB
      would be allocated, but that would only happen if there really were
      100,000 route table entries on the system, it's only held for a very
      short time.
      
      Since there is no method of specifying and unlimited max (and that
      would create a potential denial of service anyway) hopefully this
      limit is large enough to accomodate everyone.
      2bdf548f
  4. 05 6月, 2013 1 次提交
    • E
      maint: don't use config.h in .h files · 1add9c78
      Eric Blake 提交于
      Enforce the rule that .h files don't need to (redundantly)
      include <config.h>.
      
      * cfg.mk (sc_prohibit_config_h_in_headers): New rule.
      (_virsh_includes): Delete; instead, inline a smaller number of
      exclusions...
      (exclude_file_name_regexp--sc_require_config_h)
      (exclude_file_name_regexp--sc_require_config_h_first): ...here.
      * daemon/libvirtd.h (includes): Fix offenders.
      * src/driver.h (includes): Likewise.
      * src/gnutls_1_0_compat.h (includes): Likewise.
      * src/libxl/libxl_conf.h (includes): Likewise.
      * src/libxl/libxl_driver.h (includes): Likewise.
      * src/lxc/lxc_conf.h (includes): Likewise.
      * src/lxc/lxc_driver.h (includes): Likewise.
      * src/lxc/lxc_fuse.h (includes): Likewise.
      * src/network/bridge_driver.h (includes): Likewise.
      * src/phyp/phyp_driver.h (includes): Likewise.
      * src/qemu/qemu_conf.h (includes): Likewise.
      * src/util/virnetlink.h (includes): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      1add9c78
  5. 22 5月, 2013 1 次提交
    • M
      qemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net · 1f24f682
      Michal Privoznik 提交于
      In order to learn libvirt multiqueue several things must be done:
      
      1) The '/dev/net/tun' device needs to be opened multiple times with
      IFF_MULTI_QUEUE flag passed to ioctl(fd, TUNSETIFF, &ifr);
      
      2) Similarly, '/dev/vhost-net' must be opened as many times as in 1)
      in order to keep 1:1 ratio recommended by qemu and kernel folks.
      
      3) The command line construction code needs to switch from 'fd=X' to
      'fds=X:Y:...:Z' and from 'vhostfd=X' to 'vhostfds=X:Y:...:Z'.
      
      4) The monitor handling code needs to learn to pass multiple FDs.
      1f24f682
  6. 21 5月, 2013 1 次提交
  7. 14 5月, 2013 1 次提交
    • G
      Support for static routes on a virtual bridge · ccff335f
      Gene Czarcinski 提交于
      network: static route support for <network>
      
      This patch adds the <route> subelement of <network> to define a static
      route.  the address and prefix (or netmask) attribute identify the
      destination network, and the gateway attribute specifies the next hop
      address (which must be directly reachable from the containing
      <network>) which is to receive the packets destined for
      "address/(prefix|netmask)".
      
      These attributes are translated into an "ip route add" command that is
      executed when the network is started. The command used is of the
      following form:
      
        ip route add <address>/<prefix> via <gateway> \
                     dev <virbr-bridge> proto static metric <metric>
      
      Tests are done to validate that the input data are correct.  For
      example, for a static route ip definition, the address must be a
      network address and not a host address.  Additional checks are added
      to ensure that the specified gateway is directly reachable via this
      network (i.e. that the gateway IP address is in the same subnet as one
      of the IP's defined for the network).
      
      prefix='0' is supported for both family='ipv4' address='0.0.0.0'
      netmask='0.0.0.0' or prefix='0', and for family='ipv6' address='::',
      prefix=0', although care should be taken to not override a desired
      system default route.
      
      Anytime an attempt is made to define a static route which *exactly*
      duplicates an existing static route (for example, address=::,
      prefix=0, metric=1), the following error message will be sent to
      syslog:
      
          RTNETLINK answers: File exists
      
      This can be overridden by decreasing the metric value for the route
      that should be preferred, or increasing the metric for the route that
      shouldn't be preferred (and is thus in place only in anticipation that
      the preferred route may be removed in the future).  Caution should be
      used when manipulating route metrics, especially for a default route.
      
      Note: The use of the command-line interface should be replaced by
      direct use of libnl so that error conditions can be handled better.  But,
      that is being left as an exercise for another day.
      Signed-off-by: NGene Czarcinski <gene@czarc.net>
      Signed-off-by: NLaine Stump <laine@laine.org>
      ccff335f
  8. 09 5月, 2013 1 次提交
  9. 03 5月, 2013 3 次提交
    • L
      network: fix network driver startup for qemu:///session · 2ffd87d8
      Laine Stump 提交于
      This should resolve https://bugzilla.redhat.com/show_bug.cgi?id=958907
      
      Recent new addition of code to read/write active network state to the
      NETWORK_STATE_DIR in the network driver broke startup for
      qemu:///session. The network driver had several state file paths
      hardcoded to /var, which could never possibly work in session mode.
      
      This patch modifies *all* state files to use a variable string that is
      set differently according to whether or not we're running
      privileged. (It turns out that logDir was never used, so it's been
      completely eliminated.)
      
      There are very definitely other problems preventing dnsmasq and radvd
      from running in non-privileged mode, but it's more consistent to have
      the directories used by them be determined in the same fashion.
      
      NB: I've noted before that the network driver is storing its state
      (including dnsmasq and radvd state) in /var/lib, while qemu stores its
      state in /var/run. It would probably have been better if the two
      matched, but it's been this way for a long time, and changing it would
      break running installations during an upgrade, so it's best to just
      leave it as it is.
      2ffd87d8
    • D
      Fix format string handling in network driver · 5c1678ab
      Daniel P. Berrange 提交于
      The call to virReportError conditionally switched between
      two format strings, with different numbers of placeholders.
      This meant the format string with no placeholders was not
      protected by a "%s".
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5c1678ab
    • E
      build: avoid useless virAsprintf · 25ae3d30
      Eric Blake 提交于
      virAsprintf(&foo, "%s", bar) is wasteful compared to
      foo = strdup(bar) (or eventually, VIR_STRDUP(foo, bar),
      but one thing at a time...).
      
      Noticed while reviewing Laine's attempt to clean up broken
      qemu:///session.
      
      * cfg.mk (sc_prohibit_asprintf): Enhance rule.
      * src/esx/esx_storage_backend_vmfs.c
      (esxStorageBackendVMFSVolumeLookupByKey): Fix offender.
      * src/network/bridge_driver.c (networkStateInitialize): Likewise.
      * src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopDHCPOpen):
      Likewise.
      * src/storage/storage_backend_sheepdog.c
      (virStorageBackendSheepdogRefreshVol): Likewise.
      * src/util/vircgroup.c (virCgroupAddTaskStrController): Likewise.
      * src/util/virdnsmasq.c (addnhostsAdd): Likewise.
      * src/xen/block_stats.c (xenLinuxDomainDeviceID): Likewise.
      * src/xen/xen_driver.c (xenUnifiedConnectOpen): Likewise.
      * tools/virsh.c (vshGetTypedParamValue): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      25ae3d30
  10. 02 5月, 2013 1 次提交
    • M
      virutil: Move string related functions to virstring.c · 7c9a2d88
      Michal Privoznik 提交于
      The source code base needs to be adapted as well. Some files
      include virutil.h just for the string related functions (here,
      the include is substituted to match the new file), some include
      virutil.h without any need (here, the include is removed), and
      some require both.
      7c9a2d88
  11. 01 5月, 2013 1 次提交
  12. 30 4月, 2013 1 次提交
    • P
      network: Don't remove transient network if creating of config file fails · 8e918900
      Peter Krempa 提交于
      On the off-chance that creation of persistent configuration file would
      fail when defining a network that is already started as transient, the
      code would remove the transient data structure and thus the network.
      
      This patch changes the code so that in such case, the network is again
      marked as transient and left behind.
      8e918900
  13. 27 4月, 2013 2 次提交
    • L
      conf: remove extraneous _TYPE from driver backend enums · 19635f7d
      Laine Stump 提交于
      This isn't strictly speaking a bugfix, but I realized I'd gotten a bit
      too verbose when I chose the names for
      VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_*. This shortens them all a bit.
      19635f7d
    • L
      network: support <driver name='vfio'/> in network definitions · d64e114f
      Laine Stump 提交于
      I remembered to document this bit, but somehow forgot to implement it.
      
      This adds <driver name='kvm|vfio'/> as a subelement to the <forward>
      element of a network (this puts it parallel to the match between
      mode='hostdev' attribute in a network and type='hostdev' in an
      <interface>).
      
      Since it's already documented, only the parser, formatter, backend
      driver recognition (it just translates/moves the flag into the
      <interface> at the appropriate time), and a test case were needed.
      
      (I used a separate enum for the values both because the original is
      defined in domain_conf.h, which is unavailable from network_conf.h,
      and because in the future it's possible that we may want to support
      other non-hostdev oriented driver names in the network parser; this
      makes sure that one can be expanded without the other).
      d64e114f
  14. 26 4月, 2013 1 次提交
    • L
      conf: put hostdev pci address in a struct · 9f80fc1b
      Laine Stump 提交于
      There will soon be other items related to pci hostdevs that need to be
      in the same part of the hostdevsubsys union as the pci address (which
      is currently a single member called "pci". This patch replaces the
      single member named pci with a struct named pci that contains a single
      member named "addr".
      9f80fc1b
  15. 24 4月, 2013 3 次提交
  16. 19 4月, 2013 1 次提交
    • P
      network: bridge_driver: don't lose transient networks on daemon restart · 446dd66b
      Peter Krempa 提交于
      Until now tranisent networks weren't really useful as libvirtd wasn't
      able to remember them across restarts. This patch adds support for
      loading status files of transient networks (that already were generated)
      so that the status isn't lost.
      
      This patch chops up virNetworkObjUpdateParseFile and turns it into
      virNetworkLoadState and a few friends that will help us to load status
      XMLs and refactors the functions that are loading the configs to use
      them.
      446dd66b
  17. 18 4月, 2013 1 次提交
  18. 17 4月, 2013 1 次提交
    • O
      cleanup: Remove the duplicate header · bc95be5d
      Osier Yang 提交于
      Detected by a simple Shell script:
      
      for i in $(git ls-files -- '*.[ch]'); do
          awk 'BEGIN {
              fail=0
          }
          /# *include.*\.h/{
              match($0, /["<][^">]*[">]/)
              arr[substr($0, RSTART+1, RLENGTH-2)]++
          }
          END {
              for (key in arr) {
                  if (arr[key] > 1) {
                      fail=1
                      printf("%d %s\n", arr[key], key)
                  }
              }
              if (fail == 1)
                  exit 1
          }' $i
      
          if test $? != 0; then
              echo "Duplicate header(s) in $i"
          fi
      done;
      
      A later patch will add the syntax-check to avoid duplicate
      headers.
      bc95be5d
  19. 11 3月, 2013 1 次提交
    • M
      bandwidth: Require network QoS if interface uses 'floor' · f3fb916d
      Michal Privoznik 提交于
      By current implementation, network inbound is required in order
      to use 'floor' for guaranteeing  minimal throughput. This is so,
      because we want user to tell us the maximal throughput of the
      network instead of finding out ourselves (and detect bogus values
      in case of virtual interfaces). However, we are nowadays
      requiring this only on documentation level. So if user starts a
      domain with 'floor' set on one its interfaces, we silently ignore
      the setting. We should error out instead.
      f3fb916d
  20. 27 2月, 2013 1 次提交
  21. 25 2月, 2013 1 次提交
    • G
      use client id for IPv6 DHCP host definition · 0b73a763
      Gene Czarcinski 提交于
      Originally, only a host name was used to associate a
      DHCPv6 request with a specific IPv6 address.  Further testing
      demonstrates that this is an unreliable method and, instead,
      a client-id or DUID needs to be used.  According to DHCPv6
      standards, this id can be a duid-LLT, duid-LL, or duid-UUID
      even though dnsmasq will accept almost any text string.
      
      Although validity checking of a specified string makes sure it is
      hexadecimal notation with bytes separated by colons, there is no
      rigorous check to make sure it meets the standard.
      
      Documentation and schemas have been updated.
      Signed-off-by: NGene Czarcinski <gene@czarc.net>
      Signed-off-by: NLaine Stump <laine@laine.org>
      0b73a763
  22. 23 2月, 2013 1 次提交
  23. 20 2月, 2013 3 次提交
  24. 06 2月, 2013 2 次提交
  25. 22 1月, 2013 1 次提交
  26. 18 1月, 2013 3 次提交
    • J
      network: Remove dead code getting, but not using ipdef · 7d31dd64
      John Ferlan 提交于
      The fetch of 'ipdef' in networkRefreshDhcpDaemon() when the loop to fill
      in ipv4def fails to find an ipv4 address with dhcp defined. The filled in
      ipdef value was not used.  Code was made unnecessary with commit it 2d5cd1.
      7d31dd64
    • L
      network: use bandwidth from portgroup when appropriate · 7d480a46
      Laine Stump 提交于
      The bandwidth plug and unplug functions were assuming that an
      interface's bandwidth setting was always specified directly in the
      domain's <interface> definition, but that's not necessarily true - it
      could have been obtained from a <portgroup> definition in the network
      definition. This patch fixes those functions to use
      virDomainNetGetActualBandwidth(), which gets the bandwidth pointer
      from iface->data.network.actual if it exists, otherwise returns
      iface->bandwidth.
      7d480a46
    • J
      network: Resolve some issues around vlan copying · 35ed25bd
      John Ferlan 提交于
      Remove extraneous check for 'netdef' when dereferencing for vlan.nTags.
      Prior code would already check if netdef was NULL.
      
      Coverity complained about a path where the 'vlan' was potentially valid,
      but a prior checks may not have allocated 'iface->data.network.actual',
      so like other paths it needs to be allocated on the fly.
      
      Move the copying of vlan up earlier in networkAllocateActualDevice, so
      that actual.type gets properly set.
      
      Since the first assignment to vlan is redundant except in the case of
      jumping immediately to validate from the start of the function,
      eliminate its initial setting at the top of the function in favor of
      calling the helper function virDomainNetGetActualVlan() (which doesn't
      depend on the local vlan pointer being initialized) down at validate:
      Signed-off-by: NLaine Stump <laine@redhat.com>
      35ed25bd
  27. 11 1月, 2013 2 次提交
  28. 21 12月, 2012 2 次提交