Earlier  
Posted Nick Remark
#openstack-nova - 2018-04-24
16:02:03 melwitt what I mean is decouple the two (creating port vs plugging vif). because that patch moved both of them earlier, so I was thinking maybe decoupling them to leave the port create earlier but do the vif plug later (back to the original place). I need to look at it more to see if what I'm saying makes sense or not
16:03:57 melwitt oh, all prepare_networks_before_block_device_mapping does is plug vifs. it doesn't create the port
16:04:36 melwitt hm, I didn't think vif plugging had anything to do with getting an IP address. I thought that was connected to the port creation
16:16:30 TheJulia efried: I completely forgot about that *blink* *blink*
16:16:38 TheJulia feels like a lifetime ago
16:17:16 melwitt TheJulia: I see that the patch gets the IP address from the attached vif from ironic. is there some reason why we couldn't just use the IP address from the neutron port instead of attaching the vif early? https://developer.openstack.org/api-ref/network/v2/#show-port-details
16:17:46 jaypipes melwitt: it's not really port creation that is needed. it's IP allocation.
16:18:04 jaypipes melwitt: but if that's what you mean by port creation, then yes, decoupling those things would be ++
16:18:24 melwitt okay, so with ironic driver we don't get an IP when we create a port in neutron? or do we not even create a port in neutron when ironic driver?
16:18:39 jaypipes melwitt: as with most thing neutron, it depends :)
16:19:16 TheJulia heh
16:19:35 jaypipes melwitt: if the subnet upon which the port resides uses DHCP, then the IP is doled out to the port after the port is set up on the host.
16:19:47 TheJulia I think if we could get the IP address in advance then ++++++ but I'm having strong deja vu, I just can't place it at hte moment
16:19:53 melwitt okay. yeah, from what I understand, creating the port in neutron will allocate the IP(s). plugging the vif will just attach the instance to the network. so I was thinking can we decouple that and get the IP from neutron instead of getting it from ironic by way of the vif
16:19:56 TheJulia uhg, yeah
16:20:04 TheJulia which means the port has to be plugged to have correct dhcp information
16:20:07 jaypipes melwitt: in TheJulia's case, I think that basically the only way that it will work is if an IP is statically assigned ahead of time.
16:20:42 jaypipes melwitt: but I'm definitely no expert in Neutron-isms. Perhaps sean-k-mooney is a good person to ask about this if not mriedem.
16:20:44 melwitt jaypipes: oh, I see. I wasn't thinking of DHCP :(
16:21:57 jaypipes melwitt: in this specific case (the hitachi/fujitsu NFS/SAN thing) I would think that a statically-assigned IP address is really the only way it would work.
16:23:07 jaypipes melwitt: otherwise, the connector info would need to essentially say "this storage NIC is gonna get some IP address in this CIDR but I don't know what that specific IP address is right now". And I'm pretty sure no such affordance is possible in the volume connector info ;)
16:23:12 TheJulia jaypipes: as in operator pre-creation of the ports, definition of said vifs upon spawning a node?
16:23:17 melwitt yeah. huh. I guess that means that any deployment using DHCP must be creating neutron ports in deferred mode or no IP allocation mode?
16:23:51 jaypipes TheJulia: yes, which is a very common thing already.
16:24:16 jaypipes TheJulia: and passing nova boot --nic port=<UUID> (or whatever the magical incantation is...)
16:24:19 TheJulia jaypipes: that is correct, we can't say "later" for the volume connection info because it gets shipped all the way to the backend storage upfront
16:24:33 TheJulia hshiina|afk: ^^^ thoughts
16:24:44 jaypipes TheJulia: although saying "laterz dude" in the connector info would be, well, amaze-balls.
16:24:57 TheJulia jaypipes: totally
16:25:08 jaypipes TheJulia: I think you meant "totes magotes".
16:25:27 melwitt hah
16:25:33 melwitt jobin
16:25:42 TheJulia lol
16:27:11 melwitt going down a different thought path, can we not wait until after the node is reserved to attach the block device instead?
16:27:43 TheJulia we actually should be waiting
16:28:14 TheJulia but the cinderside of that has to be done first with information about the node too
16:28:20 TheJulia wow, what a fun chicken and the egg
16:28:27 melwitt okay, I think I'm confused because the new problem that's happening is vifs are being plugged before the node is reserved. and we need to plug the vifs to get the IP address so we can attach the volume
16:28:41 jaypipes melwitt: we could definitely do that, yes. Though that won't solve the problem if the port has no IP address already, right?
16:28:41 melwitt so I think I don't get why we can do both after the node is reserved
16:28:52 melwitt *can't
16:29:18 melwitt like, why can't we reserve the node, plug vifs, get IP for volume connector, attach volume
16:29:38 TheJulia Ideally that is what we should be doing in the grand scheme of the universe
16:29:42 TheJulia ideally
16:30:09 melwitt there is something preventing that from being possible?
16:30:34 jaypipes melwitt: nope
16:30:41 jaypipes melwitt: nothing preventing that AFAICT
16:30:58 TheJulia what would be more ideal I guess is the question from a nova point of view, a new pre-spawn virt driver method call or we just quietly check/assert when we get the vif plug call
16:30:59 melwitt let's do that
16:32:50 melwitt oh, so the first step in spawn would not be reserve?
16:33:05 melwitt (I don't know where reserve is currently happening)
16:33:24 TheJulia melwitt: in spawn when we begin to populate information in ironic about the instance
16:33:38 melwitt ohhh yeah. sorry
16:33:57 melwitt this network prep thing is called in compute/manager early
16:34:07 TheJulia no worries
16:34:08 TheJulia yeah
16:37:11 melwitt looking in the code for where reserve is currently happening and can't find it
16:37:31 jaypipes melwitt: yeah, we might want to move the network prep for block devices thing to being a method that is called from the virt driver and not the compute manager
16:38:07 jaypipes melwitt: so that the virt driver can dictate when it is appropriate to do that prep work
16:38:23 TheJulia melwitt: instance_uuid being set
16:38:23 dansmith melwitt: are you suggesting plugging vifs before we call virt spawn across the board?
16:38:37 jroll I did a poc for the pre-spawn method call TheJulia mentioned, fwiw: https://review.openstack.org/#/c/563722/
16:38:38 jaypipes dansmith: nope, not plugging vifs.
16:38:40 melwitt dansmith: no, I mean, where can we do the ironic node reserve call
16:39:04 dansmith jaypipes: okay I see vif plugging discussion above, but wasn't following
16:39:19 melwitt because ultimately we want to reserve the node before plugging vifs or attaching volumes. I just don't know where that's currently being done
16:39:28 TheJulia melwitt: let me get you the line, one moment
16:39:35 jroll melwitt: currently the ironic driver reserves the node within spawn()
16:39:46 jroll by sending instance_uuid in a PUT request
16:39:57 melwitt okay I see
16:39:57 jroll or node.update I guess, in ironicclient terms
16:40:25 melwitt I mean, the cheat would be move that call to "prepare networking etc" method
16:40:27 TheJulia https://github.com/openstack/nova/blob/master/nova/virt/ironic/driver.py#L360
16:40:59 jroll melwitt: ya, that's the other version: https://review.openstack.org/#/c/563714/
16:41:05 TheJulia :)
16:41:07 jaypipes dansmith: no worries. we were discussing that ironic (actually, some cinder drivers) need to know the IP address of a port up front. and the prep_network_for-blokc_devices() virt driver API method was added in order to address that need. But that method does vif plugging (because that's unfortunately when a port's IP address is guaranteed to be set). We would like to see the IP address allocation decoupled from the vif plugging action.
16:41:22 jroll feels out of place to me but if the bug gets fixed then ¯\_(ツ)_/¯
16:41:26 melwitt jroll: ah, so that's what y'all mean by "lock"
16:41:44 dansmith jaypipes: okay
16:41:46 TheJulia s/lock/giant flag saying node is in use/
16:42:00 jroll melwitt: we also have internal locks which block certain actions on the node, so... sometimes :)
16:42:10 melwitt yeah, makes sense
16:42:18 melwitt heh
16:42:50 melwitt jaypipes, dansmith: but it can't be because DHCP, right?
16:43:01 dansmith melwitt: hmm?
16:43:26 dansmith melwitt: once you know the host, you can do the binding and get a port allocation at that point
16:43:36 melwitt dansmith: like, I had been thinking up to now that we get an IP allocated when we create the neutron port. but in the case of DHCP being used, that would not be true, right?
16:43:37 dansmith er, an address allocation for the port I mean
16:43:42 jaypipes melwitt: yes, when a port is in a subnet that is DHCP-enabled, the port does not get an IP address until after vif plugging (and the DHCP lease is done)
16:44:16 dansmith jaypipes: I think you get an address when you host-bind it, not exactly plug right?
16:44:23 jroll note that ironic doesn't bind the host to the port in nova, but later in ironic, because it can't be attached to the tenant network until it's deployed
16:45:01 melwitt dansmith: because ultimately what they need is to know the IP before they attach the volume. and so far, they have to plug the vif first in order to get the IP. and the problem that's happening is that the vif plug is happening outside of the node reserve lock, so things are racing
16:45:02 jaypipes dansmith: in the case of DHCP, the VIF needs to be fully set up and then the DHCP request made to the gateway, though, right? only after that will the port get an IP adderess.
16:45:28 dansmith jaypipes: you don't have to hit the dhcp server with a client to get an address
16:46:01 jaypipes dansmith: sorry, I wasn't aware that was possible.
16:46:08 dansmith melwitt: I'm not positive at which exact step neutron will assign an address I guess (plug vs. bind),
16:46:33 dansmith but I'm nearly positive it happens before the client is really set up,
16:46:47 melwitt dansmith: plug is just a local thing (os-vif in the case of libvirt) so it must be the bind, I think
16:46:47 dansmith otherwise you wouldn't be able to see what ip your instance is going to have until it has come up enough to have hit the dhcp server
16:46:50 dansmith which wouldn't make any sense

Earlier   Later