def QEMU_images(self): """ Load Qemu images settings from config file """ # Loading Qemu image conf basegroup = "QEMU.images" c = ConfDB() c.beginGroup(basegroup) childGroups = c.childGroups() c.endGroup() for id in childGroups: cgroup = basegroup + '/' + id conf = qemuImageConf() conf.id = int(id) conf.name = c.get(cgroup + "/name", unicode('')) conf.filename = c.get(cgroup + "/filename", unicode('')) conf.memory = int(c.get(cgroup + "/memory", 256)) conf.nic_nb = int(c.get(cgroup + "/nic_nb", 6)) conf.usermod = c.value(cgroup + "/usermod", QtCore.QVariant(False)).toBool() conf.nic = str(c.get(cgroup + "/nic", 'rtl8139')) conf.flavor = str(c.get(cgroup + "/flavor", 'Default')) conf.options = str(c.get(cgroup + "/options", '')) conf.kvm = c.value(cgroup + "/kvm", QtCore.QVariant(False)).toBool() conf.monitor = c.value(cgroup + "/monitor", QtCore.QVariant(False)).toBool() globals.GApp.qemuimages[conf.name] = conf if conf.id >= globals.GApp.qemuimages_ids: globals.GApp.qemuimages_ids = conf.id + 1
def QEMU_images(self): """ Load Qemu images settings from config file """ # Loading Qemu image conf basegroup = "QEMU.images" c = ConfDB() c.beginGroup(basegroup) childGroups = c.childGroups() c.endGroup() for id in childGroups: cgroup = basegroup + '/' + id conf = qemuImageConf() conf.id = int(id) conf.name = c.get(cgroup + "/name", unicode('')) conf.filename = c.get(cgroup + "/filename", unicode('')) conf.memory = int(c.get(cgroup + "/memory", 256)) conf.nic_nb = int(c.get(cgroup + "/nic_nb", 6)) conf.nic = str(c.get(cgroup + "/nic", 'e1000')) conf.options = str(c.get(cgroup + "/options", '')) conf.kqemu = c.value(cgroup + "/kqemu", QtCore.QVariant(False)).toBool() conf.kvm = c.value(cgroup + "/kvm", QtCore.QVariant(False)).toBool() globals.GApp.qemuimages[conf.name] = conf if conf.id >= globals.GApp.qemuimages_ids: globals.GApp.qemuimages_ids = conf.id + 1
def slotSaveQemuImage(self): """ Add/Save Qemu Image in the list of Qemu images """ name = unicode(self.NameQemuImage.text()) image = unicode(self.QemuImage.text()) if not name or not image: QtGui.QMessageBox.critical(globals.preferencesWindow, translate("Page_PreferencesQemu", "Qemu host"), translate("Page_PreferencesQemu", "Identifier and binary image must be set!")) return if globals.GApp.qemuimages.has_key(name): # update an already existing Qemu host image item_to_update = self.treeWidgetQemuImages.findItems(name, QtCore.Qt.MatchFixedString)[0] item_to_update.setText(1, image) else: # else create a new entry item = QtGui.QTreeWidgetItem(self.treeWidgetQemuImages) # image name column item.setText(0, name) # image path column item.setText(1, image) # save settings if globals.GApp.qemuimages.has_key(name): conf = globals.GApp.qemuimages[name] else: conf = qemuImageConf() conf.id = globals.GApp.qemuimages_ids globals.GApp.qemuimages_ids += 1 conf.name = name conf.filename = image conf.memory = self.QemuMemory.value() conf.nic_nb = self.QemuNICNb.value() conf.nic = str(self.QemuNIC.currentText()) conf.options = str(self.QemuOptions.text()) if self.QemucheckBoxKqemu.checkState() == QtCore.Qt.Checked: conf.kqemu = True else: conf.kqemu = False if self.QemucheckBoxKVM.checkState() == QtCore.Qt.Checked: conf.kvm = True else: conf.kvm = False globals.GApp.qemuimages[name] = conf self.treeWidgetQemuImages.resizeColumnToContents(0) QtGui.QMessageBox.information(globals.preferencesWindow, translate("Page_PreferencesQemu", "Save"), translate("Page_PreferencesQemu", "Qemu host settings have been saved"))