1. 06 1月, 2011 3 次提交
    • E
      maint: document dislike of mismatched if/else bracing · 1000d9c2
      Eric Blake 提交于
      * docs/hacking.html.in (Curly braces): Tighten recommendations to
      disallow if (cond) one-line; else { block; }.
      * HACKING: Regenerate.
      Suggested by Daniel P. Berrange.
      1000d9c2
    • L
      Log an error on attempts to add a NAT rule for non-IPv4 addresses · cd6a8f9c
      Laine Stump 提交于
      Although the upper-layer code protected against it, it was possible to
      call iptablesForwardMasquerade() with an IPv6 address and have it
      attempt to add a rule to the MASQUERADE chain of ip6tables (which
      doesn't exist).
      
      This patch changes that function to check the protocol of the given
      address, generate an error log if it's not IPv4 (AF_INET), and finally
      hardcodes all the family parameters sent down to lower-level functions.
      cd6a8f9c
    • 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
  2. 05 1月, 2011 3 次提交
    • J
      docs: added libvirt-announce to contact page · 6ea4c859
      Justin Clift 提交于
      Also added explicit links to the subscription and
      archive pages for the user and developer mailing
      lists.
      6ea4c859
    • S
      qemu driver: fix positioning to end of log file · 0922ff2f
      Stefan Berger 提交于
      While doing some testing with Qemu and creating huge logfiles I encountered the case where the VM could not start anymore due to the lseek() to the end of the Qemu VM's log file failing. The patch below fixes the problem by replacing the previously used 'int' with 'off_t'.
      
      To reproduce this error, you could do the following:
      
      dd if=/dev/zero of=/var/log/libvirt/qemu/<name of VM>.log bs=1024 count=$((1024*2048))
      
      and you should get an error like this:
      
      error: Failed to start domain <name of VM>
      error: Unable to seek to -2147482651 in /var/log/libvirt/qemu/<name of VM>.log: Success
      0922ff2f
    • E
      build: satisfy 'make syntax-check' regarding year change · 45829e67
      Eric Blake 提交于
      * .gnulib: Update to latest, to pick up 2011 copyrights.
      45829e67
  3. 04 1月, 2011 4 次提交
    • D
      Release of libvirt-0.8.7 · 6675e007
      Daniel Veillard 提交于
      * configure.ac libvirt.spec.in docs/news.html.in: bump version and add
        documentation
      * po/*po*: regenerate po and pot files
      6675e007
    • E
      build: avoid compilation warnings · c685993d
      Eric Blake 提交于
      Detected on cygwin:
      util/util.c: In function 'virSetUIDGID':
      util/util.c:2824: warning: format '%d' expects type 'int', but argument 7 has type 'gid_t' [-Wformat]
      (and three other lines)
      
      * src/util/util.c (virSetUIDGID): Cast, as is done elsewhere in
      this file, to avoid printf type mismatch warnings.
      c685993d
    • H
      threadpool: allow NULL jobdata · b2dbc160
      Hu Tao 提交于
      Don't require non-null jobdata to virThreadPoolSendJob().
      b2dbc160
    • C
      node_device: udev driver does not handle SR-IOV devices · 51798a5d
      Chris Wright 提交于
      The udev driver does not update a PCI device with its SR-IOV capabilities,
      when applicable, the way the hal driver does.  As a result, dumping the
      device's XML will not include the relevant physical or virtual function
      information.
      
      With this patch, the XML is correct:
      
      # virsh nodedev-dumpxml pci_0000_09_00_0
      <device>
        <name>pci_0000_09_00_0</name>
        <parent>pci_0000_00_1c_0</parent>
        <driver>
          <name>vxge</name>
        </driver>
        <capability type='pci'>
          <domain>0</domain>
          <bus>9</bus>
          <slot>0</slot>
          <function>0</function>
          <product id='0x5833'>X3100 Series 10 Gigabit Ethernet PCIe</product>
          <vendor id='0x17d5'>Neterion Inc.</vendor>
          <capability type='virt_functions'>
            <address domain='0x0000' bus='0x0a' slot='0x00' function='0x1'/>
            <address domain='0x0000' bus='0x0a' slot='0x00' function='0x2'/>
            <address domain='0x0000' bus='0x0a' slot='0x00' function='0x3'/>
          </capability>
        </capability>
      </device>
      
      # virsh nodedev-dumpxml pci_0000_0a_00_1
      <device>
        <name>pci_0000_0a_00_1</name>
        <parent>pci_0000_00_1c_0</parent>
        <driver>
          <name>vxge</name>
        </driver>
        <capability type='pci'>
          <domain>0</domain>
          <bus>10</bus>
          <slot>0</slot>
          <function>1</function>
          <product id='0x5833'>X3100 Series 10 Gigabit Ethernet PCIe</product>
          <vendor id='0x17d5'>Neterion Inc.</vendor>
          <capability type='phys_function'>
            <address domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
          </capability>
        </capability>
      </device>
      
      Cc: Dave Allan <dallan@redhat.com>
      Signed-off-by: NChris Wright <chrisw@redhat.com>
      51798a5d
  4. 01 1月, 2011 4 次提交
    • E
      virExec: fix logic bug · e80ed3fd
      Eric Blake 提交于
      As pointed out in https://bugzilla.redhat.com/show_bug.cgi?id=659855#c9,
      commit c3568ec2 introduced a regression where we no longer close any
      fd's beyond FD_SETSIZE.
      
      * src/util/util.c (__virExec): Continue to close fd's beyond
      keepfd range.
      Reported by Stefan Praszalowicz.
      e80ed3fd
    • L
      Improve virSocketAddrMask[ByPrefix] API · 77094eaf
      Laine Stump 提交于
      The original version of these functions would modify the address sent
      in, meaning that the caller would usually need to copy the address
      first. This change makes the original a const, and puts the resulting
      masked address into a new arg (which could point to the same
      virSocketAddr as the original, if the caller really wants to modify
      it).
      
      This also makes the API consistent with virSocketAddrBroadcast[ByPrefix].
      77094eaf
    • L
      Set broadcast address for IPv4 addresses on virtual network bridges · 2eeeb601
      Laine Stump 提交于
      Previously we used ioctl() to set the IP address and netmask of the
      bridges used for virtual networks, and apparently the SIOCSIFNETMASK
      ioctl implicitly set the broadcast address for the interface. The new
      method of using the "ip" command requires broadcast address to be
      explicitly specified though.
      2eeeb601
    • L
      Utility functions to produce an IPv4 broadcast address · 86387878
      Laine Stump 提交于
      These functions work only for IPv4, becasue IPv6 doesn't have the same
      concept of "broadcast address" as IPv4. They merely OR the inverse of
      the netmask with the given host address, thus turning on all the host
      bits.
      86387878
  5. 30 12月, 2010 1 次提交
  6. 28 12月, 2010 3 次提交
    • M
      vbox: Add support for VirtualBox 4.0 · 8d2e24d6
      Matthias Bolte 提交于
      Add vboxArrayGetWithUintArg to handle new signature variations. Also
      refactor vboxArrayGet* implementation to use a common helper function.
      
      Deal with the incompatible changes in the VirtualBox 4.0 API. This
      includes major changes in virtual machine and storage medium lookup,
      in RDP server property handling, in session/lock handling and other
      minor areas.
      
      VirtualBox 4.0 also dropped the old event API and replaced it with a
      completely new one. This is not fixed yet and will be addressed in
      another patch. Therefore, currently the domain events are supported
      for VirtualBox 3.x only.
      
      Based on initial work from Jean-Baptiste Rouault.
      8d2e24d6
    • M
      Fix misuse of VIR_ERR_INVALID_DOMAIN · c4ce8333
      Matthias Bolte 提交于
      VIR_ERR_INVALID_DOMAIN is meant for invalid domain pointers.
      VIR_ERR_NO_DOMAIN is meant for non-existing domains.
      c4ce8333
    • M
      vbox: Handle different IID representation in Version 2.2 on Windows · 30a13736
      Matthias Bolte 提交于
      On Windows IID's are represented as GUID by value, instead of nsID
      by reference on non-Windows platforms.
      
      Patch the vbox_CAPI_v2_2.h header to deal with this difference.
      
      Rewrite vboxIID abstraction that deals with the different IID
      representations. Add support for the GUID representation. Also unify
      the four context dependent free functions for vboxIIDs
      
        vboxIIDUnalloc, vboxIIDFree, vboxIIDUtf8Free, vboxIIDUtf16Free
      
      into vboxIIDUnalloc that is now safe to be called (even multiple
      times) on a vboxIID independent of the source and context of the
      vboxIID.
      
      The new vboxIID is designed to be used as a stack allocated variable.
      It has a value member that represents the actual IID value.
      30a13736
  7. 24 12月, 2010 22 次提交
    • M
      update docs for network disks · d0b9eea8
      MORITA Kazutaka 提交于
      Signed-off-by: NMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
      d0b9eea8
    • W
      build: fix building error when building without libvirtd · 3b13d252
      Wen Congyang 提交于
      When I build libvirt without libvirtd, I receive some errors:
      cp: cannot stat `/home/wency/rpmbuild/BUILDROOT/libvirt-0.8.6-1.el6.x86_64/etc/libvirt/qemu/networks/default.xml': No such file or directory
      
      My build step:
      # ./autogen.sh --without-libvirtd
      # make dist
      # rpmbuild --nodeps --define "_sourcedir `pwd`" --define "_without_libvirtd 1" -ba libvirt.spec
      
      The reason is we disable network when we do not build libvirt daemon in configure.ac.
      After fixing this bug, I build libvirt without libvirtd, I receive other errors:
      RPM build errors:
          Installed (but unpackaged) file(s) found:
         /usr/share/doc/libvirt-0.8.6/html/32favicon.png
         /usr/share/doc/libvirt-0.8.6/html/api.html
      ..
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      3b13d252
    • E
      qemu: add -incoming fd:n capability checking · abff0290
      Eric Blake 提交于
      * src/qemu/qemu_capabilities.h (QEMUD_CMD_FLAG_MIGRATE_QEMU_FD):
      New enum value.
      * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags): Populate
      flags according to qemu version.
      * tests/qemuhelptest.c (mymain): Adjust test.
      abff0290
    • J
      spec: Enable ESX driver on RHEL · 40dbbd6e
      Jiri Denemark 提交于
      40dbbd6e
    • D
      spec: Automatically turn on cgconfig service · 318a4f6b
      Daniel P. Berrange 提交于
      A number of the libvirt APIs require the use of cgroups. This is not
      enabled by default on a RHEL6 install. After discussion with cgroups
      team, it was decided that upon installation of the libvirt RPM, we
      should automatically turn on the cgroups service. This will activate a
      default configuration that turns on all cgroups controllers libvirt
      requires for full operation.
      318a4f6b
    • J
      bridge: Fix uninitialized variable · 0ecac8aa
      Jiri Denemark 提交于
      0ecac8aa
    • L
      Replace setuid/setgid/initgroups with virSetUIDGID() · f42cf7cb
      Laine Stump 提交于
      This patch fixes https://bugzilla.redhat.com/show_bug.cgi?id=664406
      
      If qemu is run as a different uid, it has been unable to access mode
      0660 files that are owned by a different user, but with a group that
      the qemu is a member of (aside from the one group listed in the passwd
      file), because initgroups() is not being called prior to the
      exec. initgroups will change the group membership of the process (and
      its children) to match the new uid.
      
      To make this happen, the setregid()/setreuid() code in
      qemuSecurityDACSetProcessLabel has been replaced with a call to
      virSetUIDGID(), which does both of those, plus calls initgroups.
      
      Similar, but not identical, code in qemudOpenAsUID() has been replaced
      with virSetUIDGID(). This not only consolidates the functionality to a
      single location, but also potentially fixes some as-yet unreported
      bugs.
      f42cf7cb
    • L
      new virSetUIDGID() utility function · d596c6dc
      Laine Stump 提交于
      virSetUIDGID() sets both the real and effective group and user of the
      process, and additionally calls initgroups() to assure that the
      process joins all the auxiliary groups that the given uid is a member
      of.
      d596c6dc
    • L
      Preserve errno across calls to error reporting functions & VIR_FREE · 17e19add
      Laine Stump 提交于
      There are cases when we want log an error message, and possibly free
      some memory as part of the cleanup, while still preserving errno for a
      caller, but the functions that log errors, and virFree (VIR_FREE) make
      system calls that will clear errno. This patch preserves errno during
      those most basic functions (corresponding to virReportSystemError(),
      virReportOOMError(), networkReportError(), etc, as well as
      virStrError()). It does *not preserve errno across calls to higher
      level items such as virDispatchError(), as it's assumed the caller is
      all finished with any need for errno by the time it dispatches the
      error.
      17e19add
    • L
      Run radvd for virtual networks with IPv6 addresses · 8090a568
      Laine Stump 提交于
      Running an instance of the router advertisement daemon (radvd) allows
      guests using the virtual network to automatically acquire an IPv6
      address and default route. Note that acquiring an address only works
      for networks with a prefix length of exactly 64 - radvd is still run
      in other circumstances, and still advertises routes, but autoconf will
      not work because it requires exactly 64 bits of address info from the
      network prefix.
      
      This patch avoids a race condition with the pidfile by manually
      daemonizing radvd rather than allowing it to daemonize itself, then
      creating our own pidfile (in addition to radvd's own file, which is
      unnecessary, but there is no way to tell radvd to not create it). This
      is accomplished by exec'ing it with "--debug 1" in the commandline,
      and using virCommand's features to fork, create a pidfile, and detach
      from the newly forked process.
      8090a568
    • L
      Turn on IPv6 support in the bridge_driver.c virtual network driver · 6ccce752
      Laine Stump 提交于
      At this point everything is already in place to make IPv6 happen, we just
      need to add a few rules, remove some checks for IPv4-only, and document
      the changes to the XML on the website.
      6ccce752
    • L
      Update iptables.c to also support ip6tables. · 537e65e7
      Laine Stump 提交于
      All of the iptables functions eventually call down to a single
      bottom-level function, and fortunately, ip6tables syntax (for all the
      args that we use) is identical to iptables format (except the
      addresses), so all we need to do is:
      
      1) Get an address family down to the lowest level function in each
         case, either implied through an address, or explicitly when no
         address is in the parameter list, and
      
      2) At the lowest level, just decide whether to call "iptables" or
         "ip6tables" based on the family.
      
      The location of the ip6tables binary is determined at build time by
      autoconf. If a particular target system happens to not have ip6tables
      installed, any attempts to run it will generate an error, but that
      won't happen unless someone tries to define an IPv6 address for a
      network. This is identical behavior to IPv4 addresses and iptables.
      537e65e7
    • L
      Support multiple IP addresses on one network in bridge_driver.c · ad48dfa1
      Laine Stump 提交于
      This patch reorganizes the code in bridge_driver.c to account for the
      concept of a single network with multiple IP addresses, without adding
      in the extra variable of IPv6. A small bit of code has been
      temporarily added that checks all given addresses to verify they are
      IPv4 - this will be removed when full IPv6 support is turned on.
      ad48dfa1
    • 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 the <dhcp> element optional in network.rng · 008abeee
      Laine Stump 提交于
      In practice this has always been optional, but the RNG has shown it as
      mandatory, and since all the examples for make check had it, it was
      never noticed. One of the existing test cases has been changed to
      check for this.
      
      I also noticed that the dhcp/host/ip was still defined as <text/>,
      but should really be <ref name='ipv4-addr'/>
      008abeee
    • L
      Replace brSetInetAddress/brSetInetNetmask with brAddInetAddress · 20718b8b
      Laine Stump 提交于
      brSetInetAddress can only set a single IP address on the bridge, and
      uses a method (ioctl(SIOCSETIFADDR)) that only works for IPv4. Replace
      it and brSetInetNetmask with a single function that uses the external
      "ip addr add" command to add an address/prefix to the interface - this
      supports IPv6, and allows adding multiple addresses to the interface.
      
      Although it isn't currently used in the code, we also add a
      brDelInetAddress for completeness' sake.
      
      Also, while we're modifying bridge.c, we change brSetForwardDelay and
      brSetEnableSTP to use the new virCommand API rather than the
      deprecated virRun, and also log an error message in bridge_driver.c if
      either of those fail (previously the failure would be completely
      silent).
      20718b8b
    • 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
      Pass prefix rather than netmask into iptables functions · b23d417c
      Laine Stump 提交于
      IPv6 will use prefix exclusively, and IPv4 will also optionally be
      able to use it, and the iptables functions really need a prefix
      anyway, so use the new virNetworkDefPrefix() function to send prefixes
      into iptables functions instead of netmasks.
      
      Also, in a couple places where a netmask is actually needed, use the
      new private API function for it rather than getting it directly. This
      will allow for cases where no netmask or prefix is specified (it
      returns the default for the current class of network.)
      b23d417c
    • L
      Consistently return 0 on success, -1 on failure in bridge_driver.c · 6e3e6db1
      Laine Stump 提交于
      Some functions in this file were returning 1 on success and 0 on
      failure, and others were returning 0 on success and -1 on
      failure. Switch them all to return the libvirt-preferred 0/-1.
      6e3e6db1
    • L
      Fix logging of failed iptables commands · cf731189
      Laine Stump 提交于
      The functions in iptables.c all return -1 on failure, but all their
      callers (which all happen to be in bridge_driver.c) assume that they
      are returning an errno, and the logging is done accordingly. This
      patch fixes all the error checking and logging to assume < 0 is an
      error, and nothing else.
      cf731189
    • 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
    • L
      New virSocketAddr utility functions · 1ab80f32
      Laine Stump 提交于
      virSocketPrefixToNetmask: Given a 'prefix', which is the number of 1
      bits in a netmask, fill in a virSocketAddr object with a netmask as an
      IP address (IPv6 or IPv4).
      
      virSocketAddrMask: Mask off the host bits in one virSocketAddr
      according to the netmask in another virSocketAddr.
      
      virSocketAddrMaskByPrefix, Mask off the host bits in a virSocketAddr
      according to a prefix (number of 1 bits in netmask).
      
      VIR_SOCKET_FAMILY: return the family of a virSocketAddr
      1ab80f32