diff --git a/lxc/completion.go b/lxc/completion.go index 9bbf707a41ad..f8fc443d7a40 100644 --- a/lxc/completion.go +++ b/lxc/completion.go @@ -1369,10 +1369,8 @@ func (g *cmdGlobal) cmpStoragePoolWithVolume(toComplete string) ([]string, cobra var results []string for _, volume := range volumes { - volName, volType := parseVolume("custom", volume) - if volType == "custom" { - results = append(results, pool+"/"+volName) - } + volName, _ := parseVolume("custom", volume) + results = append(results, pool+"/"+volName) } return results, cobra.ShellCompDirectiveNoFileComp diff --git a/lxc/storage_volume.go b/lxc/storage_volume.go index ed51fd7287b0..8c0aff211a87 100644 --- a/lxc/storage_volume.go +++ b/lxc/storage_volume.go @@ -17,6 +17,7 @@ import ( "gopkg.in/yaml.v2" "github.com/canonical/lxd/client" + storageDrivers "github.com/canonical/lxd/lxd/storage/drivers" "github.com/canonical/lxd/shared" "github.com/canonical/lxd/shared/api" cli "github.com/canonical/lxd/shared/cmd" @@ -177,7 +178,7 @@ func (c *cmdStorageVolumeAttach) command() *cobra.Command { } if len(args) == 1 { - return c.global.cmpStoragePoolVolumes(args[0]) + return c.global.cmpStoragePoolVolumes(args[0], storageDrivers.VolumeTypeCustom) } if len(args) == 2 { @@ -292,7 +293,7 @@ func (c *cmdStorageVolumeAttachProfile) command() *cobra.Command { } if len(args) == 1 { - return c.global.cmpStoragePoolVolumes(args[0]) + return c.global.cmpStoragePoolVolumes(args[0], storageDrivers.VolumeTypeCustom) } if len(args) == 2 { @@ -816,7 +817,7 @@ func (c *cmdStorageVolumeDetach) command() *cobra.Command { } if len(args) == 1 { - return c.global.cmpStoragePoolVolumes(args[0]) + return c.global.cmpStoragePoolVolumes(args[0], storageDrivers.VolumeTypeCustom) } if len(args) == 2 { @@ -919,7 +920,7 @@ func (c *cmdStorageVolumeDetachProfile) command() *cobra.Command { } if len(args) == 1 { - return c.global.cmpStoragePoolVolumes(args[0]) + return c.global.cmpStoragePoolVolumes(args[0], storageDrivers.VolumeTypeCustom) } if len(args) == 2 {