Skip to content

Commit

Permalink
Merge pull request #4642 from josedonizetti/fix-error-naming-convention
Browse files Browse the repository at this point in the history
Fix error naming convention
  • Loading branch information
medyagh authored Jun 30, 2019
2 parents f464fa9 + 4d00a09 commit 5a3992b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pkg/drivers/kvm/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func closeDomain(dom *libvirt.Domain, conn *libvirt.Connect) error {
}
res, err := conn.Close()
if res != 0 {
return fmt.Errorf("CloseConnection() == %d, expected 0", res)
return fmt.Errorf("conn.Close() == %d, expected 0", res)
}
return err
}
Expand Down Expand Up @@ -188,14 +188,14 @@ func (d *Driver) createDomain() (*libvirt.Domain, error) {

conn, err := getConnection(d.ConnectionURI)
if err != nil {
return nil, errors.Wrap(err, "Error getting libvirt connection")
return nil, errors.Wrap(err, "error getting libvirt connection")
}
defer conn.Close()

// define the domain in libvirt using the generated XML
dom, err := conn.DomainDefineXML(domainXML.String())
if err != nil {
return nil, errors.Wrapf(err, "Error defining domain xml: %s", domainXML.String())
return nil, errors.Wrapf(err, "error defining domain xml: %s", domainXML.String())
}

return dom, nil
Expand Down
10 changes: 5 additions & 5 deletions pkg/drivers/kvm/kvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func NewDriver(hostName, storePath string) *Driver {
func (d *Driver) PreCommandCheck() error {
conn, err := getConnection(d.ConnectionURI)
if err != nil {
return errors.Wrap(err, "Error connecting to libvirt socket. Have you added yourself to the libvirtd group?")
return errors.Wrap(err, "error connecting to libvirt socket. Have you added yourself to the libvirtd group?")
}
libVersion, err := conn.GetLibVersion()
if err != nil {
Expand Down Expand Up @@ -276,7 +276,7 @@ func (d *Driver) Start() (err error) {

log.Info("Creating domain...")
if err := dom.Create(); err != nil {
return errors.Wrap(err, "Error creating VM")
return errors.Wrap(err, "error creating VM")
}

log.Info("Waiting to get IP...")
Expand All @@ -299,7 +299,7 @@ func (d *Driver) Start() (err error) {
}

if d.IPAddress == "" {
return errors.New("Machine didn't return an IP after 120 seconds")
return errors.New("machine didn't return an IP after 120 seconds")
}

log.Info("Waiting for SSH to be available...")
Expand Down Expand Up @@ -337,7 +337,7 @@ func (d *Driver) Create() (err error) {

log.Infof("Building disk image from %s", d.Boot2DockerURL)
if err = pkgdrivers.MakeDiskImage(d.BaseDriver, d.Boot2DockerURL, d.DiskSize); err != nil {
return errors.Wrap(err, "Error creating disk")
return errors.Wrap(err, "error creating disk")
}

if err := ensureDirPermissions(store); err != nil {
Expand Down Expand Up @@ -411,7 +411,7 @@ func (d *Driver) Stop() (err error) {
for i := 0; i < 60; i++ {
s, err := d.GetState()
if err != nil {
return errors.Wrap(err, "Error getting state of VM")
return errors.Wrap(err, "error getting state of VM")
}
if s == state.Stopped {
return nil
Expand Down

0 comments on commit 5a3992b

Please sign in to comment.