Add --vmwarefusion-no-share option

Add a vmwarefusion driver flag to disable the mounting of the /Users
directory. Name it --vmwarefusion-no-share to reflect the pre-existing
virtualbox driver option --virtualbox-no-share.

Also add a corresponding environment variable FUSION_NO_SHARE.

The code is basically identical to the virtualbox driver's
implementation.

Signed-off-by: Joachim Viide <jviide@iki.fi>
This commit is contained in:
jviide 2015-11-06 01:46:14 +02:00 committed by Joachim Viide
parent 43d9df3216
commit 9d2ebb630a
2 changed files with 10 additions and 1 deletions

View File

@ -17,6 +17,7 @@ Options:
- `--vmwarefusion-cpu-count`: Number of CPUs for the machine (-1 to use the number of CPUs available)
- `--vmwarefusion-disk-size`: Size of disk for host VM (in MB).
- `--vmwarefusion-memory-size`: Size of memory for host VM (in MB).
- `--vmwarefusion-no-share`: Disable the mount of your home directory.
The VMware Fusion driver uses the latest boot2docker image.
See [frapposelli/boot2docker](https://github.com/frapposelli/boot2docker/tree/vmware-64bit)
@ -29,3 +30,4 @@ Environment variables and default values:
| `--vmwarefusion-cpu-count` | `FUSION_CPU_COUNT` | `1` |
| `--vmwarefusion-disk-size` | `FUSION_DISK_SIZE` | `20000` |
| `--vmwarefusion-memory-size` | `FUSION_MEMORY_SIZE` | `1024` |
| `--vmwarefusion-no-share` | `FUSION_NO_SHARE` | `false` |

View File

@ -46,6 +46,7 @@ type Driver struct {
SSHPassword string
ConfigDriveISO string
ConfigDriveURL string
NoShare bool
}
const (
@ -102,6 +103,11 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Usage: "SSH password",
Value: defaultSSHPass,
},
mcnflag.BoolFlag{
EnvVar: "FUSION_NO_SHARE",
Name: "vmwarefusion-no-share",
Usage: "Disable the mount of your home directory",
},
}
}
@ -150,6 +156,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.SSHUser = flags.String("vmwarefusion-ssh-user")
d.SSHPassword = flags.String("vmwarefusion-ssh-password")
d.SSHPort = 22
d.NoShare = flags.Bool("vmwarefusion-no-share")
// We support a maximum of 16 cpu to be consistent with Virtual Hardware 10
// specs.
@ -344,7 +351,7 @@ func (d *Driver) Create() error {
// TODO "linux" and "windows"
}
if shareDir != "" {
if shareDir != "" && !d.NoShare {
if _, err := os.Stat(shareDir); err != nil && !os.IsNotExist(err) {
return err
} else if !os.IsNotExist(err) {