From 2524df5af8ed53e81f09d2236b6f4d9af0d282c2 Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Mon, 14 Mar 2011 21:37:08 +0100 Subject: [PATCH] Implemented 'Allow networking' during AppVM creation --- newappvmdlg.ui | 5 +---- qubesmanager/main.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/newappvmdlg.ui b/newappvmdlg.ui index e619da0..4ba6904 100644 --- a/newappvmdlg.ui +++ b/newappvmdlg.ui @@ -73,10 +73,7 @@ - - - false - + Allow networking diff --git a/qubesmanager/main.py b/qubesmanager/main.py index bcc651b..45e1697 100755 --- a/qubesmanager/main.py +++ b/qubesmanager/main.py @@ -613,8 +613,10 @@ class VmManagerWindow(QMainWindow): label = label_list[dialog.vmlabel.currentIndex()] template_vm = template_vm_list[dialog.template_name.currentIndex()] + allow_networking = dialog.allow_networking.isChecked() + thread_monitor = ThreadMonitor() - thread = threading.Thread (target=self.do_create_appvm, args=(vmname, label, template_vm, thread_monitor)) + thread = threading.Thread (target=self.do_create_appvm, args=(vmname, label, template_vm, allow_networking, thread_monitor)) thread.daemon = True thread.start() @@ -635,7 +637,7 @@ class VmManagerWindow(QMainWindow): QMessageBox.warning (None, "Error creating AppVM!", "ERROR: {0}".format(thread_monitor.error_msg)) - def do_create_appvm (self, vmname, label, template_vm, thread_monitor): + def do_create_appvm (self, vmname, label, template_vm, allow_networking, thread_monitor): vm = None try: self.qvm_collection.lock_db_for_writing() @@ -644,6 +646,10 @@ class VmManagerWindow(QMainWindow): vm = self.qvm_collection.add_new_appvm(vmname, template_vm, label = label) vm.create_on_disk(verbose=False) vm.add_to_xen_storage() + firewall = vm.get_firewall_conf() + firewall["allow"] = allow_networking + firewall["allowDns"] = allow_networking + vm.write_firewall_conf(firewall) self.qvm_collection.save() except Exception as ex: thread_monitor.set_error_msg (str(ex))