Esempio n. 1
0
 def __createVM(self):
     '''
     Author      : LHearen
     E-mail      : [email protected]
     Time        : 2015-12-21 10 : 49
     Description :
                 Make sure there is always a VM called 'test'
                 Delete the VM first if it exists, and then create
                 another VM called 'test'.
     '''
     _id = '103adb75-f41a-4dae-8bdc-c61e92c85e58'
     name = self.name
     memory = 1024
     vcpu = 2
     mac = ''
     diskDir = '/home/res/images/test.qcow2'
     isoDir = '/home/res/iso/CentOS-7.1.iso'
     bridgeSrc = 'ovs0'
     try:
         self.__deleteVM(self.name)
     except:
         pass
     log.debug("After deletion, now let's create a new one.")
     return VM.create(_id, name, memory, vcpu, mac, diskDir,
                      isoDir, bridgeSrc)