virttest: Handle AttributeError exception in store_vm_register() function.

We may got following error when monitor not ready:
07/05 13:11:07 ERROR| threading:0545|   File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner
07/05 13:11:07 ERROR| threading:0545|     self.run()
07/05 13:11:07 ERROR| threading:0545|   File "/usr/lib64/python2.6/threading.py", line 484, in run
07/05 13:11:07 ERROR| threading:0545|     self.__target(*self.__args, **self.__kwargs)
07/05 13:11:07 ERROR| threading:0545|   File "/usr/local/staf/test/RHEV/kvm/autotest-devel/client/tests/virt/virttest/env_process.py", line 1092, in _store_vm_register
07/05 13:11:07 ERROR| threading:0545|     stored_log = store_vm_register(vm, vr_filename)
07/05 13:11:07 ERROR| threading:0545|   File "/usr/local/staf/test/RHEV/kvm/autotest-devel/client/tests/virt/virttest/env_process.py", line 1052, in store_vm_register
07/05 13:11:07 ERROR| threading:0545|     output = vm.monitor.info('registers', debug=False)
07/05 13:11:07 ERROR| threading:0545| AttributeError: 'NoneType' object has no attribute 'info'

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.env_process: Use vm.instance in counter and vm_register_error_count in _store_vm_register()

Now we use vm.name in  counter and vm_register_error_count in _store_vm_register().
It could not work well in migration mode, which two vms have same name.

Signed-off-by: Feng Yang <fyang@redhat.com>
virttest.libvirt_vm: Add function to get libvirt job's type.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
shared.scripts: Add a tool for setting 0 to memory.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest.utils_netperf: Support multi package size in NetperfClient.(bg_)start()

Signed-off-by: Feng Yang <fyang@redhat.com>
virt.virttest.utils_test.update_boot_option: Check kernel option at the end of function.

Signed-off-by: Feng Yang <fyang@redhat.com>
vm_xml: convert 'current' vcpu value to int

The definition type of 'current' vcpu is string, so need convert it
before compare it with an int value.

Signed-off-by: Yanbing Du <ydu@redhat.com>
virttest: Update the kernel command line update part of code in env_process

As the original code for msi setup and extra_kernel_params setup are both
update the guest kernel command line. So remove some duplicate code. And
add the kernel command line restore code in post_process to restore the default
kernel command line in guest. Also add kernel command line check if guest is
started in preprocess.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest.qemu_storage: Update create() function when using qcow2 format

Some option only support qcow2 format, like: preallocation, encryption,
cluster_size.

Signed-off-by: Shuping Cui <scui@redhat.com>
virttest.qemu_storage: Fix a typo

We use 'encryption=on' for qcow2 format now.

Signed-off-by: Shuping Cui <scui@redhat.com>
Add methods to get host/VM cpu topolopy

1. Add accessors for cpu_topolopy in capability xml.
2. Add three func for libvirt VM to get domian cpu topolopy from
different ways.

Signed-off-by: Yanbing Du <ydu@redhat.com>
utils_test: Support disk format for creating image of RemoteDiskManager.

Signed-off-by: Yu Mingfei <yumingfei@cn.fujitsu.com>
virttest.utils_test.libvirt: Add export_options in pre_pool params

Add support setup netfs with export options like 'root_squash' other
than default 'no_root_squash'.

Signed-off-by: Wayne Sun <gsun@redhat.com>
utils_test.libvirt: Fix exportfs cleanup problem with netfs pool

The nfs exportfs did not clean up after run, it caused by export_dir
not specified when use cleanup_pool.

Signed-off-by: Wayne Sun <gsun@redhat.com>
libvirt_xml: update CPUXML and capabilityXML

Commit 393d19fa update class CPUXML without update related methods
of it, so fix it. And create a new func to do feature number check.

Signed-off-by: Yanbing Du <ydu@redhat.com>
virttest: Update the method to get test case name in write_subtests_files

We have some subtest name include "-". And the original method will use
the last word in the test case name as the whole case name in the subtest.cfg.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virttest: Update the code to get the command status

The original code can not handle negative number.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
virt: Support image_raw_device parameter in gluster.get_image_filename()

Signed-off-by: Feng Yang <fyang@redhat.com>
vm_xml: Add hypervisor features xml support

Signed-off-by: Yanbing Du <ydu@redhat.com>
Merge pull request #1820 from FengYang/get_image_filename

virt: Support image_raw_device parameter in gluster.get_image_filename()