1. 18 1月, 2010 3 次提交
    • D
      Properly support SCSI drive hotplug · 3a6bf1bb
      Daniel P. Berrange 提交于
      The current SCSI hotplug support attaches a brand new SCSI controller
      for every disk. This is broken because the semantics differ from those
      used when starting the VM initially. In the latter case, each SCSI
      controller is filled before a new one is added.
      
      If the user specifies an high drive index (sdazz) then at initial
      startup, many intermediate SCSI controllers may be added with no
      drives.
      
      This patch changes SCSI hotplug so that it exactly matches the
      behaviour of initial startup. First the SCSI controller number is
      determined for the drive to be hotplugged. If any controller upto
      and including that controller number is not yet present, it is
      attached. Then finally the drive is attached to the last controller.
      
      NB, this breaks SCSI hotunplug, because there is no 'drive_del'
      command in current QEMU. Previous SCSI hotunplug was broken in
      any case because it was unplugging the entire controller, not
      just the drive in question.
      
      A future QEMU will allow proper SCSI hotunplug of a drive.
      
      This patch is derived from work done by Wolfgang Mauerer on disk
      controllers.
      
      * src/qemu/qemu_driver.c: Fix SCSI hotplug to add a drive to
       the correct controller, instead of just attaching a new
        controller.
      * 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: Add
        support for 'drive_add' command
      3a6bf1bb
    • W
      Implement SCSI controller hotplug/unplug for QEMU · da9d937b
      Wolfgang Mauerer 提交于
      This patch allows for explicit hotplug/unplug of SCSI controllers.
      Ordinarily this is not required, since QEMU/libvirt will attach
      a new SCSI controller whenever one is required. Allowing explicit
      hotplug of controllers though, enables the caller to specify a
      static PCI address, instead of auto-assigning the next available
      PCI slot. Or it will when we have static PCI addressing.
      
      This patch is derived from Wolfgang Mauerer's disk controller
      patch series.
      
      * src/qemu/qemu_driver.c: Support hotplug & unplug of SCSI
        controllers
      * 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: Add
        new API for attaching PCI SCSI controllers
      da9d937b
    • M
      qemu: Use log output for pty assignment if 'info chardev' is unavailable · a0356bcc
      Matthias Bolte 提交于
      qemudFindCharDevicePTYsMonitor reports an error if 'info chardev' didn't
      provide information for a requested device, even if the log output parsing
      had found the pty path for that device. This makes pty assignment fail for
      older QEMU/KVM versions. For example KVM 72 on Debian doesn't support
      'info chardev', so qemuMonitorTextGetPtyPaths cannot parse any useful
      information and the hash for device-id-to-pty-path mapping stays empty.
      
      Make qemudFindCharDevicePTYsMonitor report an error only if the log output
      parsing and the 'info chardev' parsing failed to provide the pty path.
      a0356bcc
  2. 16 1月, 2010 2 次提交
    • D
      Convert monitor over to use virDomainDeviceAddress · ab0da52b
      Daniel P. Berrange 提交于
      Convert the QEMU monitor APIs over to use virDomainDeviceAddress
      structs for passing addresses in/out, instead of individual bits.
      This makes the number of parameters smaller & easier to deal with.
      No functional change
      
      * src/qemu/qemu_driver.c, src/qemu/qemu_monitor.c,
        src/qemu/qemu_monitor.h, src/qemu/qemu_monitor_text.c,
        src/qemu/qemu_monitor_text.h: Change monitor hotplug APIs to
        take an explicit address ptr for all host/guest addresses
      ab0da52b
    • D
      Introduce a standardized data structure for device addresses · 1b0cce7d
      Daniel P. Berrange 提交于
      All guest devices now use a common device address structure
      summarized by:
      
        enum virDomainDeviceAddressType {
          VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
          VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
        };
      
        struct _virDomainDevicePCIAddress {
          unsigned int domain;
          unsigned int bus;
          unsigned int slot;
          unsigned int function;
        };
      
        struct _virDomainDeviceInfo {
          int type;
          union {
              virDomainDevicePCIAddress pci;
          } addr;
        };
      
      This replaces the anonymous structs in Disk/Net/Hostdev data
      structures. Where available, the address is *always* printed
      in the XML file, instead of being hidden in the internal state
      file.
      
        <address type='pci' domain='0x0000' bus='0x1e' slot='0x07' function='0x0'/>
      
      The structure definition is based on Wolfgang Mauerer's disk
      controller patch series.
      
      * docs/schemas/domain.rng: Define the <address> syntax and
        associate it with disk/net/hostdev devices
      * src/conf/domain_conf.h, src/conf/domain_conf.c,
        src/libvirt_private.syms: APIs for parsing/formatting address
        information. Also remove the QEMU specific 'pci_addr' attributes
      * src/qemu/qemu_driver.c: Replace use of 'pci_addr' attrs with
        new standardized format.
      1b0cce7d
  3. 14 1月, 2010 1 次提交
    • C
      Implement path lookup for USB by vendor:product · 5073aa99
      Cole Robinson 提交于
      Based off how QEMU does it, look through /sys/bus/usb/devices/* for
      matching vendor:product info, and if found, use info from the surrounding
      files to build the device's /dev/bus/usb path.
      
      This fixes USB device assignment by vendor:product when running qemu
      as non-root (well, it should, but for some reason I couldn't reproduce
      the failure people are seeing in [1], but it appears to work properly)
      
      [1] https://bugzilla.redhat.com/show_bug.cgi?id=542450
      5073aa99
  4. 12 1月, 2010 3 次提交
  5. 06 1月, 2010 2 次提交
  6. 22 12月, 2009 1 次提交
    • D
      Fix detection of JSON when restarting libvirtd · c90e545f
      Daniel P. Berrange 提交于
      The XML XPath for detecting JSON in the running VM statefile was
      wrong causing all VMs to get JSON mode enabled at libvirtd restart.
      
      In addition if a VM was running a JSON enabled QEMU once, and then
      altered to point to a non-JSON enabled QEMU later the 'monJSON'
      flag would not get reset to 0.
      
      * src/qemu/qemu_driver.c: Fix setting/detection of JSON mode
      c90e545f
  7. 21 12月, 2009 1 次提交
  8. 20 12月, 2009 2 次提交
    • A
      Implements domainMemStats in the qemu driver · c7523b41
      Adam Litke 提交于
      Support for memory statistics reporting is accepted for qemu inclusion.
      Statistics are reported via the monitor command 'info balloon' as a comma
      seprated list:
      
      (qemu) info balloon
      balloon: actual=1024,mem_swapped_in=0,mem_swapped_out=0,major_page_faults=88,minor_page_faults=105535,free_mem=1017065472,total_mem=1045229568
      
      Libvirt, qemu, and the guest operating system may support a subset of the
      statistics defined by the virtio spec.  Thus, only statistics recognized by
      components will be reported.
      
      * src/qemu/qemu_driver.c src/qemu/qemu_monitor_text.[ch]: implement the
        new entry point by using info balloon monitor command
      c7523b41
    • A
      Add new API virDomainMemoryStats to header and drivers · 3a701313
      Adam Litke 提交于
      Set up the types for the domainMemoryStats function and insert it into the
      virDriver structure definition.  Because of static initializers, update
      every driver and set the new field to NULL.
      
      * include/libvirt/libvirt.h.in: new API
      * src/driver.h src/*/*_driver.c src/vbox/vbox_tmpl.c: add the new
        entry to the driver structure
      * python/generator.py: fix compiler errors, the actual python binding is
        implemented later
      3a701313
  9. 18 12月, 2009 2 次提交
    • J
      Implement CPU selection in QEMU driver · ffb13b11
      Jiri Denemark 提交于
      * src/qemu/qemu_conf.c src/qemu/qemu_conf.h src/qemu/qemu_driver.c:
        add the new entry point, extend capabilities and code to interract
        with qemu
      ffb13b11
    • J
      Adds the internal driver API · 16e4084a
      Jiri Denemark 提交于
      * src/driver.h: add an extra entry point in the structure
      * src/esx/esx_driver.c src/lxc/lxc_driver.c src/opennebula/one_driver.c
        src/openvz/openvz_driver.c src/phyp/phyp_driver.c src/qemu/qemu_driver.c
        src/remote/remote_driver.c src/test/test_driver.c src/uml/uml_driver.c
        src/vbox/vbox_tmpl.c src/xen/xen_driver.c: add NULL entry points for
        all drivers
      16e4084a
  10. 15 12月, 2009 3 次提交
  11. 14 12月, 2009 9 次提交
    • M
      Cleanup temporary #define after use · 057ad3a2
      Matthew Booth 提交于
      * src/qemu/qemu_driver.c: #undef LOOKUP_PTYS after use in
        qemudFindCharDevicePTYsMonitor()
      057ad3a2
    • P
      Fix possible NULL pointer dereference · 921d2225
      Paolo Bonzini 提交于
      If there are no references remaining to the object, vm is set to NULL
      and vm->persistent cannot be accessed.  Fixed by this trivial patch.
      
      * src/qemu/qemu_driver.c (qemudDomainCoreDump): Avoid possible
        NULL pointer dereference on --crash dump.
      921d2225
    • P
      add --live support to "virsh dump" · 1fb7af40
      Paolo Bonzini 提交于
      This is trivial for QEMU since you just have to not stop the vm before
      starting the dump.  And for Xen, you just pass the flag down to xend.
      
      * include/libvirt/libvirt.h.in (virDomainCoreDumpFlags): Add VIR_DUMP_LIVE.
      * src/qemu/qemu_driver.c (qemudDomainCoreDump): Support live dumping.
      * src/xen/xend_internal.c (xenDaemonDomainCoreDump): Support live dumping.
      * tools/virsh.c (opts_dump): Add --live. (cmdDump): Map it to VIR_DUMP_LIVE.
      1fb7af40
    • P
      add --crash support to "virsh dump" · b927aed8
      Paolo Bonzini 提交于
      This patch adds the --crash option (already present in "xm dump-core")
      to "virsh dump".  virDomainCoreDump already has a flags argument, so
      the API/ABI is untouched.
      
      * include/libvirt/libvirt.h.in (virDomainCoreDumpFlags): New flag for
        CoreDump
      * src/test/test_driver.c (testDomainCoreDump): Do not crash
        after dump unless VIR_DUMP_CRASH is given.
      * src/qemu/qemu_driver.c (qemudDomainCoreDump): Shutdown the domain
        instead of restarting it if --crash is passed.
      * src/xen/xend_internal.c (xenDaemonDomainCoreDump): Support --crash.
      * tools/virsh.c (opts_dump): Add --crash.
        (cmdDump): Map it to flags for virDomainCoreDump and pass them.
      b927aed8
    • P
      fix various breakages in qemu Dump command · f509e162
      Paolo Bonzini 提交于
      1) qemuMigrateToCommand uses ">>" so we have to truncate the file
      before starting the migration;
      
      2) the command wasn't updated to chown the driver and set/restore
      the security lavels;
      
      3) the VM does not have to be resumed if migration fails;
      
      4) the file is not removed when migration fails.
      
      * src/qemu/qemu_driver.c (qemuDomainCoreDump): Truncate file before
        dumping, set/restore ownership and security labels for the file.
      f509e162
    • D
      Fix a couple of problems in last patch · a7d1eb3c
      Daniel Veillard 提交于
      Those were pointed by DanB in his review but not yet fixed
      
      * src/qemu/qemu_driver.c: qemudWaitForMonitor() use EnterMonitorWithDriver()
        and ExitMonitorWithDriver() there
      * src/qemu/qemu_monitor_text.c: checking fro strdu failure and hash
        table add error in qemuMonitorTextGetPtyPaths()
      a7d1eb3c
    • M
      Get QEMU pty paths from the monitor · 60e8977f
      Matthew Booth 提交于
      This change makes the QEMU driver get pty paths from the output of the
      monitor 'info chardev' command. This output is structured, and contains
      both the name of the device and the path on the same line. This is
      considerably more reliable than parsing the startup log output, which
      requires the parsing code to know which order QEMU will print pty
      information in.
      
      Note that we still need to parse the log output as the monitor itself
      may be on a pty. This should be rare, however, and the new code will
      replace all pty paths parsed by the log output method once the monitor
      is available.
      
      * src/qemu/qemu_monitor.(c|h) src/qemu_monitor_text.(c|h): Implement
        qemuMonitorGetPtyPaths().
      * src/qemu/qemu_driver.c: Get pty path information using
        qemuMonitorGetPtyPaths().
      60e8977f
    • M
      Extract the assigned pty device for QEmu channels · 033eef43
      Matthew Booth 提交于
      * src/qemu/qemu_driver.c: Parse pty devices for channels
      033eef43
    • R
      Suppress cgroup error message on sucess startup · 2597f8ec
      Ryota Ozaki 提交于
      Even if qemudStartVMDaemon suceeds, an error was logged such as
      'qemuRemoveCgroup:1778 : internal error Unable to find cgroup for'.
      This is because qemudStartVMDaemon calls qemuRemoveCgroup to
      ensure that old cgroup does not remain. This workaround makes
      sense but leaving an error message may confuse users.
      * src/qemu/qemu_driver.c: a an option to the function to suppress the
        error being logged
      2597f8ec
  12. 11 12月, 2009 3 次提交
  13. 10 12月, 2009 1 次提交
    • M
      Add virBufferFreeAndReset() and replace free() · 1b9d0744
      Matthias Bolte 提交于
      Replace free(virBufferContentAndReset()) with virBufferFreeAndReset().
      Update documentation and replace all remaining calls to free() with
      calls to VIR_FREE(). Also add missing calls to virBufferFreeAndReset()
      and virReportOOMError() in OOM error cases.
      1b9d0744
  14. 09 12月, 2009 1 次提交
    • D
      Fix virDomainObj ref handling in QEMU driver · 8e7d1495
      Daniel P. Berrange 提交于
      Since the monitor I/O is processed out of band from the main
      thread(s) invoking monitor  commands, the virDomainObj may be
      deleted by the I/O thread. The qemuDomainObjBeginJob takes an
      extra reference to protect against final deletion, but this
      reference is released by the corresponding EndJob call. THus
      after the EndJob call it may not be valid to reference the
      virDomainObj any more. To allow callers to detect this, the
      EndJob call is changed to return the remaining reference count.
      
      * src/conf/domain_conf.c: Make virDomainObjUnref return the
        remaining reference count
      * src/qemu/qemu_driver.c: Avoid referencing virDomainObjPtr
        after qemuDomainObjEndJob if it has been deleted.
      8e7d1495
  15. 08 12月, 2009 6 次提交
    • D
      Switch over to passing a callback table to QEMU monitor · e9f4c943
      Daniel P. Berrange 提交于
      With addition of events there will be alot of callbacks.
      To avoid having to add many APIs to register callbacks,
      provide them all at once in a big table
      
      * src/qemu/qemu_driver.c: Pass in a callback table to QEMU
        monitor code
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h Replace
        the EOF and disk secret callbacks with a callback table
      e9f4c943
    • D
      Support for JSON mode monitor · 3a4f172f
      Daniel P. Berrange 提交于
      Initial support for the new QEMU monitor protocol  using JSON
      as the data encoding format instead of plain text
      
      * po/POTFILES.in: Add src/qemu/qemu_monitor_json.c
      * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Hack to turn on QMP
        mode. Replace with a version number check on >= 0.12 later
      * src/qemu/qemu_monitor.c: Delegate to json monitor if enabled
      * src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Add
        impl of QMP protocol
      * src/Makefile.am: Add src/qemu/qemu_monitor_json.{c,h}
      3a4f172f
    • D
      Introduce callbacks for serializing domain object private data to XML · c5358c0e
      Daniel P. Berrange 提交于
      Now that drivers are using a private domain object state blob,
      the virDomainObjFormat/Parse methods are no longer able to
      directly serialize all neccessary state to/from XML. It is
      thus neccessary to introduce a pair of callbacks fo serializing
      private state.
      
      The code for serializing vCPU PIDs and the monitor device
      config can now move out of domain_conf.c and into the
      qemu_driver.c where they belong.
      
      * src/conf/capabilities.h: Add callbacks for serializing private
        state to/from XML
      * src/conf/domain_conf.c, src/conf/domain_conf.h: Remove the
        monitor, monitor_chr, monitorWatch, nvcpupids and vcpupids
        fields from virDomainObjPtr. Remove code that serialized
        those fields
      * src/libvirt_private.syms: Export virXPathBoolean
      * src/qemu/qemu_driver.c: Add callbacks for serializing monitor
        and vcpupid data to/from XML
      * src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Pass monitor
        char device config into qemuMonitorOpen directly.
      c5358c0e
    • D
      Pull code to start CPUs executing out of qemudInitCpuAffinity() · 5697aa84
      Daniel P. Berrange 提交于
      The code to start CPUs executing has nothing todo with CPU
      affinity masks, so pull it out of the qemudInitCpuAffinity()
      method and up into qemudStartVMDaemon()
      
      * src/qemu/qemu_driver.c: Pull code to start CPUs executing out
        of qemudInitCpuAffinity()
      5697aa84
    • D
      Add a 'format' arg to qemuMonitorChangeMedia() since JSON will support it · 8c12b20c
      Daniel P. Berrange 提交于
      The current QEMU disk media change does not support setting the
      disk format. The new JSON monitor will support this, so add an
      extra parameter to pass this info in
      
      * src/qemu/qemu_driver.c: Pass in disk format when changing media
      * src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
        Add a 'format' arg to qemuMonitorChangeMedia()
      8c12b20c
    • D
      Fix crash when deleting monitor while a command is in progress · 79533da1
      Daniel P. Berrange 提交于
      If QEMU shuts down while we're in the middle of processing a
      monitor command, the monitor will be freed, and upon cleaning
      up we attempt to do  qemuMonitorUnlock(priv->mon) when priv->mon
      is NULL.
      
      To address this we introduce proper reference counting into
      the qemuMonitorPtr object, and hold an extra reference whenever
      executing a command.
      
      * src/qemu/qemu_driver.c: Hold a reference on the monitor while
        executing commands, and only NULL-ify the priv->mon field when
        the last reference is released
      * src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add reference
        counting to handle safe deletion of monitor objects
      79533da1