Exemplo n.º 1
0
  def Create(opts):
    """Create either a Device or VM based on |opts.device|."""
    if Device._IsVM(opts.device):
      from chromite.lib import vm

      return vm.VM(opts)
    return Device(opts)
Exemplo n.º 2
0
  def setUp(self):
    """Common set up method for all tests."""
    opts = vm.VM.GetParser().parse_args([])
    self._vm = vm.VM(opts)
    self._vm.board = 'amd64-generic'
    self._vm.cache_dir = self.tempdir
    self._vm.image_path = self.TempFilePath('chromiumos_qemu_image.bin')
    osutils.Touch(self._vm.image_path)

    self.nested_kvm_file = self.TempFilePath('kvm_intel_nested')
    osutils.WriteFile(self.nested_kvm_file, 'N')
    # Make the glob match the path we just created for nested_kvm_file.
    self._vm.NESTED_KVM_GLOB = os.path.join(
        os.path.dirname(self.nested_kvm_file), 'kvm_*_nested')

    # Satisfy QEMU version check.
    version_str = ('QEMU emulator version 2.6.0, Copyright (c) '
                   '2003-2008 Fabrice Bellard')
    self.rc.AddCmdResult(partial_mock.In('--version'), output=version_str)

    self.ssh_port = self._vm.ssh_port
Exemplo n.º 3
0
def main(argv):
  opts = vm.VM.GetParser().parse_args(argv)
  opts.Freeze()

  vm.VM(opts).Run()