1. 16 5月, 2011 3 次提交
  2. 13 5月, 2011 5 次提交
    • C
      qemu: Use virDomainEventState helpers · 42a3687f
      Cole Robinson 提交于
      v2:
          Drop libvirt_private.syms changes
      
      v3:
          Adjust for new virDomainEventStateNew argument
      42a3687f
    • C
      xml: Make sure virXpathNodeSet always sets an error · 0571c3af
      Cole Robinson 提交于
      And update callers to actually respect the error
      0571c3af
    • M
      qemu: Implement the driver methods · 9936aecf
      Michal Privoznik 提交于
      * src/qemu/qemu_driver.c: new qemuDomainScreenshot() function
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
        Monitor command
      9936aecf
    • M
      virFDStream: Add option for delete file after it's opening · 6a1f5f56
      Michal Privoznik 提交于
      This is needed if we want to transfer a temporary file. If the
      transfer is done with iohelper, we might run into a race condition,
      where we unlink() file before iohelper is executed.
      
      * src/fdstream.c, src/fdstream.h,
        src/util/iohelper.c: Add new option
      * src/lxc/lxc_driver.c, src/qemu/qemu_driver.c,
        src/storage/storage_driver.c, src/uml/uml_driver.c,
        src/xen/xen_driver.c: Expand existing function calls
      6a1f5f56
    • M
      screenshot: Defining the internal API · 3c386643
      Michal Privoznik 提交于
      * src/driver.h: Stub code for new API
      * src/esx/esx_driver.c, src/libxl/libxl_driver.c,
        src/lxc/lxc_driver.c, src/openvz/openvz_driver.c,
        src/phyp/phyp_driver.c, src/qemu/qemu_driver.c,
        rc/remote/remote_driver.c, rc/test/test_driver.c,
        src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
        src/vmware/vmware_driver.c, src/xen/xen_driver.c,
        src/xen/xen_driver.h, src/xen/xen_hypervisor.c,
        src/xen/xen_inotify.c, src/xen/xend_internal.c,
        src/xen/xm_internal.c, src/xen/xs_internal.c,
        src/xenapi/xenapi_driver.c: Add dummy entries in driver
        table for new APIs
      3c386643
  3. 12 5月, 2011 3 次提交
    • E
      maint: omit translation for all VIR_INFO · cb84580a
      Eric Blake 提交于
      We were 31/73 on whether to translate; since less than 50% translated
      and since VIR_INFO is less than VIR_WARN which also doesn't translate,
      this makes sense.
      
      * cfg.mk (sc_prohibit_gettext_markup): Add VIR_INFO, since it
      falls between WARN and DEBUG.
      * daemon/libvirtd.c (qemudDispatchSignalEvent, remoteCheckAccess)
      (qemudDispatchServer): Adjust offenders.
      * daemon/remote.c (remoteDispatchAuthPolkit): Likewise.
      * src/network/bridge_driver.c (networkReloadIptablesRules)
      (networkStartNetworkDaemon, networkShutdownNetworkDaemon)
      (networkCreate, networkDefine, networkUndefine): Likewise.
      * src/qemu/qemu_driver.c (qemudDomainDefine)
      (qemudDomainUndefine): Likewise.
      * src/storage/storage_driver.c (storagePoolCreate)
      (storagePoolDefine, storagePoolUndefine, storagePoolStart)
      (storagePoolDestroy, storagePoolDelete, storageVolumeCreateXML)
      (storageVolumeCreateXMLFrom, storageVolumeDelete): Likewise.
      * src/util/bridge.c (brProbeVnetHdr): Likewise.
      * po/POTFILES.in: Drop src/util/bridge.c.
      cb84580a
    • L
      libvirt,logging: cleanup VIR_XXX0() · b65f37a4
      Lai Jiangshan 提交于
      These VIR_XXXX0 APIs make us confused, use the non-0-suffix APIs instead.
      
      How do these coversions works? The magic is using the gcc extension of ##.
      When __VA_ARGS__ is empty, "##" will swallow the "," in "fmt," to
      avoid compile error.
      
      example: origin				after CPP
      	high_level_api("%d", a_int)	low_level_api("%d", a_int)
      	high_level_api("a  string")	low_level_api("a  string")
      
      About 400 conversions.
      
      8 special conversions:
      VIR_XXXX0("") -> VIR_XXXX("msg") (avoid empty format) 2 conversions
      VIR_XXXX0(string_literal_with_%) -> VIR_XXXX(%->%%) 0 conversions
      VIR_XXXX0(non_string_literal) -> VIR_XXXX("%s", non_string_literal)
        (for security) 6 conversions
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      b65f37a4
    • 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
  4. 11 5月, 2011 4 次提交
  5. 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
  6. 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
  7. 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
  8. 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
  9. 30 4月, 2011 1 次提交
  10. 29 4月, 2011 1 次提交
  11. 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
  12. 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
  13. 26 4月, 2011 1 次提交
  14. 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
  15. 20 4月, 2011 1 次提交