Skip to content

Commit

Permalink
blockdev: Mark BD-{remove,insert}-medium stable
Browse files Browse the repository at this point in the history
Now that iotest 093 test proves that the throttling configuration
survives a blockdev-remove-medium/blockdev-insert-medium pair, the
original reason for declaring these commands experimental is gone
(see commit 6e0abc2).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20171110224302.14424-5-mreitz@redhat.com
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
  • Loading branch information
XanClic committed Jan 23, 2018
1 parent 82fcf66 commit 34ce111
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 38 deletions.
6 changes: 3 additions & 3 deletions blockdev.c
Expand Up @@ -2508,7 +2508,7 @@ static void blockdev_remove_medium(bool has_device, const char *device,
aio_context_release(aio_context);
}

void qmp_x_blockdev_remove_medium(const char *id, Error **errp)
void qmp_blockdev_remove_medium(const char *id, Error **errp)
{
blockdev_remove_medium(false, NULL, true, id, errp);
}
Expand Down Expand Up @@ -2586,8 +2586,8 @@ static void blockdev_insert_medium(bool has_device, const char *device,
qmp_blockdev_insert_anon_medium(blk, bs, errp);
}

void qmp_x_blockdev_insert_medium(const char *id, const char *node_name,
Error **errp)
void qmp_blockdev_insert_medium(const char *id, const char *node_name,
Error **errp)
{
blockdev_insert_medium(false, NULL, true, id, node_name, errp);
}
Expand Down
32 changes: 13 additions & 19 deletions qapi/block-core.json
Expand Up @@ -3403,24 +3403,21 @@
'*id': 'str' } }

##
# @x-blockdev-remove-medium:
# @blockdev-remove-medium:
#
# Removes a medium (a block driver state tree) from a block device. That block
# device's tray must currently be open (unless there is no attached guest
# device).
#
# If the tray is open and there is no medium inserted, this will be a no-op.
#
# @id: The name or QOM path of the guest device (since: 2.8)
#
# Note: This command is still a work in progress and is considered experimental.
# Stay away from it unless you want to help with its development.
# @id: The name or QOM path of the guest device
#
# Since: 2.5
# Since: 2.12
#
# Example:
#
# -> { "execute": "x-blockdev-remove-medium",
# -> { "execute": "blockdev-remove-medium",
# "arguments": { "id": "ide0-1-0" } }
#
# <- { "error": { "class": "GenericError",
Expand All @@ -3438,30 +3435,27 @@
#
# <- { "return": {} }
#
# -> { "execute": "x-blockdev-remove-medium",
# -> { "execute": "blockdev-remove-medium",
# "arguments": { "id": "ide0-1-0" } }
#
# <- { "return": {} }
#
##
{ 'command': 'x-blockdev-remove-medium',
{ 'command': 'blockdev-remove-medium',
'data': { 'id': 'str' } }

##
# @x-blockdev-insert-medium:
# @blockdev-insert-medium:
#
# Inserts a medium (a block driver state tree) into a block device. That block
# device's tray must currently be open (unless there is no attached guest
# device) and there must be no medium inserted already.
#
# @id: The name or QOM path of the guest device (since: 2.8)
# @id: The name or QOM path of the guest device
#
# @node-name: name of a node in the block driver state graph
#
# Note: This command is still a work in progress and is considered experimental.
# Stay away from it unless you want to help with its development.
#
# Since: 2.5
# Since: 2.12
#
# Example:
#
Expand All @@ -3473,14 +3467,14 @@
# "filename": "fedora.iso" } } }
# <- { "return": {} }
#
# -> { "execute": "x-blockdev-insert-medium",
# -> { "execute": "blockdev-insert-medium",
# "arguments": { "id": "ide0-1-0",
# "node-name": "node0" } }
#
# <- { "return": {} }
#
##
{ 'command': 'x-blockdev-insert-medium',
{ 'command': 'blockdev-insert-medium',
'data': { 'id': 'str',
'node-name': 'str'} }

Expand Down Expand Up @@ -3509,8 +3503,8 @@
#
# Changes the medium inserted into a block device by ejecting the current medium
# and loading a new image file which is inserted as the new medium (this command
# combines blockdev-open-tray, x-blockdev-remove-medium,
# x-blockdev-insert-medium and blockdev-close-tray).
# combines blockdev-open-tray, blockdev-remove-medium, blockdev-insert-medium
# and blockdev-close-tray).
#
# @device: Block device name (deprecated, use @id instead)
#
Expand Down
4 changes: 2 additions & 2 deletions tests/ahci-test.c
Expand Up @@ -1596,7 +1596,7 @@ static void test_atapi_tray(void)
rsp = qmp_receive();
QDECREF(rsp);

qmp_discard_response("{'execute': 'x-blockdev-remove-medium', "
qmp_discard_response("{'execute': 'blockdev-remove-medium', "
"'arguments': {'id': 'cd0'}}");

/* Test the tray without a medium */
Expand All @@ -1612,7 +1612,7 @@ static void test_atapi_tray(void)
"'driver': 'raw', "
"'file': { 'driver': 'file', "
"'filename': %s }}}", iso);
qmp_discard_response("{'execute': 'x-blockdev-insert-medium',"
qmp_discard_response("{'execute': 'blockdev-insert-medium',"
"'arguments': { 'id': 'cd0', "
"'node-name': 'node0' }}");

Expand Down
6 changes: 3 additions & 3 deletions tests/qemu-iotests/093
Expand Up @@ -348,9 +348,9 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
# Now eject cd0 and insert cd1
result = self.vm.qmp("blockdev-open-tray", id='dev0')
self.assert_qmp(result, 'return', {})
result = self.vm.qmp("x-blockdev-remove-medium", id='dev0')
result = self.vm.qmp("blockdev-remove-medium", id='dev0')
self.assert_qmp(result, 'return', {})
result = self.vm.qmp("x-blockdev-insert-medium", id='dev0', node_name='cd1')
result = self.vm.qmp("blockdev-insert-medium", id='dev0', node_name='cd1')
self.assert_qmp(result, 'return', {})

# Check that the I/O limits are still the same
Expand All @@ -359,7 +359,7 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
self.assert_qmp(result, 'return[0]/inserted/bps', 50)

# Eject cd1
result = self.vm.qmp("x-blockdev-remove-medium", id='dev0')
result = self.vm.qmp("blockdev-remove-medium", id='dev0')
self.assert_qmp(result, 'return', {})

# Check that we can't set limits if the device has no medium
Expand Down
20 changes: 10 additions & 10 deletions tests/qemu-iotests/118
Expand Up @@ -233,7 +233,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
else:
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)

result = self.vm.qmp('x-blockdev-remove-medium',
result = self.vm.qmp('blockdev-remove-medium',
id=self.device_name)
self.assert_qmp(result, 'return', {})

Expand All @@ -242,7 +242,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
self.assert_qmp(result, 'return[0]/tray_open', True)
self.assert_qmp_absent(result, 'return[0]/inserted')

result = self.vm.qmp('x-blockdev-insert-medium',
result = self.vm.qmp('blockdev-insert-medium',
id=self.device_name, node_name='new')
self.assert_qmp(result, 'return', {})

Expand Down Expand Up @@ -271,7 +271,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
if not self.has_real_tray:
return

result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
result = self.vm.qmp('blockdev-remove-medium', id=self.device_name)
self.assert_qmp(result, 'error/class', 'GenericError')

def test_insert_on_closed(self):
Expand All @@ -285,7 +285,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
'driver': 'file'})
self.assert_qmp(result, 'return', {})

result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
result = self.vm.qmp('blockdev-insert-medium', id=self.device_name,
node_name='new')
self.assert_qmp(result, 'error/class', 'GenericError')

Expand Down Expand Up @@ -320,7 +320,7 @@ class TestInitiallyFilled(GeneralChangeTestsBaseClass):

self.wait_for_open()

result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
result = self.vm.qmp('blockdev-insert-medium', id=self.device_name,
node_name='new')
self.assert_qmp(result, 'error/class', 'GenericError')

Expand All @@ -345,7 +345,7 @@ class TestInitiallyEmpty(GeneralChangeTestsBaseClass):

self.wait_for_open()

result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
result = self.vm.qmp('blockdev-remove-medium', id=self.device_name)
# Should be a no-op
self.assert_qmp(result, 'return', {})

Expand Down Expand Up @@ -603,13 +603,13 @@ class TestChangeReadOnly(ChangeBaseClass):
self.assert_qmp(result, 'return[0]/inserted/ro', False)
self.assert_qmp(result, 'return[0]/inserted/image/filename', old_img)

result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
result = self.vm.qmp('blockdev-remove-medium', id=self.device_name)
self.assert_qmp(result, 'return', {})

result = self.vm.qmp('query-block')
self.assert_qmp_absent(result, 'return[0]/inserted')

result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
result = self.vm.qmp('blockdev-insert-medium', id=self.device_name,
node_name='new')
self.assert_qmp(result, 'return', {})

Expand Down Expand Up @@ -642,7 +642,7 @@ class TestBlockJobsAfterCycle(ChangeBaseClass):

# For device-less BBs, calling blockdev-open-tray or blockdev-close-tray
# is not necessary
result = self.vm.qmp('x-blockdev-remove-medium', id=self.device_name)
result = self.vm.qmp('blockdev-remove-medium', id=self.device_name)
self.assert_qmp(result, 'return', {})

result = self.vm.qmp('query-block')
Expand All @@ -655,7 +655,7 @@ class TestBlockJobsAfterCycle(ChangeBaseClass):
'driver': 'file'})
self.assert_qmp(result, 'return', {})

result = self.vm.qmp('x-blockdev-insert-medium', id=self.device_name,
result = self.vm.qmp('blockdev-insert-medium', id=self.device_name,
node_name='node0')
self.assert_qmp(result, 'return', {})

Expand Down
2 changes: 1 addition & 1 deletion tests/qemu-iotests/139
Expand Up @@ -133,7 +133,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
# Insert a BlockDriverState
def insertDrive(self, device, node):
self.checkBlockDriverState(node)
result = self.vm.qmp('x-blockdev-insert-medium',
result = self.vm.qmp('blockdev-insert-medium',
id = device, node_name = node)
self.assert_qmp(result, 'return', {})
self.checkBlockDriverState(node)
Expand Down

0 comments on commit 34ce111

Please sign in to comment.