diff --git a/commands/create.go b/commands/create.go index ab397cc443..a9eb1badd9 100644 --- a/commands/create.go +++ b/commands/create.go @@ -133,8 +133,6 @@ func cmdCreateInner(c CommandLine, api libmachine.API) error { return errNoMachineName } - driverName := c.String("driver") - validName := host.ValidateHostName(name) if !validName { return fmt.Errorf("Error creating machine: %s", mcnerror.ErrInvalidHostname) @@ -145,7 +143,7 @@ func cmdCreateInner(c CommandLine, api libmachine.API) error { } // TODO: Fix hacky JSON solution - bareDriverData, err := json.Marshal(&drivers.BaseDriver{ + rawDriver, err := json.Marshal(&drivers.BaseDriver{ MachineName: name, StorePath: c.GlobalString("storage-path"), }) @@ -153,7 +151,8 @@ func cmdCreateInner(c CommandLine, api libmachine.API) error { return fmt.Errorf("Error attempting to marshal bare driver data: %s", err) } - driver, err := api.NewPluginDriver(driverName, bareDriverData) + driverName := c.String("driver") + driver, err := api.NewPluginDriver(driverName, rawDriver) if err != nil { return fmt.Errorf("Error loading driver %q: %s", driverName, err) } @@ -272,23 +271,23 @@ func cmdCreateOuter(c CommandLine, api libmachine.API) error { const ( flagLookupMachineName = "flag-lookup" ) - driverName := flagHackLookup("--driver") // We didn't recognize the driver name. + driverName := flagHackLookup("--driver") if driverName == "" { c.ShowHelp() return nil // ? } // TODO: Fix hacky JSON solution - bareDriverData, err := json.Marshal(&drivers.BaseDriver{ + rawDriver, err := json.Marshal(&drivers.BaseDriver{ MachineName: flagLookupMachineName, }) if err != nil { return fmt.Errorf("Error attempting to marshal bare driver data: %s", err) } - driver, err := api.NewPluginDriver(driverName, bareDriverData) + driver, err := api.NewPluginDriver(driverName, rawDriver) if err != nil { return fmt.Errorf("Error loading driver %q: %s", driverName, err) } diff --git a/drivers/virtualbox/virtualbox.go b/drivers/virtualbox/virtualbox.go index 6ddcfb7b0d..a2e8777c5c 100644 --- a/drivers/virtualbox/virtualbox.go +++ b/drivers/virtualbox/virtualbox.go @@ -398,8 +398,6 @@ func (d *Driver) Create() error { } } - log.Infof("Starting VirtualBox VM...") - return d.Start() } diff --git a/libmachine/drivers/rpc/client_driver.go b/libmachine/drivers/rpc/client_driver.go index 25f90b135b..c423ac1d84 100644 --- a/libmachine/drivers/rpc/client_driver.go +++ b/libmachine/drivers/rpc/client_driver.go @@ -79,7 +79,7 @@ func NewInternalClient(rpcclient *rpc.Client) *InternalClient { } } -func NewRPCClientDriver(rawDriverData []byte, driverName string) (*RPCClientDriver, error) { +func NewRPCClientDriver(driverName string, rawDriver []byte) (*RPCClientDriver, error) { mcnName := "" p, err := localbinary.NewPlugin(driverName) @@ -136,7 +136,7 @@ func NewRPCClientDriver(rawDriverData []byte, driverName string) (*RPCClientDriv } log.Debug("Using API Version ", serverVersion) - if err := c.SetConfigRaw(rawDriverData); err != nil { + if err := c.SetConfigRaw(rawDriver); err != nil { return nil, err } diff --git a/libmachine/persist/plugin_store.go b/libmachine/persist/plugin_store.go index 1cb8af63c3..4a94f253c8 100644 --- a/libmachine/persist/plugin_store.go +++ b/libmachine/persist/plugin_store.go @@ -9,7 +9,7 @@ import ( ) type PluginDriverFactory interface { - NewPluginDriver(string, []byte) (drivers.Driver, error) + NewPluginDriver(driverName string, rawDriver []byte) (drivers.Driver, error) } type RPCPluginDriverFactory struct{} @@ -19,8 +19,8 @@ type PluginStore struct { PluginDriverFactory } -func (factory RPCPluginDriverFactory) NewPluginDriver(driverName string, rawContent []byte) (drivers.Driver, error) { - d, err := rpcdriver.NewRPCClientDriver(rawContent, driverName) +func (factory RPCPluginDriverFactory) NewPluginDriver(driverName string, rawDriver []byte) (drivers.Driver, error) { + d, err := rpcdriver.NewRPCClientDriver(driverName, rawDriver) if err != nil { // Not being able to find a driver binary is a "known error" if _, ok := err.(localbinary.ErrPluginBinaryNotFound); ok {