Skip to content

Commit 3d48882

Browse files
huguesalaryzchee
authored andcommitted
Make sure both Virtio9p shared folders and NFS shared folders can be used at the same time.
In this commit I removed the `d.setupMount()` from the `Start()` function: `Start()` simply starts the docker-machine and isn't supposed to do any other work. For example, you can not add more CPUs, more RAM, or more Disks with the `docker-machine start` command. Just like CPU, RAM, etc, Shared Folders can not be added after the fact with `docker-machine start` and as such, the `d.setupMounts()` shouldn't run. I, however, changed the `Create()` function so that it returns an error, and thus prevents the docker-machine from being created, when the `d.setupMounts()` fails. The other changes address the bug where you couldn't have both Virtio9p *and* NFS shared folders. The bug was that both the code setting up Virtio9p shares and the NFS shares would overwrite the `bootlocal.sh` script.
1 parent dff9c59 commit 3d48882

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

xhyve/xhyve.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,9 @@ func (d *Driver) Create() error {
484484
return err
485485
}
486486

487-
d.setupMounts()
487+
if err := d.setupMounts(); err != nil {
488+
return fmt.Errorf("Error setting up mounts: %v", err)
489+
}
488490

489491
return nil
490492
}
@@ -535,10 +537,6 @@ func (d *Driver) Start() error {
535537
return err
536538
}
537539

538-
if err := d.setupMounts(); err != nil {
539-
log.Warnf("Error setting up mounts: %v", err)
540-
}
541-
542540
return nil
543541
}
544542

@@ -1006,8 +1004,8 @@ func (d *Driver) setupVirt9pShare() error {
10061004
i++
10071005
}
10081006

1009-
writeScriptCmd := fmt.Sprintf("echo -e \"%s\" | sudo tee %s && sudo chmod +x %s && %s",
1010-
bootScript, bootScriptName, bootScriptName, bootScriptName)
1007+
writeScriptCmd := fmt.Sprintf("echo -e \"%s\" | sudo tee -a %s && sudo chmod +x %s",
1008+
bootScript, bootScriptName, bootScriptName)
10111009

10121010
if _, err := drivers.RunSSHCommandFromDriver(d, writeScriptCmd); err != nil {
10131011
return err
@@ -1056,8 +1054,8 @@ func (d *Driver) setupNFSShare() error {
10561054
return err
10571055
}
10581056

1059-
writeScriptCmd := fmt.Sprintf("echo -e \"%s\" | sudo tee %s && sudo chmod +x %s && %s",
1060-
bootScript, bootScriptName, bootScriptName, bootScriptName)
1057+
writeScriptCmd := fmt.Sprintf("echo -e \"%s\" | sudo tee -a %s && sudo chmod +x %s",
1058+
bootScript, bootScriptName, bootScriptName)
10611059

10621060
if _, err := drivers.RunSSHCommandFromDriver(d, writeScriptCmd); err != nil {
10631061
return err

0 commit comments

Comments
 (0)