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

machines: Make readonly and shareable disk options configurable #12314

Merged
merged 5 commits into from
Oct 2, 2019

Conversation

skobyda
Copy link
Contributor

@skobyda skobyda commented Jul 12, 2019

Allow multiple running VMs share a single disk.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1684304
Closes #12314

@skobyda skobyda force-pushed the vmDiskReadonlyAndShareable branch from 32488ee to 1c9a7e3 Compare July 12, 2019 16:17
@skobyda
Copy link
Contributor Author

skobyda commented Jul 12, 2019

Only disks of format 'raw' have shareable option:
Screenshot from 2019-07-12 17-10-20

Changes takes effect only after shutting down the VM:
Screenshot from 2019-07-12 17-10-38

Disks which are not persistent (e.g. 3rd disk in row) do not have configurable options:
Screenshot from 2019-07-12 18-05-33

@skobyda skobyda force-pushed the vmDiskReadonlyAndShareable branch from 1c9a7e3 to 4e2ab79 Compare July 13, 2019 14:58
@skobyda skobyda changed the title machines: Make readable and shareable disk options configurable machines: Make readonly and shareable disk options configurable Jul 13, 2019
@skobyda skobyda force-pushed the vmDiskReadonlyAndShareable branch from 4e2ab79 to 7d7324c Compare July 14, 2019 21:13
@skobyda skobyda force-pushed the vmDiskReadonlyAndShareable branch from 7d7324c to dcf83a4 Compare July 14, 2019 23:34
@skobyda skobyda force-pushed the vmDiskReadonlyAndShareable branch from dcf83a4 to cc1e823 Compare July 16, 2019 08:15
@skobyda skobyda requested a review from KKoukiou July 16, 2019 09:45
@KKoukiou KKoukiou requested a review from garrett July 16, 2019 12:44
@KKoukiou
Copy link
Contributor

This affects the design of the disk row as well, @garrett are you good with this change?

@garrett
Copy link
Member

garrett commented Jul 16, 2019

  1. We shouldn't have checkboxes without obvious labels.
  2. When would someone want read-only disks? Would they ordinarily toggle them? Is it changeable on the fly or only after a reboot? If it's possible to change a disk from RO to RW (or vice versa) when running, would things prevent that? Are errors handled, if so?
  3. What does "Sharable" mean?
  4. The values under "source" are oddly aligned.
  5. There's too much space on the [-] buttons. (I can look into and fix this. It's probably a bit of CSS.)

Copy link
Member

@garrett garrett left a comment

Choose a reason for hiding this comment

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

I think we need to rework the design. (See my previous comment for questions that need answering.)

@skobyda
Copy link
Contributor Author

skobyda commented Jul 16, 2019

  1. We shouldn't have checkboxes without obvious labels.

I cannot think of sensible labels.
For readonly, what about: "Forbid/allow modification of disk" ?
For shareable: "Available for sharing by multible VMs"?

  1. When would someone want read-only disks?

Usually when user wants multiple VMs to use the same disk. To prevent write conflicts you set this disk as readonly for some VMs, so they loose write access. Or disks which you want to act as "CDrom" or other RO disk types.

Would they ordinarily toggle them?

Again, mainly for specific use cases such as multiple VMs share disk, or to simulate readonly disk type.

Is it changeable on the fly or only after a reboot? If it's possible to change a disk from RO to RW (or vice versa) when running, would things prevent that? Are errors handled, if so?

No, this can be only updated after a reboot. You can modify readonly/shareable options only for permanent VM's XML, which will be loaded with all the new modifications after VM reboots. I forgot to take into account error handling, good idea. (altought I can't think of any error apart from some undocumented libvirt/qemu internal error).

  1. What does "Sharable" mean?

Again, used when you want to share a disk with multiple VMs, but in this case you want all of them to have a write access. From what I can read in documentation, it will turn off I/O caching, locking of the disk which will make disk available for modification by multiple VMs. It's mainly used for cluster-aware guests.

  1. The values under "source" are oddly aligned.
  2. There's too much space on the [-] buttons. (I can look into and fix this. It's probably a bit of CSS.)

Both of these things are not affected by this PR.

@skobyda skobyda force-pushed the vmDiskReadonlyAndShareable branch from cc1e823 to efeda2c Compare July 16, 2019 15:12
@skobyda skobyda force-pushed the vmDiskReadonlyAndShareable branch from efeda2c to 474c50c Compare July 16, 2019 15:14
skobyda added a commit to skobyda/cockpit that referenced this pull request Jul 16, 2019
@skobyda
Copy link
Contributor Author

skobyda commented Jul 17, 2019

@garrett After our IRC discussion to pull readonly and shareable configuration into separate disk Edit dialog, here is the first take of how it could look:
Screenshot from 2019-07-17 12-52-46

Alternatively checkboxes can be replaced by dropdown with options (Read-only / Read-write) and (Shareable / Non-shareable).
@KKoukiou What do you think about introducing Edit Disk dialog?

@garrett
Copy link
Member

garrett commented Jul 17, 2019

@skobyda: Cool! Thanks for working on splitting the state changing into a dialog.

  1. Are we going to have additional ways to edit the disk in the future?
  2. How are we editing the disk? "Edit disk" might not be specific enough. (On the other hand, we want to avoid saying things like "mount" in the UI.) "Edit disk settings" or "Edit disk state" perhaps? 🤷‍♂️
  3. Which disk is this? There's no indication what is being edited. (We should add the name to the title or above the checkboxes.)
  4. Can you share read-write disks?
  5. "Readonly" should be "Read only" or "Read-only".
  6. Will this be instant-apply, or will a reboot have to happen for this to take effect? We should say if a reboot is needed. 😉
  7. Is there an indication that a reboot is needed for this to take effect after the disk mount settings have been applied?

@skobyda
Copy link
Contributor Author

skobyda commented Jul 17, 2019

  1. Are we going to have additional ways to edit the disk in the future?

Yes, you can edit stuff like Bus, storage format and several performance options.

  1. How are we editing the disk? "Edit disk" might not be specific enough. (On the other hand, we want to avoid saying things like "mount" in the UI.) "Edit disk settings" or "Edit disk state" perhaps? man_shrugging
  2. Which disk is this? There's no indication what is being edited. (We should add the name to the title or above the checkboxes.)

Disk is uniquely specified by it's path. So dialog name could be something like "Edit /var/lib/libvirt/images/fedora30.qcow2 Disk Settings".

  1. Can you share read-write disks?

Yes. You can attach disk which is already used by another VM without setting readonly or shareable. Then however if you will try to run both VMs, you will have problem (e.g. write conflict). To prevent that, you have 2 solutions: make disk readonly for others VMs, so there will be no write conflict, or make disk shareable so libvirt/qemu will prevent conflicts by using shared file locks, turning I/O caching off...

  1. "Readonly" should be "Read only" or "Read-only".

Agree.

  1. Will this be instant-apply, or will a reboot have to happen for this to take effect? We should say if a reboot is needed. wink

It wil happen only after reboot. I will put warning at the dialog footer similar to Vcpu or Network Interface Edit dialogs.

  1. Is there an indication that a reboot is needed for this to take effect after the disk mount settings have been applied?
    Yes, the warning will show in disks table next to property which value will change after reboot.

@garrett
Copy link
Member

garrett commented Jul 17, 2019

What if the dialog would be something like this:

Edit disk state ×
Name Disk-123
Size 6GB
State ● Read & write
○ Read-only
○ Read-only and shared

Name and size are not editable (at least in this iteration). They're in the dialog for reference, to make sure someone knows what they're editing.

State is a group of 3 radio buttons.

If "read-only and shared" is selected, then perhaps there should be a warning message about how this makes the disk read-only until it is removed from other VMs. It would also be good to know which VMs are using the disk (from somewhere, within Cockpit).

The × is centered because this is a limitation of doing mockups in tables in Markdown on GitHub. Same for other alignment issues. 😉

What do you think?

@marusak
Copy link
Member

marusak commented Jul 23, 2019

Needs to rebase to master since #12367 changed tests names

@skobyda
Copy link
Contributor Author

skobyda commented Jul 23, 2019

@garrett Current state of dialog:
Screenshot from 2019-07-23 13-02-06

Also as you requested I:

  • moved alignment of the action buttons to the right
  • replaced words yes/no -> Read-Only/Read-Write or Shareable/Not Shareable
  • And also changed the [-] button into [Detach], so it fits more nicely together with [Edit] Button.

Now:
Screenshot from 2019-07-23 13-02-58

Before:
Screenshot from 2019-07-23 13-04-17

@skobyda skobyda force-pushed the vmDiskReadonlyAndShareable branch from c5f56ab to caf014e Compare September 26, 2019 10:07
@skobyda
Copy link
Contributor Author

skobyda commented Sep 26, 2019

Tests seem to be green. It also seems there are no more design objections.
@KKoukiou once you have some free time, may I ask for code review?

KKoukiou
KKoukiou previously approved these changes Sep 27, 2019
Copy link
Contributor

@KKoukiou KKoukiou left a comment

Choose a reason for hiding this comment

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

I have some minor comments, but no need to block on these for these to get merged
Retriggering for testCreate on rhel-8-1 to get green.

@KKoukiou KKoukiou requested a review from garrett September 27, 2019 15:03
Access value encompasses both readonly and shareable values.
"Read-Only": readonly==true, shareable==false
"Read-Write": readonly==false, shareable==false
"Read-Write and Shared": readonly==false, shareable==true
Combination of both readonly==true and shareable==true is incorrect
and not recommended by libvirt to use.
Change button for disk detaching, which now contains word "Detach".
Also align all actions to the right.
@skobyda skobyda force-pushed the vmDiskReadonlyAndShareable branch from b1d3959 to 37d8ed8 Compare September 30, 2019 14:11
@skobyda skobyda requested a review from KKoukiou October 2, 2019 09:38
@KKoukiou KKoukiou merged commit 288856f into cockpit-project:master Oct 2, 2019
KKoukiou pushed a commit that referenced this pull request Oct 2, 2019
@skobyda
Copy link
Contributor Author

skobyda commented Oct 2, 2019

Screenshots for release notes:

Screenshot from 2019-10-02 13-25-23

Screenshot from 2019-10-02 13-17-03
Screenshot from 2019-10-02 13-17-42

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.

5 participants