| Posted | Nick | Remark | |
|---|---|---|---|
| #openstack-nova - 2020-07-01 | |||
| 14:36:55 | lyarwood | yeah apologies, I assumed it was an available option across the subcommands but that isn't the case | |
| 14:37:20 | lyarwood | we can just truncate RAW files | |
| 14:37:38 | lyarwood | but these are qcow2 | |
| 14:38:05 | sean-k-mooney | we dont allow resize down of attached volumes right | |
| 14:38:10 | sean-k-mooney | that sound bad | |
| 14:38:13 | lyarwood | no I don't think so | |
| 14:38:28 | sean-k-mooney | so you just mean use the truncate command but not to shrink | |
| 14:38:49 | lyarwood | https://docs.openstack.org/api-ref/block-storage/v3/index.html?expanded=extend-a-volume-size-detail#extend-a-volume-size | |
| 14:38:59 | lyarwood | sean-k-mooney: yeah you can use truncate to grow files | |
| 14:39:32 | lyarwood | sean-k-mooney: but that wouldn't work in this case as it wouldn't update the qcow2 headers to use the extra space | |
| 14:39:33 | sean-k-mooney | ya wasnt sure if you ment the command or not | |
| 14:39:45 | sean-k-mooney | yes | |
| 14:40:45 | lyarwood | a hackaround would be to use swap_volume in n-cpu to switch to a larger file | |
| 14:41:12 | sean-k-mooney | lyarwood: so what we likely need to do is if the volume is attach have the backend not resize it and have nova via the qemu monitor command have qemu do the resize | |
| 14:41:24 | lyarwood | tbh using that approach for all backends might be nicer anyway now I think about it | |
| 14:41:43 | sean-k-mooney | so if volume is available then c-vol will do the resize else nova will just invoke qemu to do it | |
| 14:41:59 | sean-k-mooney | and we never call qemu-img for nfs backend | |
| 14:42:16 | lyarwood | block resize by QEMU isn't going to resize the file | |
| 14:42:27 | lyarwood | just as it isn't going to resize host devices for other backends AFAIK | |
| 14:43:08 | sean-k-mooney | so `sudo virsh qemu-monitor-command ubuntu18.04 --hmp "block_resize drive-virtio-disk1 2G"` | |
| 14:43:14 | sean-k-mooney | wont grow the file | |
| 14:43:22 | sean-k-mooney | lseki: didnt you say that worked | |
| 14:43:25 | lyarwood | I don't believe so | |
| 14:43:44 | sean-k-mooney | for qcow it does not need to make the file physically bigger | |
| 14:43:51 | sean-k-mooney | just update the headers | |
| 14:44:02 | sean-k-mooney | so that qemu can allocate it when needed | |
| 14:44:12 | sean-k-mooney | which is what we want. e.g. keep the file sparse | |
| 14:44:58 | lyarwood | hmmm is that enough? | |
| 14:45:11 | sean-k-mooney | im not sure but lseki could test with dd? | |
| 14:45:37 | lyarwood | I thought you had to at least grow the sparse file so it looks like it's 2G before you can update the qcow2 headers to be 2G | |
| 14:46:05 | sean-k-mooney | not sure but it sounds like something we should test | |
| 14:46:22 | lyarwood | yup | |
| 14:46:23 | lyarwood | brb | |
| 14:47:19 | sean-k-mooney | lseki: can you try that. grow you iamge to like 10G and then use dd to crate a 5G file in the vm | |
| 14:47:27 | lseki | sean-k-mooney: lyarwood oops, I was using a raw file instead of qcow | |
| 14:47:36 | sean-k-mooney | if it had less then 2G before that would fail | |
| 14:47:50 | sean-k-mooney | lseki: oh in that case what the size of the file on disk after that command | |
| 14:47:56 | sean-k-mooney | did it grow it to 2G | |
| 14:48:22 | lseki | yes it did, and `lsblk` inside the vm also is updated to 2G | |
| 14:48:54 | sean-k-mooney | could you convert it over to a qcow boot a vm with the new image and then grow it to say 4G | |
| 14:49:01 | sean-k-mooney | using the same command on the new vm | |
| 14:49:12 | sean-k-mooney | lets see if it will do the right thing in that case | |
| 14:49:30 | sean-k-mooney | if so i think we have a way to adresss this | |
| 14:51:52 | lseki | let me try that... | |
| 15:03:37 | lyarwood | sean-k-mooney: TIL I didn't think blockResize did that, given that we resized the file before I guess that was the case and something has changed? | |
| 15:04:14 | sean-k-mooney | from the name that is what i would expect ti to do | |
| 15:04:28 | sean-k-mooney | maybe not for host devices | |
| 15:04:32 | sean-k-mooney | but for files at least | |
| 15:04:34 | lyarwood | yeah it can't for host devices | |
| 15:05:02 | lyarwood | I might be mixing things up with blockRebase tbh | |
| 15:40:56 | lseki | sean-k-mooney: I downloaded a cirros image and booted a vm from it. I successfully extended the volume to 4G. | |
| 15:41:20 | lseki | https://www.irccloud.com/pastebin/QF9Dk7Wa/ | |
| 15:42:06 | lseki | within the vm: | |
| 15:42:11 | lseki | https://www.irccloud.com/pastebin/QJ8flBUZ/ | |
| 15:43:42 | lseki | though it didn't work when the disk was attached using the default IDE bus | |
| 15:43:53 | lseki | https://www.irccloud.com/pastebin/pv6e5QOF/ | |
| 15:44:26 | lseki | so I had to specify virtio bus while booting the vm `--disk cirros-0.5.1-x86_64-disk.img,bus=virtio` | |
| 15:47:12 | openstackgerrit | Merged openstack/nova master: Correct reported system memory https://review.opendev.org/733827 | |
| 15:47:30 | openstackgerrit | Merged openstack/nova master: Extend is_ipv6_supported() to cover more error cases https://review.opendev.org/736167 | |
| 15:50:23 | stephenfin | bauzas: Thanks for that review. You'd probably also be interested in gibi's follow-up fix here https://review.opendev.org/#/c/737508/ | |
| 15:50:50 | bauzas | stephenfin: ack, thanks for helping me to go off some hardware discussion, my brain being fried ;) | |
| 15:50:57 | stephenfin | :P | |
| 15:51:08 | stephenfin | anytime, buddy | |
| 15:59:12 | bauzas | gibi: stephenfin: holding my +W on https://review.opendev.org/#/c/737508/3 just for saying I honestly feel we should document this | |
| 15:59:32 | bauzas | and not leave operators discovering it by themselves | |
| 15:59:39 | bauzas | but, a FUP for course | |
| 16:25:51 | stephenfin | bauzas: To be honest, I thought that was assumed and I can't find anywhere easy to slot it in :-\ | |
| 16:30:25 | bauzas | stephenfin: right, hence my main comment | |
| 16:30:33 | bauzas | anyway, you saw it, +Wing | |
| 16:50:02 | sean-k-mooney | while the libvirt driver could work on non linux hosts. it has been deployed on freebsd years ago that has never really been supported | |
| 16:50:56 | sean-k-mooney | we make assumtions about linux in the code to day so i doubt you could make it work on say window easily even if you wanted too | |
| 16:57:15 | lseki | lyarwood: oh, and the volume size started with 39M, but after doing some dd inside the vm it growed to 2G | |
| 16:59:23 | sean-k-mooney | lseki: so the qcow stayed sparse until we actuly wrote data too it | |
| 16:59:30 | sean-k-mooney | which is what we want right | |
| 16:59:35 | lseki | yes | |
| 17:00:56 | sean-k-mooney | so to summerise 1, we should modify the cinder nfs backend to only extend voluem if its not attached to a vm, 2 when we are using nfs voluem in nova we should skip calling qemu-image and jsut do a block resize via the qemu monitor command | |
| 17:01:36 | sean-k-mooney | lyarwood: ^ does that make sense too you? | |
| 17:04:02 | sean-k-mooney | lseki: for the ide case did you use the correct name? | |
| 17:04:24 | sean-k-mooney | i mean it wont be drive-virtio-disk0 right | |
| 17:04:43 | sean-k-mooney | it would be something like drive-ide-disk0 | |
| 17:05:06 | lseki | sean-k-mooney: I tried the one shown by dumpxml, which is simply `disk` | |
| 17:05:19 | lseki | let me try with `drive-ide-disk0` | |
| 17:06:30 | sean-k-mooney | well its just disk for virtio as well | |
| 17:06:32 | sean-k-mooney | <disk type='file' device='disk'> | |
| 17:06:46 | sean-k-mooney | i think you are looking for the alias element | |
| 17:06:47 | sean-k-mooney | <alias name='virtio-disk0'/ | |
| 17:09:15 | lseki | oh that's right, so I should use `drive-ide0-0-0` for ide | |
| 17:09:23 | lseki | yeah it works :-) | |
| 17:09:34 | sean-k-mooney | cool | |
| 17:09:47 | sean-k-mooney | so we can lookup the alais from the xml | |
| 17:09:56 | sean-k-mooney | i assume its jsut ide0-0-0 | |
| 17:10:06 | sean-k-mooney | and we need to prepend drive- | |
| 17:11:11 | lseki | yes | |
| 17:13:17 | sean-k-mooney | im not going to ask you to test ceph but it might be intersting to see if we could use this patteren for other drivers too and avoid the calll to qemu-img | |
| 17:13:26 | sean-k-mooney | that can be a step 3 | |
| 17:13:38 | sean-k-mooney | after 1 and 2 | |
| 17:13:49 | sean-k-mooney | whcih will fix your usecase | |
| 17:19:15 | lseki | so currently cinder nfs driver calls qemu-img resize to extend a volume, attached or not | |
| 17:19:15 | lseki | https://github.com/openstack/cinder/blob/master/cinder/volume/drivers/nfs.py#L380 | |
| 17:19:15 | lseki | https://github.com/openstack/cinder/blob/master/cinder/image/image_utils.py#L408 | |