16:00:05 #startmeeting cinder-nova-api-changes 16:00:06 Meeting started Thu Apr 20 16:00:05 2017 UTC and is due to finish in 60 minutes. The chair is ildikov. Information about MeetBot at http://wiki.debian.org/MeetBot. 16:00:07 Useful Commands: #action #agreed #help #info #idea #link #topic #startvote. 16:00:09 o/ 16:00:10 The meeting name has been set to 'cinder_nova_api_changes' 16:00:14 o/ o/ o/ 16:00:16 o/ 16:00:20 DuncanT ameade cFouts johnthetubaguy jaypipes takashin alaski e0ne jgriffith tbarron andrearosa hemna erlon mriedem gouthamr ebalduf patrickeast smcginnis diablo_rojo gsilvis xyang1 raj_singh lyarwood breitz jungleboyj 16:00:22 o/ 16:00:31 \o 16:00:34 mriedem: hi :) 16:00:42 ./ 16:01:05 o/ 16:01:14 o/ 16:01:55 I think we can start :) 16:02:36 o/ 16:02:49 so ongoing things are updating the detach flow in Nova 16:02:57 and remove check_detach at this point 16:03:02 https://review.openstack.org/#/c/438750/ has a +2 16:03:41 a quick nit on that, do we also need to delete the attachment_id from the bdm when we are removing the attachment? 16:03:41 mriedem: awesome, thank you :) 16:04:06 oh hmm 16:04:18 lyarwood: actually we should :S 16:04:22 does the BDM get deleted at that point? 16:04:30 I guess not always 16:05:32 yeah sorry trying and failing to think of a use case where it would remain, ignore me, I'll follow up in the review if I find one 16:05:46 well, 16:05:52 it's a good question, 16:05:56 terminate connection ones 16:06:07 but things that are keying off attachment_id would see it's not set and then do any old path stuff 16:06:11 but wait, no attachment delete there 16:06:23 mriedem: good point 16:06:54 although after you detach a bdm, not sure what you would do with it, unless its already attached somewhere else or about to be attached somewhere else 16:06:55 but that's only on the detach flow right? attach isn't going to use attachment_id, it's just always going to use the new flow. 16:07:08 lyarwood: I think that might be the key bit 16:07:17 detach_volume in the compute manager deletes the bdm 16:07:21 after the detach 16:07:27 lyarwood: attach will set it in the BDM 16:07:39 unless it's doing a rebuild 16:07:45 lyarwood: attach will use microversions to decide what flow to use 16:08:06 hmm, this is going to be weird with rebuild/evacuate 16:08:07 o/ 16:08:29 i believe rebuild models things with a single bdm 16:08:30 well, on the new host its an attach flow 16:09:55 ... I wonder if we really detach the attachment, rather than the BDM, oh my, my head is mashed :( 16:10:03 mriedem: you mean updating or not updating the attachment_id? 16:11:17 mriedem: johnthetubaguy: do you have kind of a state machine for the BDM? 16:11:34 just to try to figure out what happens with it in each use case 16:12:06 hells no 16:12:11 I think we wrote it out in the spec 16:12:19 I wouldn't want to go down that path here 16:12:29 johnthetubaguy: so rebuild is either going to delete the old bdm and create a new bdm, or update the single bdm with the new attachment_id 16:12:31 i think 16:12:40 yeah, I think it does the update 16:12:51 you know connection_info 16:12:52 because it's the same volume 16:12:58 we have to store that 16:12:58 same volume, different attachment 16:13:01 so we don't loose it 16:13:07 yeah so i'm still +2 16:13:10 I think attachment_id will have to be done in the same way 16:13:13 yeah, I think me too 16:13:36 either way, I think its fine with what uses that code right now 16:13:47 yeah that too, 16:13:51 we can flush out other demons later 16:13:55 +1 16:14:00 its a problem for live-migrate 16:14:02 etc 16:14:12 yeap, I'm trying to organize the chain of patches right now 16:14:28 I had to accept I cannot really avoid doing that... :/ 16:14:39 yeah i was trying to figure out what to review next 16:14:42 since it's not a series that's hard 16:15:08 i guess https://review.openstack.org/#/c/456896/ is next? 16:15:33 since some things build on top of that 16:16:21 hmm... is there not a way to do an explicit flow 16:16:29 like API operation X 16:16:42 i think that's what ildikov tried to do 16:16:49 the common things are at the bottom, 16:16:53 mriedem: that can be 16:16:54 but then each api is handled separately 16:16:56 not in a chain 16:16:57 ah, my bad, I see 16:17:07 i just don't personally want to handle live migration right now... 16:17:17 yeah 16:17:25 mriedem: I tried to re-use terminate_connection, re your comment on try not to do too much copy-paste there 16:17:26 maybe migrate would be easier, or rebuild? 16:17:46 honestly, I would add a new method, and consolidate if it makes sense 16:18:04 to stop accidentally using the new stuff, I was thinking 16:18:13 mriedem: but it's not crystal clean yet whether that was a good idea or not 16:18:23 mriedem: I meant _terminate_volume_connections to be clear 16:18:25 ildikov: in https://review.openstack.org/#/c/456896/3/nova/compute/manager.py ? 16:18:41 ok i see 16:19:16 you know what, we need create before delete 16:19:55 mriedem: yes 16:20:13 mriedem: attachment_create is there by mistake in that patch 16:20:47 johnthetubaguy: accidentally use new stuff? 16:21:19 ildikov: i agree with lyarwood in that change, comments inline 16:21:27 i don't see anything calling _terminate_volume_connections that already has a connector in scope 16:21:30 unless those come later in the series 16:21:37 ildikov: I will describe more in the patch 16:21:43 johnthetubaguy: ok 16:21:53 ah, so I think I mean what mriedem just said 16:22:07 oops, maybe not 16:22:38 i guess swap_volume is the one that already has the connector 16:22:47 so https://review.openstack.org/#/c/456896/3/nova/compute/manager.py is prematurely optimizing 16:23:41 mriedem: we have it here for instance: https://review.openstack.org/#/c/456988/1/nova/compute/manager.py 16:24:22 doesn't attachment_create need the connector here? 16:24:31 my bad, its the wrong one 16:24:43 ildikov: yeah we don't need that yet in https://review.openstack.org/#/c/456896/3/nova/compute/manager.py 16:24:46 comments inline 16:24:52 anyway, we could review by committee later :) 16:24:55 should we move on? 16:25:03 johnthetubaguy: I thought it just reserves at this point, but we might actually want to connect as well 16:25:22 I don't think you do the connect in there right now 16:25:42 creating an attachment in the _terminate_volume_connections method is wrong 16:25:44 I think thats correct, because we are on the wrong host to get the destination connector 16:25:56 mriedem: I think its only needed for the old API case 16:25:57 I only split the code into multiple patches and that was it 16:26:01 so whatever patches do that, like swap_volume, will need something different 16:26:11 my bad, but I didn't have more bandwidth for it this week :( 16:26:39 mriedem: ++ 16:26:45 mriedem: when you create an attachment without connector that only keeps the volume reserved 16:27:06 mriedem: I think thats what I was trying to say earlier with my create a new method for this, it feels like we have many uses, not all need to do the attachment create 16:27:11 mriedem: we can do that later, but then the volume will be out there available 16:27:16 oh, its worse than that isn't it.... 16:27:58 the attachment delete is needed when we both detatch and terminate connection, but when we just terminate connection, we probably want to create then delete 16:28:12 I added a keep_reserved boolean to that method later on and when that's True that's when I wanted to do the attachment_create to reserve 16:28:19 I am not sure I understood what I just said there 16:28:44 honestly, I would do swap with all brand new code, then we look for shared code later? 16:28:52 the first patch there shouldn't have attachment_create regardless 16:28:54 I know thats going to mean cut and paste in the mean time 16:29:09 johnthetubaguy: Seems a reasonable approach though. 16:29:11 mriedem: do you think that would work ^ 16:29:18 As long as the clean up work gets identified and done. 16:29:24 I just think we are going to confuse ourselves with premature optimizations here 16:29:27 johnthetubaguy: works for me, I only tried this per request from mriedem, I can switch back to new code 16:29:50 its a good idea to try, but its bending my mind reviewing this stuff 16:30:01 agreed we need no cut and paste in the end, like smcginnis said 16:30:26 Let's get it working first, then get it cleaned up. 16:30:44 so... I am thinking about to nova-network and neutron integration 16:30:45 i think re-using code is fine, if it's done properly, 16:30:45 smcginnis: +2 16:30:47 fair enough, I will reorganize this when I do that chaining up 16:30:51 there are just simple mistakes in these patches 16:30:55 that once removed are not a problem 16:31:07 mriedem: maybe 16:31:12 i've commented in two of them 16:31:36 ildikov: is bandwidth going to be an issue over the next week? Happy to take on swap_volume for example if it is. 16:31:54 so what's the issue with the keeping the volume reserved think? 16:31:57 that's for swap volume? 16:32:14 because as it stands, the code is deleting the attachment and then creating a new attachment w/o a connector to fake out that the volume is still reserved 16:32:17 that's lossy 16:32:26 we have to have a better way to make that atomic 16:32:32 can't we update the attachment to drop the connector? 16:32:36 you don't need the connector 16:32:39 lyarwood: let's sync up after the meeting as if I put all these into one chain then it's tough to share the work on it 16:32:55 oh, sorry, thats not your question 16:33:09 mriedem: the API we have is create a new one, then delete it, to make it atomic 16:33:10 mriedem: I suggested that during the spec review but I don't think the api can do that at the moment 16:33:16 mriedem: the Cinder code does not support that at the moment 16:33:30 ildikov: does it support the reverse ordering? 16:33:36 create then delete 16:33:50 mriedem: and when I last talked to jgriffith we kind of agreed it would be better not to mess up update with that case 16:33:55 ok, create new attachment (w/o connector), delete old attachment (that had connector), then update new attachment with new connector? 16:34:08 mriedem: yeah, that I thought what the plan 16:34:17 it'd be nice if attachment update could just be atomic 16:34:20 mriedem: agreed its messy 16:34:26 since the client has to jump through hoops now 16:34:37 johnthetubaguy: we might be able to do that, I don't think anything prevent us from reversing that order 16:34:37 and it means the client has to know the internal state machine of cinder for how attachments work 16:34:39 so live-migrate has to do that flow anyway, as both are connected for some time 16:34:58 ildikov: we need the reverse order for live-migrate, so I hope it works 16:35:28 yeah create new attachment on destination host, once live migration is done, delete old attachment from source host 16:35:32 we do the same with ports 16:36:40 johnthetubaguy: iirc you called that flow out in the spec so it is allowed 16:36:41 johnthetubaguy: I think it should, I don't recall anything that would fail with that case right now 16:37:11 lyarwood: yeah, I remember jgriffith gave me a funny look about that, so I am curious if it made it into the code 16:37:47 mriedem: FWIW, its causing big problems with ports 16:38:05 johnthetubaguy: what kind of problems? 16:38:34 so its probably a total distraction here, its specific to how neutron does a partial attach 16:38:43 and live-migrate, naturally 16:38:57 I just asked as if we have anything similar to that here then we could try to do it better for volumes 16:39:05 johnthetubaguy: are you referring to all of the stuff we talked about with neutron in BCN that we never implemented? 16:39:11 mriedem: yeah 16:39:31 mriedem: they wouldn't implement it, because we wouldn't approve our side of the work, or something like that 16:39:40 and it wasn't high priority 16:39:44 oh mututally assured destruction, i see 16:39:45 but anyways, thats a total rat hole 16:39:54 *mutually 16:39:58 * johnthetubaguy nods 16:40:13 well it was ocata, 16:40:17 we had 3 people and 3 months to do anything 16:40:18 so... 16:40:35 anyway, 16:40:38 comments are in the patches 16:40:41 what else? 16:41:10 seems like we have the stuff for next week 16:41:26 who was working on those, I forget lyarwood or ildikov or both? 16:41:30 we could decide what to do with remove check_detach: https://review.openstack.org/#/c/446671/ 16:41:55 johnthetubaguy: me for sure, I will sync up with lyarwood and stvnoyes to see how we can share work items 16:42:04 sweet 16:42:24 #action ildikov will sync up with lyarwood and stvnoyes to see how we can share work items 16:42:31 check_detach 16:42:34 johnthetubaguy: and I will hunt down jgriffith as we're in the same town today and figure out what we touched on today to see what to do with these edge cases 16:42:42 so I totally missread the code and got all worried about breaking the API 16:43:10 it seems the extra checks are very much "belt and braces" stuff, by which I mean overkill 16:43:37 ildikov: is that right, its just redundant checks we are removing here really 16:44:35 johnthetubaguy: check_attach and check_detach were/are checks remained here from the ancient times when Cinder became a separate entity in my understanding and from what I saw in the code so far 16:45:02 johnthetubaguy: and I personally believe in code clean up and deleting code time to time and this seems like a good time for it 16:45:33 check_attach had implications for api behavior, 16:45:34 johnthetubaguy: and finally in my view Nova should not track the volume state in these cases as it's Cinder's responsibility really 16:45:38 so it required service version checks and the like 16:45:45 ildikov, +1 16:45:52 i also love deleting code 16:45:54 mriedem: that was because of a missed reserve_volume call 16:46:07 but i don't assuming every service is always upgraded to the latest level at the same time 16:46:07 ildikov: I support all your aims, I am just trying to work out if the change is safe 16:46:28 so I think we made the Nova side code better overall with that :) 16:46:31 having said all that, i haven't gone through the check_detach patch, it might be less messy 16:46:35 I mean if it were me merge code deletes should deliver you a cookie 16:46:48 mriedem: I think it is 16:46:50 i didn't get a cookie for removing os-pci 16:47:10 anyway...moving on? 16:47:14 mriedem: we can sort this out in Boston :) 16:47:24 so... I have a quick question 16:47:28 mriedem: plz check the patch, it's pretty small, should be a piece of cake 16:47:29 begin_detaching... 16:47:36 mriedem: sorry, cookie :) 16:47:44 what does that get replaced by in the new world? 16:48:15 i.e. one we use the new attachment API 16:48:31 johnthetubaguy: you or someone from Cinder should remind me what that does exactly before I try to answer that question 16:48:51 its the API that does the state check, to see if we can detach 16:48:54 cinder API 16:49:11 I don't think it exists in the new API, so Nova would have to manual check the state 16:49:38 I think it does attached -> detaching state change on the volume in the old world 16:50:06 johnthetubaguy: we shouldn't solve anything on the Nova side that belongs to Cinder 16:50:21 I agree, but the API doesn't let us do that 16:50:59 we can also re-evaluate the states that we're maintaining in Cinder, if all of them are needed then we can check what's missing and fix it 16:51:15 so... actually, about that patch we just approved 16:51:25 I mean fix where the fix should happen 16:51:29 I guess we actually still call begin_detaching, which I don't think we are allowed to? 16:51:55 so maybe begin_detaching is in the new API too, I wasn't ever 100% clear on that 16:52:29 begin_detaching changes the volume status from in-use to detaching, 16:52:35 right 16:52:38 sorry 16:52:39 I don't think it is 16:52:40 if we fail to detach, we call roll_detaching to put it back into in-use state 16:53:23 maybe thats why we dropped it in the new API, my memory is sketchy on that now 16:53:30 if begin_detaching isn't available in the new api, shouldn't it fail if you request it at microversion >= 2.37? 16:53:32 *3.27 16:53:47 or is it just a noop? 16:53:57 mriedem: I meant that the new flow doesn't use it, the code is available still 16:53:59 i guess this is homework for cinder 16:54:07 I think so 16:54:18 so to be clear, I think this is the new flow 16:54:36 check BDM state, continue (maybe check cinder is in sync-> attachment still exists) 16:54:44 give early error to uses it was a bad API call 16:54:45 etc 16:54:48 then we do stuff 16:54:52 then delete attachment 16:55:01 why does begin_detaching even exist? 16:55:03 so its like one cinder API call only in the new flow, I think 16:55:04 I thought there was a reason it was no longer needed, but we can verify that. 16:55:16 who cares if the volume is being detached? 16:55:21 so the code we are deleting seems to be needed in the new flow 16:55:22 it's either in-use or it's not 16:55:26 mriedem: correct 16:55:35 mriedem: +1 16:55:43 begin_detaching was probably some internal nova-volume thing, externalized in the cinder api 16:56:12 its just so you get a detaching... state in the API 16:56:18 actually, thats a good point 16:56:18 same with putting the volume in reserved state, but that's a bit trickier because we need to reserve the volume in nova-api and then put it in-use in the compute 16:56:24 the new flow changes the API state changes 16:56:35 well it was also used to try and prevent race conditions 16:56:43 reserve just == "in use" I think 16:56:43 hemna: which one? 16:56:52 mriedem: if we would ever get there to multi-attach I guess we might not want to attach and detach at the same time? 16:56:57 two people calling detatch... damm it 16:56:59 multiple detaches happening at the same time 16:57:14 re: volume state mgmt 16:57:18 grr, we missed that one 16:57:31 right now it will fail on the compute due to the locking going on there 16:57:39 so request 1 puts the volume into detaching state, request 2 fails because the volume is already detaching 16:57:44 wich is a poor API expereience 16:57:45 yah 16:57:59 and we don't have this with the new flows? 16:58:08 if it's already detaching, then isn't the 2nd api request a success ? 16:58:10 i.e. we can't use begin_detaching with the >=3.27? 16:58:11 it's detaching.... 16:58:19 except multi-attach 16:58:29 we have 2 minutes left 16:58:32 mriedem: we can and I think we still do actually 16:58:36 but this is why we can't just rip code out willy nilly 16:58:48 i said it, willy nilly 16:58:57 lol :) 16:59:12 anyway we're out of time 16:59:13 mriedem: it's check_detach I would love to rip out 16:59:35 we can continue on the Cinder channel and code reviews 16:59:50 * willynilly wants to remove check_detach 16:59:51 * johnthetubaguy needs to go cook his dinner 16:59:57 or Nova channel, whichever we want to 17:00:00 heh 17:00:09 thanks everyone for today 17:00:29 #endmeeting