Bug 2222677

Summary: cloud-init network configuration is failing with error "Unknown network config version: 1"
Product: Container Native Virtualization (CNV) Reporter: nijin ashok <nashok>
Component: User ExperienceAssignee: Tal Nisan <tnisan>
Status: CLOSED DUPLICATE QA Contact: Guohua Ouyang <gouyang>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.13.2CC: gouyang
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-17 07:24:04 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:

Description nijin ashok 2023-07-13 12:46:22 UTC
Description of problem:

While using the OpenShift console to configure the network using cloud-init (Add network data in scripts),  cloud-init network configuration is failing with the error below:

~~~
2023-07-13 12:26:57,206 - util.py[DEBUG]: failed stage init-local
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 767, in status_wrapper
    ret = functor(name, args)
  File "/usr/lib/python3.6/site-packages/cloudinit/cmd/main.py", line 433, in main_init
    init.apply_network_config(bring_up=bring_up_interfaces)
  File "/usr/lib/python3.6/site-packages/cloudinit/stages.py", line 926, in apply_network_config
    self.distro.networking.wait_for_physdevs(netcfg)
  File "/usr/lib/python3.6/site-packages/cloudinit/distros/networking.py", line 142, in wait_for_physdevs
    physdevs = self.extract_physdevs(netcfg)
  File "/usr/lib/python3.6/site-packages/cloudinit/distros/networking.py", line 46, in extract_physdevs
    return net.extract_physdevs(netcfg)
  File "/usr/lib/python3.6/site-packages/cloudinit/net/__init__.py", line 660, in extract_physdevs
    raise RuntimeError("Unknown network config version: %s" % version)
RuntimeError: Unknown network config version: 1
~~~

The issue looks to be because it is passing the version as a string:

~~~
 oc get vm centos-stream8-qmcxprlgjecesuj4 -o yaml|yq '.spec.template.spec.volumes[1]'
cloudInitNoCloud:
  networkData: |
    network:
      version: '1'           <===
      config:
        - type: physical
          name: eth0
          subnets:
            - type: static
              address:
                - 192.168.0.1
              gateway: 192.168.0.10
~~~

And cloud-init is expecting an integer https://github.com/canonical/cloud-init/blob/e2adc9725d204486e02d3098e2a95dc63ee4af7a/cloudinit/net/__init__.py#L623.

Editing the VM yaml and changing it to version : 1 fixes the problem.



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

OpenShift Virtualization   4.13.2

How reproducible:

100 %

Steps to Reproduce:

Try to configure the network using `Add network data` from OpenShift console. Check the cloud-init logs in the VM.

Actual results:

cloud-init network configuration is failing with error "Unknown network config version: 1"

Expected results:

Configuring network should work.

Additional info:

Comment 1 Guohua Ouyang 2023-07-17 07:24:04 UTC

*** This bug has been marked as a duplicate of bug 2213073 ***