-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Hyper-V driver code from darwin and linux targets
- Loading branch information
1 parent
b1b4a03
commit cfa8082
Showing
5 changed files
with
75 additions
and
51 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// +build !windows | ||
|
||
package libmachine | ||
|
||
import ( | ||
"github.com/code-ready/crc/pkg/libmachine/host" | ||
) | ||
|
||
func (api *Client) NewHost(driverName string, driverPath string, rawDriver []byte) (*host.Host, error) { | ||
driver, err := api.clientDriverFactory.NewRPCClientDriver(driverName, driverPath, rawDriver) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &host.Host{ | ||
ConfigVersion: host.Version, | ||
Name: driver.GetMachineName(), | ||
Driver: driver, | ||
DriverName: driver.DriverName(), | ||
DriverPath: driverPath, | ||
RawDriver: rawDriver, | ||
}, nil | ||
} | ||
|
||
func (api *Client) Load(name string) (*host.Host, error) { | ||
h, err := api.Filestore.Load(name) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
d, err := api.clientDriverFactory.NewRPCClientDriver(h.DriverName, h.DriverPath, h.RawDriver) | ||
if err != nil { | ||
return nil, err | ||
} | ||
h.Driver = d | ||
return h, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package libmachine | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/code-ready/crc/pkg/drivers/hyperv" | ||
"github.com/code-ready/crc/pkg/libmachine/host" | ||
) | ||
|
||
func (api *Client) NewHost(driverName string, driverPath string, rawDriver []byte) (*host.Host, error) { | ||
driver := hyperv.NewDriver("", "") | ||
if err := json.Unmarshal(rawDriver, &driver); err != nil { | ||
return nil, err | ||
} | ||
|
||
return &host.Host{ | ||
ConfigVersion: host.Version, | ||
Name: driver.GetMachineName(), | ||
Driver: driver, | ||
DriverName: driver.DriverName(), | ||
DriverPath: driverPath, | ||
RawDriver: rawDriver, | ||
}, nil | ||
} | ||
|
||
func (api *Client) Load(name string) (*host.Host, error) { | ||
h, err := api.Filestore.Load(name) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
driver := hyperv.NewDriver("", "") | ||
if err := json.Unmarshal(h.RawDriver, &driver); err != nil { | ||
return nil, err | ||
} | ||
h.Driver = driver | ||
return h, nil | ||
} |