Bug 2174857 - nmstatectl service do not support "capture"
Summary: nmstatectl service do not support "capture"
Keywords:
Status: VERIFIED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: nmstate
Version: 9.2
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Gris Ge
QA Contact: Mingyu Shi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-02 14:06 UTC by Quique Llorente
Modified: 2023-07-13 07:25 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github nmstate nmstate pull 2264 0 None open cli: Support policy file in service mode 2023-03-06 08:44:11 UTC
Red Hat Issue Tracker NMT-357 0 None None None 2023-03-02 14:10:08 UTC
Red Hat Issue Tracker RHELPLAN-150456 0 None None None 2023-03-02 14:10:12 UTC

Description Quique Llorente 2023-03-02 14:06:51 UTC
Description of problem:
When using nmstatectl service if the nmpolicy feature is using and the state specify "capture" and "desiredState" then the command fails with 

Mar 02 13:59:48 qemu0 kola-runext-test.sh[1762]: [2023-03-02T13:59:48Z ERROR nmstatectl::service] Failed to apply state file /etc/nmstate/br-ex-policy.yml: serde_yaml::Error: Unsupported keys found: ["capture", "desiredState"]


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


How reproducible: Always


Steps to Reproduce:
1. Create file at /etc/nmstate/state.yml with the content
capture:                                                              
            default-gw-route: routes.running.destination=="0.0.0.0/0"           
            default-gw-iface: interfaces.name==capture.default-gw-route.routes.running.0.next-hop-interface
          desiredState:                                                         
           interfaces:                                                          
            - name: "{{ capture.default-gw-iface.interfaces.0.name }}"          
              description: configured by nmstatectl                             
              type: ethernet                                                    
              state: up                                                         
            - name: br-ex                                                       
              type: linux-bridge                                                
              copy-mac-from: "{{ capture.default-gw-iface.interfaces.0.name }}" 
              state: up                                                         
              ipv4:                                                             
                enabled: true                                                   
                dhcp: true                                                      
              ipv6:                                                             
                enabled: true                                                   
                dhcp: true                                                      
                autoconf: true                                                  
              bridge:                                                           
                port:                                                           
                - name: "{{ capture.default-gw-iface.interfaces.0.name }}"      
2. Run nmstatectl service
3.

Actual results:
Mar 02 13:59:48 qemu0 kola-runext-test.sh[1762]: [2023-03-02T13:59:48Z ERROR nmstatectl::service] Failed to apply state file /etc/nmstate/br-ex-policy.yml: serde_yaml::Error: Unsupported keys found: ["capture", "desiredState"]


Expected results:
Apply the state as expected

Additional info:
We need this at RHEL 9.2 to have RHCOS configure networking with nmstate.service using nmpolicy

Comment 2 Gris Ge 2023-03-06 08:44:11 UTC
Patch posted to upstream: https://github.com/nmstate/nmstate/pull/2264

To test this:
 * Create dummy interface with iproute or nmstate.
 * Store below content as /etc/nmstate/remove_dummy_iface.yml

```yml
capture:
  dummy_iface: interfaces.type == "dummy"
desired:
  interfaces:
  - name: "{{ capture.dummy_iface.interfaces.0.name }}"
    state: absent
```

 * The dummy interface should be removed after `systemctl start nmstate`.

Comment 6 Mingyu Shi 2023-04-24 10:23:15 UTC
Verified with:
nmstate-2.2.9-1.el9.x86_64
nispor-1.2.10-1.el9.x86_64
NetworkManager-1.43.6-1.el9.x86_64
DISTRO=RHEL-9.3.0-20230423.30


Note You need to log in before you can comment on or make changes to this bug.