[CRIU] [PATCH 3/6] p.haul: add verification for specified p.haul type

Nikita Spiridonov nspiridonov at odin.com
Mon Oct 12 10:32:18 PDT 2015


Add verification for specified p.haul type in command line arguments
parser. Arguments parser now will complain about wrong p.haul type
argument specified and report avaliable choices (vz, lxc or pid for
now).

Signed-off-by: Nikita Spiridonov <nspiridonov at odin.com>
---
 p.haul |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/p.haul b/p.haul
index c828a26..e2cd56e 100755
--- a/p.haul
+++ b/p.haul
@@ -7,6 +7,7 @@ import phaul.p_haul_iters
 import phaul.p_haul_connection
 import phaul.images
 import phaul.criu_api
+import phaul.p_haul_type
 
 # Usage idea
 # p.haul <type> <id> --fdrpc <fd> --fdmem <fd> --fdfs <fd>
@@ -23,7 +24,8 @@ import phaul.criu_api
 #
 
 parser = argparse.ArgumentParser("Process HAULer")
-parser.add_argument("type", help="Type of hat to haul, e.g. vz or lxc")
+parser.add_argument("type", choices=phaul.p_haul_type.get_haul_names(),
+	help="Type of hat to haul, e.g. vz or lxc")
 parser.add_argument("id", help="ID of what to haul")
 parser.add_argument("--to", help="IP where to haul")
 parser.add_argument("--fdrpc", help="File descriptor of rpc socket", type=int, required=True)
-- 
1.7.1



More information about the CRIU mailing list