Closed cevich closed 11 years ago
This test looks good, I made a few very small changes (adding quotes & re-working some line-wraps). However I found there are a few problems on RHEL5:
debug=True
to see what was happening.Detail:
(1/16) unattended_install.import.import: PASS (38.52 s)
(2/16) virsh_domblkinfo.normal_test.id_option: FAIL (10.90 s)
(3/16) virsh_domblkinfo.normal_test.name_option: FAIL (10.86 s)
(4/16) virsh_domblkinfo.normal_test.pause_option: FAIL (11.94 s)
(5/16) virsh_domblkinfo.normal_test.uuid_option: FAIL (11.86 s)
(6/16) virsh_domblkinfo.normal_test.shutoff_option: FAIL (1.39 s)
(7/16) virsh_domblkinfo.normal_test.vm_attach_disk: PASS (12.23 s)
(8/16) virsh_domblkinfo.error_test.no_option: FAIL (0.39 s)
(9/16) virsh_domblkinfo.error_test.hex_id_option: FAIL (0.40 s)
(10/16) virsh_domblkinfo.error_test.invalid_id_option: FAIL (1.40 s)
(11/16) virsh_domblkinfo.error_test.unexpected_option: FAIL (0.41 s)
(12/16) virsh_domblkinfo.error_test.with_libvirt_stop: FAIL (1.40 s)
(13/16) virsh_domblkinfo.error_test.invalid_uuid_option: FAIL (0.40 s)
(14/16) virsh_domblkinfo.error_test.extra_option: FAIL (1.41 s)
(15/16) virsh_domblkinfo.error_test.name_only_option: FAIL (1.39 s)
(16/16) virsh_domblkinfo.error_test.name_only_extra_option: FAIL (1.41 s)
The first group (before virsh_domblkinfo.normal_test.vm_attach_disk) all report:
11:39:50 DEBUG| KVM version: kvm-83-262.el5
11:39:50 DEBUG| KVM userspace version: Unknown
11:39:50 DEBUG| Running virsh command: domblkinfo vm1 vda
11:39:50 DEBUG| Running '/usr/bin/virsh domblkinfo vm1 vda'
11:39:50 DEBUG| status: 1
11:39:50 DEBUG| stdout:
11:39:50 DEBUG| stderr: error: invalid argument in invalid path vda not assigned to domain
11:39:50 DEBUG| Checking image file /usr/local/autotest/client/tests/virt/shared/data/images/jeos-17-64.qcow2
11:39:50 ERROR|
11:39:50 ERROR| Traceback (most recent call last):
11:39:50 ERROR| File "/usr/local/autotest/client/tests/virt/virttest/standalone_test.py", line 190, in run_once
11:39:50 ERROR| run_func(self, params, env)
11:39:50 ERROR| File "/usr/local/autotest/client/tests/virt/libvirt/tests/virsh_domblkinfo.py", line 78, in run_vi
rsh_domblkinfo
11:39:50 ERROR| raise error.TestFail("Run failed with right command")
11:39:50 ERROR| TestFail: Run failed with right command
11:39:50 ERROR|
11:39:50 ERROR| FAIL virsh_domblkinfo.normal_test.shutoff_option -> TestFail: Run failed with right command
For completeness, here's the passing test:
11:39:51 DEBUG| KVM version: kvm-83-262.el5
11:39:51 DEBUG| KVM userspace version: Unknown
11:39:51 DEBUG| waiting for domain vm1 to start (0.000018 secs)
11:39:51 DEBUG| Running 'dd if=/dev/zero of=/usr/local/autotest/client/tests/virt/shared/tmp.img count=512 bs=1024K'
11:39:52 DEBUG| Running 'virsh attach-disk vm1 --target vdd --source /usr/local/autotest/client/tests/virt/shared/tm
p.img'
11:39:52 DEBUG| Running virsh command: domblkinfo vm1 /usr/local/autotest/client/tests/virt/shared/tmp.img
11:39:52 DEBUG| Running '/usr/bin/virsh domblkinfo vm1 /usr/local/autotest/client/tests/virt/shared/tmp.img'
11:39:52 DEBUG| status: 0
11:39:52 DEBUG| stdout: Capacity: 536870912
Allocation: 537399296
Physical: 537399296
11:39:52 DEBUG| stderr:
11:39:52 DEBUG| Checking image file /usr/local/autotest/client/tests/virt/shared/data/images/jeos-17-64.qcow2
11:39:53 DEBUG| Resumed VM vm1
11:39:53 DEBUG| Found/Verified IP 192.168.122.146 for VM vm1 NIC 0
11:39:53 DEBUG| Login command: 'ssh -o UserKnownHostsFile=/dev/null -o PreferredAuthentications=password -p 22 root@
192.168.122.146'
11:39:59 WARNI| Client process terminated (status: 255, output: 'ssh: connect to host 192.168.122.146 port 22:
No route to host\n')
11:40:02 DEBUG| Destroying VM
11:40:03 WARNI| Requested MAC address release from persistent vm vm1. Ignoring.
11:40:03 INFO | PASS virsh_domblkinfo.normal_test.vm_attach_disk
After virsh_domblkinfo.normal_test.vm_attach_disk passes, the last tests all fail with:
11:40:03 DEBUG| KVM version: kvm-83-262.el5
11:40:03 DEBUG| KVM userspace version: Unknown
11:40:03 ERROR| Start VM vm1 failed:
Command </usr/bin/virsh start vm1> failed, rc=1, Command returned non-zero exit status
* Command:
/usr/bin/virsh start vm1
Exit status: 1
Duration: 0.0159749984741
stderr:
error: Failed to start domain vm1
error: internal error unsupported driver name 'phy' for disk '/usr/local/autotest/client/tests/virt/shared/tmp.img'
11:40:03 DEBUG| Checking image file /usr/local/autotest/client/tests/virt/shared/data/images/jeos-17-64.qcow2
11:40:03 ERROR|
11:40:03 ERROR| Traceback (most recent call last):
11:40:03 ERROR| File "/usr/local/autotest/client/tests/virt/virttest/standalone_test.py", line 182, in run_once
11:40:03 ERROR| env_process.preprocess(self, params, env)
11:40:03 ERROR| File "/usr/local/autotest/client/shared/error.py", line 138, in new_fn
11:40:03 ERROR| return fn(*args, **kwargs)
11:40:03 ERROR| File "/usr/local/autotest/client/tests/virt/virttest/env_process.py", line 435, in preprocess
11:40:03 ERROR| process(test, params, env, preprocess_image, preprocess_vm)
11:40:03 ERROR| File "/usr/local/autotest/client/tests/virt/virttest/env_process.py", line 283, in process
11:40:03 ERROR| _call_vm_func()
11:40:03 ERROR| File "/usr/local/autotest/client/tests/virt/virttest/env_process.py", line 258, in _call_vm_func
11:40:03 ERROR| vm_func(test, vm_params, env, vm_name)
11:40:03 ERROR| File "/usr/local/autotest/client/tests/virt/virttest/env_process.py", line 103, in preprocess_vm
11:40:03 ERROR| vm.start()
11:40:03 ERROR| File "/usr/local/autotest/client/tests/virt/virttest/libvirt_vm.py", line 1278, in start
11:40:03 ERROR| raise virt_vm.VMStartError(self.name, "libvirt domain failed "
11:40:03 ERROR| VMStartError: VM 'vm1' failed to start: libvirt domain failed to start
11:40:03 ERROR|
11:40:03 ERROR| FAIL virsh_domblkinfo.error_test.no_option -> VMStartError: VM 'vm1' failed to start: libvirt domain failed to start
Here's my branch with the slightly fixed up code: https://github.com/cevich/virt-test/tree/virsh_domblkinfo
I have a feeling it's something simple to fix but I cannot see the problem. Can you find out what's wrong, fix it, and send a pull-request against my branch?
Thanks.
I ran the test on RHEL6 host, the test all passed..And it seems that RHEL5 doesn't support "domblkinfo" command... I have an idea...Can you run 2 commands on your host liks these: 1.virsh domblkinfo vm1 vda 2.virsh domblkinfo vm1 /_/vm1.img ( /_/vm1.img is device source of vda) I guess maybe your host only support the second command....
The command definitely exists on my RHEL5.9 box...
[root@localhost ~]# virsh domblkinfo
error: command 'domblkinfo' requires <domain> option
error: command 'domblkinfo' requires <device> option
[root@localhost ~]# virsh --version
0.8.2
[root@localhost ~]# rpm -q libvirt
libvirt-0.8.2-29.el5
libvirt-0.8.2-29.el5
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.9 (Tikanga)
Though like I said in my mail, it's a little less than stock (but not much). So it's possible I messed it up somehow. The other output you asked for is:
[root@localhost ~]# cat /etc/libvirt/qemu/virt-tests-vm1.xml
...
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/usr/local/autotest/client/tests/virt/shared/data/images/jeos-17-64.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
...
[root@localhost ~]# virsh domblkinfo virt-tests-vm1 vda
error: invalid argument in invalid path vda not assigned to domain
[root@cesspool ~]# virsh help domblkinfo
NAME
domblkinfo - domain block device size information
SYNOPSIS
domblkinfo <domain> <device>
DESCRIPTION
Get block device size info for a domain.
OPTIONS
[--domain] <string> domain name, id or uuid
[--device] <string> block device
[root@localhost ~]# virsh domblkinfo virt-tests-vm1 /usr/local/autotest/client/tests/virt/shared/data/images/jeos-17-64.qcow2
Capacity: 10737418240
Allocation: 946089984
Physical: 946089984
So your guess is correct, though the error is a little confusing since dev='vda'
is in the XML. Anyway, I haven't investigated too deeply. Let me know if you need anything else.
You said after virsh_domblkinfo.normal_test.vm_attach_disk passes, the last tests all fail with "virsh start vm1" error.. Maybe on your host when the guest attach-disk with "virsh attach-disk vm1 --target vdd --source /**/tmp.img " command successfully, after destroy it, it doesn't recover itself automatic(diffrent from RHEL6 ), I will fix it..
Now...It seems that RHEL6 host support "virsh domblkinfo domain target" and "virsh domblkinfo domain source",RHEL5 host support "virsh domblkinfo domain source".So, I think modify the test to 2 parts(1st part tests both RHEL6 and RHEL5, 2nd only tests RHEL6), 1st part tests "virsh domblkinfo domain source" command, and 2nd part tests "virsh domblkinfo domain target". Is that OK?
Yes, this is fine. It's equally okay if you want to split it into two separate tests entirely. Yu did this recently for a test to handle XEN vs Qemu differences. It's much easier to wrap your brain around one-test-per-style. I don't mind if it duplicates test code, since they may diverge in the future (or maybe a third "style" will be introduced).
Hum...I don't separate tests entirely...just add some codes to the test to judge the driver(qemu or xen), according to the driver, I will do diffrent actions... BTW, maybe my xen host has some problems that cause host doesn't support "virsh domblkinfo", when I complete the codes,please help me to test it on xen host....Thank you very much...
Yep I got ya, perfectly fine as well. Yes, it wouldn't surprise me since the error was coming from the driver, so it's probably xen-specific. I'll ask one of our xen experts to give it a run once your done, to be sure. No problem.
It seems that this issue has not been added to issue #64
NAME domblkinfo - domain block device size information
SYNOPSIS domblkinfo
DESCRIPTION Get block device size info for a domain.
OPTIONS [--domain] domain name, id or uuid
[--device] block device
Mailing list patchset: https://www.redhat.com/archives/virt-test-devel/2013-February/msg00034.html