saltstack / saltstack/salt

[BUG] Virt Module NIC default profile issue

Open
#57,601 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug severity-medium
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
I have Salt-master and Salt-minion connected. I try to use salt.modules.virt.init module. I get this error

Module function virt.init threw an exception. Exception: Cannot get interface MTU on 'br0': No such device

Which means I have to change the interface from nonexistence br0. I do this by the following setup. But I still get the same error. I looked at the newly created configuration instance and even I set NIC profile to None. It still creates two different network interfaces and thus giving the error.

Setup

install_kvm_instance:
    module.run:
    - name: virt.init
    - m_name: 'toaster'
    - cpu: 2
    - mem: 512
    - nic_profile: None
    - interfaces:
        - name: wlp_tst
          type: bridge
          source: virbr0
          model: virtio

I also checked nic instead of nic_profile and no difference.

Expected behavior
I expect to create only one network interface with the given details but it creates both of them and throws error.
The output XML:

<interface type='bridge'>
      <mac address='52:54:00:35:f4:66'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</interface>
<interface type='bridge'>
      <mac address='52:54:00:cb:94:ba'/>
      <source bridge='virbr0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

If I delete the default br0 interface manually after creation the issue is resolved.

Versions Report

Salt Version:
           Salt: 3000.3
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.8.0
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.10.1
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.17 (default, Apr 15 2020, 17:20:14)
   python-gnupg: 0.4.1
         PyYAML: 5.1.2
          PyZMQ: 16.0.2
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5
 
System Versions:
           dist: LinuxMint 19.3 tricia
         locale: UTF-8
        machine: x86_64
        release: 5.3.0-53-generic
         system: Linux
        version: LinuxMint 19.3 tricia

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the salt.modules.virt.init entry point and compare the nic_profile, nic, and interfaces arguments with the generated XML shown in the report. Reproduce the configuration with the provided Salt state and verify that only the requested virbr0 interface is created without attempting to use br0.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.