`zpool status` called even if not installed in a container
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
It seems that cloud-init tries to use `zpool status <pool>` whenever `/dev/zfs` exists. This can causes some bogus warnings if the zpool command it not available despite that `/dev/zfs` existing.
Here is how to reproduce:
```
lxc launch ubuntu-daily:22.04 v1 --vm
sleep 30
lxc exec v1 -- apt-get update
lxc exec v1 -- apt-get install -y linux-image-
lxc restart v1
sleep 30
lxc exec v1 -- lxd init --auto --storage-
lxc exec v1 -- lxc launch ubuntu-
lxc exec v1 -- lxc exec c1 -- cloud-init status --long --wait
```
This will output:
```
.......
status: done
extended_status: degraded done
boot_status_code: enabled-
last_update: Tue, 27 Feb 2024 20:59:35 +0000
detail:
DataSourceLXD
errors: []
recoverable_errors:
WARNING:
- Unable to get zpool status of default: Unexpected error while running command. Command: ['zpool', 'status', 'default'] Exit code: - Reason: [Errno 2] No such file or directory: b'zpool' Stdout: - Stderr: -
```
This `cloud-init status` returns 0 when running inside a 22.04 instance but would return 2 when inside a 24.04 instance. See https:/
https:/ /github. com/canonical/ cloud-init/ pull/4970 contains a proposed fix.