lxc 'unset' can be used to set config key:value

Bug #1669772 reported by Dariush Marsh-Mossadeghi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxd (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Using "$ lxc <entity> unset <entity> <key>"

If a value is passed in after the key the config key will be set with the value passed in.

"$ lxc <entity> unset <entity> <key> <value>" behaves as you would expect "$ lxc <entity> set <entity> <key> <value>" to behave.

The cli parser does not complain about an incorrect number of parameters.

Examples and OS/LXD version info below

ubuntu@FF00:~$ lxc network unset br1 bridge.external_interfaces enp7s0f0
ubuntu@FF00:~$ lxc network show br1
config:
  bridge.external_interfaces: enp7s0f0
  ipv4.address: 172.17.1.2/24
  ipv4.nat: "false"
  ipv6.address: none
name: br1
type: bridge
used_by:
- /1.0/containers/enabled-possum
managed: true

ubuntu@FF00:~$ lxc network unset br1 bridge.external_interfaces garbage
ubuntu@FF00:~$ lxc network show br1
config:
  bridge.external_interfaces: garbage
  ipv4.address: 172.17.1.2/24
  ipv4.nat: "false"
  ipv6.address: none
name: br1
type: bridge
used_by:
- /1.0/containers/enabled-possum
managed: true

ubuntu@FF00:~$ lxc network unset br1 bridge.external_interfaces
ubuntu@FF00:~$ lxc network show br1
config:
  ipv4.address: 172.17.1.2/24
  ipv4.nat: "false"
  ipv6.address: none
name: br1
type: bridge
used_by:
- /1.0/containers/enabled-possum
managed: true

ubuntu@FF00:~$ lxc profile set default limits.memory 10GB
ubuntu@FF00:~$ lxc profile show default
config:
  limits.memory: 10GB
description: Default LXD profile
devices:
  eth0:
    nictype: bridged
    parent: br1
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by:
- /1.0/containers/enabled-possum

ubuntu@FF00:~$ lxc profile unset default limits.memory 5GB
ubuntu@FF00:~$ lxc profile show default
config:
  limits.memory: 5GB
description: Default LXD profile
devices:
  eth0:
    nictype: bridged
    parent: br1
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by:
- /1.0/containers/enabled-possum

ubuntu@FF00:~$ lxc profile unset default limits.memory
ubuntu@FF00:~$ lxc profile show default
config: {}
description: Default LXD profile
devices:
  eth0:
    nictype: bridged
    parent: br1
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: default
used_by:
- /1.0/containers/enabled-possum

ubuntu@FF00:~$ uname -a
Linux FF00 4.4.0-65-generic #86-Ubuntu SMP Thu Feb 23 17:49:58 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

ubuntu@FF00:~$ lsb_release -rd
Description: Ubuntu 16.04.2 LTS
Release: 16.04

ubuntu@FF00:~$ lxc version
2.10.1

ubuntu@FF00:~$ apt list --installed | grep lxd

lxd/xenial,now 2.10.1-0ubuntu1~ubuntu16.04.1~ppa1 amd64 [installed]
lxd-client/xenial,now 2.10.1-0ubuntu1~ubuntu16.04.1~ppa1 amd64 [installed]
lxd-tools/xenial,now 2.10.1-0ubuntu1~ubuntu16.04.1~ppa1 amd64 [installed]

description: updated
Changed in lxd (Ubuntu):
status: New → Fix Committed
importance: Undecided → Low
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lxd - 2.11-0ubuntu1

---------------
lxd (2.11-0ubuntu1) zesty; urgency=medium

  * New upstream release (2.11):
    - New "aliases" field in POST /1.0/images
    - Reworked help messages and "lxc manpage" command (LP: #1544984)
    - New "vlan" nic property for "macvlan" devices
    - doc: Add instructions to grow ZFS loop (LP: #1648995)
    - doc: Improve storage doc
    - global: Use RunCommand everywhere
    - i18n: Refresh templates
    - i18n: Update translations from weblate
    - i18n: Update translation templates
    - lxc: Allow --version to be passed with any command
    - lxc: Make help/usage a bit more consistent
    - lxc: Rework for better manpages
    - lxc/image: Show the alias description
    - lxc/profile: Properly implement "profile unset" (LP: #1669772)
    - lxd/containers: Don't use FindProcess, just pass exec.Cmd
    - lxd/containers: Properly revert memory limits on failure
    - lxd/images: Properly return the alias description
    - lxd/images: Refactor code a bit
    - lxd/migration: Actually unset the storage pool if unavailable
    - lxd/migration: Better handle rsync errors (subprocesses)
    - lxd/migration: Set correct pool property for btrfs
    - lxd/migration: Set correct pool property for zfs
    - lxd/migration: Tweak rsync logging a bit
    - lxd/patches: Call tryMount() if not already mounted
    - lxd/patches: Conditionalize lvrename
    - lxd/patches: Delete image db entry if LV is missing
    - lxd/patches: Detect the logical volume size
    - lxd/patches: Fix incorrect btrfs source properties
    - lxd/patches: Handle mixed-storage upgrade
    - lxd/patches: Use MNT_DETACH for lvm
    - lxd/patches: Use RemoveAll() for lvm snapshots dir
    - lxd/storage/btrfs: Correctly handle loop-backed pools
    - lxd/storage/btrfs: Handle custom subvolume paths
    - lxd/storage/dir: Limit valid pool source paths
    - lxd/storage/lvm: Call {pv,vg}scan
    - lxd/storage/lvm: Dumb down functions from methods to functions
    - lxd/storage: Deal with source not being btrfs
    - lxd/storage: Ensure correct pool for snapshots
    - lxd/storage: Harden the btrfs migration code
    - lxd/storage: Report prepareLoopDev() error directly
    - shared/idmap: Fix various issues
    - tests: Add more dir and btrfs tests
    - tests: Improve lvm part of storage tests
  * Use "lxc manpage" to generate the manpages.
  * Update debian/tests/control to pull in lvm2 and thin-provisioning-tools.
  * Include lxd-benchmark in lxd-tools.

 -- Stéphane Graber <email address hidden> Wed, 08 Mar 2017 16:24:35 -0500

Changed in lxd (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.