cloudbase / cloudbase-init

Cross-platform instance initialization
http://openstack.org
Apache License 2.0
414 stars 150 forks source link

Static routes existing in ConfigDrive are not applied #62

Open reith opened 3 years ago

reith commented 3 years ago

Hi,

I'm provisioning a Windows image by ConfigDrive with bellow openstack/latest/network_data.json:

{
  "links": [
    {
      "id": "default-windows-eth1",
      "name": "eth1",
      "type": "vif",
      "ethernet_mac_address": "0e:16:9b:84:61:fd",
      "mtu": 1500
    }
  ],
  "networks": [
    {
      "id": "default-windows-eth1",
      "type": "ipv4",
      "link": "default-windows-eth1",
      "ip_address": "10.101.0.234",
      "netmask": "255.255.255.0",
      "routes": [
        {
          "network": "172.19.2.0",
          "netmask": "255.255.255.0",
          "gateway": "10.101.0.1"
        }
      ]
    }
  ],
  "services": [
    {
      "type": "dns",
      "address": "1.1.1.1"
    },
    {
      "type": "dns",
      "address": "8.8.8.8"
    }
  ]
}

I expect a route to 172.19.2.0/24 being set, but it's all I'd get in Windows:

network_data

I read openstack and configdrive tests and looks routes being parsed correctly but I don't see any test targeting routes in cloudbaseinit/tests/osutils/test_windows.py and they are all about static network address setting. Further investigation showed NetworkConfigPlugin itself just set network interface IP addresses and consequently just local routes. There is add_static_route function but looks it's unrelated to my case which datasource is ConfigDrive.

So IIUC ConfigDrive Network Routes are being ignored now. Am I right?

reith commented 3 years ago

I pushed some unpolished work you can see here. I have no idea about codes trying to handle legacy and new API and my code lacking those. It works for Windows server 2019 at least.

reith commented 3 years ago

Hi,

I would appreciate any thoughts or suggestions about this. Is it totally out of scope of this project? in that case it would be nice to document that cloudbase-init does not handle static routes, except for default gateway. Do you think it's good to cover static routes like cloud-init do?

I love to have this functionality in cloudbase-init rather than our private fork that would diverge us from upcomming developments and I should reach a decision at some point.

ader1990 commented 3 years ago

Hello,

Thank you for the contribution. Currently, we use the OpenStack review/gating for the patches, and Github for issue management. Can you add the patch to https://review.opendev.org/?

Here is a good how to for achieving this: https://www.openstack.org/blog/submit-your-first-openstack-patch-in-three-steps/ https://docs.openstack.org/zaqar/latest/contributor/first_patch.html - you need to replace zaqar with cloudbase-init.

I would gladly get the code that you wrote and put it to gerrit, but because of how licensing works, you are required to sign the CLA.

Thank you,