1. 11 1月, 2011 9 次提交
    • E
      cpu: plug memory leak · fae1b8aa
      Eric Blake 提交于
      * src/cpu/cpu_x86.c (x86ModelLoad): Free data before overwriting.
      fae1b8aa
    • E
      network: plug memory leak · 6e2bab80
      Eric Blake 提交于
      * src/conf/network_conf.c (virNetworkDefParseXML): Release ipNodes.
      6e2bab80
    • E
      network: plug unininitialized read found by valgrind · 243b7814
      Eric Blake 提交于
      * src/util/network.c (virSocketAddrMask): Zero out port, so that
      iptables can initialize just the netmask then call
      virSocketFormatAddr without an uninitialized read in getnameinfo.
      243b7814
    • J
      718a8dc6
    • C
      python: Use PyCapsule API if available · 4254dfea
      Cole Robinson 提交于
      On Fedore 14, virt-manager spews a bunch of warnings to the console:
      
      /usr/lib64/python2.7/site-packages/libvirt.py:1781: PendingDeprecationWarning: The CObject type is marked Pending Deprecation in Python 2.7.  Please use capsule objects instead.
      
      Have libvirt use the capsule API if available. I've verified this compiles
      fine on older python (2.6 in RHEL6 which doesn't have capsules), and
      virt-manager seems to function fine.
      4254dfea
    • C
      event-test: Simplify debug on/off · 8f3b6bc2
      Cole Robinson 提交于
      Make it easy to change debugging if being used by a client program.
      8f3b6bc2
    • C
      remote: Don't lose track of events when callbacks are slow · 1dd5c7f2
      Cole Robinson 提交于
      After the remote driver runs an event callback, it unconditionally disables the
      loop timer, thinking it just flushed every queued event. This doesn't work
      correctly though if an event is queued while a callback is running.
      
      The events actually aren't being lost, it's just that the event loop didn't
      think there was anything that needed to be dispatched. So all those 'lost
      events' should actually get re-triggered if you manually kick the loop by
      generating a new event (like creating a new guest).
      
      The solution is to disable the dispatch timer _before_ we invoke any event
      callbacks. Events queued while a callback is running will properly reenable the
      timer.
      
      More info at https://bugzilla.redhat.com/show_bug.cgi?id=624252
      1dd5c7f2
    • D
      Refactor the security drivers to simplify usage · d6623003
      Daniel P. Berrange 提交于
      The current security driver usage requires horrible code like
      
          if (driver->securityDriver &&
              driver->securityDriver->domainSetSecurityHostdevLabel &&
              driver->securityDriver->domainSetSecurityHostdevLabel(driver->securityDriver,
                                                                    vm, hostdev) < 0)
      
      This pair of checks for NULL clutters up the code, making the driver
      calls 2 lines longer than they really need to be. The goal of the
      patchset is to change the calling convention to simply
      
        if (virSecurityManagerSetHostdevLabel(driver->securityDriver,
                                              vm, hostdev) < 0)
      
      The first check for 'driver->securityDriver' being NULL is removed
      by introducing a 'no op' security driver that will always be present
      if no real driver is enabled. This guarentees driver->securityDriver
      != NULL.
      
      The second check for 'driver->securityDriver->domainSetSecurityHostdevLabel'
      being non-NULL is hidden in a new abstraction called virSecurityManager.
      This separates the driver callbacks, from main internal API. The addition
      of a virSecurityManager object, that is separate from the virSecurityDriver
      struct also allows for security drivers to carry state / configuration
      information directly. Thus the DAC/Stack drivers from src/qemu which
      used to pull config from 'struct qemud_driver' can now be moved into
      the 'src/security' directory and store their config directly.
      
      * src/qemu/qemu_conf.h, src/qemu/qemu_driver.c: Update to
        use new virSecurityManager APIs
      * src/qemu/qemu_security_dac.c,  src/qemu/qemu_security_dac.h
        src/qemu/qemu_security_stacked.c, src/qemu/qemu_security_stacked.h:
        Move into src/security directory
      * src/security/security_stack.c, src/security/security_stack.h,
        src/security/security_dac.c, src/security/security_dac.h: Generic
        versions of previous QEMU specific drivers
      * src/security/security_apparmor.c, src/security/security_apparmor.h,
        src/security/security_driver.c, src/security/security_driver.h,
        src/security/security_selinux.c, src/security/security_selinux.h:
        Update to take virSecurityManagerPtr object as the first param
        in all callbacks
      * src/security/security_nop.c, src/security/security_nop.h: Stub
        implementation of all security driver APIs.
      * src/security/security_manager.h, src/security/security_manager.c:
        New internal API for invoking security drivers
      * src/libvirt.c: Add missing debug for security APIs
      d6623003
    • O
      conf: Report error if invalid type specified for character device · 92d65301
      Osier Yang 提交于
      If invalid type is specified, e.g.
      <serial type='foo'>
          <target port='0'/>
      </serial>
      
      We replace 'foo' with "null" type implicitly, without reporting an
      error message to tell the user, and "start" or "edit" the domain
      will be success.
      
      It's not good to guess what the user wants, This patch is to fix
      the problem.
      
      * src/conf/domain_conf.c
      92d65301
  2. 10 1月, 2011 1 次提交
    • J
      daemon: Fix core dumps if unix_sock_group is set · 5e5acbc8
      Jiri Denemark 提交于
      Setting unix_sock_group to something else than default "root" in
      /etc/libvirt/libvirtd.conf prevents system libvirtd from dumping core on
      crash. This is because we used setgid(unix_sock_group) before binding to
      /var/run/libvirt/libvirt-sock* and setgid() back to original group.
      However, if a process changes its effective or filesystem group ID, it
      will be forbidden from leaving core dumps unless fs.suid_dumpable sysctl
      is set to something else then 0 (and it is 0 by default).
      
      Changing socket's group ownership after bind works better. And we can do
      so without introducing a race condition since we loosen access rights by
      changing the group from root to something else.
      5e5acbc8
  3. 08 1月, 2011 2 次提交
  4. 07 1月, 2011 6 次提交
  5. 06 1月, 2011 7 次提交
    • E
      schema: tighten <serial><protocol type=...> relaxNG · 2d44cb49
      Eric Blake 提交于
      * docs/schemas/domain.rng (qemucdevSrcDef): Restrict list of
      supported <protocol type=> values.
      2d44cb49
    • K
      bridge: Fix generation of dnsmasq's --dhcp-hostsfile option · a43c7338
      Kay Schubert 提交于
      I added a host definition to a network definition:
      
      <network>
        <name>Lokal</name>
        <uuid>2074f379-b82c-423f-9ada-305d8088daaa</uuid>
        <bridge name='virbr1' stp='on' delay='0' />
        <ip address='192.168.180.1' netmask='255.255.255.0'>
          <dhcp>
            <range start='192.168.180.128' end='192.168.180.254' />
            <host mac='23:74:00:03:42:02' name='somevm' ip='192.168.180.10' />
          </dhcp>
        </ip>
      </network>
      
      But due to the wrong if-statement the argument --dhcp-hostsfile doesn't get
      added to the dnsmasq command. The patch below fixes it for me.
      a43c7338
    • J
      qemu: Fix bogus warning about uninitialized saveptr · 4684f478
      Jiri Denemark 提交于
      The warning is bogus since strtok_r doesn't use the value when it's
      first called and initializes it for the following calls.
      4684f478
    • L
      Don't chown qemu saved image back to root after save if dynamic_ownership=0 · a691cb88
      Laine Stump 提交于
      When dynamic_ownership=0, saved images must be owned by the same uid
      as is used to run the qemu process, otherwise restore won't work. To
      accomplish this, qemuSecurityDACRestoreSavedStateLabel() needs to
      simply return when it's called.
      
      This fix is in response to:
      
        https://bugzilla.redhat.com/show_bug.cgi?id=661720
      a691cb88
    • 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
  6. 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
  7. 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
  8. 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
  9. 30 12月, 2010 1 次提交
  10. 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