tp-libvirt icon indicating copy to clipboard operation
tp-libvirt copied to clipboard

virsh_attach_device: make sure device is ready before attaching a new device

Open hs0210 opened this issue 3 years ago • 2 comments

/dev/vdX in guest may be inconsistent with disk->target@dev in XML, if the old device is not ready in guest before attaching a new device to the guest.

Before:

# /usr/local/bin/avocado run --vt-type libvirt --test-runner=runner --vt-machine-type arm64-mmio virsh.attach_device.block.multi_virtio_file.with_alias.normal_test.hot_attach_hot_vm_current.name_ref.file_positional.domain_positional --vt-connect-uri qemu:///system
JOB ID : 98178aac2a79dc233e2ed45374cda6fc85a989a8 
JOB LOG : /var/lib/avocado/job-results/job-2022-10-12T14.22-98178aa/job.log 
 (1/1) type_specific.io-github-autotest-libvirt.virsh.attach_device.block.multi_virtio_file.with_alias.normal_test.hot_attach_hot_vm_current.name_ref.file_positional.domain_positional: FAIL: Positive pre-boot functionality test failed (285.12 s) 
RESULTS : PASS 0 | ERROR 0 | FAIL 1 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 
JOB HTML : /var/lib/avocado/job-results/job-2022-10-12T14.22-98178aa/results.html 
JOB TIME : 286.19 s

After:

# /usr/local/bin/avocado run --vt-type libvirt --test-runner=runner --vt-machine-type arm64-mmio virsh.attach_device.block.multi_virtio_file.with_alias.normal_test.hot_attach_hot_vm_current.name_ref.file_positional.domain_positional --vt-connect-uri qemu:///system                                                                
JOB ID     : a17c92bbbe012f399746c7d97a6a5caf70119d66
JOB LOG    : /var/lib/avocado/job-results/job-2022-10-17T03.12-a17c92b/job.log
 (1/1) type_specific.io-github-autotest-libvirt.virsh.attach_device.block.multi_virtio_file.with_alias.normal_test.hot_attach_hot_vm_current.name_ref.file_positional.domain_positional:  PASS (214.01 s)                                     
RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /var/lib/avocado/job-results/job-2022-10-17T03.12-a17c92b/results.html
JOB TIME   : 215.10 s

Signed-off-by: Hu Shuai [email protected]

hs0210 avatar Oct 17 '22 07:10 hs0210

@Yingshun PTAL.

hs0210 avatar Nov 01 '22 01:11 hs0210

/hold, this patch will cause some other cases to fail, checking now.

hs0210 avatar Nov 02 '22 03:11 hs0210

Just wait a while before attaching a new device to make sure that /dev/vdX in guest be consistent with disk->target@dev in XML.

hs0210 avatar Jan 16 '23 06:01 hs0210