Provide a common share between VMs to allow easy communication

Every VM now mounts a common SMB share on /tmp/shared.
This commit is contained in:
Eelco Dolstra
2012-08-16 10:47:33 -04:00
parent 0e3f03106f
commit a025e7e7e2
2 changed files with 23 additions and 1 deletions
+9 -1
View File
@@ -8,10 +8,13 @@ use POSIX qw(dup2);
use FileHandle;
use Cwd;
use File::Basename;
use File::Path qw(make_path);
my $showGraphics = defined $ENV{'DISPLAY'};
my $sharedDir;
sub new {
my ($class, $args) = @_;
@@ -40,7 +43,11 @@ sub new {
}
my $tmpDir = $ENV{'TMPDIR'} || "/tmp";
unless (defined $sharedDir) {
$sharedDir = $tmpDir . "/xchg-shared";
make_path($sharedDir, { mode => 0700, owner => $< });
}
my $self = {
startCommand => $startCommand,
name => $name,
@@ -123,6 +130,7 @@ sub start {
dup2(fileno($serialC), fileno(STDOUT));
dup2(fileno($serialC), fileno(STDERR));
$ENV{TMPDIR} = $self->{stateDir};
$ENV{SHARED_DIR} = $sharedDir;
$ENV{USE_TMPDIR} = 1;
$ENV{QEMU_OPTS} =
"-no-reboot -monitor unix:./monitor -chardev socket,id=shell,path=./shell " .