How to use lxc profile set?
The basic syntax to get values is:
$ lxc profile get default somekey
However, to get something, you need to set it first. It appears you can only set known key values, i.e. those that actively mean something to lxd:
$ lxc profile set default rubbish 1
error: Bad key: rubbish
$ lxc profile set default limits.cpu 1
... and then you can retrieve it:
$ lxc profile get default limits.cpu
1
$ lxc profile show default
name: default
config:
limits.cpu: "1"
description: Default LXD profile
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr0
type: nic
Devices appear to be special; the regular get/set access the "config" sub-field of the profile, but you need to use special commands to manipulate devices:
$ lxc profile device get default eth0 nictype
bridged
Related videos on Youtube
WoJ
Updated on September 18, 2022Comments
-
WoJ over 1 year
I would like to edit LXD profiles from the command line. This is done by
lxc profile set
:lxc profile get <profile> <key>
Get profile configuration.lxc profile set <profile> <key> <value>
Set profile configuration.What is the expected format of the
<key> <value>
? The output fromlxc show profile
suggests a dotted structure:root@ubuntu ~# lxc profile show zoneminder name: zoneminder config: raw.lxc: lxc.aa_allow_incomplete=1 description: "" devices: eth0: name: eth0 nictype: bridged parent: zoneminder0 type: nic
but I did not manage to
get
anything (not to mention -set
). I tried various incantations (as an examplelxc profile get zoneminder name
,lxc profile get zoneminder lxc.name
, ... to get the value ofname
above) but they all return nothing. -
lepe about 5 yearsAnother example, to change default pool:
lxc profile device set default root pool newpool