Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(util): Check if the zpool command is available before using it #4970

Closed
wants to merge 1 commit into from
Closed

fix(util): Check if the zpool command is available before using it #4970

wants to merge 1 commit into from

Conversation

simondeziel
Copy link
Member

Proposed Commit Message

fix(util): Check if the zpool command is available before using it

LXD exposes `/dev/zfs` inside containers backed by a ZFS storage
pool (see https://github.com/canonical/lxd/pull/12056). This device
being visible caused cloud-init to try and get some zpool information
by calling `zpool status <pool>`.

However, the zpool command might not be available in the container
where cloud-init executes. When not available, it would cause the
following warning/error to be displayed:

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: -

Fixes LP: #2055219

Fixes LP: #2055219

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
simondeziel added a commit to simondeziel/pylxd that referenced this pull request Feb 27, 2024
```
+ lxc exec pylxd-noble-329986 -- cloud-init status --long --wait
............
status: done
extended_status: degraded done
boot_status_code: enabled-by-generator
last_update: Tue, 27 Feb 2024 19:49:44 +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 was noticed with a host running lxd latest/edge snap and using a zfs
storage pool:

```
$ snap list lxd
Name  Version      Rev    Tracking     Publisher   Notes
lxd   git-2688037  27360  latest/edge  canonical✓  -
```

This is a workaound for https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/2055219
with a proper fix proposed in canonical/cloud-init#4970.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
@holmanb
Copy link
Member

holmanb commented Feb 27, 2024

Thanks for the contribution. Closed in preference of #4969

@holmanb holmanb closed this Feb 27, 2024
@simondeziel simondeziel deleted the zpool-status-lp-2055219 branch February 28, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants