diff --git a/Makefile b/Makefile index 7f0fa76fa5e8..bcefc47766d6 100644 --- a/Makefile +++ b/Makefile @@ -263,6 +263,6 @@ out/docker-machine-driver-kvm: $(KVM_DRIVER_FILES) k8s.io/minikube/cmd/drivers/kvm chmod +X $@ -.PHONY: kvm-driver -install-kvm-driver: out/docker-machine-driver-kvm $(KVM_DRIVER_FILES) +.PHONY: install-kvm +install-kvm: out/docker-machine-driver-kvm cp out/docker-machine-driver-kvm $(GOBIN)/docker-machine-driver-kvm diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 82b983e188b7..c179e745a85b 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -28,7 +28,6 @@ import ( "time" "github.com/blang/semver" - units "github.com/docker/go-units" "github.com/docker/machine/libmachine/host" "github.com/golang/glog" "github.com/spf13/cobra" @@ -93,7 +92,7 @@ func runStart(cmd *cobra.Command, args []string) { defer api.Close() diskSize := viper.GetString(humanReadableDiskSize) - diskSizeMB := calculateDiskSizeInMB(diskSize) + diskSizeMB := util.CalculateDiskSizeInMB(diskSize) if diskSizeMB < constants.MinimumDiskSizeMB { err := fmt.Errorf("Disk Size %dMB (%s) is too small, the minimum disk size is %dMB", diskSizeMB, diskSize, constants.MinimumDiskSizeMB) @@ -312,14 +311,6 @@ func validateK8sVersion(version string) { } } -func calculateDiskSizeInMB(humanReadableDiskSize string) int { - diskSize, err := units.FromHumanSize(humanReadableDiskSize) - if err != nil { - glog.Errorf("Invalid disk size: %s", err) - } - return int(diskSize / units.MB) -} - func init() { startCmd.Flags().Bool(keepContext, constants.DefaultKeepContext, "This will keep the existing kubectl context and will create a minikube context.") startCmd.Flags().Bool(createMount, false, "This will start the mount daemon and automatically mount files into minikube") diff --git a/pkg/util/utils.go b/pkg/util/utils.go index e6d0361518ea..644ff8384fc8 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -30,6 +30,8 @@ import ( "time" "github.com/blang/semver" + units "github.com/docker/go-units" + "github.com/golang/glog" "github.com/pkg/errors" "k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/kubernetes_versions" @@ -42,6 +44,14 @@ type RetriableError struct { func (r RetriableError) Error() string { return "Temporary Error: " + r.Err.Error() } +func CalculateDiskSizeInMB(humanReadableDiskSize string) int { + diskSize, err := units.FromHumanSize(humanReadableDiskSize) + if err != nil { + glog.Errorf("Invalid disk size: %s", err) + } + return int(diskSize / units.MB) +} + // Until endlessly loops the provided function until a message is received on the done channel. // The function will wait the duration provided in sleep between function calls. Errors will be sent on provider Writer. func Until(fn func() error, w io.Writer, name string, sleep time.Duration, done <-chan struct{}) {