1. 12 5月, 2011 1 次提交
    • E
      build: remove some dead assignments · 4c6ae9ae
      Eric Blake 提交于
      No syntactic effect; this merely silences some clang warnings.
      
      * src/libxl/libxl_driver.c (libxlDomainSetVcpusFlags): Drop
      redundant ret=0 statement.
      * src/qemu/qemu_monitor_text.c (qemuMonitorTextDriveDel):
      Likewise.
      4c6ae9ae
  2. 11 5月, 2011 4 次提交
  3. 06 5月, 2011 5 次提交
    • D
      Make taint warnings also go into the domain logfile · f79cddad
      Daniel P. Berrange 提交于
      As well as taint warnings going to the main libvirt log,
      add taint warnings to the per-domain logfile
      
        Domain id=3 is tainted: high-privileges
        Domain id=3 is tainted: disk-probing
        Domain id=3 is tainted: shell-scripts
        Domain id=3 is tainted: custom-monitor
      
      * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Enhance
        qemuDomainTaint to also log to the domain logfile
      * src/qemu/qemu_driver.c: Pass -1 for logFD to taint methods to
        auto-append to logfile
      * src/qemu/qemu_process.c: Pass open logFD at startup for taint
        methods
      f79cddad
    • D
      Add a qemuDomainAppendLog method for writing to the domain logfile · 1f1db0b5
      Daniel P. Berrange 提交于
      The qemuDomainAppendLog method allows writing a formatted string
      to the end of the domain logfile, optionally opening it if needed.
      
      * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add
        qemuDomainAppendLog
      1f1db0b5
    • 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
  4. 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
  5. 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
  6. 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
  7. 30 4月, 2011 1 次提交
  8. 29 4月, 2011 1 次提交
  9. 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
  10. 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
  11. 26 4月, 2011 1 次提交
  12. 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
  13. 20 4月, 2011 1 次提交
  14. 19 4月, 2011 1 次提交
  15. 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
  16. 17 4月, 2011 1 次提交
  17. 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
  18. 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
  19. 14 4月, 2011 1 次提交