[lxc-devel] [lxd/master] lxd: Rename API endpoints

monstermunchkin on Github lxc-bot at linuxcontainers.org
Wed Sep 12 15:16:04 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 598 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180912/edfe4f74/attachment.bin>
-------------- next part --------------
From 9a857194b40526155ee76058b603741571f88748 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Wed, 12 Sep 2018 17:11:45 +0200
Subject: [PATCH] lxd: Rename API endpoints

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 lxd/api_internal.go          |  2 +-
 lxd/patches.go               | 12 ++++----
 lxd/storage_lvm.go           | 56 ++++++++++++++++++------------------
 lxd/storage_lvm_utils.go     | 10 +++----
 lxd/storage_pools_utils.go   |  4 +--
 lxd/storage_volumes_utils.go | 14 ++++-----
 6 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/lxd/api_internal.go b/lxd/api_internal.go
index 45be457bad..9fc65ab9f6 100644
--- a/lxd/api_internal.go
+++ b/lxd/api_internal.go
@@ -674,7 +674,7 @@ func internalImport(d *Daemon, r *http.Request) Response {
 		case "lvm":
 			ctLvmName := containerNameToLVName(snap.Name)
 			ctLvName := getLVName(poolName,
-				storagePoolVolumeAPIEndpointContainers,
+				storagePoolVolumeAPIEndpointContainer,
 				ctLvmName)
 			exists, err := storageLVExists(ctLvName)
 			if err != nil {
diff --git a/lxd/patches.go b/lxd/patches.go
index 7ae943ed2c..42890492d4 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -1029,8 +1029,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", storagePoolVolumeAPIEndpointContainer, ctLvName)
+		containerLvDevPath := getLvmDevPath(defaultPoolName, storagePoolVolumeAPIEndpointContainer, ctLvName)
 		if !shared.PathExists(containerLvDevPath) {
 			oldLvDevPath := fmt.Sprintf("/dev/%s/%s", defaultPoolName, ctLvName)
 			// If the old LVM device path for the logical volume
@@ -1185,8 +1185,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", storagePoolVolumeAPIEndpointContainer, csLvName)
+			snapshotLvDevPath := getLvmDevPath(defaultPoolName, storagePoolVolumeAPIEndpointContainer, csLvName)
 			if !shared.PathExists(snapshotLvDevPath) {
 				oldLvDevPath := fmt.Sprintf("/dev/%s/%s", defaultPoolName, csLvName)
 				if shared.PathExists(oldLvDevPath) {
@@ -1365,8 +1365,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", storagePoolVolumeAPIEndpointImage, img)
+		imageLvDevPath := getLvmDevPath(defaultPoolName, storagePoolVolumeAPIEndpointImage, 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
diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index a52f821780..d21b0608b8 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -859,7 +859,7 @@ func (s *storageLvm) StoragePoolVolumeRename(newName string) error {
 func (s *storageLvm) ContainerStorageReady(name string) bool {
 	containerLvmName := containerNameToLVName(name)
 	poolName := s.getOnDiskPoolName()
-	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
+	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainer, containerLvmName)
 	ok, _ := storageLVExists(containerLvmPath)
 	return ok
 }
@@ -886,7 +886,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, storagePoolVolumeAPIEndpointContainer, s.useThinpool)
 	if err != nil {
 		return err
 	}
@@ -965,7 +965,7 @@ func (s *storageLvm) ContainerCreateFromImage(container container, fingerprint s
 	}
 
 	poolName := s.getOnDiskPoolName()
-	containerLvDevPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
+	containerLvDevPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainer, containerLvmName)
 	// Generate a new xfs's UUID
 	lvFsType := s.getLvmFilesystem()
 	msg, err := fsGenerateNewUUID(lvFsType, containerLvDevPath)
@@ -1032,11 +1032,11 @@ func lvmContainerDeleteInternal(poolName string, ctName string, isSnapshot bool,
 	}
 
 	containerLvmDevPath := getLvmDevPath(vgName,
-		storagePoolVolumeAPIEndpointContainers, containerLvmName)
+		storagePoolVolumeAPIEndpointContainer, containerLvmName)
 
 	lvExists, _ := storageLVExists(containerLvmDevPath)
 	if lvExists {
-		err := removeLV(vgName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
+		err := removeLV(vgName, storagePoolVolumeAPIEndpointContainer, containerLvmName)
 		if err != nil {
 			return err
 		}
@@ -1167,7 +1167,7 @@ func (s *storageLvm) doContainerMount(name string) (bool, error) {
 	containerLvmName := containerNameToLVName(name)
 	lvFsType := s.getLvmFilesystem()
 	poolName := s.getOnDiskPoolName()
-	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
+	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainer, containerLvmName)
 	containerMntPoint := getContainerMountPoint(s.pool.Name, name)
 	if shared.IsSnapshot(name) {
 		containerMntPoint = getSnapshotMountPoint(s.pool.Name, name)
@@ -1270,13 +1270,13 @@ func (s *storageLvm) ContainerRename(container container, newContainerName strin
 		return err
 	}
 
-	err = s.renameLVByPath(oldLvmName, newLvmName, storagePoolVolumeAPIEndpointContainers)
+	err = s.renameLVByPath(oldLvmName, newLvmName, storagePoolVolumeAPIEndpointContainer)
 	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, storagePoolVolumeAPIEndpointContainer)
 		}
 	}()
 
@@ -1368,15 +1368,15 @@ func (s *storageLvm) ContainerRestore(target container, source container) error
 		poolName := s.getOnDiskPoolName()
 
 		err = removeLV(poolName,
-			storagePoolVolumeAPIEndpointContainers, targetLvmName)
+			storagePoolVolumeAPIEndpointContainer, targetLvmName)
 		if err != nil {
 			logger.Errorf("Failed to remove \"%s\": %s",
 				targetLvmName, err)
 		}
 
 		_, err = s.createSnapshotLV(poolName, sourceLvmName,
-			storagePoolVolumeAPIEndpointContainers, targetLvmName,
-			storagePoolVolumeAPIEndpointContainers, false, true)
+			storagePoolVolumeAPIEndpointContainer, targetLvmName,
+			storagePoolVolumeAPIEndpointContainer, false, true)
 		if err != nil {
 			return fmt.Errorf("Error creating snapshot LV: %v", err)
 		}
@@ -1455,13 +1455,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, storagePoolVolumeAPIEndpointContainer)
 	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, storagePoolVolumeAPIEndpointContainer)
 		}
 	}()
 
@@ -1484,7 +1484,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, storagePoolVolumeAPIEndpointContainer, containerLvmName)
 
 	wasWritableAtCheck, err := lvmLvIsWritable(containerLvmPath)
 	if err != nil {
@@ -1492,7 +1492,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, storagePoolVolumeAPIEndpointContainer, containerLvmName))
 		if err != nil {
 			logger.Errorf("Failed to make LVM snapshot \"%s\" read-write: %s", containerName, output)
 			return false, err
@@ -1544,14 +1544,14 @@ func (s *storageLvm) ContainerSnapshotStop(container container) (bool, error) {
 		}
 	}
 
-	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainers, containerLvmName)
+	containerLvmPath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainer, 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, storagePoolVolumeAPIEndpointContainer, containerLvmName))
 		if err != nil {
 			logger.Errorf("Failed to make LVM snapshot read-only: %s", output)
 			return false, err
@@ -1656,12 +1656,12 @@ func (s *storageLvm) ContainerBackupCreate(backup backup, source container) erro
 	defer os.RemoveAll(tmpContainerMntPoint)
 
 	_, err = s.createSnapshotLV(s.pool.Name, source.Name(),
-		storagePoolVolumeAPIEndpointContainers, containerNameToLVName(sourceLvmDatasetSnapshot),
-		storagePoolVolumeAPIEndpointContainers, false, s.useThinpool)
+		storagePoolVolumeAPIEndpointContainer, containerNameToLVName(sourceLvmDatasetSnapshot),
+		storagePoolVolumeAPIEndpointContainer, false, s.useThinpool)
 	if err != nil {
 		return err
 	}
-	defer removeLV(s.pool.Name, storagePoolVolumeAPIEndpointContainers,
+	defer removeLV(s.pool.Name, storagePoolVolumeAPIEndpointContainer,
 		containerNameToLVName(sourceLvmDatasetSnapshot))
 
 	// Mount the temporary snapshot
@@ -1762,11 +1762,11 @@ func (s *storageLvm) doContainerBackupLoad(containerName string, privileged bool
 
 	if !snapshot {
 		err = lvmCreateLv(poolName, thinPoolName, containerLvmName, lvFsType, lvSize,
-			storagePoolVolumeAPIEndpointContainers, s.useThinpool)
+			storagePoolVolumeAPIEndpointContainer, s.useThinpool)
 	} else {
 		cname, _, _ := containerGetParentAndSnapshotName(containerName)
-		_, err = s.createSnapshotLV(poolName, cname, storagePoolVolumeAPIEndpointContainers,
-			containerLvmName, storagePoolVolumeAPIEndpointContainers, false, s.useThinpool)
+		_, err = s.createSnapshotLV(poolName, cname, storagePoolVolumeAPIEndpointContainer,
+			containerLvmName, storagePoolVolumeAPIEndpointContainer, false, s.useThinpool)
 	}
 	if err != nil {
 		return "", err
@@ -1848,7 +1848,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, storagePoolVolumeAPIEndpointImage, true)
 		if err != nil {
 			return fmt.Errorf("Error Creating LVM LV for new image: %v", err)
 		}
@@ -1896,7 +1896,7 @@ func (s *storageLvm) ImageDelete(fingerprint string) error {
 	if s.useThinpool {
 		poolName := s.getOnDiskPoolName()
 		imageLvmDevPath := getLvmDevPath(poolName,
-			storagePoolVolumeAPIEndpointImages, fingerprint)
+			storagePoolVolumeAPIEndpointImage, fingerprint)
 		lvExists, _ := storageLVExists(imageLvmDevPath)
 
 		if lvExists {
@@ -1905,7 +1905,7 @@ func (s *storageLvm) ImageDelete(fingerprint string) error {
 				return err
 			}
 
-			err = removeLV(poolName, storagePoolVolumeAPIEndpointImages, fingerprint)
+			err = removeLV(poolName, storagePoolVolumeAPIEndpointImage, fingerprint)
 			if err != nil {
 				return err
 			}
@@ -1944,7 +1944,7 @@ func (s *storageLvm) ImageMount(fingerprint string) (bool, error) {
 	}
 
 	poolName := s.getOnDiskPoolName()
-	lvmVolumePath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointImages, fingerprint)
+	lvmVolumePath := getLvmDevPath(poolName, storagePoolVolumeAPIEndpointImage, fingerprint)
 	mountFlags, mountOptions := lxdResolveMountoptions(s.getLvmMountOptions())
 	err := tryMount(lvmVolumePath, imageMntPoint, lvmFstype, mountFlags, mountOptions)
 	if err != nil {
@@ -2014,7 +2014,7 @@ func (s *storageLvm) StorageEntitySetQuota(volumeType int, size int64, data inte
 		}
 
 		ctLvmName := containerNameToLVName(ctName)
-		lvDevPath = getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainers, ctLvmName)
+		lvDevPath = getLvmDevPath(poolName, storagePoolVolumeAPIEndpointContainer, ctLvmName)
 		mountpoint = getContainerMountPoint(s.pool.Name, ctName)
 	default:
 		lvDevPath = getLvmDevPath(poolName, storagePoolVolumeAPIEndpointCustom, s.volume.Name)
diff --git a/lxd/storage_lvm_utils.go b/lxd/storage_lvm_utils.go
index f685279521..19e7e576ea 100644
--- a/lxd/storage_lvm_utils.go
+++ b/lxd/storage_lvm_utils.go
@@ -249,7 +249,7 @@ func (s *storageLvm) createSnapshotContainer(snapshotContainer container, source
 	logger.Debugf("Creating snapshot: %s to %s", sourceContainerName, targetContainerName)
 
 	poolName := s.getOnDiskPoolName()
-	_, err := s.createSnapshotLV(poolName, sourceContainerLvmName, storagePoolVolumeAPIEndpointContainers, targetContainerLvmName, storagePoolVolumeAPIEndpointContainers, readonly, s.useThinpool)
+	_, err := s.createSnapshotLV(poolName, sourceContainerLvmName, storagePoolVolumeAPIEndpointContainer, targetContainerLvmName, storagePoolVolumeAPIEndpointContainer, readonly, s.useThinpool)
 	if err != nil {
 		return fmt.Errorf("Error creating snapshot LV: %s", err)
 	}
@@ -299,7 +299,7 @@ func (s *storageLvm) copyContainerThinpool(target container, source container, r
 	containerName := target.Name()
 	containerLvmName := containerNameToLVName(containerName)
 	containerLvDevPath := getLvmDevPath(poolName,
-		storagePoolVolumeAPIEndpointContainers, containerLvmName)
+		storagePoolVolumeAPIEndpointContainer, containerLvmName)
 
 	// If btrfstune sees two btrfs filesystems with the same UUID it
 	// gets confused and wants both of them unmounted. So unmount
@@ -408,7 +408,7 @@ func (s *storageLvm) copyContainerLv(target container, source container, readonl
 	if readonly {
 		targetLvmName := containerNameToLVName(targetName)
 		poolName := s.getOnDiskPoolName()
-		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, storagePoolVolumeAPIEndpointContainer, targetLvmName))
 		if err != nil {
 			logger.Errorf("Failed to make LVM snapshot \"%s\" read-write: %s", targetName, output)
 			return err
@@ -497,7 +497,7 @@ func (s *storageLvm) containerCreateFromImageLv(c container, fp string) 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, storagePoolVolumeAPIEndpointImage, fp)
 
 	imageStoragePoolLockID := getImageCreateLockID(poolName, fp)
 	lxdStorageMapLock.Lock()
@@ -545,7 +545,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, storagePoolVolumeAPIEndpointImage, containerLvmName, storagePoolVolumeAPIEndpointContainer, false, s.useThinpool)
 	if err != nil {
 		return err
 	}
diff --git a/lxd/storage_pools_utils.go b/lxd/storage_pools_utils.go
index f06a59a1ac..b68873415a 100644
--- a/lxd/storage_pools_utils.go
+++ b/lxd/storage_pools_utils.go
@@ -108,14 +108,14 @@ func storagePoolUsedByGet(state *state.State, poolID int64, poolName string) ([]
 	for i := 0; i < len(volumes); i++ {
 		apiEndpoint, _ := storagePoolVolumeTypeNameToAPIEndpoint(volumes[i].Type)
 		switch apiEndpoint {
-		case storagePoolVolumeAPIEndpointContainers:
+		case storagePoolVolumeAPIEndpointContainer:
 			if strings.Index(volumes[i].Name, shared.SnapshotDelimiter) > 0 {
 				parentName, snapOnlyName, _ := containerGetParentAndSnapshotName(volumes[i].Name)
 				poolUsedBy[i] = fmt.Sprintf("/%s/containers/%s/snapshots/%s", version.APIVersion, parentName, snapOnlyName)
 			} else {
 				poolUsedBy[i] = fmt.Sprintf("/%s/containers/%s", version.APIVersion, volumes[i].Name)
 			}
-		case storagePoolVolumeAPIEndpointImages:
+		case storagePoolVolumeAPIEndpointImage:
 			poolUsedBy[i] = fmt.Sprintf("/%s/images/%s", version.APIVersion, volumes[i].Name)
 		case storagePoolVolumeAPIEndpointCustom:
 			poolUsedBy[i] = fmt.Sprintf("/%s/storage-pools/%s/volumes/%s/%s", version.APIVersion, poolName, volumes[i].Type, volumes[i].Name)
diff --git a/lxd/storage_volumes_utils.go b/lxd/storage_volumes_utils.go
index 931b49a8b6..597e967ec7 100644
--- a/lxd/storage_volumes_utils.go
+++ b/lxd/storage_volumes_utils.go
@@ -30,9 +30,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"
+	storagePoolVolumeAPIEndpointContainer string = "container"
+	storagePoolVolumeAPIEndpointImage     string = "image"
+	storagePoolVolumeAPIEndpointCustom    string = "custom"
 )
 
 var supportedVolumeTypes = []int{storagePoolVolumeTypeContainer, storagePoolVolumeTypeImage, storagePoolVolumeTypeCustom}
@@ -53,9 +53,9 @@ func storagePoolVolumeTypeNameToType(volumeTypeName string) (int, error) {
 func storagePoolVolumeTypeNameToAPIEndpoint(volumeTypeName string) (string, error) {
 	switch volumeTypeName {
 	case storagePoolVolumeTypeNameContainer:
-		return storagePoolVolumeAPIEndpointContainers, nil
+		return storagePoolVolumeAPIEndpointContainer, nil
 	case storagePoolVolumeTypeNameImage:
-		return storagePoolVolumeAPIEndpointImages, nil
+		return storagePoolVolumeAPIEndpointImage, nil
 	case storagePoolVolumeTypeNameCustom:
 		return storagePoolVolumeAPIEndpointCustom, nil
 	}
@@ -70,9 +70,9 @@ func storagePoolVolumeTypeToName(volumeType int) (string, error) {
 func storagePoolVolumeTypeToAPIEndpoint(volumeType int) (string, error) {
 	switch volumeType {
 	case storagePoolVolumeTypeContainer:
-		return storagePoolVolumeAPIEndpointContainers, nil
+		return storagePoolVolumeAPIEndpointContainer, nil
 	case storagePoolVolumeTypeImage:
-		return storagePoolVolumeAPIEndpointImages, nil
+		return storagePoolVolumeAPIEndpointImage, nil
 	case storagePoolVolumeTypeCustom:
 		return storagePoolVolumeAPIEndpointCustom, nil
 	}


More information about the lxc-devel mailing list