1. 21 2月, 2012 1 次提交
    • C
      caps: Improve error if passed an unknown arch · e1ecba46
      Cole Robinson 提交于
      Previously we would have:
      
      "os type 'hvm' & arch 'idontexist' combination is not supported"
      
      Now we get
      
      "No guest options available for arch 'idontexist'"
      
      or if options available but guest OS type not applicable:
      
      "No os type 'xen' available for arch 'x86_64'"
      e1ecba46
  2. 20 2月, 2012 1 次提交
    • L
      Fix compilation on MacOS X · 10269064
      Lincoln Myers 提交于
      * src/util/virfile.h: the virFileWrapperFdFlags being defined as
        a globa variable instead of a type ended up generating a duplicate
        symbol error.
      * AUTHORS: added Lincoln Myers
      10269064
  3. 17 2月, 2012 1 次提交
  4. 16 2月, 2012 9 次提交
    • A
      qemu: Prevent crash of libvirtd without guest agent · 18942b9b
      Alex Jia 提交于
      * src/qemu/qemu_process.c (qemuFindAgentConfig): avoid crash libvirtd due to
      deref a NULL pointer.
      
      * How to reproduce?
      1. virsh edit the following xml into guest configuration:
          <channel type='pty'>
            <target type='virtio'/>
          </channel>
      2. virsh start <domain>
      
      or
      % virt-install -n foo -r 1024 --disk path=/var/lib/libvirt/images/foo.img,size=1 \
      --channel pty,target_type=virtio -l <installation tree>
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      18942b9b
    • J
      qemu: Unlock monitor when connecting to dest qemu fails · e0d4b0db
      Jiri Denemark 提交于
      When migrating a qemu domain, we enter the monitor, send some commands,
      try to connect to destination qemu, send other commands, end exit the
      monitor. However, if we couldn't connect to destination qemu we forgot
      to exit the monitor.
      
      Bug introduced by commit d9d518b1.
      e0d4b0db
    • J
      qemu: Fix segfault when host CPU is empty · 2ccc4a60
      Jiri Denemark 提交于
      In case libvirtd cannot detect host CPU model (which may happen if it
      runs inside a virtual machine), the daemon is likely to segfault when
      starting a new qemu domain. It segfaults when domain XML asks for host
      (either model or passthrough) CPU or does not ask for any specific CPU
      model at all.
      2ccc4a60
    • M
      storage: Allow runtime detection of scrub · 28608856
      Michal Privoznik 提交于
      Currently, if scrub (used for wiping algorithms) is not present
      at compile time, we don't support any other wiping algorithms than
      zeroing, even if it was installed later. Switch to runtime detection
      instead.
      28608856
    • E
      snapshot: fix snapshot deletion use-after-free · 4c1c3611
      Eric Blake 提交于
      Bug introduced in commit 35abced2.  On an inactive domain,
      $ virsh snapshot-create-as dom snap
      $ virsh snapshot-create dom
      $ virsh snapshot-create dom
      $ virsh snapshot-delete --children dom snap
      could crash libvirtd, due to a use-after-free that results
      when the callback freed the current element in the iteration.
      
      * src/conf/domain_conf.c (virDomainSnapshotForEachChild)
      (virDomainSnapshotActOnDescendant): Allow iteration to delete
      current child.
      4c1c3611
    • A
      network: support Open vSwitch · df810046
      Ansis Atteka 提交于
      This patch allows libvirt to add interfaces to already
      existing Open vSwitch bridges. The following syntax in
      domain XML file can be used:
      
          <interface type='bridge'>
            <mac address='52:54:00:d0:3f:f2'/>
            <source bridge='ovsbr'/>
            <virtualport type='openvswitch'>
              <parameters interfaceid='921a80cd-e6de-5a2e-db9c-ab27f15a6e1d'/>
            </virtualport>
            <address type='pci' domain='0x0000' bus='0x00'
                                slot='0x03' function='0x0'/>
          </interface>
      
      or if libvirt should auto-generate the interfaceid use
      following syntax:
      
          <interface type='bridge'>
            <mac address='52:54:00:d0:3f:f2'/>
            <source bridge='ovsbr'/>
            <virtualport type='openvswitch'>
            </virtualport>
            <address type='pci' domain='0x0000' bus='0x00'
                                slot='0x03' function='0x0'/>
          </interface>
      
      It is also possible to pass an optional profileid. To do that
      use following syntax:
      
         <interface type='bridge'>
           <source bridge='ovsbr'/>
           <mac address='00:55:1a:65:a2:8d'/>
           <virtualport type='openvswitch'>
             <parameters interfaceid='921a80cd-e6de-5a2e-db9c-ab27f15a6e1d'
                         profileid='test-profile'/>
           </virtualport>
         </interface>
      
      To create Open vSwitch bridge install Open vSwitch and
      run the following command:
      
          ovs-vsctl add-br ovsbr
      df810046
    • L
      conf: rename virDomainNetGetActualDirectVirtPortProfile · 9368465f
      Laine Stump 提交于
      An upcoming patch will add a <virtualport> element to interfaces of
      type='bridge', so it makes sense to give this function a more generic
      name.
      9368465f
    • L
      qemu: increase the timeout before sending SIGKILL to qemu process · f367cd13
      Laine Stump 提交于
      The current default method of terminating the qemu process is to send
      a SIGTERM, wait for up to 1.6 seconds for it to cleanly shutdown, then
      send a SIGKILL and wait for up to 1.4 seconds more for the process to
      terminate. This is problematic because occasionally 1.6 seconds is not
      long enough for the qemu process to flush its disk buffers, so the
      guest's disk ends up in an inconsistent state.
      
      Since this only occasionally happens when the timeout prior to SIGKILL
      is 1.6 seconds, this patch increases that timeout to 10 seconds. At
      the very least, this should reduce the occurrence from "occasionally"
      to "extremely rarely". (Once SIGKILL is sent, it waits another 5
      seconds for the process to die before returning).
      
      Note that in the cases where it takes less than this for qemu to
      shutdown cleanly, libvirt will *not* wait for any longer than it would
      without this patch - qemuProcessKill polls the process and returns as
      soon as it is gone.
      f367cd13
    • L
      qemu: drop driver lock while trying to terminate qemu process · 595e26c0
      Laine Stump 提交于
      This patch is based on an earlier patch by Eric Blake which was never
      committed:
      
      https://www.redhat.com/archives/libvir-list/2011-November/msg00243.html
      
      Aside from rebasing, this patch only drops the driver lock once (prior
      to the first time the function sleeps), then leaves it dropped until
      it returns (Eric's patch would drop and re-acquire the lock around
      each call to sleep).
      
      At the time Eric sent his patch, the response (from Dan Berrange) was
      that, while it wasn't a good thing to be holding the driver lock while
      sleeping, we really need to rethink locking wrt the driver object,
      switching to a finer-grained approach that locks individual items
      within the driver object separately to allow for greater concurrency.
      
      This is a good plan, and at the time it made sense to not apply the
      patch because there was no known bug related to the driver lock being
      held in this function.
      
      However, we now know that the length of the wait in qemuProcessKill is
      sometimes too short to allow the qemu process to fully flush its disk
      cache before SIGKILL is sent, so we need to lengthen the timeout (in
      order to improve the situation with management applications until they
      can be updated to use the new VIR_DOMAIN_DESTROY_GRACEFUL flag added
      in commit 72f8a7f1). But, if we
      lengthen the timeout, we also lengthen the amount of time that all
      other threads in libvirtd are essentially blocked from doing anything
      (since just about everything needs to acquire the driver lock, if only
      for long enough to get a pointer to a domain).
      
      The solution is to modify qemuProcessKill to drop the driver lock
      while sleeping, as proposed in Eric's patch. Then we can increase the
      timeout with a clear conscience, and thus at least lower the chances
      that someone running with existing management software will suffer the
      consequence's of qemu's disk cache not being flushed.
      
      In the meantime, we still should work on Dan's proposal to make
      locking within the driver object more fine grained.
      
      (NB: although I couldn't find any instance where qemuProcessKill() was
      called with no jobs active for the domain (or some other guarantee
      that the current thread had at least one refcount on the domain
      object), this patch still follows Eric's method of temporarily adding
      a ref prior to unlocking the domain object, because I couldn't
      convince myself 100% that this was the case.)
      595e26c0
  5. 15 2月, 2012 2 次提交
  6. 14 2月, 2012 1 次提交
    • E
      qemu: make block io tuning smarter · 172d3429
      Eric Blake 提交于
      When blkdeviotune was first committed in 0.9.8, we had the limitation
      that setting one value reset all others.  But bytes and iops should
      be relatively independent.  Furthermore, setting tuning values on
      a live domain followed by dumpxml did not output the new settings.
      
      * src/qemu/qemu_driver.c (qemuDiskPathToAlias): Add parameter, and
      update callers.
      (qemuDomainSetBlockIoTune): Don't lose previous unrelated
      settings.  Make live changes reflect to dumpxml output.
      * tools/virsh.pod (blkdeviotune): Update documentation.
      172d3429
  7. 13 2月, 2012 3 次提交
  8. 11 2月, 2012 1 次提交
  9. 10 2月, 2012 6 次提交
    • O
      util: Do not use PRIx64 macro · 2bcfd5b1
      Osier Yang 提交于
      It breaks the build on Mingw32,  because PRIx64 is coming
      from the Win32 headers, but virAsprintf uses the gnulib printf.
      2bcfd5b1
    • A
      rpc: Plug memory leaks on doRemoteOpen() failure path · 6d514728
      Alex Jia 提交于
      Detected by valgrind. Leaks are introduced in commit c1b22644.
      
      * src/remote/remote_driver.c (doRemoteOpen): free client program memory in failure path.
      
      * How to reproduce?
      % valgrind -v --leak-check=full virsh -c qemu:
      
      * Actual result
      
      ==3969== 40 bytes in 1 blocks are definitely lost in loss record 8 of 28
      ==3969==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
          ==3969==    by 0x4C89C41: virAlloc (memory.c:101)
          ==3969==    by 0x4D5A236: virNetClientProgramNew (virnetclientprogram.c:60)
          ==3969==    by 0x4D47AB4: doRemoteOpen (remote_driver.c:658)
          ==3969==    by 0x4D49FFF: remoteOpen (remote_driver.c:871)
          ==3969==    by 0x4D13373: do_open (libvirt.c:1196)
          ==3969==    by 0x4D14535: virConnectOpenAuth (libvirt.c:1422)
          ==3969==    by 0x425627: main (virsh.c:18537)
          ==3969==
          ==3969== 40 bytes in 1 blocks are definitely lost in loss record 9 of 28
          ==3969==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
          ==3969==    by 0x4C89C41: virAlloc (memory.c:101)
          ==3969==    by 0x4D5A236: virNetClientProgramNew (virnetclientprogram.c:60)
          ==3969==    by 0x4D47AD7: doRemoteOpen (remote_driver.c:664)
          ==3969==    by 0x4D49FFF: remoteOpen (remote_driver.c:871)
          ==3969==    by 0x4D13373: do_open (libvirt.c:1196)
          ==3969==    by 0x4D14535: virConnectOpenAuth (libvirt.c:1422)
          ==3969==    by 0x425627: main (virsh.c:18537)
          ==3969==
          ==3969== LEAK SUMMARY:
          ==3969==    definitely lost: 80 bytes in 2 blocks
      Signed-off-by: NAlex Jia <ajia@redhat.com>
      6d514728
    • O
      npiv: Auto-generate WWN if it's not specified · 7c90026d
      Osier Yang 提交于
      The auto-generated WWN comply with the new addressing schema of WWN:
      
      <quote>
      the first nibble is either hex 5 or 6 followed by a 3-byte vendor
      identifier and 36 bits for a vendor-specified serial number.
      </quote>
      
      We choose hex 5 for the first nibble. And for the 3-bytes vendor ID,
      we uses the OUI according to underlying hypervisor type, (invoking
      virConnectGetType to get the virt type). e.g. If virConnectGetType
      returns "QEMU", we use Qumranet's OUI (00:1A:4A), if returns
      ESX|VMWARE, we use VMWARE's OUI (00:05:69). Currently it only
      supports qemu|xen|libxl|xenapi|hyperv|esx|vmware drivers. The last
      36 bits are auto-generated.
      7c90026d
    • M
      Remove single quotes from audit records · 8ac1f8f4
      Marcelo Cerri 提交于
      Some audit records generated by libvirt contain fields enclosed by single
      quotes. Since those fields are inside the msg field, which is enclosed by
      single quotes, these records generated by libvirt are not correctly parsed by
      libauparse.
      8ac1f8f4
    • L
      GetCPUStats: fix overflow test · f9f2d3b1
      Lai Jiangshan 提交于
      Bug introduced in commit c6ec021b.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      f9f2d3b1
    • M
      domain: add implicit USB controller · 42043afc
      Marc-André Lureau 提交于
      Some tools, such as virt-manager, prefers having the default USB
      controller explicit in the XML document. This patch makes sure there
      is one. With this patch, it is now possible to switch from USB1 to
      USB2 from the release 0.9.1 of virt-manager.
      
      Fix tests to pass with this change.
      42043afc
  10. 09 2月, 2012 7 次提交
  11. 08 2月, 2012 8 次提交
    • J
      qemu: Fix memory leak when building -cpu argument · 91ca45f9
      Jiri Denemark 提交于
      Reported by Alex Jia:
      
      ==21503== 112 (32 direct, 80 indirect) bytes in 1 blocks are
      definitely lost in loss record 37 of 40
      ==21503==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
      ==21503==    by 0x4A8991: virAlloc (memory.c:101)
      ==21503==    by 0x505A6C: x86DataCopy (cpu_x86.c:247)
      ==21503==    by 0x507B34: x86Compute (cpu_x86.c:1225)
      ==21503==    by 0x43103C: qemuBuildCommandLine (qemu_command.c:3561)
      ==21503==    by 0x41C9F7: testCompareXMLToArgvHelper
      (qemuxml2argvtest.c:183)
      ==21503==    by 0x41E10D: virtTestRun (testutils.c:141)
      ==21503==    by 0x41B942: mymain (qemuxml2argvtest.c:705)
      ==21503==    by 0x41D7E7: virtTestMain (testutils.c:696)
      91ca45f9
    • J
      qemu: Always use iohelper for domain save · c4caab53
      Jiri Denemark 提交于
      This is probably not strictly needed as save operation is not live but
      we may have other reasons to avoid blocking qemu's main loop.
      c4caab53
    • J
      security: Driver 'none' cannot create confined guests · afb96301
      Jiri Denemark 提交于
      In case the caller specifies that confined guests are required but the
      security driver turns out to be 'none', we should return an error since
      this driver clearly cannot meet that requirement.  As a result of this
      error, libvirtd fails to start when the host admin explicitly sets
      confined guests are required but there is no security driver available.
      
      Since security driver 'none' cannot create confined guests, we override
      default confined setting so that hypervisor drivers do not thing they
      should create confined guests.
      afb96301
    • J
      seclabel: Do not output relabel attribute for type 'none' · f6957617
      Jiri Denemark 提交于
      Security label type 'none' requires relabel to be set to 'no' so there's
      no reason to output this extra attribute.  Moreover, since relabel is
      internally stored in a negative from (norelabel), the default value for
      relabel would be 'yes' in case there is no <seclabel> element in domain
      configuration.  In case VIR_DOMAIN_SECLABEL_DEFAULT turns into
      VIR_DOMAIN_SECLABEL_NONE, we would incorrectly output relabel='yes' for
      seclabel type 'none'.
      f6957617
    • J
      qemu: Always use iohelper for dumping domain core · c8683f23
      Jiri Denemark 提交于
      Qemu uses non-blocking I/O which doesn't play nice with regular file
      descriptors. We need to pass a pipe to qemu instead, which can easily be
      done using iohelper.
      c8683f23
    • J
      util: Generalize virFileDirectFd · afe6e58a
      Jiri Denemark 提交于
      virFileDirectFd was used for accessing files opened with O_DIRECT using
      libvirt_iohelper. We will want to use the helper for accessing files
      regardless on O_DIRECT and thus virFileDirectFd was generalized and
      renamed to virFileWrapperFd.
      afe6e58a
    • P
      On systems with dmidecode version 2.10 or older, · a76530c9
      Prerna Saxena 提交于
       dmidecode displays processor information, followed by BIOS, system and
       memory-DIMM details.
       Calls to virSysinfoParseBIOS(), virSysinfoParseSystem() would update
       the buffer pointer 'base', so the processor information would be lost
       before virSysinfoParseProcessor() was called. Sysinfo would therefore
       not be able to display processor details -- It only described <bios>,
       <system> and <memory_device> details.
       This patch attempts to insulate sysinfo from ordering of dmidecode
       output.
      
      Before the fix:
      ---------------
      virsh # sysinfo
      <sysinfo type='smbios'>
        <bios>
          ....
        </bios>
        <system>
          ....
        </system>
        <memory_device>
          ....
        </memory_device>
      
      After the fix:
      -------------
      virsh # sysinfo
      <sysinfo type='smbios'>
        <bios>
          ....
        </bios>
        <system>
          ....
        </system>
        <processor>
          ....
        </processor>
        <memory_device>
          ....
        </memory_device>
      a76530c9
    • C
      storage: Don't unsparsify images when cloning · 0ed86cfb
      Cole Robinson 提交于
      Input to the volume cloning code is a source volume and an XML
      descriptor for the new volume. It is possible for the new volume
      to have a greater size than source volume, at which point libvirt
      will just stick 0s on the end of the new image (for raw format
      anyways).
      
      Unfortunately a logic error messed up our tracking of the of the
      excess amount that needed to be written: end result is that sparse
      clones were made very much non-sparse, and cloning regular disk
      images could end up excessively sized (though data unaltered).
      
      Drop the 'remain' variable entriely here since it's redundant, and
      track actual allocation directly against the desired 'total'.
      0ed86cfb