<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,<br>
      I want to reconfigure an already created lxd-container (named
      'baab') with <br>
      the RestAPI. I searched and read on [1] and [2], but can't figure
      it out. Can <br>
      anyone tell me, whats wrong here. What is the difference between
      "config"<br>
      and "expanded_config" (is the first one from the profile and the
      second "an <br>
      overwrite"?). I attached a "<tt>GET lxd/1.0/containers/baab"</tt>
      as [3].<br>
      Thank you for any hint. Here is my unsuccessful attempt:<br>
    </p>
    <p><br>
      <tt><b>    jq .metadata <<< $(   curl -s --unix-socket
          /var/lib/lxd/unix.socket -X PUT -d '{"expanded_config":
          {"limits.cpu": "4"}}' lxd/1.0/containers/baab  )<br>
        </b><br>
            {<br>
              "id": "ee4e3187-332e-44ff-b88f-531c243b4108",<br>
              "class": "task",<br>
              "created_at": "2019-03-03T16:32:38.036308794+01:00",<br>
              "updated_at": "2019-03-03T16:32:38.036308794+01:00",<br>
              "status": "Running",<br>
              "status_code": 103,<br>
              "resources": {<br>
                "containers": [<br>
                  "/1.0/containers/baab"<br>
                ]<br>
              },<br>
              "metadata": null,<br>
              "may_cancel": false,<br>
              "err": ""<br>
            }<br>
        <br>
      </tt><br>
      <tt>kind regards,<br>
        Ingo Baab<br>
        <br>
        ____________</tt></p>
    <p><tt>[1]
        <a class="moz-txt-link-freetext" href="https://stgraber.org/2016/04/18/lxd-api-direct-interaction/">https://stgraber.org/2016/04/18/lxd-api-direct-interaction/</a><br>
        [2] <a class="moz-txt-link-freetext" href="https://lxd.readthedocs.io/en/latest/rest-api/">https://lxd.readthedocs.io/en/latest/rest-api/</a><br>
      </tt></p>
    <p><tt>[3]</tt> <tt>jq .metadata <<< $(   curl -s
        --unix-socket /var/lib/lxd/unix.socket -X GET
        lxd/1.0/containers/baab  )</tt><tt><br>
      </tt><tt>{</tt><br>
      <tt>  "architecture": "x86_64",</tt><br>
      <tt>  "config": {</tt><br>
      <tt>    "boot.autostart": "true",</tt><br>
      <tt>    "image.architecture": "amd64",</tt><br>
      <tt>    "image.description": "ubuntu 16.04 LTS amd64 (release)
        (20180306)",</tt><br>
      <tt>    "image.label": "release",</tt><br>
      <tt>    "image.os": "ubuntu",</tt><br>
      <tt>    "image.release": "xenial",</tt><br>
      <tt>    "image.serial": "20180306",</tt><br>
      <tt>    "image.version": "16.04",</tt><br>
      <tt>    "raw.apparmor": "mount,",</tt><br>
      <tt>    "volatile.base_image":
        "c5bbef7f4e1c19f0104fd49b862b2e549095d894765c75c6d72775f1d98185ec",</tt><br>
      <tt>    "volatile.eth0.hwaddr": "00:16:3e:5b:cb:d8",</tt><br>
      <tt>    "volatile.idmap.base": "0",</tt><br>
      <tt>    "volatile.idmap.next":
"[{\"Isuid\":true,\"Isgid\":false,\"Hostid\":100000,\"Nsid\":0,\"Maprange\":65536},{\"Isuid\":false,\"Isgid\":true,\"Hostid\":100000,\"Nsid\":0,\"Maprange\":65536}]",</tt><br>
      <tt>    "volatile.last_state.idmap":
"[{\"Isuid\":true,\"Isgid\":false,\"Hostid\":100000,\"Nsid\":0,\"Maprange\":65536},{\"Isuid\":false,\"Isgid\":true,\"Hostid\":100000,\"Nsid\":0,\"Maprange\":65536}]",</tt><br>
      <tt>    "volatile.last_state.power": "RUNNING"</tt><br>
      <tt>  },</tt><br>
      <tt>  "devices": {</tt><br>
      <tt>    "system": {</tt><br>
      <tt>      "path": "/var/www/system",</tt><br>
      <tt>      "source": "/root/system",</tt><br>
      <tt>      "type": "disk"</tt><br>
      <tt>    }</tt><br>
      <tt>  },</tt><br>
      <tt>  "ephemeral": false,</tt><br>
      <tt>  "profiles": [</tt><br>
      <tt>    "default"</tt><br>
      <tt>  ],</tt><br>
      <tt>  "stateful": false,</tt><br>
      <tt>  "description": "",</tt><br>
      <tt>  "created_at": "2019-02-22T14:51:50Z",</tt><br>
      <tt>  "expanded_config": {</tt><br>
      <tt>    "boot.autostart": "true",</tt><br>
      <tt>    "environment.http_proxy": "",</tt><br>
      <tt>    "image.architecture": "amd64",</tt><br>
      <tt>    "image.description": "ubuntu 16.04 LTS amd64 (release)
        (20180306)",</tt><br>
      <tt>    "image.label": "release",</tt><br>
      <tt>    "image.os": "ubuntu",</tt><br>
      <tt>    "image.release": "xenial",</tt><br>
      <tt>    "image.serial": "20180306",</tt><br>
      <tt>    "image.version": "16.04",</tt><br>
      <tt>    "limits.cpu": "3",</tt><br>
      <tt>    "limits.cpu.allowance": "10%",</tt><br>
      <tt>    "limits.cpu.priority": "0",</tt><br>
      <tt>    "limits.memory": "4GB",</tt><br>
      <tt>    "raw.apparmor": "mount,",</tt><br>
      <tt>    "user.network_mode": "",</tt><br>
      <tt>    "volatile.base_image":
        "c5bbef7f4e1c19f0104fd49b862b2e549095d894765c75c6d72775f1d98185ec",</tt><br>
      <tt>    "volatile.eth0.hwaddr": "00:16:3e:5b:cb:d8",</tt><br>
      <tt>    "volatile.idmap.base": "0",</tt><br>
      <tt>    "volatile.idmap.next":
"[{\"Isuid\":true,\"Isgid\":false,\"Hostid\":100000,\"Nsid\":0,\"Maprange\":65536},{\"Isuid\":false,\"Isgid\":true,\"Hostid\":100000,\"Nsid\":0,\"Maprange\":65536}]",</tt><br>
      <tt>    "volatile.last_state.idmap":
"[{\"Isuid\":true,\"Isgid\":false,\"Hostid\":100000,\"Nsid\":0,\"Maprange\":65536},{\"Isuid\":false,\"Isgid\":true,\"Hostid\":100000,\"Nsid\":0,\"Maprange\":65536}]",</tt><br>
      <tt>    "volatile.last_state.power": "RUNNING"</tt><br>
      <tt>  },</tt><br>
      <tt>  "expanded_devices": {</tt><br>
      <tt>    "eth0": {</tt><br>
      <tt>      "name": "eth0",</tt><br>
      <tt>      "nictype": "bridged",</tt><br>
      <tt>      "parent": "lxdbr0",</tt><br>
      <tt>      "type": "nic"</tt><br>
      <tt>    },</tt><br>
      <tt>    "root": {</tt><br>
      <tt>      "path": "/",</tt><br>
      <tt>      "pool": "lxd",</tt><br>
      <tt>      "size": "120GB",</tt><br>
      <tt>      "type": "disk"</tt><br>
      <tt>    },</tt><br>
      <tt>    "system": {</tt><br>
      <tt>      "path": "/var/www/system",</tt><br>
      <tt>      "source": "/root/system",</tt><br>
      <tt>      "type": "disk"</tt><br>
      <tt>    }</tt><br>
      <tt>  },</tt><br>
      <tt>  "name": "baab",</tt><br>
      <tt>  "status": "Running",</tt><br>
      <tt>  "status_code": 103,</tt><br>
      <tt>  "last_used_at": "2019-02-22T14:57:25.577377793Z"</tt><br>
      <tt>}</tt><br>
      <br>
    </p>
  </body>
</html>