0

我正在尝试为 LXC 创建一个新的配置文件。

我这样做了;

root@nagri:/home/nagri# curl -s -k --cert ~/.config/lxc/client.crt --key ~/.config/lxc/client.key -X POST -d '{
    "name": "testing",
    "description": "Some description string",
    "config": {
        "limits.memory": "2GB"
    },
    "devices": {
        "kvm": {
            "type": "unix-char",
            "path": "/dev/kvm"
        }
    }
}' https://localhost:8443/1.0/profiles/testing | jq .
{
  "type": "sync",
  "status": "Success",
  "status_code": 200,
  "metadata": null
}

输出是成功的,但profile实际上没有被创建。

root@nagri:/home/nagri# curl -s --unix-socket /var/lib/lxd/unix.socket a/1.0/profiles -X GET | jq
{
  "type": "sync",
  "status": "Success",
  "status_code": 200,
  "metadata": [
    "/1.0/profiles/docker",
    "/1.0/profiles/lxd-nginx"
  ]
}

日志也不显示任何错误或警告。 /var/log/lxd/lxd.log

t=2016-09-07T16:22:18+0530 lvl=info msg=handling ip=127.0.0.1:49796 method=POST url=/1.0/profiles/testing

我犯了什么罪?请帮忙。

4

1 回答 1

0

你这个愚蠢的愚蠢的人。正确阅读文档

显然,使用POST您所能做的就是更改配置文件的名称。要更新配置文件,您必须使用PUT

testing首先创建一个名为的空配置文件

$ lxc profile create testing

这将创建一个空的配置文件测试。

继续这样做;

$ curl -s -k --cert ~/.config/lxc/client.crt --key ~/.config/lxc/client.key -X PUT -d '{
"name": "testing",
"description": "Some description string",
"config": {
    "limits.memory": "2GB"
},
"devices": {
    "kvm": {
        "type": "unix-char",
        "path": "/dev/kvm"
    }
}
  }' https://localhost:8443/1.0/profiles/testing | jq .

这将更新您的个人资料。

享受。

于 2016-09-07T12:24:23.550 回答