root disk flavor constraints not applied to nova-lxd instances when config-drive is used
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nova-lxd |
Triaged
|
Low
|
Unassigned | ||
lxd (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
During the deployment of openstack with lxd as a hypervisor, using nova-lxd, I came to the issue below.
After the container is created, I tried to set the size of the root filesystem and got error in response:
$ lxc config device set instance-00000004 root size 6GB
error: The device doesn't exist
I have confirmed that it works the same if I create a standalone container with a profile:
trochej@
name: zfs-lxd
config:
security.nesting: "True"
description: ""
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr0
type: nic
root:
path: /
size: 6GB
type: disk
I've had a short discussion with Stephane Graber about it and it seems that after creating the profile and applying it to container being created, the root device is owned by profile, not by container. This scenario needs second step, adding root device to the container itself:
lxc config device add instance-00000004 root disk path=/ size=6GB
nova-lxd in version deployed by me seems to set this parameter in this line:
https:/
It is, in turn, called in create_profile:
https:/
I have repro available if you need any more data.
# Steps to reproduce:
1. Deploy openstack with nova-lxd backend. I only tried it with ZFS, so no idea if btrfs or directories will have this issue, too.
2. Create a container.
3. Query container's root device information or try to set size:
lxc config device set instance-00000004 root size 6GB
Expected outcome:
command above returns nothing, when checking zfs quota for the lxd container, it should be set to 6GB, when running df -h / from within lxd container, root filesystem should be 6 GB.
Actual outcome:
lxc command returns error:
error: The device doesn't exist
ZFS quota is not set, df -h / within lxd container reports whole underlying pool size.
Profile applied to the instance. Notice the "root:" section.
$ lxc profile show instance-00000004
name: instance-00000004
config:
boot.autostart: "True"
limits.cpu: "1"
limits.memory: 512MB
raw.lxc: |
lxc.
security.nesting: "True"
description: ""
devices:
qbrc272e9e2-e3:
hwaddr: fa:16:3e:71:b5:72
nictype: bridged
parent: qbrc272e9e2-e3
type: nic
root:
path: /
size: 20GB
type: disk
tags: | added: sts |
Changed in nova-lxd: | |
status: | Confirmed → Incomplete |
summary: |
- root disk flavor constraints not applied to nova-lxd instances + root disk flavor constraints not applied to nova-lxd instances when + config-drive is used |
Changed in nova-lxd: | |
status: | New → Confirmed |
status: | Confirmed → Triaged |
Looking closer at this, I'm not sure this is a bug. By design, if you provision a machine with nova-lxd, you should *never* manipulate the container using the lxc command. There are *horrible* issues that can result from doing this.