sysconfig render does not support type manual subnets

Bug #1687725 reported by Ryan Harper on 2017-05-02
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Medium
Ryan Harper

Bug Description

Attempting to a render a network configuration like this:

% cat manual_subnet.yaml
network:
    version: 1
    config:
        # Physical interfaces.
        - type: physical
          name: interface0
          mac_address: "52:54:00:12:34:00"
          subnets:
              - type: manual
                address: 10.0.2.100/24

Attempting to render this into sysconfig results in a traceback.
% PYTHONPATH=`pwd` ./tools/net-convert.py --network-data manual_subnet.yaml --kind yaml --output-kind sysconfig -d target

Traceback (most recent call last):
  File "./tools/net-convert.py", line 82, in <module>
    main()
  File "./tools/net-convert.py", line 78, in main
    r.render_network_state(ns, target=args.directory)
  File "/home/rharper/work/git/cloud-init/cloudinit/net/sysconfig.py", line 410, in render_network_state
    network_state).items():
  File "/home/rharper/work/git/cloud-init/cloudinit/net/sysconfig.py", line 391, in _render_sysconfig
    cls._render_physical_interfaces(network_state, iface_contents)
  File "/home/rharper/work/git/cloud-init/cloudinit/net/sysconfig.py", line 311, in _render_physical_interfaces
    cls._render_subnet(iface_cfg, route_cfg, iface_subnets[0])
  File "/home/rharper/work/git/cloud-init/cloudinit/net/sysconfig.py", line 238, in _render_subnet
    iface_cfg.name))
ValueError: Unknown subnet type 'manual' found for interface 'interface0'

Sysconfig does have an equivalent of eni's 'manual' control mode, the ONBOOT=N setting tells sysconfig to ignore this interface when booting. Later users can ifup the interface.

1. no cloud, just in-tree rendering
2. cloud-init master branch

Related branches

Ryan Harper (raharper) wrote :

commit 79795bd3098c3bef1fb39cc62bc8d1b3a2a81e5f
Author: Ryan Harper <email address hidden>
Date: Thu Jun 15 13:12:03 2017 -0500

    sysconfig: handle manual type subnets

diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index 4edde3c..b81e57a 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -291,6 +291,8 @@ class Renderer(renderer.Renderer):
                 # iface_cfg['BOOTPROTO'] = 'static'
                 if subnet_is_ipv6(subnet):
                     iface_cfg['IPV6INIT'] = True
+ elif subnet_type == 'manual':
+ iface_cfg['ONBOOT'] = False
             else:
                 raise ValueError("Unknown subnet type '%s' found"
                                  " for interface '%s'" % (subnet_type,

Scott Moser (smoser) on 2017-07-18
Changed in cloud-init:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Ryan Harper (raharper)
Scott Moser (smoser) on 2017-07-21
Changed in cloud-init:
status: Confirmed → Fix Committed

This bug is believed to be fixed in cloud-init in 17.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers