Skip to content

Volume hotplug: clear up docs --persist #877

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akalenyu
Copy link
Contributor

@akalenyu akalenyu commented Mar 4, 2025

What this PR does / why we need it:
Things have changed since the doc was introduced,
update to reflect that.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note:

Clear up hotplug volume docs around --persist

Things have changed since the doc was introduced,
update to reflect that.

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Mar 4, 2025
@kubevirt-bot kubevirt-bot requested review from awels and ShellyKa13 March 4, 2025 14:39
Copy link
Member

@awels awels left a comment

Choose a reason for hiding this comment

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

/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 4, 2025
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: awels
Once this PR has been reviewed and has the lgtm label, please assign mhenriks for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@akalenyu
Copy link
Contributor Author

akalenyu commented Mar 4, 2025

/cc @aburdenthehand

Copy link
Member

@aburdenthehand aburdenthehand left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup @akalenyu. Definitely an improvement.
I just have a couple of suggestions (second is more of a question)

@@ -85,36 +85,18 @@ $ virtctl addvolume vmi-fedora --volume-name=example-lun-hotplug --disk-type=lun
```

### Retain hotplugged volumes after restart
In many cases it is desirable to keep hotplugged volumes after a VM restart. It may also be desirable to be able to unplug these volumes after the restart. The `persist` option makes it impossible to unplug the disks after a restart. If you don't specify `persist` the default behaviour is to retain hotplugged volumes as hotplugged volumes after a VM restart. This makes the `persist` flag mostly obsolete unless you want to make a volume permanent on restart.
In many cases it is desirable to keep hotplugged volumes after a VM restart. It may also be desirable to be able to unplug these volumes after the restart. The `persist` option makes it possible to unplug the disks after a restart. If you don't specify `persist`, the volume is only ever hotplugged on the VMI (instance) level.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
In many cases it is desirable to keep hotplugged volumes after a VM restart. It may also be desirable to be able to unplug these volumes after the restart. The `persist` option makes it possible to unplug the disks after a restart. If you don't specify `persist`, the volume is only ever hotplugged on the VMI (instance) level.
In many cases it is desirable to keep hotplugged volumes after a VM restart. The `persist` option will retain the hotplugged volume after a restart and not impact your ability to unplug the volume if desired. If you don't specify `persist`, the volume is only ever hotplugged on the VMI (instance) level.

Comment on lines +91 to +93
In some cases you want a hotplugged volume to stay hotplugged after a restart of the VM.
In that case, you can call the addvolume command with the --persist flag.
This means that when you restart the VM, the disk is already defined in the VM (as hotplugged), and thus is hotplugged to the new VMI.
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused, isn't this covered in line 88? If so, maybe we can combine the two into one section:
### Retain hotplugged volumes after restart with persist option

Copy link

Choose a reason for hiding this comment

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

+1

@kubevirt-bot
Copy link
Contributor

Pull requests that are marked with lgtm should receive a review
from an approver within 1 week.

After that period the bot marks them with the label needs-approver-review.

/label needs-approver-review

@kubevirt-bot kubevirt-bot added the needs-approver-review Indicates that a PR requires a review from an approver. label Mar 12, 2025
Copy link

@jpeimer jpeimer left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!
Just a couple of comments

Comment on lines +91 to +93
In some cases you want a hotplugged volume to stay hotplugged after a restart of the VM.
In that case, you can call the addvolume command with the --persist flag.
This means that when you restart the VM, the disk is already defined in the VM (as hotplugged), and thus is hotplugged to the new VMI.
Copy link

Choose a reason for hiding this comment

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

+1

machine:
type: ""
```
> *NOTE* The persist flag could also be used with removevolume to unplug in the same manner
Copy link

Choose a reason for hiding this comment

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

Not sure I understand... What is the difference between using removevolume with --persist and without it?
Could you please add an example to the ###Removevolume section?

machine:
type: ""
```
> *NOTE* The persist flag could also be used with removevolume to unplug in the same manner
Copy link

Choose a reason for hiding this comment

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

Should we also add some info about how to mount the hotplugged disk to a VM? At least with the example for Linux:

Inside the VM (via virtctl console <vm-name> or SSH), run:
lsblk

Look for a new device (e.g., /dev/sda, /dev/vdb, etc.) that doesn't have a mount point.

Mount the new disk:

sudo mkfs.ext4 /dev/sda
sudo mkdir /mnt/hotplug
sudo mount /dev/sda /mnt/hotplug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. needs-approver-review Indicates that a PR requires a review from an approver. size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants