Skip to content

Commit c08ecce

Browse files
authored
utils_nbd.py: add shared option for qemu-nbd (#4300)
In some cases, we may need to use --shared option to share device by clients. So add this option into the utils_nbd.py function. Signed-off-by: Meina Li <meili@redhat.com>
1 parent 13c0184 commit c08ecce

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

virttest/utils_nbd.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(
4444
deleteExisted=True,
4545
private_key_encrypt_passphrase=None,
4646
secret_uuid=None,
47+
shared_num=None,
4748
):
4849
"""Create a new NbdExport instance
4950
@@ -70,6 +71,7 @@ def __init__(
7071
self.private_key_encrypt_passphrase = private_key_encrypt_passphrase
7172
self.secret_uuid = secret_uuid
7273
self.deleteExisted = deleteExisted
74+
self.shared_num = shared_num
7375

7476
def _create_img(self):
7577
"""Create a image file with specified format"""
@@ -226,6 +228,8 @@ def start_nbd_server(self):
226228
)
227229
if self.export_name:
228230
qemu_nbd_cmd += "-x %s " % self.export_name
231+
if self.shared_num:
232+
qemu_nbd_cmd += "--shared=%s" % self.shared_num
229233
qemu_nbd_cmd += "&"
230234
process.run(
231235
qemu_nbd_cmd,

0 commit comments

Comments
 (0)