Backlog #1727
Patch for one.image.resize to resize image
Status: | Closed | Start date: | 01/14/2013 | |
---|---|---|---|---|
Priority: | High | Due date: | ||
Assignee: | - | % Done: | 0% | |
Category: | Core & System | |||
Target version: | - |
Description
This patch (against 3.8.1) adds a one.image.resize call to resize image.
The call takes 2 parameters: The image ID and the new size.
- It works for image that are in READY state (with some more work, it could be extended to USED state to allow non-persistent sources to be resized, and USED_PERS to allow online resizing).
- It requires the MANAGE IMAGE permission on an image to issue a resize action.
- It checks the image owner quota before accepting the resize.
- It sets the image in LOCKED state and calls a new datastore driver action, RESIZE.
- If the driver returns SUCCESS, it sets the image back to READY state, otherwise the image is set to ERROR.
This patch doesn't implement the RESIZE action in any of the datastore drivers shipped with OpenNebula. It only implements the resize at the OpenNebula Core level. The datastore drivers needs to be updated to handle the RESIZE action.
Beware that issuing a one.image.resize call to a datastore that wasn't updated to support the RESIZE action will leave the image in LOCKED (or ERROR) state.
Feedbacks are more than welcome!
Simon
Related issues
Associated revisions
Feature #1727: VM::set_auth_request adds size to each disk
Feature #1727: VM volatile quota adds each disk size
Feature #1727: Image::disk_attribute adds ORIGINAL_SIZE
feature #1727: add clone resize to ssh, shared and qcow2
Feature #1727: Rename VOLATILE_SIZE quota to SYSTEM_DISK_SIZE
Feature #1727: New option --extend for onetemplate show
Feature #1727: Do not allow disk resize for persistent images, and for a smaller size
Feature #1727: Fix system_disk quotas
Add DS disk attributes; add disk-snapshots to total
Feature #1727: Disk snapshot actions add/del from system disk quotas
Feature #1727: Fix bug, extra semicolon
Feature #1727: Make snapshot size a long long, to be the same as image size
Feature #1727: Update fsck to calculate SYSTEM_DISK quota
Feature #1727: New SYSTEM_DISK quota in onedb upgrade
Feature #1727: Small code style change
Feature #1727: Disk attach now adds to the SYSTEM_DISK quota
feature #1727: fix bug setting ORIGINAL_SIZE
feature #1727: Add extended template support in sunstone
feature #1727: Add range slider util
feature #1727: Add disk resize in cloud view
feature #1727: Add option to disable disk resize in cloud view
feature #1727: Check if size is greater than the original
Feature #1727: Use VM::disk_extended_info with temporary template objects
feature #1727: Add resize disk to admin view
feature #1727: Update sunstone env param description
feature #1727: Not use dynamic memory in method
Feature #1727: Create new migrator for 4.13.85
Feature #1727: New option extend for java oca Template info
feature #1727: Rename disk_target to disk_tm_target
Feature #1727: Add DISK/ORIGINAL_SIZE to restricted attributes
Feature #1727: Generic system to allow to resize
on onetemplate instantiate from the CLI
Feature #1727: Document adding extra attributes to disk and nic
on onetemplate instantiate
Feature #1727: add clone resize to ceph
Feature #1727: Fix logic. Only resize of ORIGINAL_SIZE is defined
and if it's smaller than the desired size.
History
#1 Updated by Simon Boulet over 8 years ago
- File z-image-resize-used-pers.patch added
Attached patch allow images in USED and USED_PERS state to be resized.
Applies on top of image-resize.patch above.
Simon
#2 Updated by Ricardo Duarte over 8 years ago
This is a great feature.
virt-resize, from libguestfs, can be used to easily implement the actual resize on the driver.
#3 Updated by Ruben S. Montero about 8 years ago
- Category set to Core & System
#4 Updated by Ruben S. Montero about 8 years ago
- Priority changed from Normal to Low
#5 Updated by Ruben S. Montero about 8 years ago
Given the comments, I think this is better to be moved to the TM's. Images keep their potentially minimal size in the datastore. The TM then resizes the disk once the image is copied to the host, as described by #179.
In this case the interface would be:
DISK = [ IMAGE="Server CentOS", size="10GB" ]
The TM will then resize the image. Other considerations:
1.- Live resize of disk images won't be supported by all the TM's.
2.- It will only work for non-persistent images.
ALthough this issue (resize in the datastore) is slightly related, It may be better to go for the second option (resize on deployment, as in #179). Considering also the comments in #1768
Comments?
#6 Updated by Ricardo Duarte about 8 years ago
Resize on deployment will work perfectly for #1768.
#7 Updated by Simon Boulet about 8 years ago
Why not do both? Allow non-persistent image size to be specified at VM / template instantiation (independent of the initial data store image), and also have a method for updating persistent image size?
Currently all my images are persistent. I use the method in #1865 to tell my driver what final size the image is to be. My VM CREATE hooks picks up the new template and calls the one.image.resize (above patches) to set the size of the persistent image.
#8 Updated by Simon Boulet almost 8 years ago
- File image-resize-4.2.patch added
#9 Updated by Vladislav Gorbunov over 7 years ago
Could you tell me how to change the image size in one database from cli by using this path? Nedd to change the oneimage cli script?
#10 Updated by Vladislav Gorbunov over 7 years ago
- File resize.image.rb.diff added
- File resize.oneimage.diff added
I myself understood. Files with patches for resize image from command line (with oneimage) is in attachment. In datastore must be the script "resize" that do image resizing in datastore or return 0 exit code. Simon's path for OpenNebula 4.2 worked for OpenNebula 4.4.
#11 Updated by Ruben S. Montero over 7 years ago
- Target version set to Release 4.6
#12 Updated by Ruben S. Montero over 7 years ago
- Priority changed from Low to Normal
#13 Updated by Ruben S. Montero over 7 years ago
- Related to Feature #179: Ability to expand disk source on physical host added
#14 Updated by Jaime Melis over 7 years ago
- Target version changed from Release 4.6 to Release 4.8
#15 Updated by Ruben S. Montero about 7 years ago
- Tracker changed from Feature to Backlog
- Priority changed from Normal to High
- Target version deleted (
Release 4.8)
#16 Updated by Ruben S. Montero almost 7 years ago
- Related to Request #3044: Support resizing disk size added
#17 Updated by Ruben S. Montero almost 7 years ago
- Status changed from New to Pending
#18 Updated by Jaime Melis over 6 years ago
- Target version set to Release 4.12
#19 Updated by Ruben S. Montero over 6 years ago
- Target version deleted (
Release 4.12)
#20 Updated by Ruben S. Montero over 6 years ago
- Target version set to Release 4.14
#21 Updated by Ruben S. Montero over 6 years ago
- Tracker changed from Backlog to Feature
#22 Updated by Ruben S. Montero over 6 years ago
- Status changed from Pending to New
#23 Updated by Ruben S. Montero about 6 years ago
- Assignee set to Jaime Melis
#24 Updated by Stefan Kooman almost 6 years ago
When resizing RAW images and or LVM backed virtual machines the following virsh command allows to update the new disk size to the live running VM:
virsh qemu-monitor-command one-ID --hmp "block_resize drive-virtio-disk0 size B". Where "drive-virtio-disk0" is the first disk of the virtual machine. To obtain a list of disks this command can be used "virsh qemu-monitor-command ONE-ID –hmp “info block”.
As these are "virsh" commands I guess there are equivalent libvirt API calls. It would be incredibly helpfull if this could be incorporated in "one.image.resize". It would make online resizing a breaze. If a image has (external) snapshots it should not be allowed to resize the disk in this manner, since the backing file is (expected to be) read-only.
#25 Updated by Stefan Kooman almost 6 years ago
For some reason the "info block" command only works when I'm already in virsh shell:
virsh # qemu-monitor-command one-103 --hmp "info block"
drive-virtio-disk0: /var/lib/one//datastores/100/103/disk.0 (qcow2)
drive-ide0-0-0: /var/lib/one//datastores/100/103/disk.1 (raw, read-only)
Removable device: locked, tray closed
- virsh qemu-monitor-command one-103 --hmp “info block”
unknown command: '“info'
#26 Updated by Stefan Kooman almost 6 years ago
Resizing can be done more easily with "virsh blockresize" command or libvirt API call "virDomainBlockResize": https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainBlockResize
#27 Updated by Ruben S. Montero almost 6 years ago
- Tracker changed from Feature to Backlog
- Status changed from New to Pending
- Assignee deleted (
Jaime Melis) - Target version changed from Release 4.14 to Release 5.0
4.14 implements the ability to expand (resize) disk images on hypervisors at VM deployment. This issue is kept for resizing images in the datastore.
#28 Updated by Carlos Martín over 5 years ago
- Related to Bug #4073: Docs still mention VOLATILE_DISK instead of SYSTEM_DISK_SIZE added
#29 Updated by Ruben S. Montero over 5 years ago
- Status changed from Pending to Closed
- Target version deleted (
Release 5.0)
Created a new issue for this #4274