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

Cnv bz1875725 containerdisks #25359

Merged

Conversation

aburdenthehand
Copy link
Contributor

@aburdenthehand aburdenthehand commented Sep 9, 2020

Adding a procedure to cover BZ#1875725 request for how to create a containerDisk. Since this doesn't belong anywhere it needed a new assembly, which also required a concept to cover containerDisk volumes.
Also moved a para re: ephemeral nature of containerDisks into an adomintion in the storage type table to increase visibility and added the new assembly to the 'Additional resources' section of 'creating vms'

Additional info taken from https://kubevirt.io/user-guide/#/creation/disks-and-volumes?id=containerdisk

New assembly: https://cnv-bz1875725-containerdisk--ocpdocs.netlify.app/openshift-enterprise/latest/virt/virtual_machines/advanced_vm_management/virt-using-containerdisk-volumes.html
Updated storage types table: https://cnv-bz1875725-containerdisk--ocpdocs.netlify.app/openshift-enterprise/latest/virt/virtual_machines/virt-create-vms.html#virt-vm-storage-volume-types_virt-create-vms

@fabiand and @dankenigsberg please review.
Note that the new assembly is under 'Advanced virtual machine management' rather than 'Virtual machine disks' due to the concerns Fabian had raised earlier.

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 9, 2020
@openshift-docs-preview-bot

The preview will be available shortly at:

@aburdenthehand aburdenthehand force-pushed the cnv-bz1875725-containerdisk branch 2 times, most recently from 0d9e62c to c045886 Compare September 10, 2020 08:58
@dankenigsberg
Copy link
Contributor

This looks good to me, clearly better than my own #25289

@aburdenthehand
Copy link
Contributor Author

@dankenigsberg If it's raising an eyebrow for you then it's not as clear as it should be. I'll update.
Just to clarify - the only negative in that scenario is that migration is slower? There's no additional risk of data loss, right?

@dankenigsberg
Copy link
Contributor

Well, we already covered data loss in the former sentence. So yes the problem is tmp storage being wasted (a virtual filesystem of 30GiB can cost 30GiB of extra storage on the node) which then needs to be migrated with the VM to the destination node. Not fun. I just don't find the right words to express it.

Container disks are not recommended for read-write filesystems as
the data is temporarily written to local storage on the hosting node. This slows
live migration of the virtual machine, such as in the case of node maintenance,
because the entire disk must be migrated to the destination node.
Copy link
Contributor

Choose a reason for hiding this comment

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

Well, it's not the entire disk, but only the layer of diffs from the base images shipped in the container.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should also add that in the case of a powerouttage the data will be lost.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • Have s/entire disk/data/ for accuracy. I don't think we need to be more specific than that here, but I certainly appreciate the clarification.
  • Added "Additionally, all data is lost if the node loses power or otherwise shuts down unexpectedly."

Copy link
Contributor

@fabiand fabiand left a comment

Choose a reason for hiding this comment

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

A few remarks

modules/virt-about-containerdisks-for-vms.adoc Outdated Show resolved Hide resolved
modules/virt-about-containerdisks-for-vms.adoc Outdated Show resolved Hide resolved
Container disks are not recommended for read-write filesystems as
the data is temporarily written to local storage on the hosting node. This slows
live migration of the virtual machine, such as in the case of node maintenance,
because the entire disk must be migrated to the destination node.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also add that in the case of a powerouttage the data will be lost.

modules/virt-preparing-container-disk-for-vms.adoc Outdated Show resolved Hide resolved
modules/virt-preparing-container-disk-for-vms.adoc Outdated Show resolved Hide resolved
modules/virt-vm-storage-volume-types.adoc Outdated Show resolved Hide resolved
[NOTE]
====
A containerDisk volume is ephemeral. It is discarded when
the virtual machine is stopped, restarted, or deleted. A containerDisk
Copy link
Contributor

Choose a reason for hiding this comment

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

Some people could say this is to greedy.
Under certain circumstances the image will remain, but the statement above is safe, thus even if greedy, let's keep it.

Comment on lines 32 to 33
FROM scratch
ADD --chown=107:107 <vm_image>.qcow2 /disk/ <1>
Copy link
Contributor

Choose a reason for hiding this comment

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

@davidvossel when I tried this, I got myself an containerDisk; but running it produced

failed to get image info: failed to invoke qemu-img: exit status 1: 'qemu-img: Could not open '/var/run/kubevirt/container-disks/disk_0.img': Could not open '/var/run/kubevirt/container-disks/disk_0.img': Permission denied '

can you tell why? How can I chmod the ADDed file to 0444 in the Dockerfile?

Choose a reason for hiding this comment

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

This command ADD --chown=107:107 disk.qcow2 /disk/ worked without issue for me. I'm not sure what you're experiencing here.

Choose a reason for hiding this comment

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

i think you're correct that we should be setting 444 on disk now. This technically works without 444 if we get the ownership correct, but that's because the ownership allows us to modify the permissions to 444 after the fact.

The only way I'm aware of to set 444 permissions is to do it external of the scratch container's Dockerfile. ADD only has chown built in and the scratch container itself doesn't have the chmod tool internally.

So if i set 444 permissions on the file before running the docker build or podman build then it that works.

Choose a reason for hiding this comment

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

i think you're correct that we should be setting 444 on disk now. This technically works without 444 if we get the ownership correct, but that's because the ownership allows us to modify the permissions to 444 after the fact.

forget what I said there. 444 shouldn't be necessary. simply setting the owner to 107:107 and ensuring that the file has read permissions for the owner user is the minimum we need right now. The mutation of the permissions to 444 at runtime is something that we shouldn't be doing and will get addressed. that doesn't impact us here though.

Copy link
Contributor

Choose a reason for hiding this comment

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

@davidvossel I don't understand the bottom line. The the suggested Dockerfile did not produce a working container for me. What should be done to it to make it work?

Copy link
Contributor

Choose a reason for hiding this comment

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

@davidvossel what is needed to make the CD work?

Choose a reason for hiding this comment

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

@davidvossel what is needed to make the CD work?

Our testsuite verifies 444 mode and 107:107 ownership for a virtualmachine image in the disk/ dir of a container. That's what we verify.

Copy link

@davidvossel davidvossel left a comment

Choose a reason for hiding this comment

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

@dankenigsberg @fabiand

Would it make more sense for us to talk about ContainerDisks in the context of importing to a PVC with as a source for a DataVolume rather than using the ephemeral ContainerDisks directly attached to the VMI?

Maybe documenting both ways makes sense to a certain extent. I think the message is a bit confusing though. We talk about ContainerDisks being ephemeral, but then we are goign to use ContainerDisks as a source for Persistent VMs by importing the contents to a PVC in other use cases.

Comment on lines 32 to 33
FROM scratch
ADD --chown=107:107 <vm_image>.qcow2 /disk/ <1>

Choose a reason for hiding this comment

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

This command ADD --chown=107:107 disk.qcow2 /disk/ worked without issue for me. I'm not sure what you're experiencing here.

@dankenigsberg
Copy link
Contributor

Would it make more sense for us to talk about ContainerDisks in the context of importing to a PVC with as a source for a DataVolume rather than using the ephemeral ContainerDisks directly attached to the VMI?

Maybe documenting both ways makes sense to a certain extent. I think the message is a bit confusing though. We talk about ContainerDisks being ephemeral, but then we are goign to use ContainerDisks as a source for Persistent VMs by importing the contents to a PVC in other use cases.

@davidvossel I think that for cdrom and other immutable filesystems, direct ContainerDisks make sense. We certainly allow them and document them for a very long time. In this PR we only make the documentation clearer, by actually explaining what a containerDisk is and what are the drawbacks of using it.

Could it be that you are suggesting to add ContainerDisks as a possible source for DataVolumes? I https://docs.openshift.com/container-platform/4.5/virt/virtual_machines/importing_vms/virt-importing-virtual-machine-images-datavolumes.html

I'd appreciate if you can suggest a draft PR, as I'm not sure I follow.

@davidvossel
Copy link

Could it be that you are suggesting to add ContainerDisks as a possible source for DataVolumes? I https://docs.openshift.com/container-platform/4.5/virt/virtual_machines/importing_vms/virt-importing-virtual-machine-images-datavolumes.html

yes, I'm referring to importing containerDisks via DataVolumes to a PVC.

Do we want users to make the connection that they can Import their containerDisks onto PVCs? From reading through what we have so far, I wouldn't draw that connection.

Without being able to draw the connection between containerDisks and DataVolumes, it's unclear how someone would know how to consume something like our RHEL 8.x containerDisk image using persistent storage. Am I missing something?

@dankenigsberg
Copy link
Contributor

dankenigsberg commented Sep 22, 2020

Am I missing something?

I think you do, I miss it too, @davidvossel. I think that we should add a section/example about importing data from a containerDisk on top of the suggested text of this PR. I would really appreciate if you can suggest a text (and location) for where it

@dankenigsberg
Copy link
Contributor

@davidvossel I think that this PR, as it is, is instrumental to warning about the problems of containerDisks as well as how to create them. Would you please approve them and create a follow-up item about further improvements?

@aburdenthehand
Copy link
Contributor Author

@davidvossel @dankenigsberg - just to be clear for my own sake, when you say 'importing a containerDisk into a DataVolume', that is actually importing a virtual machine image into a DataVolume, right?
There's not a use case for creating a containerDisk, and then importing that containerDisk into a DataVolume.

If so, maybe the solution to this is to link out to the 'Importing a VM image to a DataVolume' (that Dan linked to earlier) after we've warned folks about the limitations of using containerDisks.

Copy link
Contributor

@fabiand fabiand left a comment

Choose a reason for hiding this comment

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

There's not a use case for creating a containerDisk, and then importing that containerDisk into a DataVolume.

There is: We call it default OS image flow ("golden image flow"), and we are looking at introducing it.
Such a flow is leveraging the strengths of container based delivery, and smart storage.

IIUIC Then David is suggesting to not explain how to use containerDisks for VM consumption (speak attach containerDisks to a VM), instead focus on how containerDisks can be used as a source for DataVolumes.

Why? In order to get and keep users on track to leverage the primary (PVC based) storage story of CNV.

Comment on lines 32 to 33
FROM scratch
ADD --chown=107:107 <vm_image>.qcow2 /disk/ <1>
Copy link
Contributor

Choose a reason for hiding this comment

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

@davidvossel what is needed to make the CD work?

include::modules/virt-document-attributes.adoc[]
:context: virt-using-containerdisk-volumes
toc::[]

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd appreciate if we can put a disclaimer here that the use-case for containerDisks is narrow, and that the general recommendation is to use CDI et al for VM storage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the updated concept (modules/virt-about-container-disks.adoc) satisfies this request now

@aburdenthehand
Copy link
Contributor Author

aburdenthehand commented Oct 6, 2020

@fabiand Thanks for the info!

There's not a use case for creating a containerDisk, and then importing that containerDisk into a DataVolume.

Sorry, this was intended as part of the question I was asking, but I see now that it reads like a declarative statement.

IIUIC Then David is suggesting to not explain how to use containerDisks for VM consumption (speak attach containerDisks to a VM), instead focus on how containerDisks can be used as a source for DataVolumes.

This came up in email yesterday and we're scoping the related stories (in KNIP-258) in our docs planning meeting today.
Likely I will amend the procedure in this PR so that it is not specific to preparing the image/pushing to registry for a containerDisk volume. I can also add a disclaimer as suggested and link to the content that will be developed in KNIP-258 - creating a DataVolume from a container image using 'source: registry:'

@davidvossel
Copy link

sorry for the delay in getting back to this.

@davidvossel I think that this PR, as it is, is instrumental to warning about the problems of containerDisks as well as how to create them. Would you please approve them and create a follow-up item about further improvements?

@dankenigsberg I'm in the middle of a big discussion about the future of persistent container disks. we're getting close to a conclusion. I want to make sure we finalize that discussion before I commit to how we word our documentation as it could impact our recommendation here.

@aburdenthehand
Copy link
Contributor Author

@davidvossel @dankenigsberg
I either have great or terrible timing then. #26591 has been created to satisfy the case of Importing container disks into DVs.
Build link here: https://cnv-1403-containerdisk-source--ocpdocs.netlify.app/openshift-enterprise/latest/virt/virtual_machines/importing_vms/virt-importing-container-disk-with-datavolumes.html

I'll wait to hear back from y'all before moving these further.

@davidvossel
Copy link

I'll wait to hear back from y'all before moving these further.

sorry if that previous comment caused any confusion. We're on target for documenting containerDisks and the DataVolume import flow. There's no technical change to that direction at the moment. The conversation I was referencing is mostly concluded. It won't impact this documentation.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2020
aburdenthehand added a commit to aburdenthehand/openshift-docs that referenced this pull request Oct 30, 2020
Copy link
Member

@ousleyp ousleyp left a comment

Choose a reason for hiding this comment

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

Mostly just nits and small fixes. Most of my comments have to do with backticks and the passive voice. There are a couple of things rendering incorrectly that should be fixed. Overall, it's looking good.

_topic_map.yml Outdated Show resolved Hide resolved
modules/virt-about-container-disks.adoc Outdated Show resolved Hide resolved
modules/virt-about-container-disks.adoc Outdated Show resolved Hide resolved
modules/virt-about-container-disks.adoc Outdated Show resolved Hide resolved
modules/virt-about-container-disks.adoc Outdated Show resolved Hide resolved
modules/virt-vm-storage-volume-types.adoc Outdated Show resolved Hide resolved
modules/virt-vm-storage-volume-types.adoc Outdated Show resolved Hide resolved
modules/virt-vm-storage-volume-types.adoc Outdated Show resolved Hide resolved
virt/virtual_machines/virt-create-vms.adoc Outdated Show resolved Hide resolved
@aburdenthehand aburdenthehand force-pushed the cnv-bz1875725-containerdisk branch 2 times, most recently from 6eff599 to eb396da Compare November 3, 2020 18:08
…ntainerDisk. During development and review this overlapped with CNV-1403 and mutated some. This now covers the concept of container disks, with adequate warnings about using containerDisk volumes, and the procedure for preparing container disks.
@aburdenthehand aburdenthehand merged commit 564416f into openshift:master Nov 3, 2020
@aburdenthehand
Copy link
Contributor Author

aburdenthehand commented Nov 3, 2020

/cherry-pick enterprise-4.5

@aburdenthehand
Copy link
Contributor Author

aburdenthehand commented Nov 3, 2020

/cherry-pick enterprise-4.6

@aburdenthehand
Copy link
Contributor Author

aburdenthehand commented Nov 3, 2020

/cherry-pick enterprise-4.7

@openshift-cherrypick-robot
Copy link

openshift-cherrypick-robot commented Nov 3, 2020

@aburdenthehand: #25359 failed to apply on top of branch "enterprise-4.5":

Applying: Adding a procedure to cover BZ#1875725 request for how to create a containerDisk. During development and review this overlapped with [CNV-1403](https://issues.redhat.com/browse/CNV-1403) and mutated some. This now covers the concept of container disks, with adequate warnings about using containerDisk volumes, and the procedure for preparing container disks.
.git/rebase-apply/patch:212: trailing whitespace.
* xref:../../virt/virtual_machines/virtual_disks/virt-using-container-disks-with-vms.adoc#virt-using-container-disks-with-vms[Prepare a container disk] before adding it to a virtual machine as a `containerDisk` volume. 
.git/rebase-apply/patch:58: new blank line at EOF.
+
warning: 2 lines add whitespace errors.
Using index info to reconstruct a base tree...
M	_topic_map.yml
M	virt/virtual_machines/virt-create-vms.adoc
Falling back to patching base and 3-way merge...
Auto-merging virt/virtual_machines/virt-create-vms.adoc
CONFLICT (content): Merge conflict in virt/virtual_machines/virt-create-vms.adoc
Auto-merging _topic_map.yml
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Adding a procedure to cover BZ#1875725 request for how to create a containerDisk. During development and review this overlapped with [CNV-1403](https://issues.redhat.com/browse/CNV-1403) and mutated some. This now covers the concept of container disks, with adequate warnings about using containerDisk volumes, and the procedure for preparing container disks.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick enterprise-4.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-cherrypick-robot
Copy link

openshift-cherrypick-robot commented Nov 3, 2020

@aburdenthehand: new pull request created: #27015

In response to this:

/cherry-pick enterprise-4.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-cherrypick-robot
Copy link

openshift-cherrypick-robot commented Nov 3, 2020

@aburdenthehand: new pull request created: #27016

In response to this:

/cherry-pick enterprise-4.7

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch/enterprise-4.5 branch/enterprise-4.6 branch/enterprise-4.7 CNV Label for all CNV PRs size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants