[CRIU] [PATCH v2 01/12] p.haul: move get_ddxml_path
Nikita Spiridonov
nspiridonov at virtuozzo.com
Mon Apr 11 04:58:06 PDT 2016
Acked-by: Nikita Spiridonov <nspiridonov at virtuozzo.com>
On Sat, 2016-04-09 at 16:41 +0300, Alexander Burluka wrote:
> move get_ddxml_path from class fs_haul_ploop to outstanding function
> and add ploop directory handling
>
> Signed-off-by: Alexander Burluka <aburluka at virtuozzo.com>
> ---
> phaul/fs_haul_ploop.py | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/phaul/fs_haul_ploop.py b/phaul/fs_haul_ploop.py
> index f26eb67..89463c3 100644
> --- a/phaul/fs_haul_ploop.py
> +++ b/phaul/fs_haul_ploop.py
> @@ -12,6 +12,12 @@ import mstats
> DDXML_FILENAME = "DiskDescriptor.xml"
>
>
> +def get_ddxml_path(path):
> + """Get path to disk descriptor file by path to disk delta or directory"""
> + p = path if os.path.isdir(path) else os.path.dirname(path)
> + return os.path.join(p, DDXML_FILENAME)
> +
> +
> class p_haul_fs:
> def __init__(self, deltas):
> """Initialize ploop disks hauler
> @@ -24,7 +30,7 @@ class p_haul_fs:
> self.__log_init_hauler(deltas)
> self.__ploop_copies = []
> for delta_path, delta_fd in deltas:
> - ddxml_path = self.__get_ddxml_path(delta_path)
> + ddxml_path = get_ddxml_path(delta_path)
> self.__check_ddxml(ddxml_path)
> self.__ploop_copies.append(
> libploop.ploopcopy(ddxml_path, delta_fd))
> @@ -62,10 +68,6 @@ class p_haul_fs:
> for delta in deltas:
> logging.info("\t`- %s", delta[0])
>
> - def __get_ddxml_path(self, delta_path):
> - """Get path to disk descriptor file by path to disk delta"""
> - return os.path.join(os.path.dirname(delta_path), DDXML_FILENAME)
> -
> def __check_ddxml(self, ddxml_path):
> """Check disk descriptor file exist"""
> if not os.path.isfile(ddxml_path):
More information about the CRIU
mailing list