virt.kvm_monitor: Future proof migration handling on QMP monitor

With d46ad35c74, the exception handling for migrations
happening when using a single QMP monitor relies on
an exception class that's going to disappear in future
versions of QEMU, being replaced by the GenericError
class. So let's also handle this exception class.

CC: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
virt.netperf: Use ssh_key lib rather than off limits server lib

When running the kvm autotest tests on a given host through
the autotest server, it's important to remember that only
the autotest client is copied to machines, making anything
that is not on the autotest.client namespace *off-limits*.

So, replace usage of SSHHost server class (here used only
to get ssh key setup) to use the ssh_key module, recently
split out due to a similar mistake made by test authors.

CC: Amos Kong <akong@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
base.cfg: Add host_ip_addr parameter

Signed-off-by: Marian Krcmarik <mkrcmari@redhat.com>
virt.kvm_vm.py: Use host ip for informing spice client about migration

Spice client may not run on localhost even during single host migration
so we need to inform spice client about host IP which is not localhost.

Signed-off-by: Marian Krcmarik <mkrcmari@redhat.com>
utils_misc: Add get_host_ip_address() function

Function returns Host IP specified in host_ip parameter If It exists
otherwise returns IP on interface specified in netdst parameter.

Signed-off-by: Marian Krcmarik <mkrcmari@redhat.com>
virt.rv_connect: Use get_host_ip_address()

Using get_host_ip_address() to be able to change
host ip of host address (where remote-viewer connects to)
in configuration.

Signed-off-by: Marian Krcmarik <mkrcmari@redhat.com>
virt.libvirt_vm.py: to add virsh_nodecpustats function

Signed-off-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
virt.subtests.cfg.sample: to add support for virsh_nodecpustats test

Signed-off-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
tests.libvirt.tests.virsh_nodecpustats.py: addition of new test case

Signed-off-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
client: Module-contents module

There's only a single function, get_map() which simply returns the
module's namespace (minus get_map).  This map can then be used at
runtime to filter out default symbols.  It makes auto-generating
__ALL__ easy and/or incorporating module namespace into a class.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Move all virsh_() functions to virsh module

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Classify Virsh from module contents

* Moved libvirtd_*() back into libvirt_vm module until they have a
  better home
* Used properties and a closure around globals() to pass
  state into virsh functions as parameters
* Made all virsh function/method API extensible/flexible
* Converted all virsh functions/methods to take **dargs
* Added/updated documentation to all virsh functions/methods
* Subclassed ShellSession as VirshSession specialised for virsh
* Implimented Closure class to fix python inconsistency
* Provide Virsh class w/ persistant or non-persistant backend sessions
* Unified virsh.cmd behavior for use as module function or class method

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Update all virsh_*() -> virsh.*()

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Added virsh help function

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

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Fixup uri handling and test operation order

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