qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: William Dauchy <william@gandi.net>
To: Markus Armbruster <armbru@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Ian Main <imain@redhat.com>,
	Fam Zheng <famz@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] hotremoving a disk qmp/hmp
Date: Tue, 18 Nov 2014 16:08:21 +0100	[thread overview]
Message-ID: <20141118150821.GN17306@gandi.net> (raw)
In-Reply-To: <87wq6smvut.fsf@blackfin.pond.sub.org>

[-- Attachment #1: Type: text/plain, Size: 8428 bytes --]

On Nov18 15:22, Markus Armbruster wrote:
> This is block backend "disk1".

yes indeed.

> I presume you're deleting the device using backend "disk1".

yes

> What kind of device is this?  PCI, perhaps?
> Please show us a complete QMP conversation.

Here it is:

live vm with one disk:

(QEMU) query-block
{   u'return': [   {   u'device': u'disk0',
                       u'inserted': {   u'backing_file_depth': 0,
                                        u'bps': 0,
                                        u'bps_rd': 0,
                                        u'bps_wr': 0,
                                        u'detect_zeroes': u'off',
                                        u'drv': u'raw',
                                        u'encrypted': False,
                                        u'encryption_key_missing': False,
                                        u'file': u'/dev/sda',
                                        u'image': {   u'actual-size': 0,
                                                      u'dirty-flag': False,
                                                      u'filename': u'/dev/sda',
                                                      u'format': u'raw',
                                                      u'virtual-size': 3221225472},
                                        u'iops': 0,
                                        u'iops_rd': 0,
                                        u'iops_wr': 0,
                                        u'ro': False},
                       u'io-status': u'ok',
                       u'locked': True,
                       u'removable': True,
                       u'tray_open': False,
                       u'type': u'unknown'}]}

hotplugging one disk:

(QEMU) blockdev-add
with
{'options' : {
    'driver': 'raw',
    'id': 'disk1',
    'file': {
        'driver': 'file',
        'filename': /dev/sdb,
        }
}}

(QEMU) device_add
with:
{
    'driver': 'scsi-hd',
    'id': 'disk1',
    'drive': 'disk1',
    'scsi-id': 1,
    'removable': 'on',
    'dpofua': 'off'
}

(QEMU) query-block
{   u'return': [   {   u'device': u'disk0',
                       u'inserted': {   u'backing_file_depth': 0,
                                        u'bps': 0,
                                        u'bps_rd': 0,
                                        u'bps_wr': 0,
                                        u'detect_zeroes': u'off',
                                        u'drv': u'raw',
                                        u'encrypted': False,
                                        u'encryption_key_missing': False,
                                        u'file': u'/dev/sda',
                                        u'image': {   u'actual-size': 0,
                                                      u'dirty-flag': False,
                                                      u'filename': u'/dev/sda',
                                                      u'format': u'raw',
                                                      u'virtual-size': 3221225472},
                                        u'iops': 0,
                                        u'iops_rd': 0,
                                        u'iops_wr': 0,
                                        u'ro': False},
                       u'io-status': u'ok',
                       u'locked': True,
                       u'removable': True,
                       u'tray_open': False,
                       u'type': u'unknown'},,
                   {   u'device': u'disk1',
                       u'inserted': {   u'backing_file_depth': 0,
                                        u'bps': 0,
                                        u'bps_rd': 0,
                                        u'bps_wr': 0,
                                        u'detect_zeroes': u'off',
                                        u'drv': u'raw',
                                        u'encrypted': False,
                                        u'encryption_key_missing': False,
                                        u'file': u'/dev/sdb',
                                        u'image': {   u'actual-size': 0,
                                                      u'dirty-flag': False,
                                                      u'filename': u'/dev/sdb',
                                                      u'format': u'raw',
                                                      u'virtual-size': 3221225472},
                                        u'iops': 0,
                                        u'iops_rd': 0,
                                        u'iops_wr': 0,
                                        u'ro': False},
                       u'io-status': u'ok',
                       u'locked': True,
                       u'removable': True,
                       u'tray_open': False,
                       u'type': u'unknown'}]}

hotremoving disk1:

(QEMU) device_del
with:
{'id': 'disk1'}

(QEMU) query-block
{   u'return': [   {   u'device': u'disk0',
                       u'inserted': {   u'backing_file_depth': 0,
                                        u'bps': 0,
                                        u'bps_rd': 0,
                                        u'bps_wr': 0,
                                        u'detect_zeroes': u'off',
                                        u'drv': u'raw',
                                        u'encrypted': False,
                                        u'encryption_key_missing': False,
                                        u'file': u'/dev/sda',
                                        u'image': {   u'actual-size': 0,
                                                      u'dirty-flag': False,
                                                      u'filename': u'/dev/sda',
                                                      u'format': u'raw',
                                                      u'virtual-size': 3221225472},
                                        u'iops': 0,
                                        u'iops_rd': 0,
                                        u'iops_wr': 0,
                                        u'ro': False},
                       u'io-status': u'ok',
                       u'locked': True,
                       u'removable': True,
                       u'tray_open': False,
                       u'type': u'unknown'},,
                   {   u'device': u'disk1',
                       u'inserted': {   u'backing_file_depth': 0,
                                        u'bps': 0,
                                        u'bps_rd': 0,
                                        u'bps_wr': 0,
                                        u'detect_zeroes': u'off',
                                        u'drv': u'raw',
                                        u'encrypted': False,
                                        u'encryption_key_missing': False,
                                        u'file': u'/dev/sdb,
                                        u'image': {   u'actual-size': 0,
                                                      u'dirty-flag': False,
                                                      u'filename': u'/dev/sdb',
                                                      u'format': u'raw',
                                                      u'virtual-size': 3221225472},
                                        u'iops': 0,
                                        u'iops_rd': 0,
                                        u'iops_wr': 0,
                                        u'ro': False},
                       u'io-status': u'ok',
                       u'locked': False,
                       u'removable': True,
                       u'tray_open': False,
                       u'type': u'unknown'}]}

So now I have locked == False but I don't know how to clean the object
with QMP API.
so...
switching to HMP API:

(QEMU) info block
disk0: /dev/sda (raw)
    Removable device: locked, tray closed

disk1: /dev/sdb (raw)
    Removable device: not locked, tray closed

(QEMU) drive_del disk1
(QEMU) info block
disk0: /dev/sda (raw)
    Removable device: locked, tray closed


Is there a way to do the same with QMP commands?

Thanks,
-- 
William

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2014-11-18 15:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18 10:02 [Qemu-devel] hotremoving a disk qmp/hmp William Dauchy
2014-11-18 14:22 ` Markus Armbruster
2014-11-18 15:08   ` William Dauchy [this message]
2014-11-18 17:15     ` Markus Armbruster
2014-11-19  9:58       ` William Dauchy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141118150821.GN17306@gandi.net \
    --to=william@gandi.net \
    --cc=armbru@redhat.com \
    --cc=famz@redhat.com \
    --cc=imain@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).