Bug 1498998

Summary: cloud-init 0.7.9 raises ValueError: Unknown subnet type 'loopback'
Product: Red Hat Enterprise Linux 7 Reporter: Greg Bailey <gbailey>
Component: cloud-initAssignee: Ryan McCabe <rmccabe>
Status: CLOSED CURRENTRELEASE QA Contact: xiachen
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: aherr, eterrell, gbailey, huzhao, jbadiapa, jgreguske, lars, leiwang, mmagr, mrunge, ribarry, xiachen, yacao, yuxisun
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-15 11:14:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
config_drive
none
/var/log/cloud-init.log
none
Patch for ValueError: Unknown subnet type 'loopback' none

Description Greg Bailey 2017-10-05 18:56:25 UTC
Description of problem:

cloud-init throws an exception when processing the "iface lo inet loopback" entry in the config drive (will attach):

ValueError: Unknown subnet type 'loopback' found for interface 'lo'

Version-Release number of selected component (if applicable):

cloud-init-0.7.9-9.el7.x86_64

How reproducible:

Always

Steps to Reproduce:
1. Boot rhel-server-7.4-x86_64-kvm.qcow2 (we're currently running OpenStack Liberty)
2. Observe network is inaccessible
3. Use spice-console to log in and observe traceback in /var/log/cloud.log (will attach)

Actual results:

Missing /etc/sysconfig/network-scripts/ifcfg-lo
Missing /etc/sysconfig/network-scripts/ifcfg-eth0

Expected results:

Populated /etc/sysconfig/network-scripts/ifcfg-lo
Populated /etc/sysconfig/network-scripts/ifcfg-eth0

Additional info:

The following patch appears to resolve the issue:

--- /usr/lib/python2.7/site-packages/cloudinit/net/sysconfig.py.orig	2017-06-22 11:04:23.000000000 -0400
+++ /usr/lib/python2.7/site-packages/cloudinit/net/sysconfig.py	2017-10-05 09:54:28.861469214 -0400
@@ -299,6 +299,9 @@
                 #    iface_cfg['BOOTPROTO'] = 'static'
                 if _subnet_is_ipv6(subnet):
                     iface_cfg['IPV6INIT'] = True
+            elif subnet_type == 'loopback':
+                iface_cfg['IPADDR'] = '127.0.0.1'
+                iface_cfg['NETMASK'] = '255.0.0.0'
             else:
                 raise ValueError("Unknown subnet type '%s' found"
                                  " for interface '%s'" % (subnet_type,

Comment 2 Greg Bailey 2017-10-05 18:57:37 UTC
Created attachment 1334952 [details]
config_drive

Comment 3 Greg Bailey 2017-10-05 18:58:09 UTC
Created attachment 1334953 [details]
/var/log/cloud-init.log

Comment 4 Greg Bailey 2017-10-05 18:58:49 UTC
Created attachment 1334954 [details]
Patch for ValueError: Unknown subnet type 'loopback'

Comment 6 Ryan McCabe 2017-10-26 15:01:06 UTC
Greg, did you submit the patch attached here upstream? I don't see it attached to the bug report. It may help to move things along. If you don't have time or have not signed the CLA, I could do it for you.

Comment 7 Greg Bailey 2017-10-26 17:37:30 UTC
Hi Ryan, I have not submitted the patch upstream, as I wasn't sure whether RHEL builds of cloud-init would follow a policy of tracking upstream (a la Fedora), or if the plan was to backport fixes to the version already in RHEL.  Given the number of RHEL patches already being applied, I guess I was assuming that Red Hat would likely backport a patch as opposed to pulling a new version from upstream.

I haven't signed the CLA, as I haven't yet had any direct interaction with the cloud-init people, other than with Josh Harlow (who I work with).

Comment 8 Ryan McCabe 2017-10-26 18:02:00 UTC
Our rule is that fixes need to be accepted upstream before we ship them. If the problem is fixed in the current upstream version already, then we'd backport the patch, or rework the fix, if it's not possible to directly backport. I didn't get the impression the issue was resolved upstream, though, as the issue on launchpad is still in the confirmed state.

Comment 9 Ryan McCabe 2017-11-13 16:49:59 UTC
I think this may be fixed as a side-effect of another set of patches that had to be pulled in to fix another network config bug. Could you give the package at people.redhat.com/rmccabe/cloud-init/cloud-init-0.7.9-15.el7.x86_64.rpm a shot to see if it resolves the problem?

Comment 10 Ryan McCabe 2017-11-13 16:50:52 UTC
http://people.redhat.com/rmccabe/cloud-init/cloud-init-0.7.9-15.el7.x86_64.rpm

actual clickable link this time

Comment 11 Ryan McCabe 2017-11-13 16:50:52 UTC
http://people.redhat.com/rmccabe/cloud-init/cloud-init-0.7.9-15.el7.x86_64.rpm

actual clickable link this time

Comment 12 Greg Bailey 2017-11-13 17:44:34 UTC
I tested against cloud-init-0.7.9-15.el7.x86_64.rpm as provided above, and it appears to resolve the issue.

Tested against RHEL 7.4 and CentOS 7.4 images (same images that were used originally when reporting the error), and I'm no longer seeing the exception.

/etc/sysconfig/network-scripts/ifcfg-eth0 appears to contain the expected values.  /etc/sysconfig/network-scripts/ifcfg-lo does not appear to be created but I do see the loopback interface configured.

Comment 14 Rick Barry 2020-07-15 11:14:33 UTC
Based on comment 12, I'm setting this to CLOSED/CURRENTRELEASE. If it turns out that there is still a problem, please re-open.

Comment 15 christy hernandez 2024-05-09 08:25:37 UTC Comment hidden (spam)