1. 10 3月, 2010 1 次提交
  2. 04 3月, 2010 1 次提交
    • D
      Support VCPU hotplug in QEMU guests · e8d6c289
      Daniel P. Berrange 提交于
      QEMU has a monitor command 'set_cpu' which allows a specific
      CPU to be toggled between online& offline state. libvirt CPU
      hotplug does not work in terms of individual indexes CPUs.
      Thus to support this, we iteratively toggle the online state
      when the total number of vCPUs is adjusted via libvirt
      
      NB, currently untested since QEMU segvs when running this!
      
      * src/qemu/qemu_driver.c: Toggle online state for CPUs when
        doing hotplug
      * 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
        monitor API for toggling a CPU's online status via 'set_cpu
      e8d6c289
  3. 02 3月, 2010 1 次提交
    • W
      Use device_del to remove SCSI controllers · 8540dadb
      Wolfgang Mauerer 提交于
      when the underlying qemu supports the drive/device model and the
      controller has been added this way.
      * src/qemu/qemu_driver.c: use qemuMonitorDelDevice() when detaching
        PCI controller and if supported
      * src/qemu/qemu_monitor.[ch]: add new qemuMonitorDelDevice() function
      * src/qemu/qemu_monitor_json.[ch]: JSON backend for DelDevice command
      * src/qemu/qemu_monitor_text.[ch]: Text backend for DelDevice command
      8540dadb
  4. 16 2月, 2010 1 次提交
    • D
      Run 'qmp_capabilities' command at QEMU monitor startup · 5d72a894
      Daniel P. Berrange 提交于
      When in JSON mode, QEMU requires that 'qmp_capabilities' is run as
      the first command in the monitor. This is a no-op when run in the
      text mode monitor
      
      * src/qemu/qemu_driver.c: Run capabilities negotiation when
        connecting to the monitor
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
        src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Add
        support for the 'qmp_capabilities' command, no-op in text mode.
      5d72a894
  5. 13 2月, 2010 1 次提交
    • D
      Support 'block_passwd' command for QEMU disk encryption · c31a116b
      Daniel P. Berrange 提交于
      The old text mode monitor prompts for a password when disks are
      encrypted. This interactive approach doesn't work for JSON mode
      monitor. Thus there is a new 'block_passwd' command that can be
      used.
      
      * src/qemu/qemu_driver.c: Split out code for looking up a disk
        secret from findVolumeQcowPassphrase, into a new method
        getVolumeQcowPassphrase. Enhance qemuInitPasswords() to also
        set the disk encryption password via the monitor
      * 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 the 'block_passwd' monitor command.
      c31a116b
  6. 03 2月, 2010 1 次提交
    • D
      Introduce internal QEMU monitor APIs for drive + device hotadd · 5ec6cf7f
      Daniel P. Berrange 提交于
      The way QEMU is started has been changed to use '-device' and
      the new style '-drive' syntax. This needs to be mirrored in
      the hotplug code, requiring addition of two new APIs.
      
      * src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Define APIs
        qemuMonitorAddDevice() and qemuMonitorAddDrive()
      * src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
        src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
        Implement the new monitor APIs
      5ec6cf7f
  7. 18 1月, 2010 3 次提交
    • D
      Detect PCI addresses at QEMU startup · 989051a8
      Daniel P. Berrange 提交于
      Hotunplug of devices requires that we know their PCI address. Even
      hotplug of SCSI drives, required that we know the PCI address of
      the SCSI controller to attach the drive to. We can find this out
      by running 'info pci' and then correlating the vendor/product IDs
      with the devices we booted with.
      
      Although this approach is somewhat fragile, it is the only viable
      option with QEMU < 0.12, since there is no way for libvirto set
      explicit PCI addresses when creating devices in the first place.
      For QEMU > 0.12, this code will not be used.
      
      * src/qemu/qemu_driver.c: Assign all dynamic PCI addresses on
        startup of QEMU VM, matching vendor/product IDs
      * 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
        API for fetching PCI device address mapping
      989051a8
    • 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
  8. 16 1月, 2010 1 次提交
    • 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
  9. 14 12月, 2009 1 次提交
    • 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
  10. 08 12月, 2009 7 次提交
    • D
      Add QEMU monitor callbacks for basic lifecycle events · 89832303
      Daniel P. Berrange 提交于
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add callbacks
        for reset, shutdown, poweroff and stop events. Add convenience
        methods for emiting those events
      89832303
    • 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
      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
      Move qemuMonitorEscape + migrate status enum into shared monitor code · fa1e4759
      Daniel P. Berrange 提交于
      The qemuMonitorEscape() method, and the VIR_ENUM for migration
      status will be needed by the JSON monitor too, so move that code
      into the shared qemu_monitor.c file instead of qemu_monitor_text.c
      
      * src/qemu/qemu_monitor.h: Declare qemuMonitorMigrationStatus enum
        and qemuMonitorEscapeArg and qemuMonitorEscapeShell methods
      * src/qemu/qemu_monitor.c: Implement qemuMonitorMigrationStatus enum
        and qemuMonitorEscapeArg and qemuMonitorEscapeShell methods
      * src/qemu/qemu_monitor_text.c: Remove above methods/enum
      fa1e4759
    • 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
  11. 10 11月, 2009 6 次提交
    • D
      Fully asynchronous monitor I/O processing · 1dc10a7b
      Daniel P. Berrange 提交于
      Change the QEMU monitor file handle watch to poll for both
      read & write events, as well as EOF. All I/O to/from the
      QEMU monitor FD is now done in the event callback thread.
      
      When the QEMU driver needs to send a command, it puts the
      data to be sent into a qemuMonitorMessagePtr object instance,
      queues it for dispatch, and then goes to sleep on a condition
      variable. The event thread sends all the data, and then waits
      for the reply to arrive, putting the response / error data
      back into the qemuMonitorMessagePtr and notifying the condition
      variable.
      
      There is a temporary hack in the disk passphrase callback to
      avoid acquiring the domain lock.  This avoids a deadlock in
      the command processing, since the domain lock is still held
      when running monitor commands. The next commit will remove
      the locking when running commands & thus allow re-introduction
      of locking the disk passphrase callback
      
      * src/qemu/qemu_driver.c: Temporarily don't acquire lock in
        disk passphrase callback. To be reverted in next commit
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Remove
        raw I/O functions, and a generic qemuMonitorSend() for
        invoking a command
      * src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
        Remove all low level I/O, and use the new qemuMonitorSend()
        API. Provide a qemuMonitorTextIOProcess() method for detecting
        command/reply/prompt boundaries in the monitor data stream
      1dc10a7b
    • D
      Locking of the qemuMonitorPtr object · 77cfcccf
      Daniel P. Berrange 提交于
      In preparation of the monitor I/O process becoming fully asynchronous,
      it is neccessary to ensure all access to internals of the qemuMonitorPtr
      object is protected by a mutex lock.
      
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add mutex for locking
        monitor.
      * src/qemu/qemu_driver.c: Add locking around all monitor commands
      77cfcccf
    • D
      Wrap text mode monitor APIs, pass qemuMonitorPtr directly to APIs · 41d8968d
      Daniel P. Berrange 提交于
      Change the QEMU driver to not directly invoke the text mode monitor
      APIs. Instead add a generic wrapper layer, which will eventually
      invoke either the text or JSON protocol code as needed. Pass an
      qemuMonitorPtr object into the monitor APIs instead of virDomainObjPtr
      to complete the de-coupling of the monitor impl from virDomainObj
      data structures
      
      * src/qemu/qemu_conf.h: Remove qemuDomainObjPrivate definition
      * src/qemu/qemu_driver.c: Add qemuDomainObjPrivate definition.
        Pass qemuMonitorPtr into all monitor APIs instead of the
        virDomainObjPtr instance.
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add thin
        wrappers for all qemuMonitorXXX command APIs, calling into
        qemu_monitor_text.c/h
      * src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
        Rename qemuMonitor -> qemuMonitorText & update to accept
        qemuMonitorPtr instead of virDomainObjPtr
      41d8968d
    • D
      Move encryption lookup back into qemu driver file · 4604c18f
      Daniel P. Berrange 提交于
      Decouple the monitor code from the virDomainDefPtr structure
      by moving the disk encryption lookup code back into the
      qemu_driver.c file. Instead provide a function callback to
      the monitor code which can be invoked to retrieve encryption
      data as required.
      
      * src/qemu/qemu_driver.c: Add findDomainDiskEncryption,
        and findVolumeQcowPassphrase. Pass address of the method
        findVolumeQcowPassphrase into qemuMonitorOpen()
      * src/qemu/qemu_monitor.c: Associate a disk
        encryption function callback with the qemuMonitorPtr
        object.
      * src/qemu/qemu_monitor_text.c: Remove findDomainDiskEncryption
        and findVolumeQcowPassphrase.
      4604c18f
    • D
      Make use of private data structure for monitor state · 1cfd5a00
      Daniel P. Berrange 提交于
      Introduce a new qemuDomainObjPrivate object which is used to store
      the private QEMU specific data associated with each virDomainObjPtr
      instance. This contains a single member, an instance of the new
      qemuMonitorPtr object which encapsulates the QEMU monitor state.
      The internals of the latter are private to the qemu_monitor* files,
      not to be shown to qemu_driver.c
      
      * src/qemu/qemu_conf.h: Definition of qemuDomainObjPrivate.
      * src/qemu/qemu_driver.c: Register a functions for creating
        and freeing qemuDomainObjPrivate instances with the domain
        capabilities. Remove the qemudDispatchVMEvent() watch since
        I/O watches are now handled by the monitor code itself. Pass
        a new qemuHandleMonitorEOF() callback into qemuMonitorOpen
        to allow notification when the monitor quits.
      * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Introduce
        the 'qemuMonitor' object. Temporarily add new APIs
        qemuMonitorWrite, qemuMonitorRead, qemuMonitorWaitForInput
        to allow text based monitor impl to perform I/O.
      * src/qemu/qemu_monitor_text.c: Call APIs for reading/writing
        to monitor instead of accessing the file handle directly.
      1cfd5a00
    • D
      Move code for low level QEMU monitor interaction into separate file · ff261941
      Daniel P. Berrange 提交于
      The qemu_driver.c code should not contain any code that interacts
      with the QEMU monitor at a low level. A previous commit moved all
      the command invocations out. This change moves out the code which
      actually opens the monitor device.
      
      * src/qemu/qemu_driver.c: Remove qemudOpenMonitor & methods called
        from it.
      * src/Makefile.am: Add qemu_monitor.{c,h}
      * src/qemu/qemu_monitor.h: Add qemuMonitorOpen()
      * src/qemu/qemu_monitor.c: All code for opening the monitor
      ff261941
  12. 21 9月, 2009 1 次提交
    • D
      Move network driver into src/network · acfe3f26
      Daniel P. Berrange 提交于
      * daemon/qemud.c, src/Makefile.am: Adapt for changed paths
      * src/network_driver.c: Rename to src/network/bridge_driver.c
      * src/network_driver.h: Rename to src/network/bridge_driver.h
      acfe3f26
  13. 10 10月, 2008 1 次提交
  14. 21 8月, 2008 1 次提交
  15. 08 2月, 2008 1 次提交
    • M
      Fix gcc-4.3.0 "inlining failed" warning. · 3da5504e
      Mark McLoughlin 提交于
      * src/internal.h: move xstrol() variants from here ...
      
      * src/util.[ch]: ... to here and rename to virStrToLong()
      
      * src/libvirt_sym.version: export __virStrToLong_i() for
      virsh and qemud.
      
      * src/nodeinfo.c, src/stats_linux.c, src/virsh.c,
        src/xend_internal.c, qemud/qemud.c: replace xstrtol()
      calls with virStrToLong()
      
      * src/nodeinfo.h: don't include internal.h, which was only
      needed for xstrtol(), but instead include libvirt.h which
      is suffificient for the declarations in the header.
      3da5504e
  16. 26 7月, 2007 1 次提交
  17. 29 6月, 2007 1 次提交
  18. 27 6月, 2007 10 次提交