Pārlūkot izejas kodu

Added explicit 'force' option to qvm-shutdown

Marta Marczykowska-Górecka 4 gadi atpakaļ
vecāks
revīzija
5c94c72ecd
2 mainītis faili ar 14 papildinājumiem un 3 dzēšanām
  1. 8 2
      doc/manpages/qvm-shutdown.rst
  2. 6 1
      qubesadmin/tools/qvm_shutdown.py

+ 8 - 2
doc/manpages/qvm-shutdown.rst

@@ -25,7 +25,7 @@ Options
 
 
 .. option:: --all
 .. option:: --all
 
 
-   perform the action on all qubes
+   perform the action on all qubes; implies :option:`--force`
 
 
 .. option:: --exclude=EXCLUDE
 .. option:: --exclude=EXCLUDE
 
 
@@ -35,12 +35,18 @@ Options
 
 
    wait for the VMs to shut down. If some domains are providing network to other
    wait for the VMs to shut down. If some domains are providing network to other
    domains, wait for those domains to shut down before shutting down their
    domains, wait for those domains to shut down before shutting down their
-   dependents.
+   dependents, unless :option:`--all` was specified
 
 
 .. option:: --timeout
 .. option:: --timeout
 
 
    timeout after which domains are killed when using :option:`--wait`
    timeout after which domains are killed when using :option:`--wait`
 
 
+.. option:: --force
+
+   force qube shutdown, regardless of whether there exist any connected domains
+   (such as those using it as network VM)
+
+
 Authors
 Authors
 -------
 -------
 
 

+ 6 - 1
qubesadmin/tools/qvm_shutdown.py

@@ -50,11 +50,16 @@ parser.add_argument('--timeout',
     help='timeout after which domains are killed when using --wait'
     help='timeout after which domains are killed when using --wait'
         ' (default: %(default)d)')
         ' (default: %(default)d)')
 
 
+parser.add_argument(
+    '--force',
+    action='store_true', default=False,
+    help='force shutdown regardless of connected domains; use with caution')
+
 
 
 def main(args=None, app=None):  # pylint: disable=missing-docstring
 def main(args=None, app=None):  # pylint: disable=missing-docstring
     args = parser.parse_args(args, app=app)
     args = parser.parse_args(args, app=app)
 
 
-    force = bool(args.all_domains)
+    force = args.force or bool(args.all_domains)
 
 
     if have_events:
     if have_events:
         loop = asyncio.get_event_loop()
         loop = asyncio.get_event_loop()