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>
virttest.utils_env_unittest: Add clean reproducer for the 'RuntimeError' issue

Sometimes, while virt-test is saving Env to a file, the
tcpdump thread writes to the Env dictionary "address_cache",
generating a:

RuntimeError: dictionary changed size during iteration

exception. Of course, any thread that modifies env data
while saving is taking place is going to create this
problem. So I implemented a similar situation in the
Env unittest code, so we have a reproducer, that can
be later fixed to use new Env locking mechanisms.

So, in case it is not clear, this unittest is supposed
to fail right now, and after said locking mechanism
is implemented, the test will start passing.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
utils_env: Solve the RuntimeError issue

In order to make sure the threads updating the environment
contents will not do so while the same is being saved,
introduce env.save_lock, that is a reentrant lock from
the standard python threading module. Threads that update
the env contents *have* to acquire env.save_lock first
before doing their job.

Differently from other solutions, this one doesn't require
a lot of refactoring to the current code. While it does
certainly need refactoring, we can do so now with less
pressure of fixing a glaring bug while doing it.

With this, the threads don't step on each other's toes
and the problem is solved. Update utils_env_unittest to
use the save_lock, making all unittests to pass again.

The credit for the idea that finally solved the problem
cleanly goes to Pavel, I just implemented it in the
context of the PR.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>