1. 14 Nov, 2014 1 commit
  2. 11 Nov, 2014 1 commit
  3. 06 Nov, 2014 1 commit
  4. 03 Nov, 2014 6 commits
  5. 23 Oct, 2014 2 commits
  6. 20 Oct, 2014 9 commits
  7. 14 Oct, 2014 1 commit
  8. 03 Oct, 2014 1 commit
    • Markus Armbruster's avatar
      util: Emancipate id_wellformed() from QemuOpts · f5bebbbb
      Markus Armbruster authored
      IDs have long spread beyond QemuOpts: not everything with an ID
      necessarily goes through QemuOpts.  Commit 9aebf3b8 is about such a
      case: block layer names are meant to be well-formed IDs, but some of
      them don't go through QemuOpts, and thus weren't checked.  The commit
      fixed that the straightforward way: rename the internal QemuOpts
      helper id_wellformed() to qemu_opts_id_wellformed() and give it
      external linkage.
      
      Instead of using it directly in block.c, the commit adds wrapper
      bdrv_is_valid_name(), probably to hide the connection to QemuOpts.
      
      Go one logical step further: emancipate IDs from QemuOpts.  Rename the
      function back to id_wellformed(), and put it in another file.  While
      there, clean up its value to bool.  Peel off the bdrv_is_valid_name()
      wrapper.
      
      [Replaced stray return 0 with return false to match bool returns used
      elsewhere in id_wellformed().
      --Stefan]
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      f5bebbbb
  9. 25 Sep, 2014 3 commits
    • Kevin Wolf's avatar
      block: Validate node-name · 9aebf3b8
      Kevin Wolf authored
      The device_name of a BlockDriverState is currently checked because it is
      always used as a QemuOpts ID and qemu_opts_create() checks whether such
      IDs are wellformed.
      
      node-name is supposed to share the same namespace, but it isn't checked
      currently. This patch adds explicit checks both for device_name and
      node-name so that the same rules will still apply even if QemuOpts won't
      be used any more at some point.
      
      qemu-img used to use names with spaces in them, which isn't allowed any
      more. Replace them with underscores.
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      9aebf3b8
    • Markus Armbruster's avatar
    • Markus Armbruster's avatar
      block: Keep DriveInfo alive until BlockDriverState dies · 3ae59580
      Markus Armbruster authored
      If the BDS's refcnt > 0, drive_del() destroys the DriveInfo, but not
      the BDS.  This can happen in three places:
      
      * Device model destruction during unplug: blockdev_auto_del()
      
      * Xen IDE unplug: pci_piix3_xen_ide_unplug()
      
      * drive_del command when no device model is attached: do_drive_del()
      
      The other callers of drive_del are on error paths where refcnt == 1.
      
      If the user somehow manages to plug in a device model using a BDS that
      has gone through drive_del(), the legacy configuration passed in
      DriveInfo doesn't reach the device model, and automatic deletion on
      unplug doesn't work.  Worse, some device models such as scsi-disk
      crash when DriveInfo doesn't exist.
      
      This is theoretical; I didn't research an actual reproducer. The problem
      was introduced when we replaced DriveInfo reference counting by BDS
      reference counting in commit a94a3fac..fa510ebf.
      
      Fix by keeping DriveInfo alive until its BDS dies.
      
      This affects qemu_drive_opts: now you can't reuse the same ID for new
      drive options until the BDS dies.  Before, you could, but since the
      code always attempts to create a BDS with the same ID next, the
      enclosing operation "create a new drive" failed anyway.  Different
      error path, same result.
      
      Unfortunately, the fix involves use of blockdev.c stuff from block.c,
      which is a layering violation.  Fortunately, my forthcoming
      BlockBackend work will get rid of it again.
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
      Reviewed-by: default avatarBenoît Canet <benoit.canet@nodalink.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      3ae59580
  10. 22 Sep, 2014 6 commits
  11. 11 Sep, 2014 1 commit
  12. 10 Sep, 2014 4 commits
    • Benoît Canet's avatar
      block: Make the block accounting functions operate on BlockAcctStats · 5366d0c8
      Benoît Canet authored
      This is the next step for decoupling block accounting functions from
      BlockDriverState.
      In a future commit the BlockAcctStats structure will be moved from
      BlockDriverState to the device models structures.
      
      Note that bdrv_get_stats was introduced so device models can retrieve the
      BlockAcctStats structure of a BlockDriverState without being aware of it's
      layout.
      This function should go away when BlockAcctStats will be embedded in the device
      models structures.
      
      CC: Kevin Wolf <kwolf@redhat.com>
      CC: Stefan Hajnoczi <stefanha@redhat.com>
      CC: Keith Busch <keith.busch@intel.com>
      CC: Anthony Liguori <aliguori@amazon.com>
      CC: "Michael S. Tsirkin" <mst@redhat.com>
      CC: Paolo Bonzini <pbonzini@redhat.com>
      CC: Eric Blake <eblake@redhat.com>
      CC: Peter Maydell <peter.maydell@linaro.org>
      CC: Michael Tokarev <mjt@tls.msk.ru>
      CC: John Snow <jsnow@redhat.com>
      CC: Markus Armbruster <armbru@redhat.com>
      CC: Alexander Graf <agraf@suse.de>
      CC: Max Reitz <mreitz@redhat.com>
      Signed-off-by: default avatarBenoît Canet <benoit.canet@nodalink.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      5366d0c8
    • Benoît Canet's avatar
      block: Extract the block accounting code · 5e5a94b6
      Benoît Canet authored
      The plan is to add new accounting metrics (latency, invalid requests, failed
      requests, queue depth) and block.c is overpopulated so it will be better to work
      in a separate module.
      
      Moreover the long term plan is to have statistics in each of the BDS of the graph
      for metrology purpose; this means that the device model statistics must move from
      the topmost BDS to the device model.
      
      So we need to decouple the statistic code from BlockDriverState.
      
      This is another argument for the extraction of the code in a separate module.
      
      CC: Kevin Wolf <kwolf@redhat.com>
      CC: Stefan Hajnoczi <stefanha@redhat.com>
      CC: Max Reitz <mreitz@redhat.com>
      CC: Eric Blake <eblake@redhat.com>
      CC: Benoit Canet <benoit@irqsave.net>
      CC: Fam Zheng <famz@redhat.com>
      CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
      CC: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarBenoît Canet <benoit.canet@nodalink.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      5e5a94b6
    • Benoît Canet's avatar
      block: Extract the BlockAcctStats structure · 0ddd0ad9
      Benoît Canet authored
      Extract the block accounting statistics into a structure so the block device
      models can hold them in the future.
      
      CC: Kevin Wolf <kwolf@redhat.com>
      CC: Stefan Hajnoczi <stefanha@redhat.com>
      CC: Max Reitz <mreitz@redhat.com>
      CC: Eric Blake <eblake@redhat.com>
      Signed-off-by: default avatarBenoît Canet <benoit.canet@nodalink.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      0ddd0ad9
    • Luiz Capitulino's avatar
      block: extend BLOCK_IO_ERROR event with nospace indicator · c7c2ff0c
      Luiz Capitulino authored
      Management software, such as RHEV's vdsm, want to be able to allocate
      disk space on demand. The basic use case is to start a VM with a small
      disk and then the disk is enlarged when QEMU hits a ENOSPC condition.
      
      To this end, the management software has to be notified when QEMU
      encounters ENOSPC. The solution implemented by this commit is simple:
      it extends the BLOCK_IO_ERROR with a 'nospace' key, which is true
      when QEMU is stopped due to ENOSPC.
      
      Note that support for querying this event is already present in
      query-block by means of the 'io-status' key. Also, the new 'nospace'
      BLOCK_IO_ERROR field shares the same semantics with 'io-status',
      which basically means that werror= has to be set to either
      'stop' or 'enospc' to enable 'nospace'.
      
      Finally, this commit also updates the 'io-status' key doc in the
      schema with a list of supported device models.
      Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
      c7c2ff0c
  13. 08 Sep, 2014 1 commit
  14. 29 Aug, 2014 2 commits
  15. 28 Aug, 2014 1 commit