Add snapshot-edit command in virsh.py

1. Add snapshot-edit, snapshot-parent command
2. Modify snapshot-current to output xml/name or command output

Signed-off-by: Kyla Zhang <weizhan@redhat.com>
Change the function place for common use and add options for sync

1. change the function place and improve implementation
2. Add option for sync

Signed-off-by: Kyla Zhang <weizhan@redhat.com>
Add config file for snapshot-edit test

Signed-off-by: Kyla Zhang <weizhan@redhat.com>
add snapshot-edit test

Signed-off-by: Kyla Zhang <weizhan@redhat.com>
virt-libguestfs: Add sparsify case for virt-sysprep test

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>
virt: variable-rename fix for pylint

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: Remove custom string conversion

Since PropcanBase is now fully pickle-able, there is no need
for custom string-conversion (which was used for pickling in virtnet).
Removed these special methods to just let normal python dict string
conversion take over.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: libvirt_xml interface xml driver

Added ability to get/set/del '<model type=>' element + attribute.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Override base classcontains/has_key

There is a secondary set of propcan instances used behind the
scenes inside accessor factories.  Whenever they were trying
to retrieve non-existing data, or receive invalid input,
they toss a variaety of LibvirtXMLError exception sub-classes
by API design.  However, this doesn't jive with the standard
attribute/dictionary key-check method behavior.

The libvirt_xml API is defined such that all internally sourced
problems always throw a LibvirtXMLError exception or subclass.
However, since libvirt_base is also a propcan subclass, these
classes were get in the way of the regular python __contains__
and has_key() behavior.

This change makes LibvirtXML subclasses all conform to the python
dict and instance-attribute access convention.  Without it, one
would need to wrap the 'has_key()' call inside a try...except
LibvirtXMLError, which is unnatural.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Fix VMXML bug

Devices were not properly having the virsh instance
passed on to them.

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

The Virsh class automatically sucks in all callable
symbols found in the module and converts them into
methods.  However, an omission from the exclusion
list caused the VirshConnectBack class to be needlessly
exposed as a method (since classes are callable).
This has the potential to mess with unittests which
must mock Virsh methods, but at the same time may need
to use this class.  Adding it to the exclusion list
will prevent those problems.
virt: Add common to all entry ponts

All entry points must import the common module.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: Mass Unittests shared-state cleanup

Identified four unittests which were incorrectly
sharing state internally and externally.  In most
cases the fixes were simple: isolate test state
for every test via setup().  In the case of tests
needing to mock virsh functions, I took the extra
precautionary step of forcing them to first over-ride
ALL virsh functions/methods with an exception.
This way, any functions that should be mocked in
unittests but are not, will be immediatly clear :)

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Fix interface XML driver

Fix duplication of 'type_name' property from base-class. In other
words, ``libvirt_xml/devices/base.py`` defines ``TypedDeviceBase``
which already handles setting up methods for ``get_type_name(),
set_type_name(), del_type_name()`` to work on device elements
``<device_name type='foobar'>``.  So there's no point in having a
subclass re-define accessor methods for the same ``type`` attribute.
Worse, it's using a python built-in (``type``) which encourages other
bad names down the stack.  I searched high and low for any usage of this
``type`` attribute and any calls to instance methods ``get_type(),
set_type(), and del_type()``  but found none.

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

Signed-off-by: Chris Evich <cevich@redhat.com>
Merge pull request #948 from kylazhang/snapshot-branch

Virsh Snapshot-edit test
virt-libvirt: Extend test-runner default tests

By default, the runner was running all variants of a single test.
This makes it harder to spot certain types of test-specific problems.
Instead, the runner should run a wider variety of tests, spreading
the variant choices across a range of underlying functionality.

Unfortunately, there's not a cleaner way to specify a wide range of
tests w/o simply listing them all.  However, the list can be read
in from a file, which will help keep the maintenance effort low. I
hard-coded list file path as relative to wherever the test runner
module is located, since there's no reason to over complicate it.

I expect this list will change over time, so this is only a reasonable
starting place. Included are about 80 libvirt tests from across the
board, with at least one positive and one negative test for each topic.
I attempted to pick different operational varients from each set so,
for example, it doesn't just exercize the same set of parameters
repeatidly.

Including the install and remove, they all complete on my intel i7 based
laptop in under 30min, which was found to be reasonable.

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