예제 #1
0
 def testName(self):
     cmd = vm_plugin.StartVmCmd()
     cmd.vmName = 'test'
     cmd.vmUuid = uuidhelper.uuid()
     self.uuid = cmd.vmUuid
     cmd.cpuNum = 2
     cmd.cpuSpeed = 3000
     cmd.memory = 3221225472
     cmd.rootVolumePath = '/home/root/images/volumes/kvmubuntu.img'
     cmd.bootDev = 'hd'
     cmd.timeout = 30
     nic = vm_plugin.NicTO()
     nic.mac = 'fa:33:f8:5f:00:00'
     nic.bridgeName = 'virbr0'
     nic.deviceId = 0
     cmd.nics.append(nic)
     url = kvmagent._build_url_for_test([vm_plugin.KVM_START_VM_PATH])
     rsp = http.json_dump_post(url,
                               cmd,
                               headers={
                                   http.TASK_UUID: uuidhelper.uuid(),
                                   http.CALLBACK_URI: self.CALLBACK_URL
                               })
     time.sleep(30)
     self.service.stop()
예제 #2
0
    def testName(self):
        cmd = vm_plugin.StartVmCmd()
        cmd.bootDev = 'hd'
        cmd.cpuNum = 2
        cmd.cpuSpeed = 2600
        cmd.dataVolumePath = ['/tmp/data.qcow2']
        cmd.rootVolumePath = '/tmp/root.qcow2'
        cmd.memory = 2048
        cmd.nics = []
        nic1 = vm_plugin.NicTO()
        nic1.mac = 'xxxxxxxx'
        nic1.bridgeName = 'br0'
        nic1.deviceId = 0
        cmd.nics.append(nic1)
        cmd.vmName = 'test'
        cmd.vmUuid = 'uuid'

        vm = vm_plugin.Vm()
        vm.boot_dev = cmd.bootDev
        vm.cpu_num = cmd.cpuNum
        vm.cpu_speed = cmd.cpuSpeed
        vm.memory = cmd.memory
        vm.name = cmd.vmName
        vm.uuid = cmd.vmUuid
        vm.nics = cmd.nics
        vm.root_volume = cmd.rootVolumePath
        vm.data_volumes = cmd.dataVolumePath
        vm.qemu_args = [
            '-append', 'mgmtNicIp=192.168.0.216',
            'mgmtNicNetmask=255.255.255.0'
        ]
        print vm.to_xml(True)