1. 21 7月, 2015 1 次提交
    • P
      qemu: Update state of block job to READY only if it actually is ready · eae59247
      Peter Krempa 提交于
      Few parts of the code looked at the current progress of and assumed that
      a two phase blockjob is in the _READY state as soon as the progress
      reached 100% (info.cur == info.end). In current versions of qemu this
      assumption is invalid and qemu exposes a new flag 'ready' in the
      query-block-jobs output that is set to true if the job is actually
      finished.
      
      This patch adds internal data handling for reading the 'ready' flag and
      acting appropriately as long as the flag is present.
      
      While this still doesn't fix the virsh client problem with two phase
      block jobs and the --pivot option, it at least improves the error
      message:
      
      $ virsh blockcommit  --wait --verbose vm vda  --base vda[1] --active --pivot
      Block commit: [100 %]error: failed to pivot job for disk vda
      error: internal error: unable to execute QEMU command 'block-job-complete': The active block job for device 'drive-virtio-disk0' cannot be completed
      
      to
      
      $ virsh blockcommit  --wait --verbose VM vda  --base vda[1] --active --pivot
      Block commit: [100 %]error: failed to pivot job for disk vda
      error: block copy still active: disk 'vda' not ready for pivot yet
      eae59247
  2. 10 7月, 2015 2 次提交
  3. 30 6月, 2015 2 次提交
  4. 26 6月, 2015 3 次提交
  5. 24 6月, 2015 1 次提交
  6. 23 6月, 2015 1 次提交
    • E
      qemu: simplify json parsing · 40783db3
      Eric Blake 提交于
      Rather than grabbing an arbitrary JSON value and then checking
      if it has the right type, we might as well request the correct
      type to begin with.
      
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONIOProcessEvent)
      (qemuMonitorJSONCommandWithFd, qemuMonitorJSONHandleGraphics)
      (qemuMonitorJSONGetStatus, qemuMonitorJSONExtractCPUInfo)
      (qemuMonitorJSONGetVirtType, qemuMonitorJSONGetBalloonInfo)
      (qemuMonitorJSONGetMemoryStats)
      (qemuMonitorJSONDevGetBlockExtent)
      (qemuMonitorJSONGetOneBlockStatsInfo)
      (qemuMonitorJSONGetAllBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacityOne)
      (qemuMonitorJSONBlockStatsUpdateCapacity)
      (qemuMonitorJSONGetBlockExtent)
      (qemuMonitorJSONGetMigrationStatusReply)
      (qemuMonitorJSONGetDumpGuestMemoryCapability)
      (qemuMonitorJSONAddFd, qemuMonitorJSONQueryRxFilterParse)
      (qemuMonitorJSONExtractChardevInfo)
      (qemuMonitorJSONDiskNameLookupOne)
      (qemuMonitorJSONDiskNameLookup)
      (qemuMonitorJSONGetAllBlockJobInfo)
      (qemuMonitorJSONBlockIoThrottleInfo, qemuMonitorJSONGetVersion)
      (qemuMonitorJSONGetMachines, qemuMonitorJSONGetCPUDefinitions)
      (qemuMonitorJSONGetCommands, qemuMonitorJSONGetEvents)
      (qemuMonitorJSONGetKVMState, qemuMonitorJSONGetObjectTypes)
      (qemuMonitorJSONGetObjectListPaths)
      (qemuMonitorJSONGetObjectProps, qemuMonitorJSONGetTargetArch)
      (qemuMonitorJSONGetMigrationCapabilities)
      (qemuMonitorJSONGetStringArray, qemuMonitorJSONAttachCharDev)
      (qemuMonitorJSONGetCPUx86Data, qemuMonitorJSONGetIOThreads)
      (qemuMonitorJSONGetMemoryDeviceInfo): Use shorter idioms.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      40783db3
  7. 19 6月, 2015 3 次提交
  8. 05 6月, 2015 3 次提交
  9. 03 6月, 2015 2 次提交
  10. 28 4月, 2015 2 次提交
  11. 14 4月, 2015 5 次提交
  12. 09 4月, 2015 1 次提交
  13. 26 3月, 2015 1 次提交
  14. 23 3月, 2015 1 次提交
  15. 19 3月, 2015 1 次提交
    • E
      qemu: track 'cancelling' migration state · e2660cb8
      Eric Blake 提交于
      In qemu 2.3, the migration status will include 'cancelling' in the
      window between when an asynchronous cancel has been requested and
      when the migration is actually halted.  Previously, qemu hid this
      state and reported 'active'.  Libvirt manages the sequence okay
      even when the string is unrecognized (that is, it will report an
      unknown state:
      
      Migration: [ 69 %]^Cerror: internal error: unexpected migration status in cancelling.
      
      but the migration is still cancelled), but recognizing the string
      makes for a smoother user experience.
      
      * src/qemu/qemu_monitor.h
      (QEMU_MONITOR_MIGRATION_STATUS_CANCELLING): Add enum.
      * src/qemu/qemu_monitor.c (qemuMonitorMigrationStatus): Map it.
      * src/qemu/qemu_migration.c (qemuMigrationUpdateJobStatus): Adjust
      clients.
      * src/qemu/qemu_monitor_json.c
      (qemuMonitorJSONGetMigrationStatusReply): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      e2660cb8
  16. 18 3月, 2015 1 次提交
    • E
      qemu: read backing chain names from qemu · f9ea3d60
      Eric Blake 提交于
      https://bugzilla.redhat.com/show_bug.cgi?id=1199182 documents that
      after a series of disk snapshots into existing destination images,
      followed by active commits of the top image, it is possible for
      qemu 2.2 and earlier to end up tracking a different name for the
      image than what it would have had when opening the chain afresh.
      That is, when starting with the chain 'a <- b <- c', the name
      associated with 'b' is how it was spelled in the metadata of 'c',
      but when starting with 'a', taking two snapshots into 'a <- b <- c',
      then committing 'c' back into 'b', the name associated with 'b' is
      now the name used when taking the first snapshot.
      
      Sadly, older qemu doesn't know how to treat different spellings of
      the same filename as identical files (it uses strcmp() instead of
      checking for the same inode), which means libvirt's attempt to
      commit an image using solely the names learned from qcow2 metadata
      fails with a cryptic:
      
      error: internal error: unable to execute QEMU command 'block-commit': Top image file /tmp/images/c/../b/b not found
      
      even though the file exists.  Trying to teach libvirt the rules on
      which name qemu will expect is not worth the effort (besides, we'd
      have to remember it across libvirtd restarts, and track whether a
      file was opened via metadata or via snapshot creation for a given
      qemu process); it is easier to just always directly ask qemu what
      string it expects to see in the first place.
      
      As a safety valve, we validate that any name returned by qemu
      still maps to the same local file as we have tracked it, so that
      a compromised qemu cannot accidentally cause us to act on an
      incorrect file.
      
      * src/qemu/qemu_monitor.h (qemuMonitorDiskNameLookup): New
      prototype.
      * src/qemu/qemu_monitor_json.h (qemuMonitorJSONDiskNameLookup):
      Likewise.
      * src/qemu/qemu_monitor.c (qemuMonitorDiskNameLookup): New function.
      * src/qemu/qemu_monitor_json.c (qemuMonitorJSONDiskNameLookup)
      (qemuMonitorJSONDiskNameLookupOne): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainBlockCommit)
      (qemuDomainBlockJobImpl): Use it.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      f9ea3d60
  17. 11 3月, 2015 5 次提交
  18. 25 2月, 2015 1 次提交
  19. 14 1月, 2015 1 次提交
    • P
      qemu_process: detect updated video ram size values from QEMU · ce745914
      Pavel Hrdina 提交于
      QEMU internally updates the size of video memory if the domain XML had
      provided too low memory size or there are some dependencies for a QXL
      devices 'vgamem' and 'ram' size. We need to know about the changes and
      store them into the status XML to not break migration or managedsave
      through different libvirt versions.
      
      The values would be loaded only if the "vgamem_mb" property exists for
      the device.  The presence of the "vgamem_mb" also tells that the
      "ram_size" and "vram_size" exists for QXL devices.
      Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
      ce745914
  20. 17 12月, 2014 2 次提交
    • E
      getstats: perform recursion in monitor collection · b1802714
      Eric Blake 提交于
      When requested in a later patch, the QMP command results are now
      examined recursively.  As qemu_driver will eventually have to
      read items out of the hash table as stored by this patch, the
      computation of backing alias string is done in a shared location.
      
      * src/qemu/qemu_domain.h (qemuDomainStorageAlias): New prototype.
      * src/qemu/qemu_domain.c (qemuDomainStorageAlias): Implement it.
      * src/qemu/qemu_monitor_json.c
      (qemuMonitorJSONGetOneBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacityOne): Perform recursion.
      (qemuMonitorJSONGetAllBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacity): Update callers.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      b1802714
    • E
      getstats: prepare monitor collection for recursion · 7b11f5e5
      Eric Blake 提交于
      A future patch will allow recursion into backing chains when
      collecting block stats.  This patch should not change behavior,
      but merely moves out the common code that will be reused once
      recursion is enabled, and adds the parameter that will turn on
      recursion.
      
      * src/qemu/qemu_monitor.h (qemuMonitorGetAllBlockStatsInfo)
      (qemuMonitorBlockStatsUpdateCapacity): Add recursion parameter,
      although it is ignored for now.
      * src/qemu/qemu_monitor.h (qemuMonitorGetAllBlockStatsInfo)
      (qemuMonitorBlockStatsUpdateCapacity): Likewise.
      * src/qemu/qemu_monitor_json.h
      (qemuMonitorJSONGetAllBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacity): Likewise.
      * src/qemu/qemu_monitor_json.c
      (qemuMonitorJSONGetAllBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacity): Add parameter, and
      split...
      (qemuMonitorJSONGetOneBlockStatsInfo)
      (qemuMonitorJSONBlockStatsUpdateCapacityOne): ...into helpers.
      (qemuMonitorJSONGetBlockStatsInfo): Update caller.
      * src/qemu/qemu_driver.c (qemuDomainGetStatsBlock): Update caller.
      * src/qemu/qemu_migration.c (qemuMigrationCookieAddNBD): Likewise.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      7b11f5e5
  21. 03 12月, 2014 1 次提交
    • M
      qemuMonitorJSONBlockStatsUpdateCapacity: Don't skip disks · a714533b
      Michal Privoznik 提交于
      The function queries the block devices visible to qemu
      ('query-block') and parses the qemu's output. The info is
      returned in a hash table which is expected to be pre-filled by
      qemuMonitorJSONGetAllBlockStatsInfo(). However, in the next patch
      we are not going to call the latter function at all, so we should
      make the former function add devices into the hash table if not
      found there.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      a714533b