1. 25 7月, 2011 2 次提交
  2. 22 7月, 2011 2 次提交
    • L
      conf: support abstracted interface info in network XML · 40fd7073
      Laine Stump 提交于
      The network XML is updated in the following ways:
      
      1) The <forward> element can now contain a list of forward interfaces:
      
           <forward .... >
             <interface dev='eth10'/>
             <interface dev='eth11'/>
             <interface dev='eth12'/>
             <interface dev='eth13'/>
           </forward>
      
         The first of these takes the place of the dev attribute that is
         normally in <forward> - when defining a network you can specify
         either one, and on output both will be present. If you specify
         both on input, they must match.
      
      2) In addition to forward modes of 'nat' and 'route', these new modes
         are supported:
      
           private, passthrough, vepa - when this network is referenced by a
           domain's interface, it will have the same effect as if the
           interface had been defined as type='direct', e.g.:
      
              <interface type='direct'>
                <source mode='${mode}' dev='${dev}>
                ...
              </interface>
      
           where ${mode} is one of the three new modes, and ${dev} is an interface
           selected from the list given in <forward>.
      
           bridge - if a <forward> dev (or multiple devs) is defined, and
           forward mode is 'bridge' this is just like the modes 'private',
           'passthrough', and 'vepa' above. If there is no forward dev
           specified but a bridge name is given (e.g. "<bridge
           name='br0'/>"), then guest interfaces using this network will use
           libvirt's "host bridge" mode, equivalent to this:
      
             <interface type='bridge'>
                <source bridge='${bridge-name}'/>
                ...
             </interface>
      
      3) A network can have multiple <portgroup> elements, which may be
         selected by the guest interface definition (by adding
         "portgroup='${name}'" in the <source> element along with the
         network name). Currently a portgroup can only contain a
         virtportprofile, but the intent is that other configuration items
         may be put there int the future (e.g. bandwidth config). When
         building a guest's interface, if the <interface> XML itself has no
         virtportprofile, and if the requested network has a portgroup with
         a name matching the name given in the <interface> (or if one of the
         network's portgroups is marked with the "default='yes'" attribute),
         the virtportprofile from that portgroup will be used by the
         interface.
      
      4) A network can have a virtportprofile defined at the top level,
         which will be used by a guest interface when connecting in one of
         the 'direct' modes if the guest interface XML itself hasn't
         specified any virtportprofile, and if there are also no matching
         portgroups on the network.
      40fd7073
    • E
      build: rename files.h to virfile.h · 8e22e089
      Eric Blake 提交于
      In preparation for a future patch adding new virFile APIs.
      
      * src/util/files.h, src/util/files.c: Move...
      * src/util/virfile.h, src/util/virfile.c: ...here, and rename
      functions to virFile prefix.  Macro names are intentionally
      left alone.
      * *.c: All '#include "files.h"' uses changed.
      * src/Makefile.am (UTIL_SOURCES): Reflect rename.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_close): Likewise.
      * src/libvirt_private.syms: Likewise.
      * docs/hacking.html.in: Likewise.
      * HACKING: Regenerate.
      8e22e089
  3. 06 7月, 2011 1 次提交
    • M
      Fix return value semantic of virFileMakePath · e123e1ee
      Matthias Bolte 提交于
      Some callers expected virFileMakePath to set errno, some expected
      it to return an errno value. Unify this to return 0 on success and
      -1 on error. Set errno to report detailed error information.
      
      Also optimize virFileMakePath if stat fails with an errno different
      from ENOENT.
      e123e1ee
  4. 29 6月, 2011 1 次提交
  5. 25 6月, 2011 2 次提交
  6. 13 5月, 2011 1 次提交
  7. 06 5月, 2011 2 次提交
    • M
      Add warning message to XML definition files stored on disk · 5d09c314
      Michal Privoznik 提交于
      Users often edit XML file stored in configuration directory
      thinking of modifying a domain/network/pool/etc. Thus it is wise
      to let them know they are using the wrong way and give them hint.
      5d09c314
    • E
      maint: rename virBufferVSprintf to virBufferAsprintf · 68ea80cf
      Eric Blake 提交于
      We already have virAsprintf, so picking a similar name helps for
      seeing a similar purpose.  Furthermore, the prefix V before printf
      generally implies 'va_list', even though this variant was '...', and
      the old name got in the way of adding a new va_list version.
      
      global rename performed with:
      
      $ git grep -l virBufferVSprintf \
        | xargs -L1 sed -i 's/virBufferVSprintf/virBufferAsprintf/g'
      
      then revert the changes in ChangeLog-old.
      68ea80cf
  8. 17 4月, 2011 1 次提交
  9. 18 2月, 2011 1 次提交
    • L
      Give each virtual network bridge its own fixed MAC address · 5754dbd5
      Laine Stump 提交于
      This fixes https://bugzilla.redhat.com/show_bug.cgi?id=609463
      
      The problem was that, since a bridge always acquires the MAC address
      of the connected interface with the numerically lowest MAC, as guests
      are started and stopped, it was possible for the MAC address to change
      over time, and this change in the network was being detected by
      Windows 7 (it sees the MAC of the default route change), so on each
      reboot it would bring up a dialog box asking about this "new network".
      
      The solution is to create a dummy tap interface with a MAC guaranteed
      to be lower than any guest interface's MAC, and attach that tap to the
      bridge as soon as it's created. Since all guest MAC addresses start
      with 0xFE, we can just generate a MAC with the standard "0x52, 0x54,
      0" prefix, and it's guaranteed to always win (physical interfaces are
      never connected to these bridges, so we don't need to worry about
      competing numerically with them).
      
      Note that the dummy tap is never set to IFF_UP state - that's not
      necessary in order for the bridge to take its MAC, and not setting it
      to UP eliminates the clutter of having an (eg) "virbr0-nic" displayed
      in the output of the ifconfig command.
      
      I chose to not auto-generate the MAC address in the network XML
      parser, as there are likely to be consumers of that API that don't
      need or want to have a MAC address associated with the
      bridge.
      
      Instead, in bridge_driver.c when the network is being defined, if
      there is no MAC, one is generated. To account for virtual network
      configs that already exist when upgrading from an older version of
      libvirt, I've added a %post script to the specfile that searches for
      all network definitions in both the config directory
      (/etc/libvirt/qemu/networks) and the state directory
      (/var/lib/libvirt/network) that are missing a mac address, generates a
      random address, and adds it to the config (and a matching address to
      the state file, if there is one).
      
      docs/formatnetwork.html.in: document <mac address.../>
      docs/schemas/network.rng: add nac address to schema
      libvirt.spec.in: %post script to update existing networks
      src/conf/network_conf.[ch]: parse and format <mac address.../>
      src/libvirt_private.syms: export a couple private symbols we need
      src/network/bridge_driver.c:
          auto-generate mac address when needed,
          create dummy interface if mac address is present.
      tests/networkxml2xmlin/isolated-network.xml
      tests/networkxml2xmlin/routed-network.xml
      tests/networkxml2xmlout/isolated-network.xml
      tests/networkxml2xmlout/routed-network.xml: add mac address to some tests
      5754dbd5
  10. 11 1月, 2011 1 次提交
  11. 06 1月, 2011 1 次提交
    • L
      Improve error reporting when parsing dhcp info for virtual networks · 6741ca36
      Laine Stump 提交于
      This is partially in response to
      
        https://bugzilla.redhat.com/show_bug.cgi?id=653300
      
      The crash in that report was coincidentally fixed when we switched
      from using inet_pton() to using virSocketParseAddr(), but the absence
      of an ip address in a dhcp static host definition was still silently
      ignored (and that entry discarded from the saved XML). This patch
      turns that into a logged failure; likewise if the entry has neither a
      mac address nor a name attribute (the entry is useless without at
      least one of those, plus an ip address).
      
      Since the network name is now pulled into this function in order for
      those error logs to be more informative, the other error messages in
      the function have also been changed to take advantage.
      6741ca36
  12. 24 12月, 2010 3 次提交
    • L
      Change virtual network XML parsing/formatting to support IPv6 · a950dd2a
      Laine Stump 提交于
      This commit adds support for IPv6 parsing and formatting to the
      virtual network XML parser, including moving around data definitions
      to allow for multiple <ip> elements on a single network, but only
      changes the consumers of this API to accommodate for the changes in
      API/structure, not to add any actual IPv6 functionality. That will
      come in a later patch - this patch attempts to maintain the same final
      functionality in both drivers that use the network XML parser - vbox
      and "bridge" (the Linux bridge-based driver used by the qemu
      hypervisor driver).
      
      * src/libvirt_private.syms: Add new private API functions.
      * src/conf/network_conf.[ch]: Change C data structure and
        parsing/formatting.
      * src/network/bridge_driver.c: Update to use new parser/formatter.
      * src/vbox/vbox_tmpl.c: update to use new parser/formatter
      * docs/schemas/network.rng: changes to the schema -
        * there can now be more than one <ip> element.
        * ip address is now an ip-addr (ipv4 or ipv6) rather than ipv4-addr
        * new optional "prefix" attribute that can be used in place of "netmask"
        * new optional "family" attribute - "ipv4" or "ipv6"
          (will default to ipv4)
        * define data types for the above
      * tests/networkxml2xml(in|out)/nat-network.xml: add multiple <ip> elements
        (including IPv6) to a single network definition to verify they are being
        correctly parsed and formatted.
      a950dd2a
    • L
      Make virtual network netmasks optional · 4713f074
      Laine Stump 提交于
      When a netmask isn't specified for an IPv4 address, one can be implied
      based on what network class range the address is in. The
      virNetworkDefPrefix function does this for us, so netmask isn't
      required.
      4713f074
    • L
      New virNetworkDef utility functions · 8322863f
      Laine Stump 提交于
      Later patches will add the possibility to define a network's netmask
      as a prefix (0-32, or 0-128 in the case of IPv6). To make it easier to
      deal with definition of both kinds (prefix or netmask), add two new
      functions:
      
      virNetworkDefNetmask: return a copy of the netmask into a
      virSocketAddr. If no netmask was specified in the XML, create a
      default netmask based on the network class of the virNetworkDef's IP
      address.
      
      virNetworkDefPrefix: return the netmask as numeric prefix (or the
      default prefix for the network class of the virNetworkDef's IP
      address, if no netmask was specified in the XML)
      8322863f
  13. 25 11月, 2010 2 次提交
    • E
      network: plug memory leak · d90babe9
      Eric Blake 提交于
      * src/conf/network_conf.c (virNetworkDHCPRangeDefParseXML): Free
      xml strings when no longer referenced.
      d90babe9
    • E
      maint: prohibit most uses of xmlGetProp · 416c09bc
      Eric Blake 提交于
      Making this change makes it easier to spot the memory leaks
      that will be fixed in the next patch.
      
      * cfg.mk (sc_prohibit_xmlGetProp): New rule.
      * .x-sc_prohibit_xmlGetProp: New exception.
      * Makefile.am (EXTRA_DIST): Ship exception file.
      * tools/virsh.c (cmdDetachInterface, cmdDetachDisk): Adjust
      offenders.
      * src/conf/storage_conf.c (virStoragePoolDefParseSource):
      Likewise.
      * src/conf/network_conf.c (virNetworkDHCPRangeDefParseXML)
      (virNetworkIPParseXML): Likewise.
      416c09bc
  14. 26 10月, 2010 1 次提交
    • D
      Fix formatting of network address in iptables helpers · eff1735e
      Daniel P. Berrange 提交于
      The network address was being set to 192.168.122.0 instead
      of 192.168.122.0/24. Fix this by removing the unneccessary
      'network' field from virNetworkDef and just pass the
      network address and netmask into the iptables APIs directly.
      
      * src/conf/network_conf.h, src/conf/network_conf.c: Remove
        the 'network' field from virNEtworkDef.
      * src/network/bridge_driver.c: Update for iptables API changes
      * src/util/iptables.c, src/util/iptables.h: Require the
        network address + netmask pair to be passed in
      eff1735e
  15. 22 10月, 2010 5 次提交
    • D
      Don't try to parse a NULL ip address for boot server · 4af71829
      Daniel P. Berrange 提交于
      The boot server IP address is optional, so it needs to be
      checked before attempting to parse it.
      
      * src/conf/network_conf.c: Don't parse NULL ip address for
        boot server
      4af71829
    • D
      Convert virNetwork to use virSocketAddr everywhere · 090404ac
      Daniel P. Berrange 提交于
      Instead of storing the IP address string in virNetwork related
      structs, store the parsed virSocketAddr. This will make it
      easier to add IPv6 support in the future, by letting driver
      code directly check what address family is present
      
      * src/conf/network_conf.c, src/conf/network_conf.h,
        src/network/bridge_driver.c: Convert to use virSocketAddr
        in virNetwork, instead of char *.
      * src/util/bridge.c, src/util/bridge.h,
        src/util/dnsmasq.c, src/util/dnsmasq.h,
        src/util/iptables.c, src/util/iptables.h: Convert to
        take a virSocketAddr instead of char * for any IP
        address parameters
      * src/util/network.h: Add macros to determine if an address
        is set, and what address family is set.
      090404ac
    • D
      Remove all use of inet_pton and inet_ntop · a8ae7d19
      Daniel P. Berrange 提交于
      The  inet_pton and inet_ntop functions are obsolete, replaced
      by getaddrinfo+getnameinfo with the AI_NUMERICHOST flag set.
      These can be accessed via the virSocket APIs.
      
      The bridge.c code had methods for fetching the IP address of
      a bridge which used inet_ntop. Aside from the use of inet_ntop
      these methods are broken, because a NIC can have multiple
      addresses and this only returns one address. Since the methods
      are never used, just remove them.
      
      * src/conf/network_conf.c, src/nwfilter/nwfilter_learnipaddr.c:
        Replace inet_pton and inet_ntop with virSocket APIs
      * src/util/bridge.c, src/util/bridge.h: Remove unused methods
        which called inet_ntop.
      a8ae7d19
    • D
      Fix error reporting for virSocketParse · 179c4be0
      Daniel P. Berrange 提交于
      The virSocketParse method was not doing any error reporting
      which meant the true cause of the problem was lost. Remove
      all error reporting from callers, and push it into virSocketParse
      
      * src/util/network.c: Add error reporting to virSocketParse
      * src/conf/domain_conf.c, src/conf/network_conf.c,
        src/network/bridge_driver.c: Remove error reporting in
        callers of virSocketParse
      179c4be0
    • D
      Fix passing of address family to virSocketParseAddr · 746c3364
      Daniel P. Berrange 提交于
      The virSocketParseAddr function was accepting any AF_* constant
      and using that to set the ai_flags field in struct addrinfo.
      This is invalid, since address families must go in the ai_family
      field of the struct.
      
      * src/util/network.c: Fix handling of address family
      * src/conf/network_conf.c, src/network/bridge_driver.c: Pass
        AF_UNSPEC instead of relying on it being 0.
      746c3364
  16. 19 10月, 2010 1 次提交
    • S
      Introduce VIR_CLOSE to be used rather than close() · f04de501
      Stefan Berger 提交于
      Since bugs due to double-closed file descriptors are difficult to track down in a multi-threaded system, I am introducing the VIR_CLOSE(fd) macro to help avoid mistakes here.
      
      There are lots of places where close() is being used. In this patch I am only cleaning up usage of close() in src/conf where the problems were.
      
      I also dare to declare close() as being deprecated in libvirt code base (HACKING).
      f04de501
  17. 02 9月, 2010 1 次提交
  18. 08 6月, 2010 1 次提交
    • D
      Network duplicate UUID/name checking · 3bb37439
      Daniel P. Berrange 提交于
      The network driver is not doing correct checking for
      duplicate UUID/name values. This introduces a new method
      virNetworkObjIsDuplicate, based on the previously
      written virDomainObjIsDuplicate.
      
      * src/conf/network_conf.c, src/conf/network_conf.c,
        src/libvirt_private.syms: Add virNetworkObjIsDuplicate,
      * src/network/bridge_driver.c: Call virNetworkObjIsDuplicate
        for checking uniqueness of uuid/names
      3bb37439
  19. 18 5月, 2010 1 次提交
    • J
      maint: add more free-like functions to the list and deal with fallout · a986892e
      Jim Meyering 提交于
      * cfg.mk (useless_free_options): Add many vir*Free* function names,
      and then remove the useless if-before-free tests exposed by running
      make syntax-check.
      * src/conf/interface_conf.c (virInterfaceDefFree): Remove useless "if".
      (virInterfaceAssignDef): Likewise.
      * src/conf/network_conf.c (virNetworkAssignDef): Likewise.
      * src/conf/storage_conf.c (virStoragePoolObjAssignDef): Likewise.
      * src/node_device/node_device_hal.c (dev_create): Likewise.
      * src/security/virt-aa-helper.c (vahDeinit): Likewise.
      * src/test/test_driver.c (testNodeDeviceCreateXML): Likewise.
      * src/util/conf.c (virConfSetValue): Likewise.
      a986892e
  20. 23 3月, 2010 1 次提交
  21. 08 3月, 2010 1 次提交
    • E
      build: consistently use C99 varargs macros · 2e56fb2b
      Eric Blake 提交于
      Prior to this patch, there was an inconsistent mix between GNU and C99.
      
      For consistency, and potential portability to other compilers, stick
      with the C99 vararg macro syntax.
      
      * src/conf/cpu_conf.c (virCPUReportError): Use C99 rather than GNU
        vararg macro syntax.
      * src/conf/domain_conf.c (virDomainReportError): Likewise.
      * src/conf/domain_event.c (eventReportError): Likewise.
      * src/conf/interface_conf.c (virInterfaceReportError): Likewise.
      * src/conf/network_conf.c (virNetworkReportError): Likewise.
      * src/conf/node_device_conf.h (virNodeDeviceReportError): Likewise.
      * src/conf/secret_conf.h (virSecretReportError): Likewise.
      * src/conf/storage_conf.h (virStorageReportError): Likewise.
      * src/esx/esx_device_monitor.c (ESX_ERROR): Use C99 rather than
        GNU vararg macro syntax.
      * src/esx/esx_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_interface_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_network_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_secret_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_storage_driver.c (ESX_ERROR): Likewise.
      * src/esx/esx_util.c (ESX_ERROR): Likewise.
      * src/esx/esx_vi.c (ESX_VI_ERROR): Likewise.
      * src/esx/esx_vi_methods.c (ESX_VI_ERROR): Likewise.
      * src/esx/esx_vi_types.c (ESX_VI_ERROR): Likewise.
      * src/esx/esx_vmx.c (ESX_ERROR): Likewise.
      * src/util/hostusb.c (usbReportError): Use C99 rather than GNU
        vararg macro syntax.
      * src/util/json.c (virJSONError): Likewise.
      * src/util/macvtap.c (ReportError): Likewise.
      * src/util/pci.c (pciReportError): Likewise.
      * src/util/stats_linux.c (virStatsError): Likewise.
      * src/util/util.c (virUtilError): Likewise.
      * src/util/xml.c (virXMLError): Likewise.
      * src/xen/proxy_internal.c (virProxyError): Use C99 rather than
        GNU vararg macro syntax.
      * src/xen/sexpr.c (virSexprError): Likewise.
      * src/xen/xen_driver.c (xenUnifiedError): Likewise.
      * src/xen/xen_hypervisor.c (virXenError): Likewise.
      * src/xen/xen_inotify.c (virXenInotifyError): Likewise.
      * src/xen/xend_internal.c (virXendError): Likewise.
      * src/xen/xm_internal.c (xenXMError): Likewise.
      * src/xen/xs_internal.c (virXenStoreError): Likewise.
      * src/cpu/cpu.h (virCPUReportError): Use C99 rather than GNU
        vararg macro syntax.
      * src/datatypes.c (virLibConnError): Likewise.
      * src/interface/netcf_driver.c (interfaceReportError): Likewise.
      * src/libvirt.c (virLibStreamError): Likewise.
      * src/lxc/lxc_conf.h (lxcError): Likewise.
      * src/network/bridge_driver.c (networkReportError): Likewise.
      * src/nodeinfo.c (nodeReportError): Likewise.
      * src/opennebula/one_conf.h (oneError): Likewise.
      * src/openvz/openvz_conf.h (openvzError): Likewise.
      * src/phyp/phyp_driver.c (PHYP_ERROR): Likewise.
      * src/qemu/qemu_conf.h (qemuReportError): Likewise.
      * src/remote/remote_driver.c (errorf): Likewise.
      * src/security/security_driver.h (virSecurityReportError): Likewise.
      * src/test/test_driver.c (testError): Likewise.
      * src/uml/uml_conf.h (umlReportError): Likewise.
      * src/vbox/vbox_driver.c (vboxError): Likewise.
      * src/vbox/vbox_tmpl.c (vboxError): Likewise.
      2e56fb2b
  22. 10 2月, 2010 1 次提交
    • D
      Remove virConnectPtr from network XML APis · 0677e111
      Daniel P. Berrange 提交于
      The virConnectPtr is no longer required for error reporting since
      that is recorded in a thread local. Remove use of virConnectPtr
      from all APIs in network_conf.{h,c} and update all callers to
      match
      0677e111
  23. 09 2月, 2010 3 次提交
  24. 22 12月, 2009 1 次提交
    • M
      Fix undefined reference to 'close_used_without_including_unistd_h' · 457d4ad9
      Matthias Bolte 提交于
      Found while trying to cross-compile libvirt on Fedora 12 for Windows.
      gnulib redefines 'close' to 'close_used_without_including_unistd_h'
      in sys/socket.h if winsock2.h is present and unistd.h has not been
      included before sys/socket.h. Reorder some includes to fix this.
      457d4ad9
  25. 10 12月, 2009 1 次提交
    • M
      Add virBufferFreeAndReset() and replace free() · 1b9d0744
      Matthias Bolte 提交于
      Replace free(virBufferContentAndReset()) with virBufferFreeAndReset().
      Update documentation and replace all remaining calls to free() with
      calls to VIR_FREE(). Also add missing calls to virBufferFreeAndReset()
      and virReportOOMError() in OOM error cases.
      1b9d0744
  26. 07 11月, 2009 1 次提交
  27. 03 11月, 2009 1 次提交
    • D
      Rename internal APis · fc8d1991
      Daniel P. Berrange 提交于
      Rename virDomainIsActive to virDomainObjIsActive, and
      virInterfaceIsActive to virInterfaceObjIsActive and finally
      virNetworkIsActive to virNetworkObjIsActive.
      
      * src/conf/domain_conf.c, src/conf/domain_conf.h,
        src/conf/interface_conf.h, src/conf/network_conf.c,
        src/conf/network_conf.h, src/lxc/lxc_driver.c,
        src/network/bridge_driver.c, src/opennebula/one_driver.c,
        src/openvz/openvz_driver.c, src/qemu/qemu_driver.c,
        src/test/test_driver.c, src/uml/uml_driver.c: Update for
        renamed APIs.
      fc8d1991