qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v10 3/3] iotests: test nbd reconnect


From: Eric Blake
Subject: Re: [PATCH v10 3/3] iotests: test nbd reconnect
Date: Wed, 23 Oct 2019 06:33:06 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1

On 10/23/19 3:33 AM, Vladimir Sementsov-Ogievskiy wrote:
23.10.2019 4:31, Eric Blake wrote:
On 10/9/19 3:41 AM, Vladimir Sementsov-Ogievskiy wrote:
Add test, which starts backup to nbd target and restarts nbd server
during backup.

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---

+vm.qmp_log('blockdev-backup', device='drive0', sync='full', target='backup0',
+           speed=(1 * 1024 * 1024))

This starts the job throttled, to give us time...

+
+# Wait for some progress
+t = 0
+while t < wait_limit:
+    jobs = vm.qmp('query-block-jobs')['return']
+    if jobs and jobs[0]['offset'] > 0:
+        break
+    time.sleep(wait_step)
+    t += wait_step
+
+if jobs and jobs[0]['offset'] > 0:
+    log('Backup job is started')
+
+log('Kill NBD server')
+srv.kill()
+srv.wait()
+
+jobs = vm.qmp('query-block-jobs')['return']
+if jobs and jobs[0]['offset'] < jobs[0]['len']:
+    log('Backup job is still in progress')
+
+vm.qmp_log('block-job-set-speed', device='drive0', speed=0)

Ah, I overlooked this line in my late-night review.

+
+# Emulate server down time for 1 second
+time.sleep(1)

...but once we restart,...

+
+log('Start NBD server')
+srv = qemu_nbd_popen('-k', nbd_sock, '-f', iotests.imgfmt, disk_b)
+
+e = vm.event_wait('BLOCK_JOB_COMPLETED')

...should we unthrottle the job to allow the test to complete slightly faster 
after the reconnect?  But that can be done as an improvement on top, if it 
helps.

It is done above, before time.sleep(1)

Yep, so I feel better now.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]