def _addVdagent(self, mptObj, dstDir): drvDir = os.path.join(self.param.tmpDir, "vdagent") FvmUtil.shell('/bin/mkdir "%s"' % (drvDir), "stdout") FvmUtil.shell('/usr/bin/unzip "%s" -d "%s"' % (os.path.join(self.dataDir, "vdagent-win32_20111124.zip"), drvDir), "stdout") if FvmUtil.getWinArch(self.osName) == "x86": drvSubDir = os.path.join(drvDir, "vdagent_x86") elif FvmUtil.getWinArch(self.osName) == "amd64": drvSubDir = os.path.join(drvDir, "vdagent_x64") else: assert False for f in os.listdir(drvSubDir): mptObj.addFile(os.path.join(drvSubDir, f), dstDir, True)
def getVmCfgHw(self, param, optList): """minimal requirement: 128M mem, 1.5G disk pci slot allcation: slot 0x04: graphics adapter slot 0x05: sound adapter slot 0x06: network adapter slot 0x07: balloon device slot 0x08: vdi-port device""" osName = optList[0][3:] vmCfgHw = FvmVmFqemuConfigHardware() vmCfgHw.qemuVmType = "pc" vmCfgHw.cpuArch = FvmUtil.getWinArch(osName) vmCfgHw.cpuNumber = 1 vmCfgHw.memorySize = 1024 # fixme if FvmUtil.getWinArch(osName) == "x86": vmCfgHw.mainDiskInterface = "virtio-blk" elif FvmUtil.getWinArch(osName) == "amd64": vmCfgHw.mainDiskInterface = "ide" # winxp amd64 has no virtio block device driver else: assert False vmCfgHw.mainDiskFormat = "raw-sparse" vmCfgHw.mainDiskSize = 30 * 1024 # fixme vmCfgHw.graphicsAdapterInterface = "qxl" # fixme vmCfgHw.graphicsAdapterPciSlot = 0x04 vmCfgHw.soundAdapterInterface = "ac97" # fixme vmCfgHw.soundAdapterPciSlot = 0x05 vmCfgHw.networkAdapterInterface = "virtio" # fixme vmCfgHw.networkAdapterPciSlot = 0x06 vmCfgHw.balloonDeviceSupport = True # fixme vmCfgHw.balloonDevicePciSlot = 0x07 vmCfgHw.vdiPortDeviceSupport = True # fixme vmCfgHw.vdiPortDevicePciSlot = 0x08 vmCfgHw.shareDirectoryNumber = 0 vmCfgHw.shareDirectoryHotplugSupport = False vmCfgHw.shareUsbNumber = 0 vmCfgHw.shareUsbHotplugSupport = False vmCfgHw.shareScsiNumber = 0 vmCfgHw.shareScsiHotplugSupport = False return vmCfgHw
def _addParaDriver(self, mptObj, dstDir): drvDir = os.path.join(self.param.tmpDir, "virtio") FvmUtil.shell('/bin/mkdir "%s"' % (drvDir), "stdout") FvmUtil.shell('/usr/bin/7z x "%s" -o"%s"' % (os.path.join(self.dataDir, "virtio-win-0.1-52.iso"), drvDir), "stdout") if FvmUtil.getWinArch(self.osName) == "x86": drvSubDir = os.path.join(drvDir, "XP", "X86") for f in os.listdir(drvSubDir): mptObj.addFile(os.path.join(drvSubDir, f), dstDir, True) drvSubDir = os.path.join(drvDir, "WXP", "X86") for f in os.listdir(drvSubDir): mptObj.addFile(os.path.join(drvSubDir, f), dstDir, True) elif FvmUtil.getWinArch(self.osName) == "amd64": drvSubDir = os.path.join(drvDir, "XP", "AMD64") for f in os.listdir(drvSubDir): mptObj.addFile(os.path.join(drvSubDir, f), dstDir, True) else: assert False
def _checkVmCfg(self, vmInfo, osName): if FvmUtil.getWinArch(osName) != vmInfo.vmCfgHw.cpuArch: raise Exception("unmatch Windows architecture and CPU architecture") if vmInfo.vmCfgHw.memorySize < 128: raise Exception("require at least 128MB memory") if vmInfo.vmCfgHw.mainDiskSize < 1500: raise Exception("require at least 1.5GB main disk size")