Skip to content

Commit

Permalink
Remove unused methods and bump machine
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumerose authored and praveenkumar committed Dec 11, 2020
1 parent c024410 commit cec477b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 84 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/code-ready/machine-driver-libvirt

require (
github.com/code-ready/machine v0.0.0-20201022100236-4405fef4d0cc
github.com/code-ready/machine v0.0.0-20201202090222-9558ae8c05b9
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/libvirt/libvirt-go v3.4.0+incompatible
github.com/libvirt/libvirt-go-xml v6.8.0+incompatible
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/bugsnag/bugsnag-go v1.5.1/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8=
github.com/bugsnag/panicwrap v1.2.0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE=
github.com/code-ready/machine v0.0.0-20201022100236-4405fef4d0cc h1:9Tp3sGd10JVbS2OhRmsxtsRytRbZoS6akW7DR8hk6Jw=
github.com/code-ready/machine v0.0.0-20201022100236-4405fef4d0cc/go.mod h1:g30jKsf0FV9yJjsqZFAuFzVxwJE2h5cqDXSuMUV1G/U=
github.com/code-ready/machine v0.0.0-20201202090222-9558ae8c05b9 h1:fUAQ1rYNefX/QPuU0HL7qxc1bURY3qDq/gca+NxiXt8=
github.com/code-ready/machine v0.0.0-20201202090222-9558ae8c05b9/go.mod h1:g30jKsf0FV9yJjsqZFAuFzVxwJE2h5cqDXSuMUV1G/U=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down Expand Up @@ -32,6 +32,7 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190529164535-6a60838ec259 h1:so6Hr/LodwSZ5UQDu/7PmQiDeS112WwtLvU3lpSPZTU=
golang.org/x/sys v0.0.0-20190529164535-6a60838ec259/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
6 changes: 0 additions & 6 deletions pkg/libvirt/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ const (
DriverVersion = "0.12.13"

connectionString = "qemu:///system"
DefaultMemory = 8096
DefaultCPUs = 4
DefaultNetwork = "crc"
DefaultPool = "crc"
DefaultCacheMode = "default"
DefaultIOMode = "threads"
DefaultSSHUser = "core"
DefaultSSHPort = 22
)
75 changes: 0 additions & 75 deletions pkg/libvirt/libvirt.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
libvirtdriver "github.com/code-ready/machine/drivers/libvirt"
"github.com/code-ready/machine/libmachine/drivers"
"github.com/code-ready/machine/libmachine/log"
"github.com/code-ready/machine/libmachine/mcnflag"
"github.com/code-ready/machine/libmachine/mcnutils"
"github.com/code-ready/machine/libmachine/state"
)
Expand All @@ -30,42 +29,6 @@ type Driver struct {
vmLoaded bool
}

func (d *Driver) GetCreateFlags() []mcnflag.Flag {
return []mcnflag.Flag{
mcnflag.IntFlag{
Name: "crc-libvirt-memory",
Usage: "Size of memory for host in MiB",
Value: DefaultMemory,
},
mcnflag.IntFlag{
Name: "crc-libvirt-cpu-count",
Usage: "Number of CPUs",
Value: DefaultCPUs,
},
mcnflag.StringFlag{
Name: "crc-libvirt-network",
Usage: "Name of network to connect to",
Value: DefaultNetwork,
},
mcnflag.StringFlag{
Name: "crc-libvirt-cachemode",
Usage: "Disk cache mode: default, none, writethrough, writeback, directsync, or unsafe",
Value: DefaultCacheMode,
},
mcnflag.StringFlag{
Name: "crc-libvirt-iomode",
Usage: "Disk IO mode: threads, native",
Value: DefaultIOMode,
},
mcnflag.StringFlag{
EnvVar: "CRC_LIBVIRT_SSHUSER",
Name: "crc-libvirt-sshuser",
Usage: "SSH username",
Value: DefaultSSHUser,
},
}
}

func (d *Driver) GetMachineName() string {
return d.MachineName
}
Expand All @@ -74,26 +37,6 @@ func (d *Driver) GetSSHHostname() (string, error) {
return d.GetIP()
}

func (d *Driver) GetSSHKeyPath() string {
return d.SSHKeyPath
}

func (d *Driver) GetSSHPort() (int, error) {
if d.SSHPort == 0 {
d.SSHPort = DefaultSSHPort
}

return d.SSHPort, nil
}

func (d *Driver) GetSSHUsername() string {
if d.SSHUser == "" {
d.SSHUser = DefaultSSHUser
}

return d.SSHUser
}

func (d *Driver) DriverName() string {
return DriverName
}
Expand All @@ -102,20 +45,6 @@ func (d *Driver) DriverVersion() string {
return DriverVersion
}

func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
log.Debugf("SetConfigFromFlags called")
d.Memory = flags.Int("libvirt-memory")
d.CPU = flags.Int("libvirt-cpu-count")
d.Network = flags.String("libvirt-network")
d.CacheMode = flags.String("libvirt-cachemode")
d.IOMode = flags.String("libvirt-iomode")
d.SSHPort = 22

// CRC system bundle
d.BundleName = flags.String("libvirt-bundlepath")
return nil
}

func convertMiBToKiB(sizeMb int) uint64 {
return uint64(sizeMb) * 1024
}
Expand Down Expand Up @@ -185,9 +114,6 @@ func (d *Driver) UpdateConfigRaw(rawConfig []byte) error {
return err
}
}
if newDriver.SSHKeyPath != d.SSHKeyPath {
log.Debugf("Updating SSH Key Path", d.SSHKeyPath, newDriver.SSHKeyPath)
}

_, err = d.resizeDiskImageIfNeeded(newDriver.DiskCapacity)
if err != nil {
Expand Down Expand Up @@ -620,7 +546,6 @@ func NewDriver(hostName, storePath string) drivers.Driver {
BaseDriver: &drivers.BaseDriver{
MachineName: hostName,
StorePath: storePath,
SSHUser: DefaultSSHUser,
},
},
Network: DefaultNetwork,
Expand Down

0 comments on commit cec477b

Please sign in to comment.