Skip to content

Conversation

@ktsakalozos
Copy link
Contributor

When LXD containers are backed up by a ZFS storage pool they do not have the /dev/zfs device. Trying to get the file system stats from that device will fail (va the zfs utility).

With this PR, in the above setup (ZFS inside and LXD container), we default to getting the file system stats from VFS.

Here is the error you get when /dev/zfs is not present:

Feb 19 09:38:54 definite-cricket microk8s.daemon-kubelet[3118]: I0219 09:38:54.595436    3118 fs.go:425] Stat fs failed. Error: exit status 1: "/snap/microk8s/383/sbin/zfs zfs get -Hp all zfsdefault/containers/definite-cricket" => /dev/zfs and /proc/self/mounts are required.

@ktsakalozos
Copy link
Contributor Author

/test pull-cadvisor-e2e

@dashpole
Copy link
Collaborator

dashpole commented Mar 7, 2019

You will need to rebase on #2191, since the update to go 1.12 made our go-lint fail

fs/fs.go Outdated
switch partition.fsType {
var fsType = partition.fsType
if fsType == ZFS.String() {
if _, devZfs := os.Stat("/dev/zfs"); os.IsNotExist(devZfs) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of defining a new fsType. Maybe put this inside of case ZFS.String(), and use goto default to revert to the default behavior when this is the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review @dashpole. I moved the /dev/zfs check inside the ZFS case. Are you firmly set on using goto with an extra label (I believe the case label default does not qualify as a goto target)? I went with fallthrough what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, if you can't goto default, then I don't know if that will work... Let me take another look

Copy link
Collaborator

@dashpole dashpole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dashpole dashpole merged commit 28d11ad into google:master Mar 12, 2019
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