Skip to content

Conversation

@Bilgetz
Copy link

@Bilgetz Bilgetz commented Jan 10, 2023

  • [ X] Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • [ X] Ensure that the pull request title represents the desired changelog entry
  • [ X] Please describe what you did
  • [ X] Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • [X ] Ensure you have provided tests - that demonstrates feature works or fixes the issue

Add an option for choose the network interface for ssh

JIRA 40325: Unable to create a VM with multiple networks

@olivergondza
Copy link
Member

Thanks for the MR.

  • What is the motivation to specify the network name specifically? Can't the list simply be reordered, so the first network is the one use wants to connect to?
  • How does one find out the names of those interfaces ahead of time? IOW, when I configure the template to connect to networks net_a,net_b, what would the user specify is the name of the interface for net_b?
  • I would like to see this being an attribute of LauncherFactory.SSH, as the option is irrelevant for other launcher factory implementations. Although, the SimplifiedServer might want this as well.

@Bilgetz
Copy link
Author

Bilgetz commented Jan 23, 2023

I can't re-order the list of network, and we have 2 network. One is on jenkins master, the other is on our artifactory, so i need both.

Yes, the user need specify the name of the interface "net_b" in your example.

i will check for add attribute of LauncherFactory.SSH.

@olivergondza
Copy link
Member

I can't re-order the list of network

@Bilgetz, can you elaborate?

It seems that replacing net_a,net_b with net_b,net_a would do the trick. Would it not?

@Bilgetz
Copy link
Author

Bilgetz commented Jan 23, 2023

i have 2 network declared in openstack. i can't change order in openstack ( administrateur don't want/can't ) .
if i declare in networkId net_a_id,net_b_id or net_b_id,net_a_id openstack always return net_a as first IP
jenkins logs :

 INFO jenkins.plugins.openstack.compute.JCloudsSlaveTemplate provisionServer
Provisioned: NovaServer{
....
  addresses=NovaAddresses{
    addresses={net_a=[NovaAddress{address=*******, type=fixed, version=4, macaddr=******,}], 
                      net_b=[NovaAddress{address=*******, type=fixed, version=4, macaddr=*****, }]
   }
}
....
....

The problem is master is on net_b, so he can't reach the slave.

@olivergondza
Copy link
Member

You are correct! The plugin asks for networks in declared order, but they are not served in the same order from openstack.

I am thinking if making Openstack#getAccessIpAddressObject() smarter would not be better - not to accept networks in openstack order, but reorder them to match declaration. Provided the implementation can be sane in terms of complexity, I prefer that over adding more fields to the config that is already complex enough.

With adding the other field, we would need to verify the sshNetworkInterface is actually one of those configured in networks. Also, when | is used (connect to either of declared networks), we would have hard time specifying which to connect to. IOW, with networks=="a|b,c|d" (connect to 2 networks, a or b and c or d), we cannot choose c or d as sshNetworkInterface simply because there is no guarantee we are connected to either c or d. On the other hand, finding some network in Openstack#getAccessIpAddressObject() that matches the first network specification (c|d) will do what we want.

Thoughts, @Bilgetz?

@Bilgetz
Copy link
Author

Bilgetz commented Jan 26, 2023

You are correct! The plugin asks for networks in declared order, but they are not served in the same order from openstack.

I am thinking if making Openstack#getAccessIpAddressObject() smarter would not be better - not to accept networks in openstack order, but reorder them to match declaration. Provided the implementation can be sane in terms of complexity, I prefer that over adding more fields to the config that is already complex enough.

With adding the other field, we would need to verify the sshNetworkInterface is actually one of those configured in networks. Also, when | is used (connect to either of declared networks), we would have hard time specifying which to connect to. IOW, with networks=="a|b,c|d" (connect to 2 networks, a or b and c or d), we cannot choose c or d as sshNetworkInterface simply because there is no guarantee we are connected to either c or d. On the other hand, finding some network in Openstack#getAccessIpAddressObject() that matches the first network specification (c|d) will do what we want.

Thoughts, @Bilgetz?

i'm always correct :p

Re-order the given IP is cleary the correct way to do it.
The only tricky thing is whe have id in the networks field and openstack give use name with the ip.

@Bilgetz Bilgetz force-pushed the feature/selection-interface-ssh-multiple-network branch from 28b22ca to be4f2b8 Compare February 9, 2023 08:54
@Bilgetz
Copy link
Author

Bilgetz commented May 6, 2025

Ready to merge. ( tested on a real Jenkins )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants