[pve-devel] [PATCH v2 pve-container 0/1] add ipam support

Alexandre Derumier aderumier at odiso.com
Wed May 19 08:59:48 CEST 2021


Changelog v2:

- refactor code
- move code from PVE::LXC::Config to PVE::LXC
- add update_net_ip tests
- fix bugs when changing from vnet ipam to vnet without ipam/ without subnets / classic vmbr
- add support for snasphot rollback
- add support for backup restore

Alexandre Derumier (1):
  add ipam support

 src/PVE/LXC.pm                                | 144 ++++++++++++++++++
 src/PVE/LXC/Config.pm                         |  58 +++++++
 src/PVE/LXC/Create.pm                         |  33 +++-
 src/test/Makefile                             |   5 +-
 .../ipam.db                                   |  18 +++
 .../ipam.db.expected                          |  17 +++
 .../ipam_config                               |   7 +
 .../net                                       |   7 +
 .../net.expected                              |   7 +
 .../oldnet                                    |   7 +
 .../sdn_config                                |  35 +++++
 .../ipam.db                                   |  18 +++
 .../ipam.db.expected                          |  18 +++
 .../ipam_config                               |   7 +
 .../net                                       |   7 +
 .../net.expected                              |   7 +
 .../oldnet                                    |   7 +
 .../sdn_config                                |  35 +++++
 .../ipam.db                                   |  18 +++
 .../ipam.db.expected                          |  17 +++
 .../ipam_config                               |   7 +
 .../net                                       |   7 +
 .../net.expected                              |   7 +
 .../oldnet                                    |   7 +
 .../sdn_config                                |  35 +++++
 .../ipam.db                                   |  18 +++
 .../ipam.db.expected                          |  18 +++
 .../ipam_config                               |   7 +
 .../net                                       |   6 +
 .../net.expected                              |   7 +
 .../oldnet                                    |   7 +
 .../sdn_config                                |  35 +++++
 .../ipam.db                                   |  18 +++
 .../ipam.db.expected                          |  18 +++
 .../ipam_config                               |   7 +
 .../net                                       |   6 +
 .../net.expected                              |   7 +
 .../oldnet                                    |   7 +
 .../sdn_config                                |  35 +++++
 .../ipv4_changeip_samevnet_with_ipam/ipam.db  |  18 +++
 .../ipam.db.expected                          |  18 +++
 .../ipam_config                               |   7 +
 .../ipv4_changeip_samevnet_with_ipam/net      |   7 +
 .../net.expected                              |   7 +
 .../ipv4_changeip_samevnet_with_ipam/oldnet   |   7 +
 .../sdn_config                                |  35 +++++
 .../ipv4_changeip_vmbr0_to_ipamvnet/ipam.db   |  17 +++
 .../ipam.db.expected                          |  18 +++
 .../ipam_config                               |   7 +
 .../ipams/ipv4_changeip_vmbr0_to_ipamvnet/net |   7 +
 .../net.expected                              |   7 +
 .../ipv4_changeip_vmbr0_to_ipamvnet/oldnet    |   7 +
 .../sdn_config                                |  35 +++++
 .../ipv4_changeip_vmbr0_to_noipamvnet/ipam.db |  17 +++
 .../ipam.db.expected                          |  17 +++
 .../ipam_config                               |   7 +
 .../ipv4_changeip_vmbr0_to_noipamvnet/net     |   7 +
 .../net.expected                              |   7 +
 .../ipv4_changeip_vmbr0_to_noipamvnet/oldnet  |   7 +
 .../sdn_config                                |  35 +++++
 .../ipam.db                                   |  18 +++
 .../ipam.db.expected                          |  18 +++
 .../ipam_config                               |   7 +
 .../net                                       |   7 +
 .../net.expected                              |   8 +
 .../oldnet                                    |   7 +
 .../sdn_config                                |  38 +++++
 .../ipam.db                                   |  18 +++
 .../ipam.db.expected                          |  17 +++
 .../ipam_config                               |   7 +
 .../net                                       |   8 +
 .../net.expected                              |   8 +
 .../oldnet                                    |   7 +
 .../sdn_config                                |  38 +++++
 .../ipam.db                                   |  18 +++
 .../ipam.db.expected                          |  18 +++
 .../ipam_config                               |   7 +
 .../net                                       |   7 +
 .../net.expected                              |   7 +
 .../oldnet                                    |   8 +
 .../sdn_config                                |  36 +++++
 .../ipams/ipv4_updateipam_ipamvnet/ipam.db    |  18 +++
 .../ipv4_updateipam_ipamvnet/ipam.db.expected |  18 +++
 .../ipv4_updateipam_ipamvnet/ipam_config      |   7 +
 src/test/ipams/ipv4_updateipam_ipamvnet/net   |   7 +
 .../ipv4_updateipam_ipamvnet/net.expected     |   7 +
 .../ipams/ipv4_updateipam_ipamvnet/oldnet     |   7 +
 .../ipams/ipv4_updateipam_ipamvnet/sdn_config |  35 +++++
 .../ipam.db                                   |  19 +++
 .../ipam.db.expected                          |  19 +++
 .../ipam_config                               |   7 +
 .../ipv4v6_next_free_samevnet_with_ipam/net   |   6 +
 .../net.expected                              |   8 +
 .../oldnet                                    |   8 +
 .../sdn_config                                |  39 +++++
 .../ipam.db                                   |  20 +++
 .../ipam.db.expected                          |  20 +++
 .../ipam_config                               |   7 +
 .../net                                       |   6 +
 .../net.expected                              |   8 +
 .../oldnet                                    |   8 +
 .../sdn_config                                |  39 +++++
 .../ipams/ipv4v6_updateipam_ipamvnet/ipam.db  |  19 +++
 .../ipam.db.expected                          |  19 +++
 .../ipv4v6_updateipam_ipamvnet/ipam_config    |   7 +
 src/test/ipams/ipv4v6_updateipam_ipamvnet/net |   8 +
 .../ipv4v6_updateipam_ipamvnet/net.expected   |   8 +
 .../ipams/ipv4v6_updateipam_ipamvnet/oldnet   |   8 +
 .../ipv4v6_updateipam_ipamvnet/sdn_config     |  39 +++++
 .../ipam.db                                   |  19 +++
 .../ipam.db.expected                          |  19 +++
 .../ipam_config                               |   7 +
 .../ipv4v6_updateipam_ipamvnet_failingv6/net  |   8 +
 .../net.expected                              |   8 +
 .../oldnet                                    |   8 +
 .../sdn_config                                |  35 +++++
 .../ipam.db                                   |  18 +++
 .../ipam.db.expected                          |  18 +++
 .../ipam_config                               |   7 +
 .../net                                       |   7 +
 .../net.expected                              |   7 +
 .../oldnet                                    |   7 +
 .../sdn_config                                |  35 +++++
 .../ipam.db                                   |  18 +++
 .../ipam.db.expected                          |  18 +++
 .../ipam_config                               |   7 +
 .../net                                       |   7 +
 .../net.expected                              |   8 +
 .../oldnet                                    |   7 +
 .../sdn_config                                |  37 +++++
 .../ipams/ipv6_updateipam_ipamvnet/ipam.db    |  14 ++
 .../ipv6_updateipam_ipamvnet/ipam.db.expected |  14 ++
 .../ipv6_updateipam_ipamvnet/ipam_config      |   7 +
 src/test/ipams/ipv6_updateipam_ipamvnet/net   |   7 +
 .../ipv6_updateipam_ipamvnet/net.expected     |   7 +
 .../ipams/ipv6_updateipam_ipamvnet/oldnet     |   7 +
 .../ipams/ipv6_updateipam_ipamvnet/sdn_config |  35 +++++
 src/test/run_ipam_tests.pl                    | 126 +++++++++++++++
 src/test/snapshot-input/sdn/subnets.cfg       |   0
 src/test/snapshot-test.pm                     |   1 -
 140 files changed, 2266 insertions(+), 10 deletions(-)
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnet_noipam/ipam.db
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnet_noipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnet_noipam/ipam_config
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnet_noipam/net
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnet_noipam/net.expected
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnet_noipam/oldnet
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnet_noipam/sdn_config
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnetipam/ipam.db
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnetipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnetipam/ipam_config
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnetipam/net
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnetipam/net.expected
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnetipam/oldnet
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_othervnetipam/sdn_config
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_vmbr0_noipam/ipam.db
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_vmbr0_noipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_vmbr0_noipam/ipam_config
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_vmbr0_noipam/net
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_vmbr0_noipam/net.expected
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_vmbr0_noipam/oldnet
 create mode 100644 src/test/ipams/ipv4_changeip_ipamvnet_to_vmbr0_noipam/sdn_config
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_othervnet_with_ipam/ipam.db
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_othervnet_with_ipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_othervnet_with_ipam/ipam_config
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_othervnet_with_ipam/net
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_othervnet_with_ipam/net.expected
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_othervnet_with_ipam/oldnet
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_othervnet_with_ipam/sdn_config
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_samevnet_with_ipam/ipam.db
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_samevnet_with_ipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_samevnet_with_ipam/ipam_config
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_samevnet_with_ipam/net
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_samevnet_with_ipam/net.expected
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_samevnet_with_ipam/oldnet
 create mode 100644 src/test/ipams/ipv4_changeip_next_free_samevnet_with_ipam/sdn_config
 create mode 100644 src/test/ipams/ipv4_changeip_samevnet_with_ipam/ipam.db
 create mode 100644 src/test/ipams/ipv4_changeip_samevnet_with_ipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_changeip_samevnet_with_ipam/ipam_config
 create mode 100644 src/test/ipams/ipv4_changeip_samevnet_with_ipam/net
 create mode 100644 src/test/ipams/ipv4_changeip_samevnet_with_ipam/net.expected
 create mode 100644 src/test/ipams/ipv4_changeip_samevnet_with_ipam/oldnet
 create mode 100644 src/test/ipams/ipv4_changeip_samevnet_with_ipam/sdn_config
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_ipamvnet/ipam.db
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_ipamvnet/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_ipamvnet/ipam_config
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_ipamvnet/net
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_ipamvnet/net.expected
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_ipamvnet/oldnet
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_ipamvnet/sdn_config
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_noipamvnet/ipam.db
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_noipamvnet/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_noipamvnet/ipam_config
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_noipamvnet/net
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_noipamvnet/net.expected
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_noipamvnet/oldnet
 create mode 100644 src/test/ipams/ipv4_changeip_vmbr0_to_noipamvnet/sdn_config
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetipam/ipam.db
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetipam/ipam_config
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetipam/net
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetipam/net.expected
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetipam/oldnet
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetipam/sdn_config
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetnoipam/ipam.db
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetnoipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetnoipam/ipam_config
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetnoipam/net
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetnoipam/net.expected
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetnoipam/oldnet
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_gateway_othervnetnoipam/sdn_config
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_nogateway_othervnetipam/ipam.db
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_nogateway_othervnetipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_nogateway_othervnetipam/ipam_config
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_nogateway_othervnetipam/net
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_nogateway_othervnetipam/net.expected
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_nogateway_othervnetipam/oldnet
 create mode 100644 src/test/ipams/ipv4_gateway_changeip_ipamvnet_to_nogateway_othervnetipam/sdn_config
 create mode 100644 src/test/ipams/ipv4_updateipam_ipamvnet/ipam.db
 create mode 100644 src/test/ipams/ipv4_updateipam_ipamvnet/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4_updateipam_ipamvnet/ipam_config
 create mode 100644 src/test/ipams/ipv4_updateipam_ipamvnet/net
 create mode 100644 src/test/ipams/ipv4_updateipam_ipamvnet/net.expected
 create mode 100644 src/test/ipams/ipv4_updateipam_ipamvnet/oldnet
 create mode 100644 src/test/ipams/ipv4_updateipam_ipamvnet/sdn_config
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam/ipam.db
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam/ipam_config
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam/net
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam/net.expected
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam/oldnet
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam/sdn_config
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam_failingv6/ipam.db
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam_failingv6/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam_failingv6/ipam_config
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam_failingv6/net
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam_failingv6/net.expected
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam_failingv6/oldnet
 create mode 100644 src/test/ipams/ipv4v6_next_free_samevnet_with_ipam_failingv6/sdn_config
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet/ipam.db
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet/ipam_config
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet/net
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet/net.expected
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet/oldnet
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet/sdn_config
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet_failingv6/ipam.db
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet_failingv6/ipam.db.expected
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet_failingv6/ipam_config
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet_failingv6/net
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet_failingv6/net.expected
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet_failingv6/oldnet
 create mode 100644 src/test/ipams/ipv4v6_updateipam_ipamvnet_failingv6/sdn_config
 create mode 100644 src/test/ipams/ipv6_changeip_ipamvnet_to_othervnetipam/ipam.db
 create mode 100644 src/test/ipams/ipv6_changeip_ipamvnet_to_othervnetipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv6_changeip_ipamvnet_to_othervnetipam/ipam_config
 create mode 100644 src/test/ipams/ipv6_changeip_ipamvnet_to_othervnetipam/net
 create mode 100644 src/test/ipams/ipv6_changeip_ipamvnet_to_othervnetipam/net.expected
 create mode 100644 src/test/ipams/ipv6_changeip_ipamvnet_to_othervnetipam/oldnet
 create mode 100644 src/test/ipams/ipv6_changeip_ipamvnet_to_othervnetipam/sdn_config
 create mode 100644 src/test/ipams/ipv6_gateway_changeip_ipamvnet_to_gateway_othervnetipam/ipam.db
 create mode 100644 src/test/ipams/ipv6_gateway_changeip_ipamvnet_to_gateway_othervnetipam/ipam.db.expected
 create mode 100644 src/test/ipams/ipv6_gateway_changeip_ipamvnet_to_gateway_othervnetipam/ipam_config
 create mode 100644 src/test/ipams/ipv6_gateway_changeip_ipamvnet_to_gateway_othervnetipam/net
 create mode 100644 src/test/ipams/ipv6_gateway_changeip_ipamvnet_to_gateway_othervnetipam/net.expected
 create mode 100644 src/test/ipams/ipv6_gateway_changeip_ipamvnet_to_gateway_othervnetipam/oldnet
 create mode 100644 src/test/ipams/ipv6_gateway_changeip_ipamvnet_to_gateway_othervnetipam/sdn_config
 create mode 100644 src/test/ipams/ipv6_updateipam_ipamvnet/ipam.db
 create mode 100644 src/test/ipams/ipv6_updateipam_ipamvnet/ipam.db.expected
 create mode 100644 src/test/ipams/ipv6_updateipam_ipamvnet/ipam_config
 create mode 100644 src/test/ipams/ipv6_updateipam_ipamvnet/net
 create mode 100644 src/test/ipams/ipv6_updateipam_ipamvnet/net.expected
 create mode 100644 src/test/ipams/ipv6_updateipam_ipamvnet/oldnet
 create mode 100644 src/test/ipams/ipv6_updateipam_ipamvnet/sdn_config
 create mode 100755 src/test/run_ipam_tests.pl
 create mode 100644 src/test/snapshot-input/sdn/subnets.cfg

-- 
2.20.1




More information about the pve-devel mailing list