我想从命令行编辑LXD配置文件。这是通过lxc profile set
:
lxc profile get <profile> <key>
获取配置文件配置。
lxc profile set <profile> <key> <value>
设置配置文件配置。
预期的格式是<key> <value>
什么?来自的输出lxc show profile
表明是一个虚线结构:
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
但是我get
什么都没做(更不用说-了set
)。我尝试了各种各样的咒语(例如lxc profile get zoneminder name
,,lxc profile get zoneminder lxc.name
...,以获得name
上面的值),但是它们都不返回任何内容。
获取值的基本语法为:
$ lxc profile get default somekey
但是,要获得某些东西,您需要先进行设置。看来您只能设置已知的键值,即那些对lxd有意义的键值:
$ lxc profile set default rubbish 1
error: Bad key: rubbish
$ lxc profile set default limits.cpu 1
...然后您可以检索它:
$ 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
设备看起来很特殊。常规的获取/设置访问配置文件的“ config”子字段,但是您需要使用特殊的命令来操作设备:
$ lxc profile device get default eth0 nictype
bridged
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句