block: Make blockdev-reopen stable API
This patch drops the 'x-' prefix from x-blockdev-reopen. Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20210708114709.206487-7-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
246ebc2d6a
commit
e60edf69e2
|
@ -3559,7 +3559,7 @@ fail:
|
||||||
visit_free(v);
|
visit_free(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qmp_x_blockdev_reopen(BlockdevOptionsList *reopen_list, Error **errp)
|
void qmp_blockdev_reopen(BlockdevOptionsList *reopen_list, Error **errp)
|
||||||
{
|
{
|
||||||
BlockReopenQueue *queue = NULL;
|
BlockReopenQueue *queue = NULL;
|
||||||
GSList *drained = NULL;
|
GSList *drained = NULL;
|
||||||
|
|
|
@ -4219,7 +4219,7 @@
|
||||||
{ 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
|
{ 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true }
|
||||||
|
|
||||||
##
|
##
|
||||||
# @x-blockdev-reopen:
|
# @blockdev-reopen:
|
||||||
#
|
#
|
||||||
# Reopens one or more block devices using the given set of options.
|
# Reopens one or more block devices using the given set of options.
|
||||||
# Any option not specified will be reset to its default value regardless
|
# Any option not specified will be reset to its default value regardless
|
||||||
|
@ -4257,9 +4257,9 @@
|
||||||
# image does not have a default backing file name as part of its
|
# image does not have a default backing file name as part of its
|
||||||
# metadata.
|
# metadata.
|
||||||
#
|
#
|
||||||
# Since: 4.0
|
# Since: 6.1
|
||||||
##
|
##
|
||||||
{ 'command': 'x-blockdev-reopen',
|
{ 'command': 'blockdev-reopen',
|
||||||
'data': { 'options': ['BlockdevOptions'] } }
|
'data': { 'options': ['BlockdevOptions'] } }
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -261,7 +261,7 @@ class TestBlockdevMirrorReopen(MirrorBaseClass):
|
||||||
result = self.vm.qmp('blockdev-add', node_name="backing",
|
result = self.vm.qmp('blockdev-add', node_name="backing",
|
||||||
driver="null-co")
|
driver="null-co")
|
||||||
self.assert_qmp(result, 'return', {})
|
self.assert_qmp(result, 'return', {})
|
||||||
result = self.vm.qmp('x-blockdev-reopen', options=[{
|
result = self.vm.qmp('blockdev-reopen', options=[{
|
||||||
'node-name': "target",
|
'node-name': "target",
|
||||||
'driver': iotests.imgfmt,
|
'driver': iotests.imgfmt,
|
||||||
'file': "target-file",
|
'file': "target-file",
|
||||||
|
|
|
@ -137,7 +137,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase):
|
||||||
assert sha256_1 == self.getSha256()
|
assert sha256_1 == self.getSha256()
|
||||||
|
|
||||||
# Reopen to RW
|
# Reopen to RW
|
||||||
result = self.vm.qmp('x-blockdev-reopen', options=[{
|
result = self.vm.qmp('blockdev-reopen', options=[{
|
||||||
'node-name': 'node0',
|
'node-name': 'node0',
|
||||||
'driver': iotests.imgfmt,
|
'driver': iotests.imgfmt,
|
||||||
'file': {
|
'file': {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# group: rw
|
# group: rw
|
||||||
#
|
#
|
||||||
# Test cases for the QMP 'x-blockdev-reopen' command
|
# Test cases for the QMP 'blockdev-reopen' command
|
||||||
#
|
#
|
||||||
# Copyright (C) 2018-2019 Igalia, S.L.
|
# Copyright (C) 2018-2019 Igalia, S.L.
|
||||||
# Author: Alberto Garcia <berto@igalia.com>
|
# Author: Alberto Garcia <berto@igalia.com>
|
||||||
|
@ -85,16 +85,16 @@ class TestBlockdevReopen(iotests.QMPTestCase):
|
||||||
"Expected output of %d qemu-io commands, found %d" %
|
"Expected output of %d qemu-io commands, found %d" %
|
||||||
(found, self.total_io_cmds))
|
(found, self.total_io_cmds))
|
||||||
|
|
||||||
# Run x-blockdev-reopen on a list of block devices
|
# Run blockdev-reopen on a list of block devices
|
||||||
def reopenMultiple(self, opts, errmsg = None):
|
def reopenMultiple(self, opts, errmsg = None):
|
||||||
result = self.vm.qmp('x-blockdev-reopen', conv_keys=False, options=opts)
|
result = self.vm.qmp('blockdev-reopen', conv_keys=False, options=opts)
|
||||||
if errmsg:
|
if errmsg:
|
||||||
self.assert_qmp(result, 'error/class', 'GenericError')
|
self.assert_qmp(result, 'error/class', 'GenericError')
|
||||||
self.assert_qmp(result, 'error/desc', errmsg)
|
self.assert_qmp(result, 'error/desc', errmsg)
|
||||||
else:
|
else:
|
||||||
self.assert_qmp(result, 'return', {})
|
self.assert_qmp(result, 'return', {})
|
||||||
|
|
||||||
# Run x-blockdev-reopen on a single block device (specified by
|
# Run blockdev-reopen on a single block device (specified by
|
||||||
# 'opts') but applying 'newopts' on top of it. The original 'opts'
|
# 'opts') but applying 'newopts' on top of it. The original 'opts'
|
||||||
# dict is unmodified
|
# dict is unmodified
|
||||||
def reopen(self, opts, newopts = {}, errmsg = None):
|
def reopen(self, opts, newopts = {}, errmsg = None):
|
||||||
|
@ -161,7 +161,7 @@ class TestBlockdevReopen(iotests.QMPTestCase):
|
||||||
self.reopen(opts, {'file.locking': 'off'}, "Cannot change the option 'locking'")
|
self.reopen(opts, {'file.locking': 'off'}, "Cannot change the option 'locking'")
|
||||||
self.reopen(opts, {'file.filename': None}, "Invalid parameter type for 'options[0].file.filename', expected: string")
|
self.reopen(opts, {'file.filename': None}, "Invalid parameter type for 'options[0].file.filename', expected: string")
|
||||||
|
|
||||||
# node-name is optional in BlockdevOptions, but x-blockdev-reopen needs it
|
# node-name is optional in BlockdevOptions, but blockdev-reopen needs it
|
||||||
del opts['node-name']
|
del opts['node-name']
|
||||||
self.reopen(opts, {}, "node-name not specified")
|
self.reopen(opts, {}, "node-name not specified")
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ vm.event_wait('JOB_STATUS_CHANGE', timeout=3.0,
|
||||||
vm.get_qmp_events()
|
vm.get_qmp_events()
|
||||||
|
|
||||||
del blockdev_opts['file']['size']
|
del blockdev_opts['file']['size']
|
||||||
vm.qmp_log('x-blockdev-reopen', filters=[filter_qmp_testfiles],
|
vm.qmp_log('blockdev-reopen', filters=[filter_qmp_testfiles],
|
||||||
options = [ blockdev_opts ])
|
options = [ blockdev_opts ])
|
||||||
|
|
||||||
vm.qmp_log('block-job-resume', device='drive0')
|
vm.qmp_log('block-job-resume', device='drive0')
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"execute": "blockdev-mirror", "arguments": {"device": "drive0", "on-target-error": "enospc", "sync": "full", "target": "target"}}
|
{"execute": "blockdev-mirror", "arguments": {"device": "drive0", "on-target-error": "enospc", "sync": "full", "target": "target"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"execute": "x-blockdev-reopen", "arguments": {"options": [{"driver": "qcow2", "file": {"driver": "raw", "file": {"driver": "file", "filename": "TEST_DIR/PID-target"}}, "node-name": "target"}]}}
|
{"execute": "blockdev-reopen", "arguments": {"options": [{"driver": "qcow2", "file": {"driver": "raw", "file": {"driver": "file", "filename": "TEST_DIR/PID-target"}}, "node-name": "target"}]}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
{"execute": "block-job-resume", "arguments": {"device": "drive0"}}
|
{"execute": "block-job-resume", "arguments": {"device": "drive0"}}
|
||||||
{"return": {}}
|
{"return": {}}
|
||||||
|
|
|
@ -118,7 +118,7 @@ class EncryptionSetupTestCase(iotests.QMPTestCase):
|
||||||
def openImageQmp(self, vm, id, file, secret,
|
def openImageQmp(self, vm, id, file, secret,
|
||||||
readOnly = False, reOpen = False):
|
readOnly = False, reOpen = False):
|
||||||
|
|
||||||
command = 'x-blockdev-reopen' if reOpen else 'blockdev-add'
|
command = 'blockdev-reopen' if reOpen else 'blockdev-add'
|
||||||
|
|
||||||
opts = {
|
opts = {
|
||||||
'driver': iotests.imgfmt,
|
'driver': iotests.imgfmt,
|
||||||
|
|
|
@ -98,7 +98,7 @@ class TestPreallocateFilter(TestPreallocateBase):
|
||||||
self.check_big()
|
self.check_big()
|
||||||
|
|
||||||
def test_reopen_opts(self):
|
def test_reopen_opts(self):
|
||||||
result = self.vm.qmp('x-blockdev-reopen', options=[{
|
result = self.vm.qmp('blockdev-reopen', options=[{
|
||||||
'node-name': 'disk',
|
'node-name': 'disk',
|
||||||
'driver': iotests.imgfmt,
|
'driver': iotests.imgfmt,
|
||||||
'file': {
|
'file': {
|
||||||
|
|
|
@ -53,7 +53,7 @@ new_base_opts = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Don't want to bother with filtering qmp_log for reopen command
|
# Don't want to bother with filtering qmp_log for reopen command
|
||||||
result = vm.qmp('x-blockdev-reopen', **new_base_opts)
|
result = vm.qmp('blockdev-reopen', **new_base_opts)
|
||||||
if result != {'return': {}}:
|
if result != {'return': {}}:
|
||||||
log('Failed to reopen: ' + str(result))
|
log('Failed to reopen: ' + str(result))
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ log('Remove persistent bitmap from base node reopened to RW:')
|
||||||
vm.qmp_log('block-dirty-bitmap-remove', node='base', name='bitmap0')
|
vm.qmp_log('block-dirty-bitmap-remove', node='base', name='bitmap0')
|
||||||
|
|
||||||
new_base_opts['options'][0]['read-only'] = True
|
new_base_opts['options'][0]['read-only'] = True
|
||||||
result = vm.qmp('x-blockdev-reopen', **new_base_opts)
|
result = vm.qmp('blockdev-reopen', **new_base_opts)
|
||||||
if result != {'return': {}}:
|
if result != {'return': {}}:
|
||||||
log('Failed to reopen: ' + str(result))
|
log('Failed to reopen: ' + str(result))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue