From ab9c2e503a02258f7245cbf7204e281f736d7bc3 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Fri, 15 Jun 2012 17:37:19 +0200 Subject: [PATCH 1/3] dom0: qvm-run --nogui switch Can be used to not start guid. --- dom0/qvm-core/qubes.py | 4 ++-- dom0/qvm-tools/qvm-run | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dom0/qvm-core/qubes.py b/dom0/qvm-core/qubes.py index 937bbad0..83828819 100755 --- a/dom0/qvm-core/qubes.py +++ b/dom0/qvm-core/qubes.py @@ -1286,7 +1286,7 @@ class QubesVm(object): return conf - def run(self, command, verbose = True, autostart = False, notify_function = None, passio = False, passio_popen = False, localcmd = None, wait = False): + def run(self, command, verbose = True, autostart = False, notify_function = None, passio = False, passio_popen = False, localcmd = None, wait = False, gui = True): """command should be in form 'user:cmdline'""" if not self.is_running(): @@ -1306,7 +1306,7 @@ class QubesVm(object): raise QubesException("Not enough memory to start '{0}' VM! Close one or more running VMs and try again.".format(self.name)) xid = self.get_xid() - if os.getenv("DISPLAY") is not None and not self.is_guid_running(): + if gui and os.getenv("DISPLAY") is not None and not self.is_guid_running(): self.start_guid(verbose = verbose, notify_function = notify_function) args = [qrexec_client_path, "-d", str(xid), command] diff --git a/dom0/qvm-tools/qvm-run b/dom0/qvm-tools/qvm-run index 89d53756..d83236cd 100755 --- a/dom0/qvm-tools/qvm-run +++ b/dom0/qvm-tools/qvm-run @@ -85,7 +85,7 @@ def vm_run_cmd(vm, cmd, options): return vm.run(cmd, autostart = options.auto, verbose = options.verbose, notify_function = tray_notify_generic if options.tray else None, - passio = options.passio, localcmd = options.localcmd) + passio = options.passio, localcmd = options.localcmd, gui = options.gui) except QubesException as err: if options.tray: tray_notify_error(str(err)) @@ -130,6 +130,9 @@ def main(): parser.add_option ("--force", action="store_true", dest="force", default=False, help="Force operation, even if may damage other VMs (eg shutdown of NetVM)") + parser.add_option ("--nogui", action="store_false", dest="gui", default=True, + help="Run command without gui") + (options, args) = parser.parse_args () From 0e2aba228f4faffdd28e8c10df6f0e148b66611c Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Fri, 15 Jun 2012 17:42:14 +0200 Subject: [PATCH 2/3] dom0: minor qvm-sync-clock fix Catch any error in vm.run, to not break clock syncing of all VMs because one VM. --- dom0/qvm-tools/qvm-sync-clock | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dom0/qvm-tools/qvm-sync-clock b/dom0/qvm-tools/qvm-sync-clock index 30978af4..449c664f 100755 --- a/dom0/qvm-tools/qvm-sync-clock +++ b/dom0/qvm-tools/qvm-sync-clock @@ -91,7 +91,8 @@ def main(): print >> sys.stderr, '--> Syncing \'%s\' clock.' % vm.name try: vm.run('root:date -u -s "%s"' % date_out, verbose=verbose) - except NotImplementedError: + except Exception as e: + print >> sys.stderr, "ERROR syncing time in VM '%s': %s" % (vm.name, str(e)) pass main() From c978ce3a485ea51d5033cfff32bafe44c6b8ba18 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Mon, 18 Jun 2012 23:51:44 +0200 Subject: [PATCH 3/3] dom0/qvm-firewall: eliminate duplicate firewall defaults definition (#599) This caused ignore of different firewall defaults for TemplateVM. --- dom0/qvm-core/qubes.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dom0/qvm-core/qubes.py b/dom0/qvm-core/qubes.py index 83828819..d33cd882 100755 --- a/dom0/qvm-core/qubes.py +++ b/dom0/qvm-core/qubes.py @@ -1983,10 +1983,7 @@ class QubesProxyVm(QubesNetVm): vms = [vm for vm in self.connected_vms.values()] for vm in vms: iptables="*filter\n" - if vm.has_firewall(): - conf = vm.get_firewall_conf() - else: - conf = { "rules": list(), "allow": True, "allowDns": True, "allowIcmp": True, "allowYumProxy": False } + conf = vm.get_firewall_conf() xid = vm.get_xid() if xid < 0: # VM not active ATM