libvirt: Fix setmaxmem from changing mem size

The test setmaxmem backup the vm's max memory and restore it by calling
`virsh setmaxmem` after test.

This will cause problem when test shinking the max memory. The current
memory will also shrink to adapt the max memory. After restore the max
memory, this shrinked current memory will remain.

* To ensure the fully restoration of guest, we change back to
  backup by new_from_inactive_dumpxml and sync after test.

* Use `try ... finally ...` to make sure restoration even bad thing
  happens.

* Fix some pylint complaints.

Signed-off-by: Hao Liu <hliu@redhat.com>
libvirt: Fix attach-device itertools backports

Calling backported itertools using 'from ... import ...' will cause
following error.

ERROR| Traceback (most recent call last):
ERROR|   File "virttest/standalone_test.py", line 182, in run_once
ERROR|     test_modules[t_type] = imp.load_module(t_type, f, p, d)
ERROR|   File "libvirt/tests/src/virsh_cmd/domain/virsh_attach_device.py", line 14, in <module>
ERROR|     from virttest.staging.backports.itertools import product, islice, count
ERROR| ImportError: No module named itertools

Signed-off-by: Hao Liu <hliu@redhat.com>
qemu.tests.virtual_nic_send_buffer: Update the way used to checkout md5 in guest

md5 command in guest may have different output format. It is a little difficult to
filter out the md5 value from the output. So just checkout whether correct md5 value
is in the output is enough.

Signed-off-by: Feng Yang <fyang@redhat.com>
Merge pull request #1265 from Hao-Liu/fix_setmaxmem

libvirt: Fix setmaxmem from changing mem size
Merge pull request #1287 from Hao-Liu/fix_attach_device

libvirt: Fix attach-device itertools backports
Merge pull request #1290 from FengYang/virtual_nic_send_buffer

qemu.tests.virtual_nic_send_buffer: Update the way used to checkout md5 ...
virttest.libvirt_xml.vm_xml: Add option to get_disk_resource

Add option to get_disk_resource to support extra option when
dumpxml.

Signed-off-by: Wayne Sun <gsun@redhat.com>
virttest.libvirt_xml.devices.disk: Add type attribute

Add type attribute to disk xml for support get and set it

Signed-off-by: Wayne Sun <gsun@redhat.com>
libvirt.tests: Add virsh domblklist test

Add virsh domblklist test and cfg

Signed-off-by: Wayne Sun <gsun@redhat.com>