Implemented 'Allow networking' during AppVM creation
This commit is contained in:
		
							parent
							
								
									52741c369a
								
							
						
					
					
						commit
						2524df5af8
					
				| @ -73,10 +73,7 @@ | |||||||
|         </spacer> |         </spacer> | ||||||
|        </item> |        </item> | ||||||
|        <item row="2" column="0" colspan="2"> |        <item row="2" column="0" colspan="2"> | ||||||
|         <widget class="QCheckBox" name="checkBox_2"> |         <widget class="QCheckBox" name="allow_networking"> | ||||||
|          <property name="enabled"> |  | ||||||
|           <bool>false</bool> |  | ||||||
|          </property> |  | ||||||
|          <property name="text"> |          <property name="text"> | ||||||
|           <string>Allow networking</string> |           <string>Allow networking</string> | ||||||
|          </property> |          </property> | ||||||
|  | |||||||
| @ -613,8 +613,10 @@ class VmManagerWindow(QMainWindow): | |||||||
|             label = label_list[dialog.vmlabel.currentIndex()] |             label = label_list[dialog.vmlabel.currentIndex()] | ||||||
|             template_vm = template_vm_list[dialog.template_name.currentIndex()] |             template_vm = template_vm_list[dialog.template_name.currentIndex()] | ||||||
| 
 | 
 | ||||||
|  |             allow_networking = dialog.allow_networking.isChecked() | ||||||
|  | 
 | ||||||
|             thread_monitor = ThreadMonitor() |             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.daemon = True | ||||||
|             thread.start() |             thread.start() | ||||||
| 
 | 
 | ||||||
| @ -635,7 +637,7 @@ class VmManagerWindow(QMainWindow): | |||||||
|                 QMessageBox.warning (None, "Error creating AppVM!", "ERROR: {0}".format(thread_monitor.error_msg)) |                 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 |         vm = None | ||||||
|         try: |         try: | ||||||
|             self.qvm_collection.lock_db_for_writing() |             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 = self.qvm_collection.add_new_appvm(vmname, template_vm, label = label) | ||||||
|             vm.create_on_disk(verbose=False) |             vm.create_on_disk(verbose=False) | ||||||
|             vm.add_to_xen_storage() |             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() |             self.qvm_collection.save() | ||||||
|         except Exception as ex: |         except Exception as ex: | ||||||
|             thread_monitor.set_error_msg (str(ex)) |             thread_monitor.set_error_msg (str(ex)) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Tomasz Sterna
						Tomasz Sterna