On 04/10/2013 01:52 AM, liyang wrote:
> On 2013-4-9 22:02, Cole Robinson wrote:
>> On 04/08/2013 09:01 PM, liyang wrote:
>>> On 2013-4-8 23:17, Lucas Meneghel Rodrigues wrote:
>>>> On 08/04/13 06:48 AM, liyang wrote:
>>>>> Signed-off-by: Li Yang<[email protected]>
>>>>> ---
>>>>>    libvirt/tests/cfg/virsh_cpu_compare.cfg |   21 ++++++++++++++-------
>>>>>    libvirt/tests/virsh_cpu_compare.py      |   18 ++++++++++++++----
>>>>>    2 files changed, 28 insertions(+), 11 deletions(-)
>>>>>
>>>>> +        if target == "host":
>>>>> +            domxml = virsh.capabilities()
>>>>> +        else:
>>>>> +            domxml = virsh.dumpxml(vm_name)
>>>> Turns out dumpxml for the domain has no element 'cpu'
>>>>
>>>> <domain type='kvm'>
>>>> <name>virt-tests-vm1</name>
>>>> <uuid>ae2a34e2-64f8-62c6-db92-449617c08361</uuid>
>>>> <memory unit='KiB'>1048576</memory>
>>>> <currentMemory unit='KiB'>1048576</currentMemory>
>>>> <vcpu placement='static'>2</vcpu>
>>>> <os>
>>>> <type arch='x86_64' machine='pc-i440fx-1.4'>hvm</type>
>>>> <boot dev='hd'/>
>>>> </os>
>>>> <features>
>>>> <acpi/>
>>>> <apic/>
>>>> <pae/>
>>>> </features>
>>>> <clock offset='utc'/>
>>>> <on_poweroff>destroy</on_poweroff>
>>>> <on_reboot>restart</on_reboot>
>>>> <on_crash>restart</on_crash>
>>>> <devices>
>>>> <emulator>/usr/bin/qemu-kvm</emulator>
>>>> <disk type='file' device='disk'>
>>>> <driver name='qemu' type='qcow2'/>
>>>> <source
>>>> file='/home/lmr/Code/virt-test.git/shared/data/images/jeos-17-64.qcow2'/>
>>>> <target dev='vda' bus='virtio'/>
>>>> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
>>>> </disk>
>>>> <controller type='usb' index='0'>
>>>> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
>>>> </controller>
>>>> <interface type='bridge'>
>>>> <mac address='52:54:00:bf:c0:c1'/>
>>>> <source bridge='virbr0'/>
>>>> <model type='virtio'/>
>>>> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
>>>> </interface>
>>>> <serial type='file'>
>>>> <source path='/tmp/serial-20130408-121506-YySBxhLT'/>
>>>> <target port='0'/>
>>>> </serial>
>>>> <serial type='pty'>
>>>> <target port='1'/>
>>>> </serial>
>>>> <console type='file'>
>>>> <source path='/tmp/serial-20130408-121506-YySBxhLT'/>
>>>> <target type='serial' port='0'/>
>>>> </console>
>>>> <input type='mouse' bus='ps2'/>
>>>> <graphics type='vnc' port='-1' autoport='yes'/>
>>>> <video>
>>>> <model type='cirrus' vram='9216' heads='1'/>
>>>> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
>>>> </video>
>>>> <memballoon model='virtio'>
>>>> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
>>>> </memballoon>
>>>> </devices>
>>>> </domain>
>>>>
>>>> Therefore, all tests will fail. I am simply fixing the typo that went
>>>> unnoticed and NACKing all the rest of this patch.
>>> There's a problem in the test.:-( Before starting test, please confirm that
>>> the tested guest's xml definition contains information about cpu.(virsh
>>> dumpxml domain).
>>> If not, you must modify Processor's configuration in virt-manager
>>> manually(Select a model or
>>> use "Copy host CPU configuration" button) .After that,the guest's xml
>>> definition will contain
>>> the cpu information.
>>> Does any body have the way can make the action above be automated?
>>
>> You can specify<cpu mode='host-model'/>  in the XML and libvirt will do that
>> step for you automatically. Needs at least libvirt 0.9.10
>>
>> - Cole
>>
> Thanks...According to your suggestion, I just tried it, but it seems doesn't
> take effect .
> 
> 1.Use "virsh edit vm1" command to modify vm1's XML.
> [root@63beta-kvm liyang]# virsh edit vm1
> .............
> <features>
> <acpi/>
> <apic/>
> <pae/>
> </features>
> <clock offset='utc'/>
> .............
> ↓↓↓
> ↓↓↓
> .............
> <features>
> <acpi/>
> <apic/>
> <pae/>
> </features>
> <cpu mode='host-model'/>
> <clock offset='utc'/>
> .............
> 2.After saving the XML, use "virsh dumpxml vm1" to check vm1's XML.
> [root@63beta-kvm liyang]# virsh dumpxml vm1 > tmp.xml
> [root@63beta-kvm liyang]# cat tmp.xml

Hmm, this confused me for a second, then I remembered you need to pass the
--update-cpu flag to dumpxml to have it fill in the CPU values. That should
fix these steps.

- Cole

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to