1. 06 5月, 2011 3 次提交
    • D
      Move qemuProcessLogReadFD and qemuProcessLogFD methods · ce1b1f41
      Daniel P. Berrange 提交于
      Move the qemuProcessLogReadFD and qemuProcessLogFD methods
      into qemu_domain.c, renaming them to qemuDomainCreateLog
      and qemuDomainOpenLog.
      
      * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
        qemuDomainCreateLog and qemuDomainOpenLog.
      * src/qemu/qemu_process.c: Remove qemuProcessLogFD
        and qemuProcessLogReadFD
      ce1b1f41
    • D
      Log taint warnings in QEMU driver · 718ac9b5
      Daniel P. Berrange 提交于
      Wire up logging of VM tainting to the QEMU driver
      
       - If running QEMU as root user/group or without capabilities
         being cleared
       - If passing custom QEMU command line args
       - If issuing custom QEMU monitor commands
       - If using a network interface config with an associated
         shell script
       - If using a disk config relying on format probing
      
      The warnings, per-VM appear in the main libvirtd logs
      
        11:56:17.571: 10832: warning : qemuDomainObjTaint:712 : Domain id=1 name='l2' uuid=c7a3edbd-edaf-9455-926a-d65c16db1802 is tainted: high-privileges
        11:56:17.571: 10832: warning : qemuDomainObjTaint:712 : Domain id=1 name='l2' uuid=c7a3edbd-edaf-9455-926a-d65c16db1802 is tainted: disk-probing
      
      The taint flags are reset when the VM is stopped.
      
      * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Helper APIs
        for logging taint warnings
      * src/qemu/qemu_driver.c: Log tainting with custom QEMU monitor
        commands and disk/net hotplug with unsupported configs
      * src/qemu/qemu_process.c: Log tainting at startup based on
        unsupported configs
      718ac9b5
    • 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
  2. 05 5月, 2011 4 次提交
    • D
      Fix qemuMigrationToFile nonull annotation · f7fc885d
      Daniel P. Berrange 提交于
      The qemuMigrationToFile method was accidentally annotated for
      the 'compressor' parameter to be non-null, instead of the
      'path' parameter. Thus GCC with -O2, unhelpfully deleted the
      entire 'if (compressor == NULL)' block of code during
      optimization. Thus NULL was passed to virCommandNew() with
      predictably bad results.
      
      * src/qemu/qemu_migration.h: Fix non-null annotation to be
        against path instead of compressor
      f7fc885d
    • D
      Make QEMU migration use cached qemu capabilities data · 7c31e1ef
      Daniel P. Berrange 提交于
      * src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Remove
        qemuCaps parameters & use cached data
      * src/qemu/qemu_driver.c: Don't create & pass qemuCaps to
        migration methods
      7c31e1ef
    • D
      Make QEMU hotplug use cached qemu capabilities data · a623bff4
      Daniel P. Berrange 提交于
      * src/qemu/qemu_hotplug.h, src/qemu/qemu_hotplug.c: Remove
        qemuCaps parameters from all methods
      * src/qemu/qemu_driver.c: Don't create & pass qemuCaps to
        hotplug methods
      a623bff4
    • D
      Persist qemu capabilities in the domain status file · 43c01d38
      Daniel P. Berrange 提交于
      To cope with the QEMU binary being changed while a VM is running,
      it is neccessary to persist the original qemu capabilities at the
      time the VM is booted.
      
      * src/qemu/qemu_capabilities.c, src/qemu/qemu_capabilities.h: Add
        an enum for a string rep of every capability
      * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Support for
        storing capabilities in the domain status XML
      * src/qemu/qemu_process.c: Populate & free QEMU capabilities at
        domain startup
      43c01d38
  3. 04 5月, 2011 4 次提交
    • E
      qemu: update qemuCgroupControllerActive signature · 29e131de
      Eric Blake 提交于
      Clang warned about a dead assignment.  In the process, I noticed
      that we are only using the function for a bool value.  I audited
      all other callers in qemu_{migration,cgroup,driver,hotplug), and
      all were making the call in a bool context.
      
      Also, do bounds checking on the argument.
      
      * src/qemu/qemu_cgroup.c (qemuSetupCgroup): Delete dead
      assignment.
      (qemuCgroupControllerActive): Change return type to bool.
      * src/qemu/qemu_cgroup.h (qemuCgroupControllerActive): Likewise.
      29e131de
    • E
      qemu: remove dead assignment · 5f929dd3
      Eric Blake 提交于
      Detected by clang.
      
      * src/qemu/qemu_migration.c (qemuMigrationToFile): Nothing later
      uses is_reg.
      5f929dd3
    • E
      qemu: silence clang false positives · d8f75281
      Eric Blake 提交于
      Clang 2.8 wasn't quite able to follow that persistentDef was
      assigned earlier if (flags & VIR_DOMAIN_MEM_CONFIG) is true.
      Silence this false positive, to make clang analysis easier to use.
      
      * src/qemu/qemu_driver.c (qemudDomainSetMemoryFlags): Add an
      annotation to silence clang's claim of a NULL dereference.
      d8f75281
    • E
      qemu: avoid null pointer dereference · 4d080ee4
      Eric Blake 提交于
      This code has had problems historically.  As originally
      written, in commit 6bcf2501 (Jun 08), it could call unlink
      on a random string, nuking an unrelated file.
      
      Then commit 182a80b9 (Sep 09), the code was rewritten to
      allocate tmp, with both a use-after-free bug and a chance to
      call unlink(NULL).
      
      Commit e206946d (Mar 11) fixed the use-after-free, but not the
      NULL dereference.  Thanks to clang for catching this!
      
      * src/qemu/qemu_driver.c (qemudDomainMemoryPeek): Don't call
      unlink on NULL.
      4d080ee4
  4. 02 5月, 2011 1 次提交
    • C
      qemu: fix uninitialized variable warning · b15a8a1b
      Christophe Fergeau 提交于
      This commit fixes
      qemu/qemu_driver.c: In function 'qemuDomainModifyDeviceFlags':
      qemu/qemu_driver.c:4041:8: warning: 'ret' may be used uninitialized in this
      function [-Wuninitialized]
      qemu/qemu_driver.c:4013:9: note: 'ret' was declared here
      
      The variable is set to -1 so that the error paths are taken when the code
      to set it didn't get a chance to run. Without initializing it, we could
      return some an undefined value from this function.
      
      While I was at it, I made a trivial whitespace change in the same function
      to improve readability.
      b15a8a1b
  5. 30 4月, 2011 1 次提交
  6. 29 4月, 2011 1 次提交
  7. 28 4月, 2011 2 次提交
    • K
      libvirt/qemu - support persistent attach/detach disks · ab9102c2
      KAMEZAWA Hiroyuki 提交于
      Support changes of disks by MODIFY_CONFIG for qemu.
      
      This patch includes patches for qemu's disk to support
      virDomainAt(De)tachDeviceFlags with VIR_DOMAIN_DEVICE_MODIFY_CONFIG.
      
      Other devices can be added incrementally.
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      
      * /src/conf/domain_conf.c
      (virDomainDiskIndexByName): returns array index of disk in vmdef.
      (virDomainDiskRemoveByName): removes a disk which has the name in vmdef.
      * src/qemu/qemu_driver.c
      (qemuDomainAttachDeviceConfig): add support for Disks.
      (qemuDomainDetachDeviceConfig): add support for Disks.
      ab9102c2
    • K
      libvirt/qemu - support persistent modification of devices · da1eba6b
      KAMEZAWA Hiroyuki 提交于
      This patch adds functions for modify domain's persistent definition.
      To do error recovery in easy way, we use a copy of vmdef and update it.
      
      The whole sequence will be:
      
        make a copy of domain definition.
      
        if (flags & MODIFY_CONFIG)
            update copied domain definition
        if (flags & MODIF_LIVE)
            do hotplug.
        if (no error)
            save copied one to the file and update cached definition.
        else
            discard copied definition.
      
      This patch is mixuture of Eric Blake's work and mine.
      From: Eric Blake <eblake@redhat.com>
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      
      (virDomainObjCopyPersistentDef): make a copy of persistent vm definition
      (qemuDomainAttach/Detach/UpdateDeviceConfig) : callbacks. now empty
      (qemuDomainModifyDeviceFlags): add support for MODIFY_CONFIG and MODIFY_CURRENT
      da1eba6b
  8. 27 4月, 2011 1 次提交
    • W
      release PCI address only when we have ensured it successfully · 968fd011
      Wen Congyang 提交于
      Steps to reproduce this bug:
      1. # cat net.xml # 00:03.0 has been used
          <interface type='network'>
            <mac address='52:54:00:04:72:f3'/>
            <source network='default'/>
            <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
          </interface>
      
      2. # virsh attach-device vm1 net.xml
         error: Failed to attach device from net.xml
         error: internal error unable to reserve PCI address 0:0:3
      
      3. # virsh attach-device vm1 net.xml
         error: Failed to attach device from net.xml
         error: internal error unable to execute QEMU command 'device_add': Device 'rtl8139' could not be initialized
      
      The reason of this bug is that: we can not reserve PCI address 0:0:3 because it has
      been used, but we release PCI address when we reserve it failed.
      968fd011
  9. 26 4月, 2011 1 次提交
  10. 22 4月, 2011 4 次提交
    • K
      libvirt/qemu - clean up UpdateDevice for consolidation. · 9b8543b6
      KAMEZAWA Hiroyuki 提交于
      This patch strips reusable part of qemuDomainUpdateDeviceFlags()
      and consolidate it to qemuDomainModifyDeviceFlags().
      No functional changes.
      
      * src/qemu/qemu_driver.c
      (qemuDomainChangeDiskMediaLive) : pulled out code for updating disks.
      (qemuDomainUpdateDeviceLive) : core of UpdateDevice, extracted from
      UpdateDeviceFlags()
      (qemuDomainModifyDeviceFlags): add support for updating device in live domain.
      (qemuDomainUpdateDeviceFlags): reworked as a wrapper function of
      qemuDomainModifyDeviceFlags()
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      9b8543b6
    • K
      libvirt/qemu - clean up At(De)tachDeviceFlags() for consolidation. · 19ad136f
      KAMEZAWA Hiroyuki 提交于
      clean up At(De)tachDeviceFlags() for consolidation.
      
      qemuDomainAttachDeviceFlags()/qemuDomainDetachFlags()/
      qemuDomainUpdateDeviceFlags() has similar logics and copied codes.
      
      This patch series tries to unify them to use shared code when it can.
      At first, clean up At(De)tachDeviceFlags() and devide it into functions.
      
      By this, this patch pulls out shared components between functions.
      Based on patch series by Eric Blake, I added some modification as
      switch-case with QEMU_DEVICE_ATTACH, QEMU_DEVICE_DETACH, QEMU_DEVICE_UPDATE
      
      * src/qemu/qemu_driver.c
      (qemuDomainAt(De)tachDeviceFlags) : pulled out to qemuDomainModifyDeviceFlags()
      (qemuDomainModifyDeviceFlags) : implements generic code for modifying domain.
      (qemuDomainAt(De)tachDeviceFlagsLive) : code for at(de)taching devices to
      domain in line. no changes in logic from old code.
      (qemuDomainAt(De)tachDeviceDiskLive) : for at(de)taching Disks.
      (qemuDomainAt(De)tachDeviceControllerLive) : for at(de)taching Controllers
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      19ad136f
    • K
      libvirt/qemu - Centralize device modification in the more flexible APIs · 2160116f
      KAMEZAWA Hiroyuki 提交于
      Centralize device modification in the more flexible APIs, to allow future
      honoring of additional flags.  Explicitly reject the
      VIR_DOMAIN_DEVICE_MODIFY_FORCE flag on attach/detach.
      
      Based on Eric Blake<eblake@redhat.com>'s work.
      
      * src/qemu/qemu_driver.c
      (qemudDomainAttachDevice)(qemudDomainAttachDeviceFlags): Swap bodies,rename...
      (qemudDomainDetachDevice, qemudDomainDetachDeviceFlags): Likewise.
      Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: NEric Blake <eblake@redhat.com>
      2160116f
    • D
      Fix QEMU tunnelled migration FD handling · 29fca785
      Daniel P. Berrange 提交于
      The two ends of the pipe used for feeding QEMU tunnelled
      migration data were interchanged, so QEMU got given the
      "write" end instead of the "read" end.
      
      The qemuMigrationPrepareTunnel method was also immediately
      closing the "write" end of the pipe, so the stream failed
      to actually write anything.
      
      * src/qemu/qemu_migration.c: Swap tunnelled migration
        pipe FDs & don't close pipe given to stream
      29fca785
  11. 20 4月, 2011 1 次提交
  12. 19 4月, 2011 1 次提交
  13. 18 4月, 2011 3 次提交
    • D
      build: fix qemu build failure in previous patch · ce3ae1b0
      Daniel P. Berrange 提交于
      This last minute addition caused a build failure
      
      cc1: warnings being treated as errors
      qemu/qemu_process.c: In function 'qemuProcessHandleWatchdog':
      qemu/qemu_process.c:436:34: error: ignoring return value of 'virDomainObjUnref', declared with attribute warn_unused_result [-Wunused-result]
      make[3]: *** [libvirt_driver_qemu_la-qemu_process.lo] Error 1
      ce3ae1b0
    • W
      enhance processWatchdogEvent() · b060d2e5
      Wen Congyang 提交于
      This patch does the following two things:
      1. hold an extra reference while handling watchdog event
         If the domain is not persistent, and qemu quits unexpectedly before
         calling processWatchdogEvent(), vm will be freed and the function
         processWatchdogEvent() will be dangerous.
      
      2. unlock qemu driver and vm before returning from processWatchdogEvent()
         When the function processWatchdogEvent() failed, we only free wdEvent,
         but forget to unlock qemu driver and vm, free dumpfile.
      b060d2e5
    • W
      qemu: avoid qemu_driver being unlocked twice when virThreadPoolNew() failed · 847efb32
      Wen Congyang 提交于
      We do not lock qemu_driver when calling virThreadPoolNew(). If it failed,
      we will unlock qemu_driver. It is dangerous.
      
      We may use this pool during auto starting domains. So we must create it before
      calling qemuAutostartDomains(). Otherwise, libvirtd will crash.
      847efb32
  14. 17 4月, 2011 1 次提交
  15. 16 4月, 2011 1 次提交
    • E
      maint: use lighter-weight function for straight appends · dbe3bad9
      Eric Blake 提交于
      It costs quite a few processor cycles to go through printf parsing
      just to determine that we only meant to append.
      
      * src/xen/xend_internal.c (xend_op_ext): Consolidate multiple
      printfs into one.
      * src/qemu/qemu_command.c (qemuBuildWatchdogDevStr)
      (qemuBuildUSBInputDevStr, qemuBuildSoundDevStr)
      (qemuBuildSoundCodecStr, qemuBuildVideoDevStr): Likewise.
      (qemuBuildCpuArgStr, qemuBuildCommandLine): Prefer virBufferAdd
      over virBufferVsprintf for trivial appends.
      * src/phyp/phyp_driver.c (phypExec, phypUUIDTable_Push)
      (phypUUIDTable_Pull): Likewise.
      * src/conf/nwfilter_conf.c (macProtocolIDFormatter)
      (arpOpcodeFormatter, formatIPProtocolID, printStringItems)
      (virNWFilterPrintStateMatchFlags, virNWIPAddressFormat)
      (virNWFilterDefFormat): Likewise.
      * src/security/virt-aa-helper.c (main): Likewise.
      * src/util/sexpr.c (sexpr2string): Likewise.
      * src/xenxs/xen_sxpr.c (xenFormatSxprChr): Likewise.
      * src/xenxs/xen_xm.c (xenFormatXMDisk): Likewise.
      dbe3bad9
  16. 15 4月, 2011 3 次提交
    • S
      Migrate VMs between different-endianess hosts · cf2145d5
      Stefan Berger 提交于
      This patch enables the migration of Qemu VMs between hosts of different endianess. I tested this by migrating a i686 VM between a x86 and ppc64 host.
      
      I am converting the 'int's in the VM's state header to uint32_t assuming this doesn't break compatibility with existing deployments other than Linux.
      cf2145d5
    • M
      Introduce virDomainChrDefNew() · 2ac455c4
      Michal Novotny 提交于
      Make: passed
      Make check: passed
      Make syntax-check: passed
      
      this is the commit to introduce the function to create new character
      device definition for the domain as advised by Cole Robinson
      <crobinso@redhat.com>.
      
      The function is used on the relevant places and also new tests has
      been added.
      Signed-off-by: NMichal Novotny <minovotn@redhat.com>
      2ac455c4
    • M
      Spice: support audio, images and stream compression · abb1570e
      Michal Privoznik 提交于
      This extends the SPICE XML to allow variable compression settings for audio,
      images and streaming:
          <graphics type='spice' port='5901' tlsPort='-1' autoport='yes'>
              <image compression='auto_glz'/>
              <jpeg compression='auto'/>
              <zlib compression='auto'/>
              <playback compression='on'/>
          </graphics>
      
      All new elements are optional.
      abb1570e
  17. 14 4月, 2011 1 次提交
  18. 13 4月, 2011 1 次提交
    • H
      qemu: fix a dead-lock problem · 30c551ab
      Hu Tao 提交于
      In qemuDomainObjBeginJobWithDriver, when virCondWaitUntil timeouts,
      the function tries to call qemuDriverLock with virDomainObj locked,
      this causes the dead-lock problem. This patch fixes this.
      30c551ab
  19. 12 4月, 2011 1 次提交
    • E
      maint: fix grammar errors · 99fa3080
      Eric Blake 提交于
      Jim Meyering recently improved gnulib to catch various grammar
      errors during 'make syntax-check'.
      
      * .gnulib: Update to latest, for syntax-check improvements.
      * include/libvirt/libvirt.h.in (virConnectAuthCallbackPtr): Use
      cannot rather than two words.
      * src/driver.c: Likewise.
      * src/driver.h (VIR_SECRET_GET_VALUE_INTERNAL_CALL): Likewise.
      * src/remote/remote_driver.c (initialize_gnutls): Likewise.
      * src/util/pci.c (pciBindDeviceToStub): Likewise.
      * src/storage/storage_backend.c (virStorageBackendCreateQemuImg):
      Likewise.
      (virStorageBackendUpdateVolTargetInfoFD): Avoid doubled word.
      * docs/formatdomain.html.in: Likewise.
      * src/qemu/qemu_process.c (qemuProcessStart): Likewise.
      * cfg.mk (exclude_file_name_regexp--sc_prohibit_can_not)
      (exclude_file_name_regexp--sc_prohibit_doubled_word): Exclude
      existing translation problems.
      99fa3080
  20. 09 4月, 2011 1 次提交
  21. 08 4月, 2011 2 次提交
  22. 07 4月, 2011 2 次提交
    • O
      qemu: Remove the managed state file only if restoring succeeded · a73bbfc8
      Osier Yang 提交于
      1) Both "qemuDomainStartWithFlags" and "qemuAutostartDomain" try to
      restore the domain from managedsave'ed image if it exists (by
      invoking "qemuDomainObjRestore"), but it unlinks the image even
      if restoring fails, which causes data loss. (This problem exists
      for "virsh managedsave dom; virsh start dom").
      
      The fix for is to unlink the managed state file only if restoring
      succeeded.
      
      2) For "virsh save dom; virsh restore dom;", it can cause data
      corruption if one reuse the saved state file for restoring. Add
      doc to tell user about it.
      
      3) In "qemuDomainObjStart", if "managed_save" is NULL, we shouldn't
      fallback to start the domain, skipping it to cleanup as a incidental
      fix. Discovered by Eric.
      a73bbfc8
    • W
      reattach pci devices when qemuPrepareHostdevPCIDevices() failed · a4efb2e3
      Wen Congyang 提交于
      Reattach all pci devices that we detached when qemuPrepareHostdevPCIDevices()
      failed.
      a4efb2e3