autotest/virt-test — pull request #1769 by Hao-Liu (2014-07-22 03:31:04+00:00)
Title: utils_config: Add new class to manipulate config files

A set of classes to manipulate options of a libvirt related configure
files in a property's way.

Variables `"__option_types__"` and `"conf_path"` must be setup in the
inherented classes before use.

`"__option_types__"` is a dict contains every possible option as keys and
their type ("boolean", "int", "string", "float" or "list") as values.

Basic usage:
1) Create a config file object:
```
>>> config = LibvirtdConfig()
```

2) Set or update an option:
```
>>> config.listen_tcp = True
>>> config.listen_tcp = 1
>>> config.listen_tcp = "1" # All three have the same effect.

>>> # If the setting value don't meet the specified type.
>>> config.listen_tcp = "invalid"
>>> # It'll thown an warning message in log and set a raw string instead.

>>> # Use set_* methods when need to customize the result.
>>> config.set_raw("'1'")
```

3) Get an option:
```
>>> is_listening = config.listen_tcp
>>> print is_listening
True
```

4) Delete an option from the config file:
```
>>> del config.listen_tcp
```

5) Make the changes take effect in libvirt by restart libvirt daemon.
```
>>> config.sync()
```

6) Restore the content of the config file.
```
>>> config.restore()
```

Signed-off-by: Hao Liu