1. 01 5月, 2019 1 次提交
    • D
      hmp: gva2gpa debug command · 574d9693
      Dr. David Alan Gilbert 提交于
      Add a gva2gpa command purely for debug which performs
      address translation on the gva, the existing gpa2hva
      command can then also be used to find it in the qemu
      userspace; e.g.
      
      (qemu) info registers
      .... RSP=ffffffff81c03e98
      ....
      (qemu) gva2gpa 0xffffffff81c03e98
      gpa: 0x1c03e98
      (qemu) gpa2hva 0x1c03e98
      Host virtual address for 0x1c03e98 (pc.ram) is 0x7f0599a03e98
      (qemu) x/10x 0xffffffff81c03e98
      ffffffff81c03e98: 0x81c03eb8 0xffffffff 0x8101ea3f 0xffffffff
      ffffffff81c03ea8: 0x81d27b00 0xffffffff 0x00000000 0x00000000
      ffffffff81c03eb8: 0x81c03ec8 0xffffffff
      
      gdb -p ...qemu...
      (gdb) x/10x 0x7f0599a03e98
      0x7f0599a03e98:	0x81c03eb8	0xffffffff	0x8101ea3f	0xffffffff
      0x7f0599a03ea8:	0x81d27b00	0xffffffff	0x00000000	0x00000000
      0x7f0599a03eb8:	0x81c03ec8	0xffffffff
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Message-Id: <20190412152652.827-1-dgilbert@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      574d9693
  2. 05 3月, 2019 1 次提交
  3. 25 2月, 2019 1 次提交
    • D
      block/snapshot.c: eliminate use of ID input in snapshot operations · 6ca08045
      Daniel Henrique Barboza 提交于
      At this moment, QEMU attempts to create/load/delete snapshots
      by using either an ID (id_str) or a name. The problem is that the code
      isn't consistent of whether the entered argument is an ID or a name,
      causing unexpected behaviors.
      
      For example, when creating snapshots via savevm <arg>, what happens is that
      "arg" is treated as both name and id_str. In a guest without snapshots, create
      a single snapshot via savevm:
      
      (qemu) savevm 0
      (qemu) info snapshots
      List of snapshots present on all disks:
      ID        TAG                 VM SIZE                DATE       VM CLOCK
      --        0                      741M 2018-07-31 13:39:56   00:41:25.313
      
      A snapshot with name "0" is created. ID is hidden from the user, but the
      ID is a non-zero integer that starts at "1". Thus, this snapshot has
      id_str=1, TAG="0". Creating a second snapshot with arg = 1, the first one
      is deleted:
      
      (qemu) savevm 1
      (qemu) info snapshots
      List of snapshots present on all disks:
      ID        TAG                 VM SIZE                DATE       VM CLOCK
      --        1                      741M 2018-07-31 13:42:14   00:41:55.252
      
      What happened?
      
      - when creating the second snapshot, a verification is done inside
      bdrv_all_delete_snapshot to delete any existing snapshots that matches an
      string argument. Here, the code calls bdrv_all_delete_snapshot("1", ...);
      
      - bdrv_all_delete_snapshot calls bdrv_snapshot_find(..., "1") for each
      BlockDriverState of the guest. And this is where things goes tilting:
      bdrv_snapshot_find does a search by both id_str and name. It finds
      out that there is a snapshot that has id_str = 1, stores a reference
      to the snapshot in the sn_info pointer and then returns match found;
      
      - since a match was found, a call to bdrv_snapshot_delete_by_id_or_name() is
      made. This function ignores the pointer written by bdrv_snapshot_find. Instead,
      it deletes the snapshot using bdrv_snapshot_delete() calling it first with
      id_str = 1. If it fails to delete, then it calls it again with name = 1.
      
      - after all that, QEMU creates the new snapshot, that has id_str = 1 and
      name = 1. The user is left wondering that happened with the first snapshot
      created. Similar bugs can be triggered when using loadvm and delvm.
      
      Before contemplating discarding the use of ID input in these operations,
      I've searched the code of what would be the implications. My findings
      are:
      
      - the RBD and Sheepdog drivers don't care. Both uses the 'name' field as
      key in their logic, making id_str = name when appropriate.
      replay-snapshot.c does not make any special use of id_str;
      
      - qcow2 uses id_str as an unique identifier but it is automatically
      calculated, not being influenced by user input. Other than that, there are
      no distinguish operations made only with id_str;
      
      - in blockdev.c, the delete operation uses a match of both id_str AND
      name. Given that id_str is either a copy of 'name' or auto-generated,
      we're fine here.
      
      This gives motivation to not consider ID as a valid user input in HMP
      commands - sticking with 'name' input only is more consistent. To
      accomplish that, the following changes were made in this patch:
      
      - bdrv_snapshot_find() does not match for id_str anymore, only 'name'. The
      function is called in save_snapshot(), load_snapshot(), bdrv_all_delete_snapshot()
      and bdrv_all_find_snapshot(). This change makes the search function more
      predictable and does not change the behavior of any underlying code that uses
      these affected functions, which are related to HMP (which is fine) and the
      main loop inside vl.c (which doesn't care about it anyways);
      
      - bdrv_all_delete_snapshot() does not call bdrv_snapshot_delete_by_id_or_name
      anymore. Instead, it uses the pointer returned by bdrv_snapshot_find to
      erase the snapshot with the exact match of id_str an name. This function
      is called in save_snapshot and hmp_delvm, thus this change  produces the
      intended effect;
      
      - documentation changes to reflect the new behavior. I consider this to
      be an API fix instead of an API change - the user was already creating
      snapshots using 'name', but now he/she will also enjoy a consistent
      behavior.
      
      Ideally we would get rid of the id_str field entirely, but this would have
      repercussions on existing snapshots. Another day perhaps.
      Signed-off-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
      Acked-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      6ca08045
  4. 12 12月, 2018 1 次提交
  5. 24 8月, 2018 1 次提交
  6. 15 8月, 2018 1 次提交
    • K
      block: Remove deprecated -drive geometry options · b24ec3c4
      Kevin Wolf 提交于
      This reinstates commit a7aff6dd,
      which was temporarily reverted for the 3.0 release so that libvirt gets
      some extra time to update their command lines.
      
      The -drive options cyls, heads, secs and trans were deprecated in
      QEMU 2.10. It's time to remove them.
      
      hd-geo-test tested both the old version with geometry options in -drive
      and the new one with -device. Therefore the code using -drive doesn't
      have to be replaced there, we just need to remove the -drive test cases.
      This in turn allows some simplification of the code.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      b24ec3c4
  7. 10 7月, 2018 1 次提交
  8. 29 6月, 2018 1 次提交
  9. 21 6月, 2018 4 次提交
  10. 15 6月, 2018 1 次提交
  11. 16 5月, 2018 3 次提交
  12. 15 5月, 2018 1 次提交
  13. 19 3月, 2018 1 次提交
    • L
      block/mirror: change the semantic of 'force' of block-job-cancel · b76e4458
      Liang Li 提交于
      When doing drive mirror to a low speed shared storage, if there was heavy
      BLK IO write workload in VM after the 'ready' event, drive mirror block job
      can't be canceled immediately, it would keep running until the heavy BLK IO
      workload stopped in the VM.
      
      Libvirt depends on the current block-job-cancel semantics, which is that
      when used without a flag after the 'ready' event, the command blocks
      until data is in sync.  However, these semantics are awkward in other
      situations, for example, people may use drive mirror for realtime
      backups while still wanting to use block live migration.  Libvirt cannot
      start a block live migration while another drive mirror is in progress,
      but the user would rather abandon the backup attempt as broken and
      proceed with the live migration than be stuck waiting for the current
      drive mirror backup to finish.
      
      The drive-mirror command already includes a 'force' flag, which libvirt
      does not use, although it documented the flag as only being useful to
      quit a job which is paused.  However, since quitting a paused job has
      the same effect as abandoning a backup in a non-paused job (namely, the
      destination file is not in sync, and the command completes immediately),
      we can just improve the documentation to make the force flag obviously
      useful.
      
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Jeff Cody <jcody@redhat.com>
      Cc: Kevin Wolf <kwolf@redhat.com>
      Cc: Max Reitz <mreitz@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: John Snow <jsnow@redhat.com>
      Reported-by: NHuaitong Han <huanhuaitong@didichuxing.com>
      Signed-off-by: NHuaitong Han <huanhuaitong@didichuxing.com>
      Signed-off-by: NLiang Li <liliangleo@didichuxing.com>
      Signed-off-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b76e4458
  14. 12 3月, 2018 1 次提交
  15. 05 3月, 2018 1 次提交
  16. 14 2月, 2018 1 次提交
  17. 29 1月, 2018 1 次提交
    • T
      net: Allow netdevs to be used with 'hostfwd_add' and 'hostfwd_remove' · 93653066
      Thomas Huth 提交于
      It does not make much sense to limit these commands to the legacy 'vlan'
      concept only, they should work with the modern netdevs, too. So now
      it is possible to use this command with one, two or three parameters.
      
      With one parameter, the command installs a hostfwd rule on the default
      "user" network:
          hostfwd_add tcp:...
      
      With two parameters, the command installs a hostfwd rule on a netdev
      (that's the new way of using this command):
          hostfwd_add netdev_id tcp:...
      
      With three parameters, the command installs a rule on a 'vlan' (aka hub):
          hostfwd_add hub_id name tcp:...
      
      Same applies to the hostfwd_remove command now.
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      93653066
  18. 26 1月, 2018 2 次提交
  19. 14 12月, 2017 1 次提交
  20. 24 10月, 2017 1 次提交
  21. 14 7月, 2017 2 次提交
  22. 11 7月, 2017 1 次提交
  23. 30 6月, 2017 1 次提交
  24. 29 5月, 2017 1 次提交
  25. 23 5月, 2017 1 次提交
  26. 26 4月, 2017 1 次提交
  27. 30 10月, 2016 1 次提交
  28. 19 9月, 2016 1 次提交
  29. 06 9月, 2016 1 次提交
    • P
      drive-backup: added support for data compression · 13b9414b
      Pavel Butsykin 提交于
      The idea is simple - backup is "written-once" data. It is written block
      by block and it is large enough. It would be nice to save storage
      space and compress it.
      
      The patch adds a flag to the qmp/hmp drive-backup command which enables
      block compression. Compression should be implemented in the format driver
      to enable this feature.
      
      There are some limitations of the format driver to allow compressed writes.
      We can write data only once. Though for backup this is perfectly fine.
      These limitations are maintained by the driver and the error will be
      reported if we are doing something wrong.
      Signed-off-by: NPavel Butsykin <pbutsykin@virtuozzo.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      CC: Jeff Cody <jcody@redhat.com>
      CC: Markus Armbruster <armbru@redhat.com>
      CC: Eric Blake <eblake@redhat.com>
      CC: John Snow <jsnow@redhat.com>
      CC: Stefan Hajnoczi <stefanha@redhat.com>
      CC: Kevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      13b9414b
  30. 19 7月, 2016 1 次提交
  31. 26 5月, 2016 1 次提交
    • D
      migration: define 'tls-creds' and 'tls-hostname' migration parameters · 69ef1f36
      Daniel P. Berrange 提交于
      Define two new migration parameters to be used with TLS encryption.
      The 'tls-creds' parameter provides the ID of an instance of the
      'tls-creds' object type, or rather a subclass such as 'tls-creds-x509'.
      Providing these credentials will enable use of TLS on the migration
      data stream.
      
      If using x509 certificates, together with a migration URI that does
      not include a hostname, the 'tls-hostname' parameter provides the
      hostname to use when verifying the server's x509 certificate. This
      allows TLS to be used in combination with fd: and exec: protocols
      where a TCP connection is established by a 3rd party outside of
      QEMU.
      
      NB, this requires changing the migrate_set_parameter method in the
      HMP to accept a 's' (string) value instead of 'i' (integer). This
      is backwards compatible, because the parsing of strings allows the
      quotes to be optional, thus any integer is also a valid string.
      Reviewed-by: NDr. David Alan Gilbert <dgilbert@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1461751518-12128-26-git-send-email-berrange@redhat.com>
      Signed-off-by: NAmit Shah <amit.shah@redhat.com>
      69ef1f36
  32. 14 3月, 2016 1 次提交
    • K
      hmp: 'drive_add -n' for creating a node without BB · abb21ac3
      Kevin Wolf 提交于
      This patch adds an option to the drive_add HMP command to create only a
      BlockDriverState without a BlockBackend on top.
      
      The motivation for this is that libvirt needs to specify options to a
      migration target (specifically, detect-zeroes). drive-mirror doesn't
      allow specifying options, and the proper way to do this is to create the
      target BDS separately with blockdev-add (where you can specify options)
      and then use blockdev-mirror to that BDS.
      
      However, libvirt can't use blockdev-add as long as it is still
      experimental, and we're expecting that it will still take some time, so
      we need to resort to drive_add.
      
      The problem with drive_add is that so far it always created a BB, and
      BDSes with a BB can't be used as a mirroring target as long as we don't
      support multiple BBs per BDS - and while we're working towards that
      goal, it's another thing that will still take some time.
      
      So to achieve the goal, the simplest solution to provide the
      functionality now without adding one-off options to the mirror QMP
      commands is to extend drive_add to create nodes without BBs.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      abb21ac3
  33. 11 3月, 2016 1 次提交