[lxc-devel] [lxd/master] lxc/storage: Fix bad argument parsing
stgraber on Github
lxc-bot at linuxcontainers.org
Tue Jul 31 04:30:51 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180731/6329ec20/attachment.bin>
-------------- next part --------------
From a257ff6ba2639ef8b54c5b8292c8c387492ae2c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 31 Jul 2018 00:28:20 -0400
Subject: [PATCH] lxc/storage: Fix bad argument parsing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #4855
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxc/storage.go | 2 +-
lxc/storage_volume.go | 2 +-
test/suites/storage.sh | 7 +++++++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lxc/storage.go b/lxc/storage.go
index 96e894a48..d958c0b78 100644
--- a/lxc/storage.go
+++ b/lxc/storage.go
@@ -360,7 +360,7 @@ func (c *cmdStorageGet) Run(cmd *cobra.Command, args []string) error {
}
for k, v := range resp.Config {
- if k == args[0] {
+ if k == args[1] {
fmt.Printf("%s\n", v)
}
}
diff --git a/lxc/storage_volume.go b/lxc/storage_volume.go
index a70012c3f..872be04b2 100644
--- a/lxc/storage_volume.go
+++ b/lxc/storage_volume.go
@@ -881,7 +881,7 @@ func (c *cmdStorageVolumeGet) Run(cmd *cobra.Command, args []string) error {
}
for k, v := range resp.Config {
- if k == args[1] {
+ if k == args[2] {
fmt.Printf("%s\n", v)
}
}
diff --git a/test/suites/storage.sh b/test/suites/storage.sh
index 5c42297c4..73f3d6c4d 100644
--- a/test/suites/storage.sh
+++ b/test/suites/storage.sh
@@ -27,6 +27,13 @@ test_storage() {
lxc storage volume show "$storage_pool" "$storage_volume" | grep -q 'description: bar'
lxc storage volume delete "$storage_pool" "$storage_volume"
+ # Validate get/set
+ lxc storage set "$storage_pool" user.abc def
+ [ "$(lxc storage get "$storage_pool" user.abc)" = "def" ]
+
+ lxc storage volume set "$storage_pool" "$storage_volume" user.abc def
+ [ "$(lxc storage volume get "$storage_pool" "$storage_volume" user.abc)" = "def" ]
+
lxc storage delete "$storage_pool"
# Test btrfs resize
More information about the lxc-devel
mailing list