cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Configurable disk size of systemvm

Open ustcweizhou opened this issue 7 years ago • 13 comments

Currently we have systemvm template which has very small disk size. Because of this, it is difficult to install new packages or upgrade existing packages. Another issue is, if disk is full, virtual routers will not work because cloudstack will write some files to local disk when new configurations are applied to virtual routers.

Here is the partitions of a virtual router

root@r-220-VM:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            110M     0  110M   0% /dev
tmpfs            49M   25M   24M  52% /run
/dev/sda5       1.1G  714M  342M  68% /
tmpfs           121M     0  121M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           121M     0  121M   0% /sys/fs/cgroup
/dev/sda1        92M   35M   57M  39% /boot
/dev/sda6       435M   31M  400M   8% /var
/dev/sda7        75M  1.6M   72M   3% /tmp
tmpfs           121M   20K  121M   1% /ramdisk
tmpfs            25M     0   25M   0% /run/user/0
ISSUE TYPE

Improvement Request

COMPONENT NAME

SystemVM Template

CLOUDSTACK VERSION

4.14 (?)

SUMMARY

It would be nice to make disk size of systemvm configurable. To archive it, we need to (1) add global setting to indicate the disk size of systemvms and virtual routers (2) allocate disk with new size when provision the systemvm and virtual routers (3) install some packages/scripts in sysemvm template, so systemvm/vr can be auto-resized when systemvm/vr start. some documents in openstack: https://docs.openstack.org/image-guide/openstack-images.html#disk-partitions-and-resize-root-partition-on-boot-cloud-init

We might need to change scripts to build the systemvm template (to have only one partition in systemvm ?)

this is related to #3426 @rhtyd

ustcweizhou avatar Jul 02 '19 08:07 ustcweizhou

I think it would be much better to create a new template instead of modifying VRs in-place. That way, you will always get a consistent setup whenever you create or recreate a new system VM.

onitake avatar Jul 02 '19 08:07 onitake

@onitake do you mean create a new systemvm template with bigger disk size ? official release or by ourselves ?

If by ourselves, we need to (1) create a vm from systemvm template (2) resize disk (3) resize partitions (4) stop the vm (5) create a template from the vm (6) upload systemvm template (7) set template type as SYSTEM in database (8) change global settings

any other step I missed ?

We have used cloud-init to autoresize /autogrow on partitions for many vm templates without any issue. The consistent or inconsistent on disk size of systemvm/virtual routers is not important for us. systemvm/virtual routers can have different disk size, same user vm instances. If disk of a virtual router is almost full, we can restart network with cleanup to create a new virtual router with bigger size, if disk size is configurable.

ustcweizhou avatar Jul 02 '19 09:07 ustcweizhou

We create our own systemvm templates and have switched to just root/boot partitions as the many partitions approach just led to inefficient use of space.

richardlawley avatar Jul 03 '19 08:07 richardlawley

@richardlawley yes, that's also what we did.

@rhtyd can we do in three steps ? (1) only one partition in systemvm template (2) a fixed bigger disk size (?) (3) configurable disk size. this has low priority if the default size is increased.

ustcweizhou avatar Jul 03 '19 09:07 ustcweizhou

@ustcweizhou @richardlawley yes, we can consider that. The main reason to keep separate partitions was to ensure that filling of logs and process creates files in /var/cache/cloud doesn't kill the VM. Do note that the VR could be public facing and may be prone to attacks.

I would propose to keep at least the /var as a separate partition and to support pvgrub based boot on xenserver the /boot has to be an ext2 (separate) partition.

I think starting 4.11.2+, there is an option to pass and specify the root disk size we could (1) introduce a systemvm/vr specific global setting that is the root disk size, which is not defined/null by default, (2) when this global setting is defined it resizes the root disk before deployment, (3) during patching via bootstrap.sh the script can extend one or all the partitions to fill any empty space if necessary and if we move to something like cloud-init it can do that for us.

I've few other ideas around the new systemvmtemplate, where the whole root disk could be simply used as data disk while the appliance OS (a custom debian 10 or alpine based) boots via the systemvm.iso directly as a read-only system (no need to ship separate systemvmtemplate appliances and force users to go through the register/setup steps during install/upgrade). I also have some ideas that I'll document and propose after 4.13 around live patching (no need to reboot VRs during upgrade), runc/containerd inclusion for dnsmasq/nginx/strongswan/* services and a light-weight tls-secured VR agent than use the ssh-based programming model. More on that after 4.13. cc @PaulAngus

yadvr avatar Jul 03 '19 09:07 yadvr

@rhtyd awesome !!

ustcweizhou avatar Jul 03 '19 10:07 ustcweizhou

@rhtyd linking this one with #3601 if you feel we have the bandwidth, otherwise let's move this one for 4.15?

andrijapanicsb avatar Jan 03 '20 15:01 andrijapanicsb

We are not doing debian10 for this releases systemvm template so moving this to 4.15 milestone

andrijapanicsb avatar Jan 13 '20 19:01 andrijapanicsb

cc @Pearl1594

yadvr avatar Aug 09 '21 09:08 yadvr

This was addressed as part of https://github.com/apache/cloudstack/pull/3900 -which is now part #4329.

Pearl1594 avatar Aug 09 '21 09:08 Pearl1594

This was addressed as part of #3900 -which is now part #4329.

cool. thanks @Pearl1594

weizhouapache avatar Aug 19 '21 09:08 weizhouapache

Let's close this if this is already moved/merged in #4329 @weizhouapache ?

yadvr avatar Aug 19 '21 10:08 yadvr

Let's close this if this is already moved/merged in #4329 @weizhouapache ?

@rhtyd closing now.

weizhouapache avatar Aug 19 '21 11:08 weizhouapache