Uploaded image for project: 'OpenShift Virtualization'
  1. OpenShift Virtualization
  2. CNV-28700

Attempting to set Static IP on a VM via OCP Console UI does not work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Major Major
    • CNV v4.15.0
    • CNV v4.12.1
    • CNV User Interface
    • None
    • 0.42
    • False
    • Hide

      None

      Show
      None
    • False
    • ---
    • ---
    • None

      Setting the IP address via the Console GUI does not work.  Inspecting the YAML, it looks like the YAML generated is wrong.

      Steps to replicate issue:

      1. Create Virtual Machine from Catalog
      2. Select any RHEL
      3. Click Customize Virtual machine.
      4. Click Next.
      5. Go to Network Interfaces, delete the Pod Network Interface and add an Interface to an existing NAD for a VLAN
      6. Go to Scripts Tab and click Edit next to Cloud-init.
      7. Check "Add network data" and a drop down will appear.
      8. Provide an interface, IP and gateway and click Apply.

      Go to the YAML tab and scroll down and examine the YAML section and you will see the following:

              - cloudInitNoCloud:
                  networkData: |
                    network:
                      version: '1'
                      config:
                        - type: physical
                          name: eth0
                          subnets:
                            - type: static
                              address:
                                - 172.20.84.234
                              gateway: 172.20.84.1
                  userData: |
                    #cloud-config
                    user: cloud-user
                    password: aaaa-bbbb-cccc
                    chpasswd:
                      expire: false 

      This does not seem to work. Also, our documentation shows a different format:

      https://docs.openshift.com/container-platform/4.12/virt/virtual_machines/vm_networking/virt-configuring-ip-for-vms.html

      kind: VirtualMachine
      spec:
      ...
        volumes:
        - cloudInitNoCloud:
            networkData: |
              version: 2
              ethernets:
                eth1: 
                  addresses:
                  - 10.10.10.14/24 

      The documented format does set the IP, however, I also think the documentation requires updating as well since it is a bit confusing where this should go as "spec" is used multiple times in the YAML.  It should probably read:

      kind: VirtualMachine
      spec:
      ...
        template:
        ...
          spec:
            volumes:
            - cloudInitNoCloud:
                networkData: |
                  version: 2
                  ethernets:
                    eth1: 
                      addresses:
                      - 10.10.10.14/24 

      Lastly, we should probably call out in the documentation that if you leave the VM connected to the Pod Network, it will always create a default route on that VM to the Pod network.  Users may try adding a second interface and defining a gateway and expect it to take precedence over the pod network and it does not.

              aturgema Aviv Turgeman
              darin.sorrentino Darin Sorrentino
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: