run: Add --monitor, for monitor type

Allow to test qmp vs hmp monitor types more easily
by adding a new switch --monitor.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
KVM Test: remove the unnecessary double quote on uri when migrate using qmp monitor

otherwise, the migration would fail.
Tested on my localhost using F18(both hmp && qmp)
before patch:
{"execute": "migrate", "arguments": {"uri": "\"exec:nc localhost 5200\"", "blk": false, "inc": false}, "id": "fUOKXSd2"}
after patch:
{"execute": "migrate", "arguments": {"uri": "exec:nc localhost 5200", "blk": false, "inc": false}, "id": "fUOKXSd2"}

Signed-off-by: Xiaoqing Wei <xwei@redhat.com>
virt-libvirt: Add NetworkXML class for libvirt_xml module.

Signed-off-by: Yu Mingfei<yumingfei@cn.fujitsu.com>
virt-libvirt: Add configuration for virsh net-create test.

Signed-off-by: Yu Mingfei<yumingfei@cn.fujitsu.com>
virt-libvirt: Add test module for virsh net-create.

Signed-off-by: Yu Mingfei<yumingfei@cn.fujitsu.com>
virt-libvirt: Reorganized virsh net_create configuration

Flipped variant tree inside out so it's based on expected
output rather than input.  This allows test module code
to require fewer conditionals and special case branches.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: virsh module cleanup & doc update

* Increase timeout used for VirshPersistent to allow
  recovery oportunity when libvirtd has just been started
  or restarted.
* Docstring updates
* Simplification of a few net-* functions

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add virsh.net_dumpxml method

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add virsh.net_define() and net_undefine methods

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add virsh.net_start() and net_autostart methods

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add virsh.net_state_dict() method

The virsh net-list command output returns a table structure
describing some of the current host network state.  However,
by default it does not show inactive networks, nor does it
display the transient/persistent state of a network.  Rather
than require callers to determine this every time, wrap all this
info up into a dictionary of dictionaries.  The outer-most
dictionary is keyed by network name, the innter-most
specifies values for the varous properties of that network.

There exists in later libvirt versions, a virsh net-info command
that would simplify this method greatly.  However this method
does not exist in older versions of libvirt, so it's necessary
to perform hacks to obtain transient/persistent state.  The
hack exploits the fact that the autostart state cannot be
updated on transient networks, and the error message clearly
states this.  Therefor, the transient/persistent state
can be obtained by setting it to the current value and
reading any produced error message.  If this does not work
with future versions, then we only need fallback to using a
[new] virsh net-info method.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: cleanup + update docstrings in libvirt_xml

* Lots of formatting & docstring cleanup
* Moved a few write() calls outside try: clauses for clarity
* Added a simple NetworkXML.debug_xml() method

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add & rename libvirt_xml NetworkXML properties

* Renamed "network_name" -> "name"
* Fixed accessor names "*_network_uuid()" -> "*_uuid()"
* Added properties for 'bridge', 'defined', 'active',
  'autostart', and 'persistent'

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add docstring & accessor methods for new properties

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add libvirt_xml NetworkXML methods

* Add __init__ to allow starting with minimal xml
* Add static method to return dictionary of all
  currently define Networks as NetworkXML instances
  keyd by their name.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add create and "destroy" methods

* Added a create method which mostly wrapps virsh
  net-create command to adds and starts a _transient_
  (NOT persistent) host network.

* Added the compliment of new_all_networks_dict() which
  utterly and completely removes ALL defined host
  networks unconditionally.  The method name guards
  against foolish usage (You made a backup right?).

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add test cases for libvirt_xml NetworkXML classes

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Update virsh net-create test

Changed structure to use libvirt_xml for high-level
test cases, and go direct to virsh for low-level
situations.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Recover virsh_net_create configuration

Signed-off-by: Chris Evich <cevich@redhat.com>