5

Background

I have an application which comes with a Vagrant setup that is designed for this usage scenario:

Laptop (Windows, Virtualbox host) => edit source code
+----> Vagrant VM (Linux) => build and run

Plain, default, simple, works. The sources are on a shared/synced directory, i.e., they are usually edited on the Windows host and then compiled and ran inside the VM.

Unfortunately, I prefer to use Linux development tools myself. Right now, I have this setup:

Laptop (Windows)
+----> Vagrant VM
+----> My personal VM (Linux, non-vagrant)

So my editor etc. run in the personal VM, and I have a common directory shared through Virtualbox. Again, everything works just fine.

Here is the problem:

To control the vagrant stuff, I need to enter the vagrant commands in the Windows shell, which is slowing me down. For example, to run the build inside the vagrant VM, I would prefer to use a hotkey in my editor to start vagrant ssh build.sh instead of switching to the CMD.EXE and entering that command. Unneccessary context switch.

Question

I don't wish to open the can of worms that is "virtualization inside virtualization" (i.e., I won't run Linux Virtualbox inside a Windows-hosted VM); so this keeps me with these two alternatives:

Is there a way to control the "Windows-Vagrant" that is running on the Windows host from inside a Linux VM (which itself is not under Vagrant control), i.e., to use vagrant up or vagrant ssh?

Alternatively, is it possible to install "Linux-Vagrant" in my existing VM right away (i.e. the Debian version) and have it create its VM in the Windows host?

Or is there a completely different way to solve this problem in an elegant fashion?

AnoE
  • 4,936
  • 14
  • 26

3 Answers3

1

Is the answer as simple as setting up a dual-booted machine? Linux partitions for development tasks and as the VM host, Windows partitions for normal computing use.

  • Laptop
    • Windows partition
    • Linux Partition
      • Vagrant VM
1

One possible but kind of ugly and very brittle workaround could be to use winrm to launch the vagrant commands on windows from linux 'remotely'.

This need a networking setup for the VM so it can talk to the host through tcp/ip (configuration done on the virtualization you use), configuring winrm on the windows host (if your company allows it) and then using something like pywinrm (first found with a quick search) or any other tool in your language of choice.

Tensibai
  • 11,416
  • 2
  • 37
  • 63
0

I also wish to know this answer. Did you come up with anything yet? The only way I can think of is to install/create a proxy like service on the host that exposes the virtualbox/vmware command line for vagrant to use. Might also be possible for a small service on the host that listens/reads from a socket/file for incoming commands while the vm writes the commands to the socket/file. This socket/file would be in the shared directory. You would probably need 2 sockets (one for read, one for write). This could be turned into a vagrant plugin that would initially extend virtualbox plugin.

I am literally just spitballing here though. You probably can't stand up adhoc tcp servcies on you laptop but you might be able to get by with a socket/file based mechanism.