[lxd]: fix container_create not creating devices other than of type disk

This commit is contained in:
Julian Dehm 2023-03-29 13:02:24 +02:00 committed by Megan Wilhite
parent 21bb7bdc9e
commit ec3b208d76
2 changed files with 6 additions and 1 deletions

1
changelog/63996.fixed.md Normal file
View file

@ -0,0 +1 @@
[lxd] Fixed a bug in `container_create` which prevented devices which are not of type `disk` to be correctly created and added to the container when passed via the `devices` parameter.

View file

@ -688,7 +688,11 @@ def container_create(
# Add devices if not wait and devices have been given.
if devices:
for dn, dargs in devices.items():
container_device_add(name, dn, **dargs)
if "type" in dargs:
# extract 'type' so it won't be overwritten
container_device_add(name, dn, device_type=dargs["type"], **dargs)
else:
container_device_add(name, dn, **dargs)
if _raw:
return container