Okay, so I figured out what's going on here and while not ideal, it
actually makes sense.

unix-char and unix-block devices don't have an "optional" property,
therefore LXD will fail to start any container which lists such a device
without the host path existing.

LXD also validates the container configuration to be valid whenever a change to 
it is done.
When removing one of the device, the client tool gives LXD an updated container 
config which includes the remaining device. That device is invalid and so LXD 
fails the config validation and returns the error.

The way around the issue is to use "lxc config edit" to remove both
devices in one shot. That way the LXD configuration will be valid.


There are a couple of things we could do to make this easier:
 - Add an "optional" flag to unix-char and unix-block, allowing you to specify 
devices which may not yet exist. The container would then start fine and the 
config would be considered valid by the validator even if those devices are 
missing. When the device shows up again, a restart would be needed to have it 
show up in the container again.

 - Allow for multiple device names to be passed to "lxc config device
remove". This would let you remove both devices in one shot, resulting
in a valid configuration.


Let me know if either/both of those would be useful to you. Until then, use 
"lxc config edit" to remove both devices.

** Changed in: lxd (Ubuntu)
       Status: New => Triaged

** Changed in: lxd (Ubuntu)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1690299

Title:
  Cannot remove detached devices from container

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxd/+bug/1690299/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to