-
Notifications
You must be signed in to change notification settings - Fork 128
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
Add devicemapper GC for persistent rootfs #771
Conversation
ff4a93e
to
9bd67ed
Compare
Upon GC at the Virtlet startup, the virtual block devices that are created by Virtlet are recognized by name and the sector 0 of underlying block device (Virtlet magic header). If they're not related to any active domain, they're removed (note that this doesn't mean the data on the device is affected in any way).
9bd67ed
to
57337af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 10 of 10 files at r1.
Reviewable status: 0 of 2 approvals obtained (waiting on @ivan4th)
pkg/libvirttools/gc.go, line 275 at r1 (raw file):
idsInUse[id] = true } ldh := blockdev.NewLogicalDeviceHandler(v.Commander(), devPath, sysfsPath)
Maybe this could be done during creation of VirtualizationTool once, stored in its structure, then could be used there and also could be returned by devHandler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 change requests, 0 of 2 approvals obtained (waiting on @ivan4th)
pkg/libvirttools/gc.go, line 284 at r1 (raw file):
for _, dmName := range dmNames { if !strings.HasPrefix(dmName, blockdev.VirtletLogicalDevicePrefix) { panic("bad dmname " + dmName)
why panic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 change requests, 0 of 2 approvals obtained (waiting on @ivan4th)
pkg/libvirttools/gc.go, line 284 at r1 (raw file):
Previously, lukaszo (Łukasz Oleś) wrote…
why panic?
I'm reading that ListVirtletLogicalDevices returned a device which has virtlet magic but wrong name. This should never happened, unless there was breaking api virtlet pod upgrade which would include change of virtlet logical device prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 change requests, 0 of 2 approvals obtained (waiting on @ivan4th)
pkg/libvirttools/gc.go, line 284 at r1 (raw file):
Previously, jellonek (Piotr Skamruk) wrote…
I'm reading that ListVirtletLogicalDevices returned a device which has virtlet magic but wrong name. This should never happened, unless there was breaking api virtlet pod upgrade which would include change of virtlet logical device prefix.
It's gc. I think that device can just be skipped with a big warning message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 change requests, 0 of 2 approvals obtained (waiting on @ivan4th and @jellonek)
pkg/libvirttools/gc.go, line 275 at r1 (raw file):
Previously, jellonek (Piotr Skamruk) wrote…
Maybe this could be done during creation of VirtualizationTool once, stored in its structure, then could be used there and also could be returned by devHandler?
I thought about this. What stopped me from this approach is that with gc.go being a set of VirtualizationTool
methods, VirtualizationTool
itself becomes an instance of "God Object" antipattern. Because of this, I'd prefer not to add extra coupling between GC methods and other parts of VirtualizationTool
.
pkg/libvirttools/gc.go, line 284 at r1 (raw file):
Previously, lukaszo (Łukasz Oleś) wrote…
It's gc. I think that device can just be skipped with a big warning message.
panic is used here because ListVirtletLogicalDevices
should only return Virtlet-related devices that MUST include the prefix in their names. If that's not the case, this means some severe bug in Virtlet code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 change requests, 0 of 2 approvals obtained (waiting on @jellonek and @lukaszo)
pkg/libvirttools/gc.go, line 275 at r1 (raw file):
Previously, ivan4th (Ivan Shvedunov) wrote…
I thought about this. What stopped me from this approach is that with gc.go being a set of
VirtualizationTool
methods,VirtualizationTool
itself becomes an instance of "God Object" antipattern. Because of this, I'd prefer not to add extra coupling between GC methods and other parts ofVirtualizationTool
.
That's solid reason with which I fully agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 10 of 10 files at r1.
Reviewable status: 1 change requests, 1 of 2 approvals obtained (waiting on @ivan4th and @lukaszo)
Upon GC at the Virtlet startup, the virtual block devices that are
created by Virtlet are recognized by name and the sector 0 of underlying
block device (Virtlet magic header). If they're not related to any
active domain, they're removed (note that this doesn't mean the data on
the device is affected in any way).
This change is