Example #1
0
    def viewAllExistVM(self):
        logging.debug("[viewAllExistVM]")
        _kvmManager = KVMManager()
        _infotext = _kvmManager.getAllExistVM()

        _did = DetailInfoDialog()
        _did.setText("Result:")
        _did.setDetailedText(str(_infotext))
        _did.exec_()
Example #2
0
 def viewAllExistVM(self):
     logging.debug("[viewAllExistVM]")
     _kvmManager = KVMManager()    
     _infotext = _kvmManager.getAllExistVM()
             
     _did = DetailInfoDialog()
     _did.setText("Result:")
     _did.setDetailedText(str(_infotext))
     _did.exec_()
Example #3
0
    def cloneVM(self):
        print "[cloneVM...]"
        _result = ""
        _kvmManager = KVMManager()
        _vmInfo = VMinfo()
        
        _owner = str(self.owenerComboBox.currentText())
        _userInfo = self.__vmInfoDB.getUser(_owner)
        _lifeTime = str(self.lifeTimeSpinBox.value())
        _comment = unicode(self.commentNameLineEdit.text())
        
        _vmName = unicode(self.vmNameLineEdit.text())
        _vmName = _vmName.replace(unicode(" ", "utf-8"), "_")
        _vmName = _vmName.replace(unicode("ü", "utf-8"), "ue")
        _vmName = _vmName.replace(unicode("Ü", "utf-8"), "Ue")
        _vmName = _vmName.replace(unicode("ö", "utf-8"), "oe")
        _vmName = _vmName.replace(unicode("Ö", "utf-8"), "Oe")
        _vmName = _vmName.replace(unicode("ä", "utf-8"), "ae")
        _vmName = _vmName.replace(unicode("Ä", "utf-8"), "Ae")
        _vmName = _vmName.replace(unicode("ß", "utf-8"), "ss")
        self._distName = self._distName.replace(unicode(" ", "utf-8"), "_")
        _vmName = _owner + "_" + self._distName + "_" + _vmName
        
        _kvmManager.setOwnersHome(_userInfo.homedir)   
        _kvmManager.setMachineName(_vmName) 
        _kvmManager.setOriginalVM(self.__originalVM) 
        
        try:
            _result = _kvmManager.cloneMachine()

            mb = DetailInfoDialog()
            mb.setText("Result detail:")
            mb.setDetailedText(_result)
            mb.exec_()
            #QtGui.QMessageBox.information(self, "Result", _result) 
        except subprocess.CalledProcessError, e:
            infotext = "An error occurred:", (e.output.replace('\n',' ')).replace('\r',' ')
            QtGui.QMessageBox.critical(self, "Error",str(infotext))
            return  
Example #4
0
                    _importVMList.append(_existVMName)
        # Import...
        for _vmName in _importVMList:

            _vmInfo.name = _vmName
            _vmInfo.createdate = str(int(time.time()))
            _vmInfo.lifetimedays = "60"
            _vmInfo.comment = "Data import by isar."
            _vmInfo.mail = "root@localhost"
            _vmInfo.image_file = ""
            _vmInfo.owner = "no body"
            _vmInfo.OS = "unknown"

            try:
                self.__vmInfoDB.addVMinfo(_vmInfo)
            except sqlite3.Error, e:
                infotext = "An error occurred:", e.args[0]
                QtGui.QMessageBox.critical(self, "Error", str(infotext))
                ret = QtGui.QMessageBox.critical(self, \
                    "Error", \
                    str(infotext), \
                    QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ignore)
                if (ret == QtGui.QMessageBox.Cancel):
                    return

        _did = DetailInfoDialog()
        _did.setText("Import:")
        _did.setDetailedText("\n".join(_importVMList))
        _did.exec_()
        self.refreshVMList()
Example #5
0
 # Import...
 for _vmName in _importVMList:
     
     _vmInfo.name = _vmName
     _vmInfo.createdate = str(int(time.time()))
     _vmInfo.lifetimedays = "60"
     _vmInfo.comment = "Data import by isar." 
     _vmInfo.mail = "root@localhost"
     _vmInfo.image_file = ""
     _vmInfo.owner = "no body"
     _vmInfo.OS = "unknown"
 
     try:
         self.__vmInfoDB.addVMinfo(_vmInfo)
     except sqlite3.Error, e:
         infotext = "An error occurred:", e.args[0]
         QtGui.QMessageBox.critical(self, "Error",str(infotext))
         ret = QtGui.QMessageBox.critical(self, \
             "Error", \
             str(infotext), \
             QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Ignore)
         if (ret == QtGui.QMessageBox.Cancel):
             return
   
     
 _did = DetailInfoDialog()
 _did.setText("Import:")
 _did.setDetailedText("\n".join(_importVMList))
 _did.exec_()     
 self.refreshVMList()