[nova] local LVM volume on compute hosts

Sean Mooney smooney at redhat.com
Fri Jun 10 13:43:55 UTC 2022


On Fri, 2022-06-10 at 13:13 +0000, Paul Harrison wrote:
> 
> > On 2022-06 -08, at 08:26, Paul Harrison <paul.harrison at manchester.ac.uk> wrote:
> > 
> > 
> > 
> > > On 2022-06 -07, at 13:25, Sean Mooney <smooney at redhat.com <mailto:smooney at redhat.com>> wrote:
> > > 
> > > no there is noting else you need to configure but this option is not what you think it is.
> > > the images_type option contols what storage will be used for all non cinder storage.
> > > i.e. vms that are booted with out usign a boot volume.
> > > 
> > > 
> 
> > > 
> > > so your current config will make any non boot from volume nova instance use lvm storage to provision the vm root/swap/epmeral disks
> > > but will not prevent end users requesting cinder data voluems or boot volumes via the cli/api. if the opt in to cinder stoage that
> > > is what they will recive but if they use teh default storage provided by the flaovr then it will be local.
> > 
> > thanks for the explanation - it is a shame that there is not a more direct way in config to force local storage - looks like https://blueprints.launchpad.net/nova/+spec/use-libvirt-storage-pools <https://blueprints.launchpad.net/nova/+spec/use-libvirt-storage-pools> has never got enough votes for implementation.
> > 
> > 
> 
> I have discovered the reason why my original setup was not working (it would fail if I tried to force in the GUI, by specifying “no” to "create new volume”) - I think it was failing here
> 
> https://opendev.org/openstack/nova/src/commit/d86916360858daa06164ebc0d012b78d19ae6497/nova/virt/libvirt/imagebackend.py#L722
> 
> as the volume group device does not appear when there are no logical volumes in the group (in Centos 8 stream at least). So I forced the creation of that device by adding a dummy logical volume.
> 
> Anyway, the situation is now that I can create instances that will use compute node local LVM storage, if I start them from the GUI, but not from the command line.

so on the commandlien to use local storage assume you have a flavor with root disk not equal to 0 is as follows
openstack server create --flavor <local storage flavor> --image <my image> --network <my network> <vm name>

you can try somethign like this
export IMAGE_URL=https://github.com/cirros-dev/cirros/releases/download/0.5.1/
ARCH=$(uname -m)
export IMAGE=cirros-0.5.1-${ARCH}-disk.img
curl --fail -L -o cirros.qcow ${IMAGE_URL}/${IMAGE} 
image create --disk-format qcow2 --container-format bare --public --file cirros.qcow cirros
openstack flavor create --public local-storage-tiny --id auto    --ram 256 --disk 1 --vcpus 1
openstack network create lvm-test
openstack subnet create --subnet-range 10.0.0.0/24 --network lvm-test \
    --gateway 10.0.0.1 --dns-nameserver 8.8.8.8 demo-subnet
openstack router create lvm-router
openstack router add subnet lvm-router lvm-subnet
# assuming your public external network is called public
openstack router set --external-gateway public lvm-router
openstack server create --flavor local-storage-tiny --image cirros --network lvm-test local-storage-vm


this is losely based on https://github.com/openstack/kolla-ansible/blob/master/tools/init-runonce


> 
> I had a look at what the GUI sends to the /api/nova/servers/ endpoint
> 
> {"availability_zone":"nova","config_drive":false,"user_data":"","disk_config":"AUTO","instance_count":1,"name":"fromgui","scheduler_hints":{},"security_groups":["48648c10-ce91-4916-9347-d88fbdba9ce6"],"create_volume_default":true,"hide_create_volume":false,"source_id":"b2a3ca46-8b0b-4748-863f-6f3e11301872","flavor_id":"da28d141-3d05-4f0f-a188-229352ccf0a3","nics":[{"net-id":"5e7a171a-ceda-4051-abe6-0496e2e8e154","v4-fixed-ip":""}],"key_name":"cloud”}
> 
> However, I have not been able to find the set of command line switches for "openstack server create" that achieve the same effect - if someone knows, I would be grateful.
> 
> Thanks,
> 	Paul.
> 
> p.s. I was not really able to match up what the GUI sends with the API spec either. https://docs.openstack.org/api-ref/compute/?expanded=create-server-detail#create-server
> 
> 




More information about the openstack-discuss mailing list