diff options
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | libvirt/cloudinit_def.go | 2 | ||||
-rw-r--r-- | libvirt/network_def.go | 2 | ||||
-rw-r--r-- | libvirt/qemu_agent.go | 2 | ||||
-rw-r--r-- | libvirt/resource_libvirt_domain.go | 6 | ||||
-rw-r--r-- | libvirt/resource_libvirt_volume.go | 4 | ||||
-rw-r--r-- | libvirt/utils_volume.go | 3 |
8 files changed, 12 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml index ab45ae97..1048239f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ before_script: - sudo lxc exec libvirt -- bash /code/travis/setup-guest script: - bash ./travis/gofmtcheck.sh + - make vet - golint -set_exit_status libvirt/ - sudo lxc exec libvirt -- bash /code/travis/run-tests-inside-guest - sudo lxc file pull libvirt/root/go/src/github.com/dmacvicar/terraform-provider-libvirt/profile.cov . @@ -1,6 +1,6 @@ default: build -build: gofmtcheck golint +build: gofmtcheck golint go build install: diff --git a/libvirt/cloudinit_def.go b/libvirt/cloudinit_def.go index fb148b75..d3426dc5 100644 --- a/libvirt/cloudinit_def.go +++ b/libvirt/cloudinit_def.go @@ -160,7 +160,7 @@ func (ci *defCloudInit) createISO() (string, error) { filepath.Join(tmpDir, USERDATA), filepath.Join(tmpDir, METADATA)) - log.Print("About to execute cmd: %+v", cmd) + log.Printf("About to execute cmd: %+v", cmd) if err = cmd.Run(); err != nil { return "", fmt.Errorf("Error while starting the creation of CloudInit's ISO image: %s", err) } diff --git a/libvirt/network_def.go b/libvirt/network_def.go index 77ead849..c53f2896 100644 --- a/libvirt/network_def.go +++ b/libvirt/network_def.go @@ -52,7 +52,7 @@ func newNetworkDef() libvirtxml.Network { </forward> </network>` if d, err := newDefNetworkFromXML(defNetworkXML); err != nil { - panic(fmt.Sprint("Unexpected error while parsing default network definition: %s", err)) + panic(fmt.Sprintf("Unexpected error while parsing default network definition: %s", err)) } else { return d } diff --git a/libvirt/qemu_agent.go b/libvirt/qemu_agent.go index 82e76685..b884f7c4 100644 --- a/libvirt/qemu_agent.go +++ b/libvirt/qemu_agent.go @@ -50,7 +50,7 @@ func getDomainInterfacesViaQemuAgent(domain Domain, wait4ipv4 bool) []libvirt.Do response := QemuAgentInterfacesResponse{} if err := json.Unmarshal([]byte(result), &response); err != nil { log.Printf("[DEBUG] Error converting Qemu agent response about domain interfaces: %s", err) - log.Printf("[DEBUG] Original message: %s", response) + log.Printf("[DEBUG] Original message: %v", response) log.Print("[DEBUG] Returning an empty list of interfaces") return interfaces } diff --git a/libvirt/resource_libvirt_domain.go b/libvirt/resource_libvirt_domain.go index e5034352..707cd61e 100644 --- a/libvirt/resource_libvirt_domain.go +++ b/libvirt/resource_libvirt_domain.go @@ -233,8 +233,8 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error return err } ignStr := fmt.Sprintf("name=opt/com.coreos/config,file=%s", ignitionKey) - fwCfg = append(fwCfg, libvirtxml.DomainQEMUCommandlineArg{"-fw_cfg"}) - fwCfg = append(fwCfg, libvirtxml.DomainQEMUCommandlineArg{ignStr}) + fwCfg = append(fwCfg, libvirtxml.DomainQEMUCommandlineArg{Value: "-fw_cfg"}) + fwCfg = append(fwCfg, libvirtxml.DomainQEMUCommandlineArg{Value: ignStr}) QemuCmdline := &libvirtxml.DomainQEMUCommandline{ Args: fwCfg, } @@ -427,7 +427,7 @@ func resourceLibvirtDomainCreate(d *schema.ResourceData, meta interface{}) error disks = append(disks, disk) } - log.Printf("[DEBUG] scsiDisk: %s", scsiDisk) + log.Printf("[DEBUG] scsiDisk: %t", scsiDisk) if scsiDisk { controller := libvirtxml.DomainController{Type: "scsi", Model: "virtio-scsi"} domainDef.Devices.Controllers = append(domainDef.Devices.Controllers, controller) diff --git a/libvirt/resource_libvirt_volume.go b/libvirt/resource_libvirt_volume.go index afd5b16d..958f9598 100644 --- a/libvirt/resource_libvirt_volume.go +++ b/libvirt/resource_libvirt_volume.go @@ -271,10 +271,10 @@ func resourceLibvirtVolumeRead(d *schema.ResourceData, meta interface{}) error { if virErr.Code != libvirt.ERR_NO_STORAGE_VOL { return fmt.Errorf("Can't retrieve volume %s", d.Id()) } + volID := d.Id() - log.Printf("[INFO] Volume %s not found, attempting to start its pool") + log.Printf("[INFO] Volume %s not found, attempting to start its pool", d.Id()) - volID := d.Id() volPoolName := d.Get("pool").(string) volPool, err := virConn.LookupStoragePoolByName(volPoolName) if err != nil { diff --git a/libvirt/utils_volume.go b/libvirt/utils_volume.go index 457bacb9..03c99180 100644 --- a/libvirt/utils_volume.go +++ b/libvirt/utils_volume.go @@ -106,11 +106,12 @@ func (i *httpImage) Import(copier func(io.Reader) error, vol libvirtxml.StorageV req.Header.Set("If-Modified-Since", timeFromEpoch(vol.Target.Timestamps.Mtime).UTC().Format(http.TimeFormat)) } response, err := client.Do(req) - defer response.Body.Close() if err != nil { return fmt.Errorf("Error while downloading %s: %s", i.url.String(), err) } + + defer response.Body.Close() if response.StatusCode == http.StatusNotModified { return nil } |