[PATCH sandbox v5 10/20] Image: Add run args

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Eren Yagdiran <erenyagdiran@xxxxxxxxx>

Commandline parameters for running a template

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 libvirt-sandbox/image/cli.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py
index 5490c4b..6f9a5e7 100755
--- a/libvirt-sandbox/image/cli.py
+++ b/libvirt-sandbox/image/cli.py
@@ -101,6 +101,10 @@ def requires_template(parser):
     parser.add_argument("template",
                         help=_("name of the template"))
 
+def requires_name(parser):
+    parser.add_argument("-n","--name",
+                        help=_("Name of the running sandbox"))
+
 def requires_source(parser):
     parser.add_argument("-s","--source",
                         default="docker",
@@ -124,6 +128,12 @@ def requires_template_dir(parser):
                         default=default_template_dir,
                         help=_("Template directory for saving templates"))
 
+def requires_image_dir(parser):
+    global default_image_dir
+    parser.add_argument("-I","--image-dir",
+                        default=default_image_dir,
+                        help=_("Image directory for saving images"))
+
 def gen_download_args(subparser):
     parser = subparser.add_parser("download",
                                    help=_("Download template data"))
@@ -153,6 +163,20 @@ def gen_create_args(subparser):
                         help=_("format format for image"))
     parser.set_defaults(func=create)
 
+def gen_run_args(subparser):
+    parser = subparser.add_parser("run",
+                                  help=_("Run a already built image"))
+    requires_name(parser)
+    requires_template(parser)
+    requires_source(parser)
+    requires_connect(parser)
+    requires_template_dir(parser)
+    requires_image_dir(parser)
+    parser.add_argument("args",
+                        nargs=argparse.REMAINDER,
+                        help=_("command arguments to run"))
+    parser.set_defaults(func=run)
+
 def main():
     parser = argparse.ArgumentParser(description='Sandbox Container Image Tool')
 
@@ -160,6 +184,7 @@ def main():
     gen_download_args(subparser)
     gen_delete_args(subparser)
     gen_create_args(subparser)
+    gen_run_args(subparser)
 
     try:
         args = parser.parse_args()
-- 
2.4.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]