[lxc-devel] [lxd/master] storage: make golint clean

brauner on Github lxc-bot at linuxcontainers.org
Fri Apr 21 14:55:49 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 390 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170421/85933869/attachment.bin>
-------------- next part --------------
From fc06a9cd9f1633b251758abe18b67bb15e72aa8d Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 21 Apr 2017 16:55:00 +0200
Subject: [PATCH] storage: make golint clean

non-functional changes

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/patches.go                |  14 ++---
 lxd/storage.go                |  14 +++--
 lxd/storage_btrfs.go          |  38 ++++++------
 lxd/storage_cgo.go            |  18 +++---
 lxd/storage_dir.go            |  40 ++++++------
 lxd/storage_lvm.go            | 141 +++++++++++++++++++++---------------------
 lxd/storage_migration.go      |   4 +-
 lxd/storage_pools.go          |   4 +-
 lxd/storage_pools_config.go   |   8 +--
 lxd/storage_pools_utils.go    |  14 ++---
 lxd/storage_shared.go         |   4 +-
 lxd/storage_volumes.go        |  20 +++---
 lxd/storage_volumes_config.go |  10 +--
 lxd/storage_volumes_utils.go  |  34 +++++-----
 lxd/storage_zfs.go            |  40 ++++++------
 15 files changed, 205 insertions(+), 198 deletions(-)

diff --git a/lxd/patches.go b/lxd/patches.go
index 83bdd16..ee3642f 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -985,8 +985,8 @@ func upgradeFromStorageTypeLvm(name string, d *Daemon, defaultPoolName string, d
 		// permissions and ownership.
 		newContainerMntPoint := getContainerMountPoint(defaultPoolName, ct)
 		ctLvName := containerNameToLVName(ct)
-		newContainerLvName := fmt.Sprintf("%s_%s", storagePoolVolumeApiEndpointContainers, ctLvName)
-		containerLvDevPath := getLvmDevPath(defaultPoolName, storagePoolVolumeApiEndpointContainers, ctLvName)
+		newContainerLvName := fmt.Sprintf("%s_%s", storagePoolVolumeAPIEndpointContainers, ctLvName)
+		containerLvDevPath := getLvmDevPath(defaultPoolName, storagePoolVolumeAPIEndpointContainers, ctLvName)
 		if !shared.PathExists(containerLvDevPath) {
 			oldLvDevPath := fmt.Sprintf("/dev/%s/%s", defaultPoolName, ctLvName)
 			// If the old LVM device path for the logical volume
@@ -1141,8 +1141,8 @@ func upgradeFromStorageTypeLvm(name string, d *Daemon, defaultPoolName string, d
 
 			// Make sure we use a valid lv name.
 			csLvName := containerNameToLVName(cs)
-			newSnapshotLvName := fmt.Sprintf("%s_%s", storagePoolVolumeApiEndpointContainers, csLvName)
-			snapshotLvDevPath := getLvmDevPath(defaultPoolName, storagePoolVolumeApiEndpointContainers, csLvName)
+			newSnapshotLvName := fmt.Sprintf("%s_%s", storagePoolVolumeAPIEndpointContainers, csLvName)
+			snapshotLvDevPath := getLvmDevPath(defaultPoolName, storagePoolVolumeAPIEndpointContainers, csLvName)
 			if !shared.PathExists(snapshotLvDevPath) {
 				oldLvDevPath := fmt.Sprintf("/dev/%s/%s", defaultPoolName, csLvName)
 				if shared.PathExists(oldLvDevPath) {
@@ -1321,8 +1321,8 @@ func upgradeFromStorageTypeLvm(name string, d *Daemon, defaultPoolName string, d
 		}
 
 		// Rename the logical volume device.
-		newImageLvName := fmt.Sprintf("%s_%s", storagePoolVolumeApiEndpointImages, img)
-		imageLvDevPath := getLvmDevPath(defaultPoolName, storagePoolVolumeApiEndpointImages, img)
+		newImageLvName := fmt.Sprintf("%s_%s", storagePoolVolumeAPIEndpointImages, img)
+		imageLvDevPath := getLvmDevPath(defaultPoolName, storagePoolVolumeAPIEndpointImages, img)
 		oldLvDevPath := fmt.Sprintf("/dev/%s/%s", defaultPoolName, img)
 		// Only create logical volumes for images that have a logical
 		// volume on the pre-storage-api LXD instance. If not, we don't
@@ -2207,7 +2207,7 @@ func patchStorageApiDetectLVSize(name string, d *Daemon) error {
 
 			// It shouldn't be possible that false volume types
 			// exist in the db, so it's safe to ignore the error.
-			volumeTypeApiEndpoint, _ := storagePoolVolumeTypeNameToApiEndpoint(volume.Type)
+			volumeTypeApiEndpoint, _ := storagePoolVolumeTypeNameToAPIEndpoint(volume.Type)
 			lvmName := containerNameToLVName(volume.Name)
 			lvmLvDevPath := getLvmDevPath(poolName, volumeTypeApiEndpoint, lvmName)
 			size, err := lvmGetLVSize(lvmLvDevPath)
diff --git a/lxd/storage.go b/lxd/storage.go
index 98c8f69..629e0e3 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -139,7 +139,7 @@ func storageTypeToString(sType storageType) (string, error) {
 		return "dir", nil
 	}
 
-	return "", fmt.Errorf("Invalid storage type.")
+	return "", fmt.Errorf("invalid storage type")
 }
 
 func storageStringToType(sName string) (storageType, error) {
@@ -156,7 +156,7 @@ func storageStringToType(sName string) (storageType, error) {
 		return storageTypeDir, nil
 	}
 
-	return -1, fmt.Errorf("Invalid storage type name.")
+	return -1, fmt.Errorf("invalid storage type name")
 }
 
 // The storage interface defines the functions needed to implement a storage
@@ -292,7 +292,7 @@ func storageCoreInit(driver string) (storage, error) {
 		return &zfs, nil
 	}
 
-	return nil, fmt.Errorf("Invalid storage type.")
+	return nil, fmt.Errorf("invalid storage type")
 }
 
 func storageInit(d *Daemon, poolName string, volumeName string, volumeType int) (storage, error) {
@@ -306,7 +306,7 @@ func storageInit(d *Daemon, poolName string, volumeName string, volumeType int)
 	if driver == "" {
 		// This shouldn't actually be possible but better safe than
 		// sorry.
-		return nil, fmt.Errorf("No storage driver was provided.")
+		return nil, fmt.Errorf("no storage driver was provided")
 	}
 
 	// Load the storage volume.
@@ -381,7 +381,7 @@ func storageInit(d *Daemon, poolName string, volumeName string, volumeType int)
 		return &zfs, nil
 	}
 
-	return nil, fmt.Errorf("Invalid storage type.")
+	return nil, fmt.Errorf("invalid storage type")
 }
 
 func storagePoolInit(d *Daemon, poolName string) (storage, error) {
@@ -570,6 +570,8 @@ func deleteSnapshotMountpoint(snapshotMountpoint string, snapshotsSymlinkTarget
 	return nil
 }
 
+// ShiftIfNecessary sets the volatile.last_state.idmap key to the idmap last
+// used by the container.
 func ShiftIfNecessary(container container, srcIdmap *shared.IdmapSet) error {
 	dstIdmap, err := container.IdmapSet()
 	if err != nil {
@@ -657,6 +659,7 @@ func progressWrapperRender(op *operation, key string, description string, progre
 	}
 }
 
+// StorageProgressReader reports the read progress.
 func StorageProgressReader(op *operation, key string, description string) func(io.ReadCloser) io.ReadCloser {
 	return func(reader io.ReadCloser) io.ReadCloser {
 		if op == nil {
@@ -678,6 +681,7 @@ func StorageProgressReader(op *operation, key string, description string) func(i
 	}
 }
 
+// StorageProgressWriter reports the write progress.
 func StorageProgressWriter(op *operation, key string, description string) func(io.WriteCloser) io.WriteCloser {
 	return func(writer io.WriteCloser) io.WriteCloser {
 		if op == nil {
diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index 5561663..56424e3 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -141,22 +141,22 @@ func (s *storageBtrfs) StoragePoolCreate() error {
 				if isBtrfsSubVolume(source) {
 					subvols, err := btrfsSubVolumesGet(source)
 					if err != nil {
-						return fmt.Errorf("Could not determine if existing BTRFS subvolume ist empty: %s.", err)
+						return fmt.Errorf("could not determine if existing BTRFS subvolume ist empty: %s", err)
 					}
 					if len(subvols) > 0 {
-						return fmt.Errorf("Requested BTRFS subvolume exists but is not empty.")
+						return fmt.Errorf("requested BTRFS subvolume exists but is not empty")
 					}
 				} else {
 					cleanSource := filepath.Clean(source)
 					lxdDir := shared.VarPath()
 					poolMntPoint := getStoragePoolMountPoint(s.pool.Name)
 					if shared.PathExists(source) && !isOnBtrfs(source) {
-						return fmt.Errorf("Existing path is neither a BTRFS subvolume nor does it reside on a BTRFS filesystem.")
+						return fmt.Errorf("existing path is neither a BTRFS subvolume nor does it reside on a BTRFS filesystem")
 					} else if strings.HasPrefix(cleanSource, lxdDir) {
 						if cleanSource != poolMntPoint {
 							return fmt.Errorf("BTRFS subvolumes requests in LXD directory \"%s\" are only valid under \"%s\"\n(e.g. source=%s)", shared.VarPath(), shared.VarPath("storage-pools"), poolMntPoint)
 						} else if s.d.BackingFs != "btrfs" {
-							return fmt.Errorf("Creation of BTRFS subvolume requested but \"%s\" does not reside on BTRFS filesystem.", source)
+							return fmt.Errorf("creation of BTRFS subvolume requested but \"%s\" does not reside on BTRFS filesystem", source)
 						}
 					}
 
@@ -167,7 +167,7 @@ func (s *storageBtrfs) StoragePoolCreate() error {
 				}
 			}
 		} else {
-			return fmt.Errorf("Invalid \"source\" property.")
+			return fmt.Errorf("invalid \"source\" property")
 		}
 	}
 
@@ -255,7 +255,7 @@ func (s *storageBtrfs) StoragePoolDelete() error {
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	// Delete default subvolumes.
@@ -321,7 +321,7 @@ func (s *storageBtrfs) StoragePoolMount() (bool, error) {
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return false, fmt.Errorf("No \"source\" property found for the storage pool.")
+		return false, fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	poolMntPoint := getStoragePoolMountPoint(s.pool.Name)
@@ -378,7 +378,7 @@ func (s *storageBtrfs) StoragePoolMount() (bool, error) {
 			// Since we mount the loop device LO_FLAGS_AUTOCLEAR is
 			// fine since the loop device will be kept around for as
 			// long as the mount exists.
-			loopF, loopErr := prepareLoopDev(source, LO_FLAGS_AUTOCLEAR)
+			loopF, loopErr := prepareLoopDev(source, LoFlagsAutoclear)
 			if loopErr != nil {
 				return false, loopErr
 			}
@@ -467,7 +467,7 @@ func (s *storageBtrfs) StoragePoolUpdate(writable *api.StoragePoolPut, changedCo
 		return nil
 	}
 
-	return fmt.Errorf("Storage property cannot be changed.")
+	return fmt.Errorf("storage property cannot be changed")
 }
 
 func (s *storageBtrfs) GetStoragePoolWritable() api.StoragePoolPut {
@@ -556,7 +556,7 @@ func (s *storageBtrfs) StoragePoolVolumeUmount() (bool, error) {
 }
 
 func (s *storageBtrfs) StoragePoolVolumeUpdate(changedConfig []string) error {
-	return fmt.Errorf("Btrfs storage properties cannot be changed.")
+	return fmt.Errorf("BTRFS storage properties cannot be changed")
 }
 
 func (s *storageBtrfs) GetStoragePoolVolumeWritable() api.StorageVolumePut {
@@ -619,7 +619,7 @@ func (s *storageBtrfs) ContainerCreateFromImage(container container, fingerprint
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	_, err := s.StoragePoolMount()
@@ -776,7 +776,7 @@ func (s *storageBtrfs) copyContainer(target container, source container) error {
 		return err
 	}
 
-	err = s.setUnprivUserAcl(source, targetContainerSubvolumeName)
+	err = s.setUnprivUserACL(source, targetContainerSubvolumeName)
 	if err != nil {
 		s.ContainerDelete(target)
 		return err
@@ -842,7 +842,7 @@ func (s *storageBtrfs) ContainerCopy(target container, source container, contain
 	_, sourcePool := source.Storage().GetContainerPoolInfo()
 	_, targetPool := target.Storage().GetContainerPoolInfo()
 	if sourcePool != targetPool {
-		return fmt.Errorf("Copying containers between different storage pools is not implemented.")
+		return fmt.Errorf("copying containers between different storage pools is not implemented")
 	}
 
 	err = s.copyContainer(target, source)
@@ -1022,7 +1022,7 @@ func (s *storageBtrfs) ContainerRestore(container container, sourceContainer con
 	}
 
 	// Now allow unprivileged users to access its data.
-	err = s.setUnprivUserAcl(sourceContainer, targetContainerSubvolumeName)
+	err = s.setUnprivUserACL(sourceContainer, targetContainerSubvolumeName)
 	if err != nil {
 		failure = err
 	}
@@ -1272,7 +1272,7 @@ func (s *storageBtrfs) ImageCreate(fingerprint string) error {
 	// Create the subvolume.
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	_, err := s.StoragePoolMount()
@@ -1431,7 +1431,7 @@ func btrfsSubVolumeQGroup(subvol string) (string, error) {
 		"-f")
 
 	if err != nil {
-		return "", fmt.Errorf("btrfs quotas not supported. Try enabling them with 'btrfs quota enable'.")
+		return "", fmt.Errorf("BTRFS quotas not supported. Try enabling them with \"btrfs quota enable\"")
 	}
 
 	var qgroup string
@@ -1465,7 +1465,7 @@ func (s *storageBtrfs) btrfsPoolVolumeQGroupUsage(subvol string) (int64, error)
 		"-f")
 
 	if err != nil {
-		return -1, fmt.Errorf("btrfs quotas not supported. Try enabling them with 'btrfs quota enable'.")
+		return -1, fmt.Errorf("BTRFS quotas not supported. Try enabling them with \"btrfs quota enable\"")
 	}
 
 	for _, line := range strings.Split(output, "\n") {
@@ -2006,7 +2006,7 @@ func (s *storageBtrfs) MigrationSink(live bool, container container, snapshots [
 
 	// A little neuroticism.
 	if parentStoragePool == "" {
-		return fmt.Errorf("Detected that the container's root device is missing the pool property during BTRFS migration.")
+		return fmt.Errorf("detected that the container's root device is missing the pool property during BTRFS migration")
 	}
 
 	if !containerOnly {
@@ -2093,7 +2093,7 @@ func (s *storageBtrfs) btrfsLookupFsUUID(fs string) (string, error) {
 		"--raw",
 		fs)
 	if err != nil {
-		return "", fmt.Errorf("Failed to detect UUID.")
+		return "", fmt.Errorf("failed to detect UUID")
 	}
 
 	outputString := output
diff --git a/lxd/storage_cgo.go b/lxd/storage_cgo.go
index b70c655..981f76e 100644
--- a/lxd/storage_cgo.go
+++ b/lxd/storage_cgo.go
@@ -274,7 +274,9 @@ import (
 	"unsafe"
 )
 
-const LO_FLAGS_AUTOCLEAR int = C.LO_FLAGS_AUTOCLEAR
+// LoFlagsAutoclear determines whether the loop device will autodestruct on last
+// close.
+const LoFlagsAutoclear int = C.LO_FLAGS_AUTOCLEAR
 
 // prepareLoopDev() detects and sets up a loop device for source. It returns an
 // open file descriptor to the free loop device and the path of the free loop
@@ -282,7 +284,7 @@ const LO_FLAGS_AUTOCLEAR int = C.LO_FLAGS_AUTOCLEAR
 func prepareLoopDev(source string, flags int) (*os.File, error) {
 	cLoopDev := C.malloc(C.size_t(C.LO_NAME_SIZE))
 	if cLoopDev == nil {
-		return nil, fmt.Errorf("Failed to allocate memory in C.")
+		return nil, fmt.Errorf("failed to allocate memory in C")
 	}
 	defer C.free(cLoopDev)
 
@@ -296,9 +298,9 @@ func prepareLoopDev(source string, flags int) (*os.File, error) {
 	loopFd, err := C.prepare_loop_dev(cSource, (*C.char)(cLoopDev), C.int(flags))
 	if loopFd < 0 {
 		if err != nil {
-			return nil, fmt.Errorf("Failed to prepare loop device: %s.", err)
+			return nil, fmt.Errorf("failed to prepare loop device: %s", err)
 		}
-		return nil, fmt.Errorf("Failed to prepare loop device.")
+		return nil, fmt.Errorf("failed to prepare loop device")
 	}
 
 	return os.NewFile(uintptr(loopFd), C.GoString((*C.char)(cLoopDev))), nil
@@ -310,7 +312,7 @@ func setAutoclearOnLoopDev(loopFd int) error {
 		if err != nil {
 			return err
 		}
-		return fmt.Errorf("Failed to set LO_FLAGS_AUTOCLEAR.")
+		return fmt.Errorf("failed to set LO_FLAGS_AUTOCLEAR")
 	}
 
 	return nil
@@ -322,7 +324,7 @@ func unsetAutoclearOnLoopDev(loopFd int) error {
 		if err != nil {
 			return err
 		}
-		return fmt.Errorf("Failed to unset LO_FLAGS_AUTOCLEAR.")
+		return fmt.Errorf("failed to unset LO_FLAGS_AUTOCLEAR")
 	}
 
 	return nil
@@ -331,7 +333,7 @@ func unsetAutoclearOnLoopDev(loopFd int) error {
 func loopDeviceHasBackingFile(loopDevice string, loopFile string) (*os.File, error) {
 	lidx := strings.LastIndex(loopDevice, "/")
 	if lidx < 0 {
-		return nil, fmt.Errorf("Invalid loop device path: \"%s\".", loopDevice)
+		return nil, fmt.Errorf("invalid loop device path: \"%s\"", loopDevice)
 	}
 
 	loopName := loopDevice[(lidx + 1):]
@@ -343,7 +345,7 @@ func loopDeviceHasBackingFile(loopDevice string, loopFile string) (*os.File, err
 
 	cleanBackingFile := strings.TrimSpace(string(contents))
 	if cleanBackingFile != loopFile {
-		return nil, fmt.Errorf("Loop device has new backing file: \"%s\".", cleanBackingFile)
+		return nil, fmt.Errorf("loop device has new backing file: \"%s\"", cleanBackingFile)
 	}
 
 	return os.OpenFile(loopDevice, os.O_RDWR, 0660)
diff --git a/lxd/storage_dir.go b/lxd/storage_dir.go
index 27890df..7e4677c 100644
--- a/lxd/storage_dir.go
+++ b/lxd/storage_dir.go
@@ -103,7 +103,7 @@ func (s *storageDir) StoragePoolDelete() error {
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	if shared.PathExists(source) {
@@ -163,7 +163,7 @@ func (s *storageDir) StoragePoolUpdate(writable *api.StoragePoolPut, changedConf
 		return nil
 	}
 
-	return fmt.Errorf("Storage property cannot be changed.")
+	return fmt.Errorf("storage property cannot be changed")
 }
 
 // Functions dealing with storage pools.
@@ -172,7 +172,7 @@ func (s *storageDir) StoragePoolVolumeCreate() error {
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	storageVolumePath := getStoragePoolVolumeMountPoint(s.pool.Name, s.volume.Name)
@@ -190,7 +190,7 @@ func (s *storageDir) StoragePoolVolumeDelete() error {
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	storageVolumePath := getStoragePoolVolumeMountPoint(s.pool.Name, s.volume.Name)
@@ -216,7 +216,7 @@ func (s *storageDir) StoragePoolVolumeUmount() (bool, error) {
 }
 
 func (s *storageDir) StoragePoolVolumeUpdate(changedConfig []string) error {
-	return fmt.Errorf("Dir storage properties cannot be changed.")
+	return fmt.Errorf("dir storage properties cannot be changed")
 }
 
 func (s *storageDir) ContainerStorageReady(name string) bool {
@@ -230,7 +230,7 @@ func (s *storageDir) ContainerCreate(container container) error {
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	containerMntPoint := getContainerMountPoint(s.pool.Name, container.Name())
@@ -262,7 +262,7 @@ func (s *storageDir) ContainerCreateFromImage(container container, imageFingerpr
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	privileged := container.IsPrivileged()
@@ -313,7 +313,7 @@ func (s *storageDir) ContainerDelete(container container) error {
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	// Delete the container on its storage pool:
@@ -326,7 +326,7 @@ func (s *storageDir) ContainerDelete(container container) error {
 			// RemovaAll fails on very long paths, so attempt an rm -Rf
 			output, err := shared.RunCommand("rm", "-Rf", containerMntPoint)
 			if err != nil {
-				return fmt.Errorf("Error removing %s: %s.", containerMntPoint, output)
+				return fmt.Errorf("error removing %s: %s", containerMntPoint, output)
 			}
 		}
 	}
@@ -374,10 +374,10 @@ func (s *storageDir) copyContainer(target container, source container) error {
 	bwlimit := s.pool.Config["rsync.bwlimit"]
 	output, err := rsyncLocalCopy(sourceContainerMntPoint, targetContainerMntPoint, bwlimit)
 	if err != nil {
-		return fmt.Errorf("Failed to rsync container: %s: %s.", string(output), err)
+		return fmt.Errorf("failed to rsync container: %s: %s", string(output), err)
 	}
 
-	err = s.setUnprivUserAcl(source, targetContainerMntPoint)
+	err = s.setUnprivUserACL(source, targetContainerMntPoint)
 	if err != nil {
 		return err
 	}
@@ -408,7 +408,7 @@ func (s *storageDir) copySnapshot(target container, source container) error {
 	bwlimit := s.pool.Config["rsync.bwlimit"]
 	output, err := rsyncLocalCopy(sourceContainerMntPoint, targetContainerMntPoint, bwlimit)
 	if err != nil {
-		return fmt.Errorf("Failed to rsync container: %s: %s.", string(output), err)
+		return fmt.Errorf("failed to rsync container: %s: %s", string(output), err)
 	}
 
 	return nil
@@ -428,7 +428,7 @@ func (s *storageDir) ContainerCopy(target container, source container, container
 	_, sourcePool := source.Storage().GetContainerPoolInfo()
 	_, targetPool := target.Storage().GetContainerPoolInfo()
 	if sourcePool != targetPool {
-		return fmt.Errorf("Copying containers between different storage pools is not implemented.")
+		return fmt.Errorf("copying containers between different storage pools is not implemented")
 	}
 
 	err = s.copyContainer(target, source)
@@ -487,7 +487,7 @@ func (s *storageDir) ContainerRename(container container, newName string) error
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	oldContainerMntPoint := getContainerMountPoint(s.pool.Name, container.Name())
@@ -542,11 +542,11 @@ func (s *storageDir) ContainerRestore(container container, sourceContainer conta
 	bwlimit := s.pool.Config["rsync.bwlimit"]
 	output, err := rsyncLocalCopy(sourcePath, targetPath, bwlimit)
 	if err != nil {
-		return fmt.Errorf("Failed to rsync container: %s: %s.", string(output), err)
+		return fmt.Errorf("failed to rsync container: %s: %s", string(output), err)
 	}
 
 	// Now allow unprivileged users to access its data.
-	if err := s.setUnprivUserAcl(sourceContainer, targetPath); err != nil {
+	if err := s.setUnprivUserACL(sourceContainer, targetPath); err != nil {
 		return err
 	}
 
@@ -555,11 +555,11 @@ func (s *storageDir) ContainerRestore(container container, sourceContainer conta
 }
 
 func (s *storageDir) ContainerSetQuota(container container, size int64) error {
-	return fmt.Errorf("The directory container backend doesn't support quotas.")
+	return fmt.Errorf("the directory container backend doesn't support quotas")
 }
 
 func (s *storageDir) ContainerGetUsage(container container) (int64, error) {
-	return -1, fmt.Errorf("The directory container backend doesn't support quotas.")
+	return -1, fmt.Errorf("the directory container backend doesn't support quotas")
 }
 
 func (s *storageDir) ContainerSnapshotCreate(snapshotContainer container, sourceContainer container) error {
@@ -577,7 +577,7 @@ func (s *storageDir) ContainerSnapshotCreate(snapshotContainer container, source
 		output, err := rsyncLocalCopy(oldPath, newPath, bwlimit)
 		if err != nil {
 			s.ContainerDelete(snapshotContainer)
-			return fmt.Errorf("Failed to rsync: %s: %s.", string(output), err)
+			return fmt.Errorf("failed to rsync: %s: %s", string(output), err)
 		}
 		return nil
 	}
@@ -677,7 +677,7 @@ func (s *storageDir) ContainerSnapshotDelete(snapshotContainer container) error
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	// Delete the snapshot on its storage pool:
diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index 221adb3..abdfed3 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -19,7 +19,7 @@ import (
 func storageVGActivate(lvmVolumePath string) error {
 	output, err := shared.TryRunCommand("vgchange", "-ay", lvmVolumePath)
 	if err != nil {
-		return fmt.Errorf("Could not activate volume group \"%s\": %s.", lvmVolumePath, output)
+		return fmt.Errorf("could not activate volume group \"%s\": %s", lvmVolumePath, output)
 	}
 
 	return nil
@@ -28,7 +28,7 @@ func storageVGActivate(lvmVolumePath string) error {
 func storageLVActivate(lvmVolumePath string) error {
 	output, err := shared.TryRunCommand("lvchange", "-ay", lvmVolumePath)
 	if err != nil {
-		return fmt.Errorf("Could not activate logival volume \"%s\": %s.", lvmVolumePath, output)
+		return fmt.Errorf("could not activate logival volume \"%s\": %s", lvmVolumePath, output)
 	}
 
 	return nil
@@ -44,7 +44,7 @@ func storagePVExists(pvName string) (bool, error) {
 				return false, nil
 			}
 		}
-		return false, fmt.Errorf("Error checking for physical volume \"%s\"", pvName)
+		return false, fmt.Errorf("error checking for physical volume \"%s\"", pvName)
 	}
 
 	return true, nil
@@ -60,7 +60,7 @@ func storageVGExists(vgName string) (bool, error) {
 				return false, nil
 			}
 		}
-		return false, fmt.Errorf("Error checking for volume group \"%s\"", vgName)
+		return false, fmt.Errorf("error checking for volume group \"%s\"", vgName)
 	}
 
 	return true, nil
@@ -76,7 +76,7 @@ func storageLVExists(lvName string) (bool, error) {
 				return false, nil
 			}
 		}
-		return false, fmt.Errorf("Error checking for logical volume \"%s\"", lvName)
+		return false, fmt.Errorf("error checking for logical volume \"%s\"", lvName)
 	}
 
 	return true, nil
@@ -85,7 +85,7 @@ func storageLVExists(lvName string) (bool, error) {
 func lvmGetLVSize(lvPath string) (string, error) {
 	msg, err := shared.TryRunCommand("lvs", "--noheadings", "-o", "size", "--nosuffix", "--units", "b", lvPath)
 	if err != nil {
-		return "", fmt.Errorf("Failed to retrieve size of logical volume: %s: %s.", string(msg), err)
+		return "", fmt.Errorf("failed to retrieve size of logical volume: %s: %s", string(msg), err)
 	}
 
 	sizeString := string(msg)
@@ -110,7 +110,7 @@ func storageLVMThinpoolExists(vgName string, poolName string) (bool, error) {
 				return false, nil
 			}
 		}
-		return false, fmt.Errorf("Error checking for pool '%s'", poolName)
+		return false, fmt.Errorf("error checking for pool \"%s\"", poolName)
 	}
 	// Found LV named poolname, check type:
 	attrs := strings.TrimSpace(string(output[:]))
@@ -118,7 +118,7 @@ func storageLVMThinpoolExists(vgName string, poolName string) (bool, error) {
 		return true, nil
 	}
 
-	return false, fmt.Errorf("Pool named '%s' exists but is not a thin pool.", poolName)
+	return false, fmt.Errorf("pool named \"%s\" exists but is not a thin pool", poolName)
 }
 
 func storageLVMGetThinPoolUsers(d *Daemon) ([]string, error) {
@@ -160,25 +160,25 @@ func storageLVMGetThinPoolUsers(d *Daemon) ([]string, error) {
 func storageLVMValidateThinPoolName(d *Daemon, vgName string, value string) error {
 	users, err := storageLVMGetThinPoolUsers(d)
 	if err != nil {
-		return fmt.Errorf("Error checking if a pool is already in use: %v", err)
+		return fmt.Errorf("error checking if a pool is already in use: %v", err)
 	}
 
 	if len(users) > 0 {
-		return fmt.Errorf("Can not change LVM config. Images or containers are still using LVs: %v", users)
+		return fmt.Errorf("can not change LVM config. Images or containers are still using LVs: %v", users)
 	}
 
 	if value != "" {
 		if vgName == "" {
-			return fmt.Errorf("Can not set lvm.thinpool_name without lvm.vg_name set.")
+			return fmt.Errorf("can not set lvm.thinpool_name without lvm.vg_name set")
 		}
 
 		poolExists, err := storageLVMThinpoolExists(vgName, value)
 		if err != nil {
-			return fmt.Errorf("Error checking for thin pool '%s' in '%s': %v", value, vgName, err)
+			return fmt.Errorf("error checking for thin pool \"%s\" in \"%s\": %v", value, vgName, err)
 		}
 
 		if !poolExists {
-			return fmt.Errorf("Pool '%s' does not exist in Volume Group '%s'", value, vgName)
+			return fmt.Errorf("pool \"'%s\" does not exist in Volume Group \"%s\"", value, vgName)
 		}
 	}
 
@@ -188,7 +188,7 @@ func storageLVMValidateThinPoolName(d *Daemon, vgName string, value string) erro
 func lvmVGRename(oldName string, newName string) error {
 	output, err := shared.TryRunCommand("vgrename", oldName, newName)
 	if err != nil {
-		return fmt.Errorf("Could not rename volume group from \"%s\" to \"%s\": %s.", oldName, newName, output)
+		return fmt.Errorf("could not rename volume group from \"%s\" to \"%s\": %s", oldName, newName, output)
 	}
 
 	return nil
@@ -197,7 +197,7 @@ func lvmVGRename(oldName string, newName string) error {
 func lvmLVRename(vgName string, oldName string, newName string) error {
 	output, err := shared.TryRunCommand("lvrename", vgName, oldName, newName)
 	if err != nil {
-		return fmt.Errorf("Could not rename volume group from \"%s\" to \"%s\": %s.", oldName, newName, output)
+		return fmt.Errorf("could not rename volume group from \"%s\" to \"%s\": %s", oldName, newName, output)
 	}
 
 	return nil
@@ -360,7 +360,7 @@ func (s *storageLvm) StoragePoolInit() error {
 			return err
 		} else if !ok {
 			// Volume group does not exist.
-			return fmt.Errorf("The requested volume group \"%s\" does not exist.", source)
+			return fmt.Errorf("the requested volume group \"%s\" does not exist", source)
 		}
 	}
 
@@ -425,10 +425,9 @@ func lvmVersionIsAtLeast(sTypeVersion string, versionString string) (bool, error
 
 	if lvmMaj < inMaj || lvmMin < inMin || lvmInc < inInc {
 		return false, nil
-	} else {
-		return true, nil
 	}
 
+	return true, nil
 }
 
 func (s *storageLvm) StoragePoolCreate() error {
@@ -498,7 +497,7 @@ func (s *storageLvm) StoragePoolCreate() error {
 			// Create a new lvm physical volume.
 			output, err := shared.TryRunCommand("pvcreate", loopDevicePath)
 			if err != nil {
-				return fmt.Errorf("Failed to create the physical volume for the lvm storage pool: %s.", output)
+				return fmt.Errorf("failed to create the physical volume for the lvm storage pool: %s", output)
 			}
 			defer func() {
 				if tryUndo {
@@ -513,14 +512,14 @@ func (s *storageLvm) StoragePoolCreate() error {
 			// Create a volume group on the physical volume.
 			output, err := shared.TryRunCommand("vgcreate", poolName, loopDevicePath)
 			if err != nil {
-				return fmt.Errorf("Failed to create the volume group for the lvm storage pool: %s.", output)
+				return fmt.Errorf("failed to create the volume group for the lvm storage pool: %s", output)
 			}
 		}
 	} else {
 		s.pool.Config["size"] = ""
 		if filepath.IsAbs(source) {
 			if !shared.IsBlockdevPath(source) {
-				return fmt.Errorf("Custom loop file locations are not supported.")
+				return fmt.Errorf("custom loop file locations are not supported")
 			}
 
 			if s.pool.Config["lvm.vg_name"] == "" {
@@ -536,7 +535,7 @@ func (s *storageLvm) StoragePoolCreate() error {
 				// Create a new lvm physical volume.
 				output, err := shared.TryRunCommand("pvcreate", source)
 				if err != nil {
-					return fmt.Errorf("Failed to create the physical volume for the lvm storage pool: %s.", output)
+					return fmt.Errorf("failed to create the physical volume for the lvm storage pool: %s", output)
 				}
 				defer func() {
 					if tryUndo {
@@ -551,13 +550,13 @@ func (s *storageLvm) StoragePoolCreate() error {
 				// Create a volume group on the physical volume.
 				output, err := shared.TryRunCommand("vgcreate", poolName, source)
 				if err != nil {
-					return fmt.Errorf("Failed to create the volume group for the lvm storage pool: %s.", output)
+					return fmt.Errorf("failed to create the volume group for the lvm storage pool: %s", output)
 				}
 			}
 		} else {
 			if s.pool.Config["lvm.vg_name"] != "" {
 				// User gave us something weird.
-				return fmt.Errorf("Invalid combination of \"source\" and \"zfs.pool_name\" property.")
+				return fmt.Errorf("invalid combination of \"source\" and \"zfs.pool_name\" property")
 			}
 			s.pool.Config["lvm.vg_name"] = source
 			s.vgName = source
@@ -568,7 +567,7 @@ func (s *storageLvm) StoragePoolCreate() error {
 				return err
 			} else if !ok {
 				// Volume group does not exist.
-				return fmt.Errorf("The requested volume group \"%s\" does not exist.", source)
+				return fmt.Errorf("the requested volume group \"%s\" does not exist", source)
 			}
 		}
 	}
@@ -590,7 +589,7 @@ func (s *storageLvm) StoragePoolDelete() error {
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	_, err := s.StoragePoolMount()
@@ -606,7 +605,7 @@ func (s *storageLvm) StoragePoolDelete() error {
 	// Remove the volume group.
 	output, err := shared.TryRunCommand("vgremove", "-f", poolName)
 	if err != nil {
-		return fmt.Errorf("Failed to destroy the volume group for the lvm storage pool: %s.", output)
+		return fmt.Errorf("failed to destroy the volume group for the lvm storage pool: %s", output)
 	}
 
 	if s.loopInfo != nil {
@@ -644,7 +643,7 @@ func (s *storageLvm) StoragePoolDelete() error {
 func (s *storageLvm) StoragePoolMount() (bool, error) {
 	source := s.pool.Config["source"]
 	if source == "" {
-		return false, fmt.Errorf("No \"source\" property found for the storage pool.")
+		return false, fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	if !filepath.IsAbs(source) {
@@ -710,7 +709,7 @@ func (s *storageLvm) StoragePoolVolumeCreate() error {
 		return err
 	}
 
-	volumeType, err := storagePoolVolumeTypeNameToApiEndpoint(s.volume.Type)
+	volumeType, err := storagePoolVolumeTypeNameToAPIEndpoint(s.volume.Type)
 	if err != nil {
 		return err
 	}
@@ -758,7 +757,7 @@ func (s *storageLvm) StoragePoolVolumeDelete() error {
 		return err
 	}
 
-	volumeType, err := storagePoolVolumeTypeNameToApiEndpoint(s.volume.Type)
+	volumeType, err := storagePoolVolumeTypeNameToAPIEndpoint(s.volume.Type)
 	if err != nil {
 		return err
 	}
@@ -787,7 +786,7 @@ func (s *storageLvm) StoragePoolVolumeMount() (bool, error) {
 	poolName := s.getOnDiskPoolName()
 	mountOptions := s.getLvmBlockMountOptions()
 	lvFsType := s.getLvmFilesystem()
-	volumeType, err := storagePoolVolumeTypeNameToApiEndpoint(s.volume.Type)
+	volumeType, err := storagePoolVolumeTypeNameToAPIEndpoint(s.volume.Type)
 	if err != nil {
 		return false, err
 	}
@@ -896,23 +895,23 @@ func (s *storageLvm) StoragePoolUpdate(writable *api.StoragePoolPut, changedConf
 	logger.Infof("Updating LVM storage pool \"%s\".", s.pool.Name)
 
 	if shared.StringInSlice("size", changedConfig) {
-		return fmt.Errorf("The \"size\" property cannot be changed.")
+		return fmt.Errorf("the \"size\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("source", changedConfig) {
-		return fmt.Errorf("The \"source\" property cannot be changed.")
+		return fmt.Errorf("the \"source\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("volume.zfs.use_refquota", changedConfig) {
-		return fmt.Errorf("The \"volume.zfs.use_refquota\" property does not apply to LVM drivers.")
+		return fmt.Errorf("the \"volume.zfs.use_refquota\" property does not apply to LVM drivers")
 	}
 
 	if shared.StringInSlice("volume.zfs.remove_snapshots", changedConfig) {
-		return fmt.Errorf("The \"volume.zfs.remove_snapshots\" property does not apply to LVM drivers.")
+		return fmt.Errorf("the \"volume.zfs.remove_snapshots\" property does not apply to LVM drivers")
 	}
 
 	if shared.StringInSlice("zfs.pool_name", changedConfig) {
-		return fmt.Errorf("The \"zfs.pool_name\" property does not apply to LVM drivers.")
+		return fmt.Errorf("the \"zfs.pool_name\" property does not apply to LVM drivers")
 	}
 
 	// "volume.block.mount_options" requires no on-disk modifications.
@@ -925,18 +924,18 @@ func (s *storageLvm) StoragePoolUpdate(writable *api.StoragePoolPut, changedConf
 	// revert on error.
 	revert := true
 	if shared.StringInSlice("lvm.use_thinpool", changedConfig) {
-		return fmt.Errorf("The \"lvm.use_thinpool\" property cannot be changed.")
+		return fmt.Errorf("the \"lvm.use_thinpool\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("lvm.thinpool_name", changedConfig) {
 		if !s.useThinpool {
-			return fmt.Errorf("The LVM storage pool \"%s\" does not use thin pools. The \"lvm.thinpool_name\" porperty cannot be set.", s.pool.Name)
+			return fmt.Errorf("the LVM storage pool \"%s\" does not use thin pools. The \"lvm.thinpool_name\" porperty cannot be set", s.pool.Name)
 		}
 
 		newThinpoolName := writable.Config["lvm.thinpool_name"]
 		// Paranoia check
 		if newThinpoolName == "" {
-			return fmt.Errorf("Could not rename volume group: No new name provided.")
+			return fmt.Errorf("could not rename volume group: No new name provided")
 		}
 
 		poolName := s.getOnDiskPoolName()
@@ -970,7 +969,7 @@ func (s *storageLvm) StoragePoolUpdate(writable *api.StoragePoolPut, changedConf
 		newName := writable.Config["lvm.vg_name"]
 		// Paranoia check
 		if newName == "" {
-			return fmt.Errorf("Could not rename volume group: No new name provided.")
+			return fmt.Errorf("could not rename volume group: No new name provided")
 		}
 		writable.Config["source"] = newName
 
@@ -1012,7 +1011,7 @@ func (s *storageLvm) StoragePoolVolumeUpdate(changedConfig []string) error {
 	if shared.StringInSlice("block.mount_options", changedConfig) && len(changedConfig) == 1 {
 		// noop
 	} else {
-		return fmt.Errorf("The properties \"%v\" cannot be changed.", changedConfig)
+		return fmt.Errorf("the properties \"%v\" cannot be changed", changedConfig)
 	}
 
 	logger.Infof("Updated LVM storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
@@ -1022,7 +1021,7 @@ func (s *storageLvm) StoragePoolVolumeUpdate(changedConfig []string) error {
 func (s *storageLvm) ContainerStorageReady(name string) bool {
 	containerLvmName := containerNameToLVName(name)
 	poolName := s.getOnDiskPoolName()
-	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeApiEndpointContainers, containerLvmName)
+	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
 	ok, _ := storageLVExists(containerLvmPath)
 	return ok
 }
@@ -1049,7 +1048,7 @@ func (s *storageLvm) ContainerCreate(container container) error {
 		}
 	}
 
-	err = lvmCreateLv(poolName, thinPoolName, containerLvmName, lvFsType, lvSize, storagePoolVolumeApiEndpointContainers, s.useThinpool)
+	err = lvmCreateLv(poolName, thinPoolName, containerLvmName, lvFsType, lvSize, storagePoolVolumeAPIEndpointContainers, s.useThinpool)
 	if err != nil {
 		return err
 	}
@@ -1095,7 +1094,7 @@ func (s *storageLvm) ContainerCreate(container container) error {
 func (s *storageLvm) containerCreateFromImageThinLv(c container, fp string) error {
 	poolName := s.getOnDiskPoolName()
 	// Check if the image already exists.
-	imageLvmDevPath := getLvmDevPath(poolName, storagePoolVolumeApiEndpointImages, fp)
+	imageLvmDevPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointImages, fp)
 
 	imageStoragePoolLockID := getImageCreateLockID(poolName, fp)
 	lxdStorageMapLock.Lock()
@@ -1128,7 +1127,7 @@ func (s *storageLvm) containerCreateFromImageThinLv(c container, fp string) erro
 
 	containerName := c.Name()
 	containerLvmName := containerNameToLVName(containerName)
-	_, err := s.createSnapshotLV(poolName, fp, storagePoolVolumeApiEndpointImages, containerLvmName, storagePoolVolumeApiEndpointContainers, false, s.useThinpool)
+	_, err := s.createSnapshotLV(poolName, fp, storagePoolVolumeAPIEndpointImages, containerLvmName, storagePoolVolumeAPIEndpointContainers, false, s.useThinpool)
 	if err != nil {
 		return err
 	}
@@ -1197,7 +1196,7 @@ func (s *storageLvm) ContainerCreateFromImage(container container, fingerprint s
 	}
 
 	poolName := s.getOnDiskPoolName()
-	containerLvDevPath := getLvmDevPath(poolName, storagePoolVolumeApiEndpointContainers, containerLvmName)
+	containerLvDevPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
 	// Generate a new xfs's UUID
 	lvFsType := s.getLvmFilesystem()
 	if lvFsType == "xfs" {
@@ -1269,7 +1268,7 @@ func (s *storageLvm) ContainerDelete(container container) error {
 	}
 
 	poolName := s.getOnDiskPoolName()
-	err := s.removeLV(poolName, storagePoolVolumeApiEndpointContainers, containerLvmName)
+	err := s.removeLV(poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
 	if err != nil {
 		return err
 	}
@@ -1315,7 +1314,7 @@ func (s *storageLvm) copyContainer(target container, source container) error {
 		return err
 	}
 
-	err = s.setUnprivUserAcl(source, targetContainerMntPoint)
+	err = s.setUnprivUserACL(source, targetContainerMntPoint)
 	if err != nil {
 		return err
 	}
@@ -1374,12 +1373,12 @@ func (s *storageLvm) copyContainerLv(target container, source container, readonl
 	bwlimit := s.pool.Config["rsync.bwlimit"]
 	output, err := rsyncLocalCopy(sourceContainerMntPoint, targetContainerMntPoint, bwlimit)
 	if err != nil {
-		return fmt.Errorf("Failed to rsync container: %s: %s.", string(output), err)
+		return fmt.Errorf("failed to rsync container: %s: %s", string(output), err)
 	}
 
 	if readonly {
 		targetLvmName := containerNameToLVName(targetName)
-		output, err := shared.TryRunCommand("lvchange", "-pr", fmt.Sprintf("%s/%s_%s", poolName, storagePoolVolumeApiEndpointContainers, targetLvmName))
+		output, err := shared.TryRunCommand("lvchange", "-pr", fmt.Sprintf("%s/%s_%s", poolName, storagePoolVolumeAPIEndpointContainers, targetLvmName))
 		if err != nil {
 			logger.Errorf("Failed to make LVM snapshot \"%s\" read-write: %s.", targetName, output)
 			return err
@@ -1437,7 +1436,7 @@ func (s *storageLvm) ContainerCopy(target container, source container, container
 	_, sourcePool := source.Storage().GetContainerPoolInfo()
 	_, targetPool := target.Storage().GetContainerPoolInfo()
 	if sourcePool != targetPool {
-		return fmt.Errorf("Copying containers between different storage pools is not implemented.")
+		return fmt.Errorf("copying containers between different storage pools is not implemented")
 	}
 
 	err = s.copyContainer(target, source)
@@ -1494,7 +1493,7 @@ func (s *storageLvm) ContainerMount(name string, path string) (bool, error) {
 	containerLvmName := containerNameToLVName(name)
 	lvFsType := s.getLvmFilesystem()
 	poolName := s.getOnDiskPoolName()
-	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeApiEndpointContainers, containerLvmName)
+	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
 	mountOptions := s.getLvmBlockMountOptions()
 
 	containerMntPoint := getContainerMountPoint(s.pool.Name, name)
@@ -1598,13 +1597,13 @@ func (s *storageLvm) ContainerRename(container container, newContainerName strin
 		return err
 	}
 
-	err = s.renameLVByPath(oldLvmName, newLvmName, storagePoolVolumeApiEndpointContainers)
+	err = s.renameLVByPath(oldLvmName, newLvmName, storagePoolVolumeAPIEndpointContainers)
 	if err != nil {
 		return fmt.Errorf("Failed to rename a container LV, oldName='%s', newName='%s', err='%s'", oldLvmName, newLvmName, err)
 	}
 	defer func() {
 		if tryUndo {
-			s.renameLVByPath(newLvmName, oldLvmName, storagePoolVolumeApiEndpointContainers)
+			s.renameLVByPath(newLvmName, oldLvmName, storagePoolVolumeAPIEndpointContainers)
 		}
 	}()
 
@@ -1678,7 +1677,7 @@ func (s *storageLvm) ContainerRestore(target container, source container) error
 
 	_, sourcePool := source.Storage().GetContainerPoolInfo()
 	if s.pool.Name != sourcePool {
-		return fmt.Errorf("Containers must be on the same pool to be restored.")
+		return fmt.Errorf("containers must be on the same pool to be restored")
 	}
 
 	sourceName := source.Name()
@@ -1694,12 +1693,12 @@ func (s *storageLvm) ContainerRestore(target container, source container) error
 		}
 
 		poolName := s.getOnDiskPoolName()
-		err = s.removeLV(poolName, storagePoolVolumeApiEndpointContainers, targetLvmName)
+		err = s.removeLV(poolName, storagePoolVolumeAPIEndpointContainers, targetLvmName)
 		if err != nil {
 			logger.Errorf(fmt.Sprintf("Failed to remove \"%s\": %s.", targetLvmName, err))
 		}
 
-		_, err = s.createSnapshotLV(poolName, sourceLvmName, storagePoolVolumeApiEndpointContainers, targetLvmName, storagePoolVolumeApiEndpointContainers, false, true)
+		_, err = s.createSnapshotLV(poolName, sourceLvmName, storagePoolVolumeAPIEndpointContainers, targetLvmName, storagePoolVolumeAPIEndpointContainers, false, true)
 		if err != nil {
 			return fmt.Errorf("Error creating snapshot LV: %v", err)
 		}
@@ -1728,7 +1727,7 @@ func (s *storageLvm) ContainerRestore(target container, source container) error
 		bwlimit := s.pool.Config["rsync.bwlimit"]
 		output, err := rsyncLocalCopy(sourceContainerMntPoint, targetContainerMntPoint, bwlimit)
 		if err != nil {
-			return fmt.Errorf("Failed to rsync container: %s: %s.", string(output), err)
+			return fmt.Errorf("failed to rsync container: %s: %s", string(output), err)
 		}
 	}
 
@@ -1737,11 +1736,11 @@ func (s *storageLvm) ContainerRestore(target container, source container) error
 }
 
 func (s *storageLvm) ContainerSetQuota(container container, size int64) error {
-	return fmt.Errorf("The LVM container backend doesn't support quotas.")
+	return fmt.Errorf("the LVM container backend doesn't support quotas")
 }
 
 func (s *storageLvm) ContainerGetUsage(container container) (int64, error) {
-	return -1, fmt.Errorf("The LVM container backend doesn't support quotas.")
+	return -1, fmt.Errorf("the LVM container backend doesn't support quotas")
 }
 
 func (s *storageLvm) ContainerSnapshotCreate(snapshotContainer container, sourceContainer container) error {
@@ -1766,7 +1765,7 @@ func (s *storageLvm) createSnapshotContainer(snapshotContainer container, source
 	logger.Debugf("Creating snapshot: %s -> %s.", sourceContainerName, targetContainerName)
 
 	poolName := s.getOnDiskPoolName()
-	_, err := s.createSnapshotLV(poolName, sourceContainerLvmName, storagePoolVolumeApiEndpointContainers, targetContainerLvmName, storagePoolVolumeApiEndpointContainers, readonly, s.useThinpool)
+	_, err := s.createSnapshotLV(poolName, sourceContainerLvmName, storagePoolVolumeAPIEndpointContainers, targetContainerLvmName, storagePoolVolumeAPIEndpointContainers, readonly, s.useThinpool)
 	if err != nil {
 		return fmt.Errorf("Error creating snapshot LV: %s", err)
 	}
@@ -1820,13 +1819,13 @@ func (s *storageLvm) ContainerSnapshotRename(snapshotContainer container, newCon
 	oldLvmName := containerNameToLVName(oldName)
 	newLvmName := containerNameToLVName(newContainerName)
 
-	err := s.renameLVByPath(oldLvmName, newLvmName, storagePoolVolumeApiEndpointContainers)
+	err := s.renameLVByPath(oldLvmName, newLvmName, storagePoolVolumeAPIEndpointContainers)
 	if err != nil {
 		return fmt.Errorf("Failed to rename a container LV, oldName='%s', newName='%s', err='%s'", oldLvmName, newLvmName, err)
 	}
 	defer func() {
 		if tryUndo {
-			s.renameLVByPath(newLvmName, oldLvmName, storagePoolVolumeApiEndpointContainers)
+			s.renameLVByPath(newLvmName, oldLvmName, storagePoolVolumeAPIEndpointContainers)
 		}
 	}()
 
@@ -1849,7 +1848,7 @@ func (s *storageLvm) ContainerSnapshotStart(container container) (bool, error) {
 	poolName := s.getOnDiskPoolName()
 	containerName := container.Name()
 	containerLvmName := containerNameToLVName(containerName)
-	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeApiEndpointContainers, containerLvmName)
+	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
 
 	wasWritableAtCheck, err := lvmLvIsWritable(containerLvmPath)
 	if err != nil {
@@ -1857,7 +1856,7 @@ func (s *storageLvm) ContainerSnapshotStart(container container) (bool, error) {
 	}
 
 	if !wasWritableAtCheck {
-		output, err := shared.TryRunCommand("lvchange", "-prw", fmt.Sprintf("%s/%s_%s", poolName, storagePoolVolumeApiEndpointContainers, containerLvmName))
+		output, err := shared.TryRunCommand("lvchange", "-prw", fmt.Sprintf("%s/%s_%s", poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName))
 		if err != nil {
 			logger.Errorf("Failed to make LVM snapshot \"%s\" read-write: %s.", containerName, output)
 			return false, err
@@ -1900,14 +1899,14 @@ func (s *storageLvm) ContainerSnapshotStop(container container) (bool, error) {
 		}
 	}
 
-	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeApiEndpointContainers, containerLvmName)
+	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
 	wasWritableAtCheck, err := lvmLvIsWritable(containerLvmPath)
 	if err != nil {
 		return false, err
 	}
 
 	if wasWritableAtCheck {
-		output, err := shared.TryRunCommand("lvchange", "-pr", fmt.Sprintf("%s/%s_%s", poolName, storagePoolVolumeApiEndpointContainers, containerLvmName))
+		output, err := shared.TryRunCommand("lvchange", "-pr", fmt.Sprintf("%s/%s_%s", poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName))
 		if err != nil {
 			logger.Errorf("Failed to make LVM snapshot read-only: %s.", output)
 			return false, err
@@ -1969,7 +1968,7 @@ func (s *storageLvm) ImageCreate(fingerprint string) error {
 			return err
 		}
 
-		err = lvmCreateLv(poolName, thinPoolName, fingerprint, lvFsType, lvSize, storagePoolVolumeApiEndpointImages, true)
+		err = lvmCreateLv(poolName, thinPoolName, fingerprint, lvFsType, lvSize, storagePoolVolumeAPIEndpointImages, true)
 		if err != nil {
 			logger.Errorf("lvmCreateLv: %s.", err)
 			return fmt.Errorf("Error Creating LVM LV for new image: %v", err)
@@ -2022,7 +2021,7 @@ func (s *storageLvm) ImageDelete(fingerprint string) error {
 		}
 
 		poolName := s.getOnDiskPoolName()
-		err = s.removeLV(poolName, storagePoolVolumeApiEndpointImages, fingerprint)
+		err = s.removeLV(poolName, storagePoolVolumeAPIEndpointImages, fingerprint)
 		if err != nil {
 			return err
 		}
@@ -2056,11 +2055,11 @@ func (s *storageLvm) ImageMount(fingerprint string) (bool, error) {
 	// Shouldn't happen.
 	lvmFstype := s.getLvmFilesystem()
 	if lvmFstype == "" {
-		return false, fmt.Errorf("No filesystem type specified.")
+		return false, fmt.Errorf("no filesystem type specified")
 	}
 
 	poolName := s.getOnDiskPoolName()
-	lvmVolumePath := getLvmDevPath(poolName, storagePoolVolumeApiEndpointImages, fingerprint)
+	lvmVolumePath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointImages, fingerprint)
 	lvmMountOptions := s.getLvmBlockMountOptions()
 	err := tryMount(lvmVolumePath, imageMntPoint, lvmFstype, 0, lvmMountOptions)
 	if err != nil {
diff --git a/lxd/storage_migration.go b/lxd/storage_migration.go
index c8042dc..4f1e095 100644
--- a/lxd/storage_migration.go
+++ b/lxd/storage_migration.go
@@ -9,6 +9,8 @@ import (
 	"github.com/lxc/lxd/shared"
 )
 
+// MigrationStorageSourceDriver defines the functions needed to implement a
+// migration source driver.
 type MigrationStorageSourceDriver interface {
 	/* snapshots for this container, if any */
 	Snapshots() []container
@@ -136,7 +138,7 @@ func rsyncMigrationSink(live bool, container container, snapshots []*Snapshot, c
 
 	// A little neuroticism.
 	if parentStoragePool == "" {
-		return fmt.Errorf("The container's root device is missing the pool property.")
+		return fmt.Errorf("the container's root device is missing the pool property")
 	}
 
 	isDirBackend := container.Storage().GetStorageType() == storageTypeDir
diff --git a/lxd/storage_pools.go b/lxd/storage_pools.go
index 8fcdb24..bbd23f0 100644
--- a/lxd/storage_pools.go
+++ b/lxd/storage_pools.go
@@ -190,7 +190,7 @@ func storagePoolPatch(d *Daemon, r *http.Request) Response {
 
 	err = storagePoolUpdate(d, poolName, req.Config)
 	if err != nil {
-		return InternalError(fmt.Errorf("Failed to update the storage pool configuration."))
+		return InternalError(fmt.Errorf("failed to update the storage pool configuration"))
 	}
 
 	return EmptySyncResponse
@@ -210,7 +210,7 @@ func storagePoolDelete(d *Daemon, r *http.Request) Response {
 	// error out.
 	volumeCount, err := dbStoragePoolVolumesGetNames(d.db, poolID)
 	if volumeCount > 0 {
-		return BadRequest(fmt.Errorf("Storage pool \"%s\" has volumes attached to it.", poolName))
+		return BadRequest(fmt.Errorf("storage pool \"%s\" has volumes attached to it", poolName))
 	}
 
 	// Check if the storage pool is still referenced in any profiles.
diff --git a/lxd/storage_pools_config.go b/lxd/storage_pools_config.go
index 2c97c07..5f12423 100644
--- a/lxd/storage_pools_config.go
+++ b/lxd/storage_pools_config.go
@@ -65,7 +65,7 @@ func storagePoolValidateConfig(name string, driver string, config map[string]str
 	if driver == "lvm" {
 		v, ok := config["lvm.use_thinpool"]
 		if ok && !shared.IsTrue(v) && config["lvm.thinpool_name"] != "" {
-			return fmt.Errorf("The key \"lvm.use_thinpool\" cannot be set to a false value when \"lvm.thinpool_name\" is set for LVM storage pools.")
+			return fmt.Errorf("the key \"lvm.use_thinpool\" cannot be set to a false value when \"lvm.thinpool_name\" is set for LVM storage pools")
 		}
 	}
 
@@ -88,19 +88,19 @@ func storagePoolValidateConfig(name string, driver string, config map[string]str
 		prfx := strings.HasPrefix
 		if driver != "zfs" {
 			if prfx(key, "volume.zfs.") || prfx(key, "zfs.") {
-				return fmt.Errorf("The key %s cannot be used with %s storage pools.", key, strings.ToUpper(driver))
+				return fmt.Errorf("the key %s cannot be used with %s storage pools", key, strings.ToUpper(driver))
 			}
 		}
 
 		if driver != "lvm" {
 			if prfx(key, "lvm.") || prfx(key, "volume.block.") || key == "volume.size" {
-				return fmt.Errorf("The key %s cannot be used with %s storage pools.", key, strings.ToUpper(driver))
+				return fmt.Errorf("the key %s cannot be used with %s storage pools", key, strings.ToUpper(driver))
 			}
 		}
 
 		if driver == "dir" {
 			if key == "size" {
-				return fmt.Errorf("The key %s cannot be used with %s storage pools.", key, strings.ToUpper(driver))
+				return fmt.Errorf("the key %s cannot be used with %s storage pools", key, strings.ToUpper(driver))
 			}
 		}
 
diff --git a/lxd/storage_pools_utils.go b/lxd/storage_pools_utils.go
index 903795f..e43d102 100644
--- a/lxd/storage_pools_utils.go
+++ b/lxd/storage_pools_utils.go
@@ -47,7 +47,7 @@ func storagePoolUpdate(d *Daemon, name string, newConfig map[string]string) erro
 	// Update the storage pool
 	if !userOnly {
 		if shared.StringInSlice("driver", changedConfig) {
-			return fmt.Errorf("The \"driver\" property of a storage pool cannot be changed.")
+			return fmt.Errorf("the \"driver\" property of a storage pool cannot be changed")
 		}
 
 		err = s.StoragePoolUpdate(&newWritable, changedConfig)
@@ -98,23 +98,23 @@ func storagePoolUsedByGet(db *sql.DB, poolID int64, poolName string) ([]string,
 	// Save some allocation cycles by preallocating the correct len.
 	poolUsedBy := make([]string, slicelen)
 	for i := 0; i < len(volumes); i++ {
-		apiEndpoint, _ := storagePoolVolumeTypeNameToApiEndpoint(volumes[i].Type)
+		apiEndpoint, _ := storagePoolVolumeTypeNameToAPIEndpoint(volumes[i].Type)
 		switch apiEndpoint {
-		case storagePoolVolumeApiEndpointContainers:
+		case storagePoolVolumeAPIEndpointContainers:
 			if strings.Index(volumes[i].Name, shared.SnapshotDelimiter) > 0 {
 				fields := strings.SplitN(volumes[i].Name, shared.SnapshotDelimiter, 2)
 				poolUsedBy[i] = fmt.Sprintf("/%s/containers/%s/snapshots/%s", version.APIVersion, fields[0], fields[1])
 			} else {
 				poolUsedBy[i] = fmt.Sprintf("/%s/containers/%s", version.APIVersion, volumes[i].Name)
 			}
-		case storagePoolVolumeApiEndpointImages:
+		case storagePoolVolumeAPIEndpointImages:
 			poolUsedBy[i] = fmt.Sprintf("/%s/images/%s", version.APIVersion, volumes[i].Name)
-		case storagePoolVolumeApiEndpointCustom:
+		case storagePoolVolumeAPIEndpointCustom:
 			// Bug
-			return []string{}, fmt.Errorf("Database function returned volume type \"%s\" although not queried for it.", volumes[i].Type)
+			return []string{}, fmt.Errorf("database function returned volume type \"%s\" although not queried for it", volumes[i].Type)
 		default:
 			// If that happens the db is busted, so report an error.
-			return []string{}, fmt.Errorf("Invalid storage type for storage volume \"%s\".", volumes[i].Name)
+			return []string{}, fmt.Errorf("invalid storage type for storage volume \"%s\"", volumes[i].Name)
 		}
 	}
 
diff --git a/lxd/storage_shared.go b/lxd/storage_shared.go
index 6961e68..d6378e5 100644
--- a/lxd/storage_shared.go
+++ b/lxd/storage_shared.go
@@ -57,10 +57,10 @@ func (s *storageShared) shiftRootfs(c container) error {
 	/* Set an acl so the container root can descend the container dir */
 	// TODO: i changed this so it calls s.setUnprivUserAcl, which does
 	// the acl change only if the container is not privileged, think thats right.
-	return s.setUnprivUserAcl(c, dpath)
+	return s.setUnprivUserACL(c, dpath)
 }
 
-func (s *storageShared) setUnprivUserAcl(c container, destPath string) error {
+func (s *storageShared) setUnprivUserACL(c container, destPath string) error {
 	idmapset, err := c.IdmapSet()
 	if err != nil {
 		return err
diff --git a/lxd/storage_volumes.go b/lxd/storage_volumes.go
index cb2036f..a0d09f9 100644
--- a/lxd/storage_volumes.go
+++ b/lxd/storage_volumes.go
@@ -39,7 +39,7 @@ func storagePoolVolumesGet(d *Daemon, r *http.Request) Response {
 
 	resultString := []string{}
 	for _, volume := range volumes {
-		apiEndpoint, err := storagePoolVolumeTypeNameToApiEndpoint(volume.Type)
+		apiEndpoint, err := storagePoolVolumeTypeNameToAPIEndpoint(volume.Type)
 		if err != nil {
 			return InternalError(err)
 		}
@@ -87,7 +87,7 @@ func storagePoolVolumesTypeGet(d *Daemon, r *http.Request) Response {
 	}
 	// Check that the storage volume type is valid.
 	if !shared.IntInSlice(volumeType, supportedVolumeTypes) {
-		return BadRequest(fmt.Errorf("Invalid storage volume type %s.", volumeTypeName))
+		return BadRequest(fmt.Errorf("invalid storage volume type %s", volumeTypeName))
 	}
 
 	// Retrieve ID of the storage pool (and check if the storage pool
@@ -108,7 +108,7 @@ func storagePoolVolumesTypeGet(d *Daemon, r *http.Request) Response {
 	resultMap := []*api.StorageVolume{}
 	for _, volume := range volumes {
 		if recursion == 0 {
-			apiEndpoint, err := storagePoolVolumeTypeToApiEndpoint(volumeType)
+			apiEndpoint, err := storagePoolVolumeTypeToAPIEndpoint(volumeType)
 			if err != nil {
 				return InternalError(err)
 			}
@@ -155,7 +155,7 @@ func storagePoolVolumesTypePost(d *Daemon, r *http.Request) Response {
 	// Check that the user gave use a storage volume type for the storage
 	// volume we are about to create.
 	if req.Type == "" {
-		return BadRequest(fmt.Errorf("You must provide a storage volume type of the storage volume."))
+		return BadRequest(fmt.Errorf("you must provide a storage volume type of the storage volume"))
 	}
 
 	// Check if the user gave us a valid pool name in which the new storage
@@ -167,7 +167,7 @@ func storagePoolVolumesTypePost(d *Daemon, r *http.Request) Response {
 		return InternalError(err)
 	}
 
-	apiEndpoint, err := storagePoolVolumeTypeNameToApiEndpoint(req.Type)
+	apiEndpoint, err := storagePoolVolumeTypeNameToAPIEndpoint(req.Type)
 	if err != nil {
 		return InternalError(err)
 	}
@@ -197,7 +197,7 @@ func storagePoolVolumeTypeGet(d *Daemon, r *http.Request) Response {
 	}
 	// Check that the storage volume type is valid.
 	if !shared.IntInSlice(volumeType, supportedVolumeTypes) {
-		return BadRequest(fmt.Errorf("Invalid storage volume type %s.", volumeTypeName))
+		return BadRequest(fmt.Errorf("invalid storage volume type %s", volumeTypeName))
 	}
 
 	// Get the ID of the storage pool the storage volume is supposed to be
@@ -243,7 +243,7 @@ func storagePoolVolumeTypePut(d *Daemon, r *http.Request) Response {
 	}
 	// Check that the storage volume type is valid.
 	if !shared.IntInSlice(volumeType, supportedVolumeTypes) {
-		return BadRequest(fmt.Errorf("Invalid storage volume type %s.", volumeTypeName))
+		return BadRequest(fmt.Errorf("invalid storage volume type %s", volumeTypeName))
 	}
 
 	poolID, pool, err := dbStoragePoolGet(d.db, poolName)
@@ -303,7 +303,7 @@ func storagePoolVolumeTypePatch(d *Daemon, r *http.Request) Response {
 	}
 	// Check that the storage volume type is valid.
 	if !shared.IntInSlice(volumeType, supportedVolumeTypes) {
-		return BadRequest(fmt.Errorf("Invalid storage volume type %s.", volumeTypeName))
+		return BadRequest(fmt.Errorf("invalid storage volume type %s", volumeTypeName))
 	}
 
 	// Get the ID of the storage pool the storage volume is supposed to be
@@ -376,7 +376,7 @@ func storagePoolVolumeTypeDelete(d *Daemon, r *http.Request) Response {
 	}
 	// Check that the storage volume type is valid.
 	if !shared.IntInSlice(volumeType, supportedVolumeTypes) {
-		return BadRequest(fmt.Errorf("Invalid storage volume type %s.", volumeTypeName))
+		return BadRequest(fmt.Errorf("invalid storage volume type %s", volumeTypeName))
 	}
 
 	volumeUsedBy, err := storagePoolVolumeUsedByGet(d, volumeName, volumeTypeName)
@@ -385,7 +385,7 @@ func storagePoolVolumeTypeDelete(d *Daemon, r *http.Request) Response {
 	}
 
 	if len(volumeUsedBy) > 0 {
-		return BadRequest(fmt.Errorf("The storage volume is still in use by containers or profiles."))
+		return BadRequest(fmt.Errorf("the storage volume is still in use by containers or profiles"))
 	}
 
 	s, err := storagePoolVolumeInit(d, poolName, volumeName, volumeType)
diff --git a/lxd/storage_volumes_config.go b/lxd/storage_volumes_config.go
index 92d6587..7fab8a7 100644
--- a/lxd/storage_volumes_config.go
+++ b/lxd/storage_volumes_config.go
@@ -45,25 +45,25 @@ func storageVolumeValidateConfig(name string, config map[string]string, parentPo
 
 		if parentPool.Driver != "zfs" || parentPool.Driver == "dir" {
 			if config["zfs.use_refquota"] != "" {
-				return fmt.Errorf("The key volume.zfs.use_refquota cannot be used with non zfs storage volumes.")
+				return fmt.Errorf("the key volume.zfs.use_refquota cannot be used with non zfs storage volumes")
 			}
 
 			if config["zfs.remove_snapshots"] != "" {
-				return fmt.Errorf("The key volume.zfs.remove_snapshots cannot be used with non zfs storage volumes.")
+				return fmt.Errorf("the key volume.zfs.remove_snapshots cannot be used with non zfs storage volumes")
 			}
 		}
 
 		if parentPool.Driver == "dir" {
 			if config["block.mount_options"] != "" {
-				return fmt.Errorf("The key block.mount_options cannot be used with dir storage volumes.")
+				return fmt.Errorf("the key block.mount_options cannot be used with dir storage volumes")
 			}
 
 			if config["block.filesystem"] != "" {
-				return fmt.Errorf("The key block.filesystem cannot be used with dir storage volumes.")
+				return fmt.Errorf("the key block.filesystem cannot be used with dir storage volumes")
 			}
 
 			if config["size"] != "" {
-				return fmt.Errorf("The key size cannot be used with dir storage volumes.")
+				return fmt.Errorf("the key size cannot be used with dir storage volumes")
 			}
 		}
 	}
diff --git a/lxd/storage_volumes_utils.go b/lxd/storage_volumes_utils.go
index 9cebdd8..a216e36 100644
--- a/lxd/storage_volumes_utils.go
+++ b/lxd/storage_volumes_utils.go
@@ -29,9 +29,9 @@ const (
 // typed string constant. Removing it causes go to treat these as untyped string
 // constants which is not what we want.
 const (
-	storagePoolVolumeApiEndpointContainers string = "containers"
-	storagePoolVolumeApiEndpointImages     string = "images"
-	storagePoolVolumeApiEndpointCustom     string = "custom"
+	storagePoolVolumeAPIEndpointContainers string = "containers"
+	storagePoolVolumeAPIEndpointImages     string = "images"
+	storagePoolVolumeAPIEndpointCustom     string = "custom"
 )
 
 var supportedVolumeTypes = []int{storagePoolVolumeTypeContainer, storagePoolVolumeTypeImage, storagePoolVolumeTypeCustom}
@@ -46,20 +46,20 @@ func storagePoolVolumeTypeNameToType(volumeTypeName string) (int, error) {
 		return storagePoolVolumeTypeCustom, nil
 	}
 
-	return -1, fmt.Errorf("Invalid storage volume type name.")
+	return -1, fmt.Errorf("invalid storage volume type name")
 }
 
-func storagePoolVolumeTypeNameToApiEndpoint(volumeTypeName string) (string, error) {
+func storagePoolVolumeTypeNameToAPIEndpoint(volumeTypeName string) (string, error) {
 	switch volumeTypeName {
 	case storagePoolVolumeTypeNameContainer:
-		return storagePoolVolumeApiEndpointContainers, nil
+		return storagePoolVolumeAPIEndpointContainers, nil
 	case storagePoolVolumeTypeNameImage:
-		return storagePoolVolumeApiEndpointImages, nil
+		return storagePoolVolumeAPIEndpointImages, nil
 	case storagePoolVolumeTypeNameCustom:
-		return storagePoolVolumeApiEndpointCustom, nil
+		return storagePoolVolumeAPIEndpointCustom, nil
 	}
 
-	return "", fmt.Errorf("Invalid storage volume type name.")
+	return "", fmt.Errorf("invalid storage volume type name")
 }
 
 func storagePoolVolumeTypeToName(volumeType int) (string, error) {
@@ -72,20 +72,20 @@ func storagePoolVolumeTypeToName(volumeType int) (string, error) {
 		return storagePoolVolumeTypeNameCustom, nil
 	}
 
-	return "", fmt.Errorf("Invalid storage volume type.")
+	return "", fmt.Errorf("invalid storage volume type")
 }
 
-func storagePoolVolumeTypeToApiEndpoint(volumeType int) (string, error) {
+func storagePoolVolumeTypeToAPIEndpoint(volumeType int) (string, error) {
 	switch volumeType {
 	case storagePoolVolumeTypeContainer:
-		return storagePoolVolumeApiEndpointContainers, nil
+		return storagePoolVolumeAPIEndpointContainers, nil
 	case storagePoolVolumeTypeImage:
-		return storagePoolVolumeApiEndpointImages, nil
+		return storagePoolVolumeAPIEndpointImages, nil
 	case storagePoolVolumeTypeCustom:
-		return storagePoolVolumeApiEndpointCustom, nil
+		return storagePoolVolumeAPIEndpointCustom, nil
 	}
 
-	return "", fmt.Errorf("Invalid storage volume type.")
+	return "", fmt.Errorf("invalid storage volume type")
 }
 
 func storagePoolVolumeUpdate(d *Daemon, poolName string, volumeName string, volumeType int, newConfig map[string]string) error {
@@ -278,7 +278,7 @@ func storagePoolVolumeDBCreate(d *Daemon, poolName string, volumeName string, vo
 	// storagePoolVolumeTypeCustom. So check, that nothing else was
 	// requested.
 	if volumeType != storagePoolVolumeTypeCustom {
-		return fmt.Errorf("Currently not allowed to create storage volumes of type %s.", volumeTypeName)
+		return fmt.Errorf("currently not allowed to create storage volumes of type %s", volumeTypeName)
 	}
 
 	// Load storage pool the volume will be attached to.
@@ -291,7 +291,7 @@ func storagePoolVolumeDBCreate(d *Daemon, poolName string, volumeName string, vo
 	// already exist.
 	volumeID, _ := dbStoragePoolVolumeGetTypeID(d.db, volumeName, volumeType, poolID)
 	if volumeID > 0 {
-		return fmt.Errorf("A storage volume of type %s does already exist.", volumeTypeName)
+		return fmt.Errorf("a storage volume of type %s does already exist", volumeTypeName)
 	}
 
 	// Make sure that we don't pass a nil to the next function.
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index bd02bb6..b6552a0 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -49,7 +49,7 @@ func zfsIsEnabled() bool {
 func zfsModuleVersionGet() (string, error) {
 	zfsVersion, err := ioutil.ReadFile("/sys/module/zfs/version")
 	if err != nil {
-		return "", fmt.Errorf("Could not determine ZFS module version.")
+		return "", fmt.Errorf("could not determine ZFS module version")
 	}
 
 	return strings.TrimSpace(string(zfsVersion)), nil
@@ -67,7 +67,7 @@ func (s *storageZfs) StorageCoreInit() error {
 	loadModule("zfs")
 
 	if !zfsIsEnabled() {
-		return fmt.Errorf("The \"zfs\" tool is not enabled.")
+		return fmt.Errorf("the \"zfs\" tool is not enabled")
 	}
 
 	s.sTypeVersion, err = zfsModuleVersionGet()
@@ -99,7 +99,7 @@ func (s *storageZfs) StoragePoolCheck() error {
 
 	source := s.pool.Config["source"]
 	if source == "" {
-		return fmt.Errorf("No \"source\" property found for the storage pool.")
+		return fmt.Errorf("no \"source\" property found for the storage pool")
 	}
 
 	poolName := s.getOnDiskPoolName()
@@ -115,7 +115,7 @@ func (s *storageZfs) StoragePoolCheck() error {
 			"import",
 			"-d", disksPath, poolName)
 		if err != nil {
-			return fmt.Errorf("ZFS storage pool \"%s\" could not be imported: %s.", poolName, output)
+			return fmt.Errorf("ZFS storage pool \"%s\" could not be imported: %s", poolName, output)
 		}
 
 		logger.Debugf("ZFS storage pool \"%s\" successfully imported.", poolName)
@@ -349,35 +349,35 @@ func (s *storageZfs) StoragePoolUpdate(writable *api.StoragePoolPut, changedConf
 	logger.Infof("Updating ZFS storage pool \"%s\".", s.pool.Name)
 
 	if shared.StringInSlice("size", changedConfig) {
-		return fmt.Errorf("The \"size\" property cannot be changed.")
+		return fmt.Errorf("the \"size\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("source", changedConfig) {
-		return fmt.Errorf("The \"source\" property cannot be changed.")
+		return fmt.Errorf("the \"source\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("volume.size", changedConfig) {
-		return fmt.Errorf("The \"volume.size\" property cannot be changed.")
+		return fmt.Errorf("the \"volume.size\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("volume.block.mount_options", changedConfig) {
-		return fmt.Errorf("The \"volume.block.mount_options\" property cannot be changed.")
+		return fmt.Errorf("the \"volume.block.mount_options\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("volume.block.filesystem", changedConfig) {
-		return fmt.Errorf("The \"volume.block.filesystem\" property cannot be changed.")
+		return fmt.Errorf("the \"volume.block.filesystem\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("lvm.thinpool_name", changedConfig) {
-		return fmt.Errorf("The \"lvm.thinpool_name\" property cannot be changed.")
+		return fmt.Errorf("the \"lvm.thinpool_name\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("lvm.vg_name", changedConfig) {
-		return fmt.Errorf("The \"lvm.vg_name\" property cannot be changed.")
+		return fmt.Errorf("the \"lvm.vg_name\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("zfs.pool_name", changedConfig) {
-		return fmt.Errorf("The \"zfs.pool_name\" property cannot be changed.")
+		return fmt.Errorf("the \"zfs.pool_name\" property cannot be changed")
 	}
 
 	// "rsync.bwlimit" requires no on-disk modifications.
@@ -390,15 +390,15 @@ func (s *storageZfs) StoragePoolVolumeUpdate(changedConfig []string) error {
 	logger.Infof("Updating ZFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
 
 	if shared.StringInSlice("block.mount_options", changedConfig) {
-		return fmt.Errorf("The \"block.mount_options\" property cannot be changed.")
+		return fmt.Errorf("the \"block.mount_options\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("block.filesystem", changedConfig) {
-		return fmt.Errorf("The \"block.filesystem\" property cannot be changed.")
+		return fmt.Errorf("the \"block.filesystem\" property cannot be changed")
 	}
 
 	if shared.StringInSlice("size", changedConfig) {
-		return fmt.Errorf("The \"size\" property cannot be changed.")
+		return fmt.Errorf("the \"size\" property cannot be changed")
 	}
 
 	logger.Infof("Updated ZFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
@@ -630,7 +630,7 @@ func (s *storageZfs) ContainerCanRestore(container container, sourceContainer co
 			zfsRemoveSnapshots = s.volume.Config["zfs.remove_snapshots"]
 		}
 		if !shared.IsTrue(zfsRemoveSnapshots) {
-			return fmt.Errorf("ZFS can only restore from the latest snapshot. Delete newer snapshots or copy the snapshot into a new container instead.")
+			return fmt.Errorf("ZFS can only restore from the latest snapshot. Delete newer snapshots or copy the snapshot into a new container instead")
 		}
 
 		return nil
@@ -975,7 +975,7 @@ func (s *storageZfs) ContainerCopy(target container, source container, container
 	_, sourcePool := source.Storage().GetContainerPoolInfo()
 	_, targetPool := target.Storage().GetContainerPoolInfo()
 	if sourcePool != targetPool {
-		return fmt.Errorf("Copying containers between different storage pools is not implemented.")
+		return fmt.Errorf("copying containers between different storage pools is not implemented")
 	}
 
 	snapshots, err := source.Snapshots()
@@ -1726,7 +1726,7 @@ func (s *storageZfs) zfsPoolCreate() error {
 
 		if filepath.IsAbs(vdev) {
 			if !shared.IsBlockdevPath(vdev) {
-				return fmt.Errorf("Custom loop file locations are not supported.")
+				return fmt.Errorf("custom loop file locations are not supported")
 			}
 
 			if s.pool.Config["zfs.pool_name"] == "" {
@@ -1750,7 +1750,7 @@ func (s *storageZfs) zfsPoolCreate() error {
 			}
 		} else {
 			if s.pool.Config["zfs.pool_name"] != "" {
-				return fmt.Errorf("Invalid combination of \"source\" and \"zfs.pool_name\" property.")
+				return fmt.Errorf("invalid combination of \"source\" and \"zfs.pool_name\" property")
 			}
 			s.pool.Config["zfs.pool_name"] = vdev
 			s.dataset = vdev
@@ -2615,7 +2615,7 @@ func (s *storageZfs) MigrationSink(live bool, container container, snapshots []*
 
 	// A little neuroticism.
 	if parentStoragePool == "" {
-		return fmt.Errorf("Detected that the container's root device is missing the pool property during BTRFS migration.")
+		return fmt.Errorf("detected that the container's root device is missing the pool property during BTRFS migration")
 	}
 
 	for _, snap := range snapshots {


More information about the lxc-devel mailing list