コード例 #1
0
 def getDomainInfo(self, domain):
     dom = Driver.getDomainByID(domain)
     name = dom.name()
     id = domain
     host = hostname
     type = "silver"
     if name.lower().startswith("g"):
         type = "gold"
     vm = VirtualMachine.VirtualMachine(domain, name, id, host, type)
     return vm
コード例 #2
0
 def get_vm_by_name(self, name):
     content = self.instance.RetrieveContent()
     virtual_machine = None
     container = content.viewManager.CreateContainerView(content.rootFolder, [vim.VirtualMachine], True)
     for item in container.view:
         if item.name.lower() == name.lower():
             virtual_machine = item
             break
     container.Destroy()
     if virtual_machine is not None:
         return VirtualMachine(virtual_machine, self.instance)
     return None
コード例 #3
0
    def printQuads(self):
        counter = 1

        for quad in self.Quads:
            #print(counter, quad.Operador, quad.OperandoI, quad.OperandoD, quad.Resultado)
            counter += 1
        tables = {
            "functions": namesTable.functionsT,
            "globals": namesTable.globalsT,
            "constants": namesTable.constantsT
        }

        namesTable.globalsT["vars"] = self.countVarByTypeScope(
            "Global")  #Obtener el conteo de memoria global

        virtualMachine = VirtualMachine(self.Quads, tables, Memory.MemSize)

        virtualMachine.run()
コード例 #4
0
 def scanForExisting(self):
     configFiles = self.scanForFiles()
     vmArray = []
     xml = XmlDriver.XmlDriver()
     for i in range(len(configFiles)):
         fileLocation = configFiles[i]
         name = xml.getName(fileLocation)
         ostype = xml.getOsType(fileLocation)
         harddrive = xml.getHardDrive(fileLocation)
         mem = xml.getMemory(fileLocation)
         cpu = xml.getCpuCount(fileLocation)
         mac = xml.getMac(fileLocation)
         network = xml.getNetworkAdapter(fileLocation)
         cddrive = xml.getCdDrive(fileLocation)
         harddrivesize = self.getFileSize(harddrive, name)
         vmstate = self.getVmState(name)
         newVm = VirtualMachine.VirtualMachine(name, vmstate, ostype, mem,
                                               cpu, harddrive,
                                               harddrivesize, cddrive,
                                               network, mac)
         vmArray.append(newVm)
     return vmArray
コード例 #5
0
# para testear con un file
import os
fileDir = os.path.dirname(os.path.realpath('__file__'))
programa = 'advListFunctions.txt'
filename = os.path.join(fileDir, 'tomate/tests/FinalTest/' + programa)
#filename = os.path.join(fileDir, 'tests/' + programa )
f = open(filename, "r")
input = f.read()
yacc.parse(input)

print("stackListComplete: " + str(stackListsAuxComplete))
print("stackListAux: " + str(stackListsAux))
print("stackOperandos: " + str(stackOperandos))
print("stackTypes: " + str(stackTypes))
print("stackScope: " + str(stackScope))
print("Const Table: " + str(constTable))
print("Address: " + str(address))
print("DirFunctions: " + str(dirFunctions))

quadruples.print()
globalVariables()
#print(globalMemory)
print("======= Output =======")
createOvejota()

## VM
vm = VirtualMachine()
vm.loadOvejota()

vm.pointerSomething()
コード例 #6
0
#################
#
# Joe
#
# Cloud Controller
#
###################

from VirtualMachine import *


vm1 = VirtualMachine()

vm1.printVMDetails()
コード例 #7
0
ファイル: main.py プロジェクト: andanil/JavaScript_Compiler
# строка с кодом, который в последствии будет распознаваться парсером.
prog = '''
    var i = 5;
    do {
        if(i >= 7)
            logprint(i);
        i++;
    } while(i < 10)
'''
# вызов конструктора класса Parser.
parser = Parser()
# вызов конструктора класса Analyzer.
analyzer = Analyzer()
# в переменной res хранится корень графа, описывающего структуру кода из переменной prog.
res = parser.parse(prog)
print(*res.tree, sep=os.linesep)

# вызов метода analyze, который производит семантический анализ
analyzer.analyze(res)
if len(analyzer.errors) > 0:
    for e in analyzer.errors:
        print("Ошибка: {}".format(e.message))
else:
    print("Ошибок не обнаружено.")
    generator = CodeGenerator(res)
    generator.print_bytecode()
    vm = VirtualMachine(generator.lines)


コード例 #8
0
 def get_vm_by_ip(self, ip):
     content = self.instance.RetrieveContent()
     virtual_machine = content.searchIndex.FindByIp(None, ip, True)
     if virtual_machine is not None:
         return VirtualMachine(virtual_machine, self.instance)
     return None
コード例 #9
0
 def get_vm_by_dns_name(self, name):
     content = self.instance.RetrieveContent()
     virtual_machine = content.searchIndex.FindByDnsName(None, name, True)
     if virtual_machine is not None:
         return VirtualMachine(virtual_machine, self.instance)
     return None
コード例 #10
0
 def get_vm_by_uuid(self, uuid):
     content = self.instance.RetrieveContent()
     virtual_machine = content.searchIndex.FindByUuid(None, uuid, True)
     if virtual_machine is not None:
         return VirtualMachine(virtual_machine, self.instance)
     return None
コード例 #11
0
ファイル: Snapshot.py プロジェクト: szydre/pyVBox
 def machine(self):
     """Return VirtualMachine object associated wit this snapshot"""
     import VirtualMachine
     return VirtualMachine(self.machine)