virt: New xml_utils.create_by_xpath() method + test

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Descendent creation by accessors

This allows using an XML accessor factory to create
an entire chain of element descendents if they don't
exist.  i.e. A disused property need not require
specific, or any XML to be in place.

Added unittest to also serve as an example for how this
can be used.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: libvirt_xml docstring update/fix

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: libvirt_xml module @staticmethod fix

All @staticmethods on LibvirtXMLBase subclasses must
accept and pass a virsh_instance parameter, but many
were not.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Resolve libvirt_xml numa tune TODO

Simplify access to numa parameters by making it
into a propery to return attributes as a dict.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: fix virsh_numatune test bug

Test was failing when start_vm was "no" but gest was running.
Test was failing when requested numaset greater than available
on host.  Test was failing when --config parameter was used
but guest was not restarted.  Many thanks to Yang Dongsheng
<yangds.fnst@cn.fujitsu.com> for his help finding and helping
fix some of these problems.

Signed-off-by: Chris Evich <cevich@redhat.com>
Merge pull request #452 from cevich/create_by_xpath

Create by xpath enhancement and virsh_numatine test fixups
fix typo in libvirt/tests/cfg/virsh_attach_detach_disk.cfg

1. del a space end of line.
2. dos2unix.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
Remove the new line at the end of file virsh_edit.cfg and virsh_save.cfg.

(1). remove the new line at the end of virsh_edit.cfg.
(2). remove the new line at the end of virsh_save.cfg.

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
libvirt-tests: rebuild the struct of dir libvirt/tests.

Make a dir struct for libvirt-tests. Referring to "virsh help",
the virsh_cmd module contains 11 parts. The outline looks
like:

libvirt/tests/                              virsh_cmd/
            |---cfg/                            |---domain/
                |---kernel_panic.cfg            |---monitor/
                |---remove_guest.cfg            |---host/
                |---virsh_cmd/                  |---interface/
            |---src/                            |---filter/
                |---kernel_panic.py             |---network/
                |---remove_guest.py             |---nodedev/
                |---virsh_cmd/                  |---secret/
                                                |---snapshot/
                                                |---pool/
                                                |---volume/

Signed-off-by: yangdongsheng <yangds.fnst@cn.fujitsu.com>
virt-libvirt: Move newer tests into virsh_cmd structure

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: virsh_destroy bugfix

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: Make datadir filter messages DEBUG

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: virsh_setmem bugfix

Signed-off-by: Chris Evich <cevich@redhat.com>
Merge pull request #400 into next
qemu: make virtual_nic_sendbuffer test support windows guests

This patch make virtual_nic_sendbuffer test support windows guest.

For Windows guests:

1. Download udt.sdk.4.8.win32.zip.
   link: http://sourceforge.net/projects/udt/files/udt/4.8/udt.sdk.4.8.win32.zip
2. Unzip it, and put the file in your guest disk or cdrom.
3. Make sure the program can run normally in your guest.

Linux guest:
    make the udt_url is a valid git repo

Signed-off-by: Yunping Zheng <yunzheng@redhat.com>
qemu.tests:add sub case add max CPUs for cpu hotplug

hotplug 159 vcpus and check vcpu number inside and reboot guest

Changelog from V3:
1) removed open/close session code.
2) use vm.monitor.send_args_cmd to auto choose monitor
3) use utils_misc.wait_for() to replace time.sleep()
Changelog from V2:
1) add all error.context with logging.info
Changelog from V1:
1) fixed the hardcode log
2) make the error.context with 'logging.info' argument
3) update the docstring
4) add try / except to the hotplug code
5) sync the log with test steps
6) added 10 Secs sleep time as Win guest needs it

Signed-off-by: Xiaoqing Wei <xwei@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>

Merge the old scripts into cpu_hotplug

And cpu hotplug may support in qemu 1.5, so remove the manually
set cpu online inside guest related code.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
qemu.tests: add cpu_hotplug.nonexist_vcpu case

Hotplug one nonexistent cpus number

Signed-off-by: Xiaoqing Wei <xwei@redhat.com>
qemu.tests : Add new test boot_order_check

add new case boot_order_check

changes from v1:
1) update time.sleep to wait_for()
2) add some comments
3) modify replace ascii char(backspace)

changes from v2:
1) fix check whether guest is booted

changes from v3:
1) move boot_fail_infos to the cfg files
2) update the check branch

changes from v4:
1) update the TestFail info

changes from v5:
1) check the boot order by boot_fail_infos

changes from v6:
1) get the nic_addr from 'info pci'

chages from v7:
1) add func to get nic_addr from nic_device_id

Signed-off-by: Shuping Cui <scui@redhat.com>
Acked-by: Feng Yang <fyang@redhat.com>

Update the method for get pci address for nic deivce and fix some
minor problems.

Signed-off-by: Yiqiao Pu <ypu@redhat.com>
qemu: add test for drive_mirror

Signed-off-by: Xu Tian <xutian@redhat.com>