Skip to content

Unable to Remove a Specific Virual Switch #373

Closed

Description

@SomePoorBastard

I've encountered an issue where I am unable to remove a switch by a specific name: "luna".

[root@lunashine /pool/vmstore]# vm switch destroy luna
/usr/local/sbin/vm: DEBUG: Sourcing /etc/rc.conf.d/vm
/usr/local/sbin/vm: DEBUG: checkyesno: vm_enable is set to YES.
/usr/local/sbin/vm: ERROR: failed to remove virtual switch

Other switches can be added and removed just fine:

[root@lunashine /pool/vmstore]# vm switch create moon
/usr/local/sbin/vm: DEBUG: Sourcing /etc/rc.conf.d/vm
/usr/local/sbin/vm: DEBUG: checkyesno: vm_enable is set to YES.
[root@lunashine /pool/vmstore]# vm switch destroy moon
/usr/local/sbin/vm: DEBUG: Sourcing /etc/rc.conf.d/vm
/usr/local/sbin/vm: DEBUG: checkyesno: vm_enable is set to YES.

The vm config file is located here:

[root@lunashine /pool/vmstore/.config]# less system.conf
switch_list="luna test-switch-01"
type_luna="standard"
ports_luna="igb0 tap0 tap1"
type_test-switch-01="standard"

Interestingly, this switch also is causing issues with two virtual machines when they start up:

Jun 24 20:59:52: initialising
Jun 24 20:59:52:  [loader: bhyveload]
Jun 24 20:59:52:  [cpu: 2]
Jun 24 20:59:52:  [memory: 512M]
Jun 24 20:59:52:  [hostbridge: standard]
Jun 24 20:59:52:  [com ports: com1]
Jun 24 20:59:52:  [uuid: d7ad3b4f-bf88-11e8-816e-0cc47a69ad4e]
Jun 24 20:59:52:  [utctime: yes]
Jun 24 20:59:52:  [debug mode: no]
Jun 24 20:59:52:  [primary disk: disk0.img]
Jun 24 20:59:52:  [primary disk dev: file]
Jun 24 20:59:52: initialising network device tap0

**************************************************
Jun 24 20:59:52: failed to find virtual switch 'luna'
**************************************************

Jun 24 20:59:52: booting
Jun 24 20:59:52: bhyveload -c /dev/nmdm-ns2.1A -m 512M -e autoboot_delay=3 -d /pool/vmstore/ns2/disk0.img ns2
Jun 24 20:59:56:  [bhyve options: -c 2 -m 512M -AHP -U d7ad3b4f-bf88-11e8-816e-0cc47a69ad4e -u]
Jun 24 20:59:56:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,virtio-blk,/pool/vmstore/ns2/disk0.img -s 5:0,virtio-net,tap0,mac=58:9c:fc:03:0e:b2]
Jun 24 20:59:56:  [bhyve console: -l com1,/dev/nmdm-ns2.1A]
Jun 24 20:59:56: starting bhyve (run 1)
Jun 24 22:19:27: bhyve exited with status 1
Jun 24 22:19:27: restarting
Jun 24 22:19:28: bhyveload -c /dev/nmdm-ns2.1A -m 512M -e autoboot_delay=3 -d /pool/vmstore/ns2/disk0.img ns2
Jun 24 22:19:31:  [bhyve options: -c 2 -m 512M -AHP -U d7ad3b4f-bf88-11e8-816e-0cc47a69ad4e -u]
Jun 24 22:19:31:  [bhyve devices: -s 0,hostbridge -s 31,lpc -s 4:0,virtio-blk,/pool/vmstore/ns2/disk0.img -s 5:0,virtio-net,tap0,mac=58:9c:fc:03:0e:b2]
Jun 24 22:19:31:  [bhyve console: -l com1,/dev/nmdm-ns2.1A]
Jun 24 22:19:31: starting bhyve (run 2)
Jun 28 14:14:59: bhyve exited with status 1
Jun 28 14:14:59: destroying network device tap0
Jun 28 14:14:59: stopped

I can show/read this switch from vm:

[root@lunashine /pool/vmstore2]# vm switch info
/usr/local/sbin/vm: DEBUG: Sourcing /etc/rc.conf.d/vm
/usr/local/sbin/vm: DEBUG: checkyesno: vm_enable is set to YES.
------------------------
Virtual Switch: luna
------------------------
  type: standard
  ident: -
  vlan: -
  physical-ports: igb0 tap0 tap1

------------------------
Virtual Switch: test-switch-01
------------------------
  type: standard
  ident: bridge0
  vlan: -
  physical-ports: -
  bytes-in: 0 (0.000B)
  bytes-out: 0 (0.000B)

Anyone have ideas where I could find the source of why I'm unable to interact with modifying this switch's config?

Activity

  1. SomePoorBastard commented on Jun 28, 2020

    @SomePoorBastard
    Author

    Config file for ns2:

    [...]
    network0_type="virtio-net"
    network0_switch="luna"
    [...]
    network0_mac="58:9c:fc:03:0e:b2"
    
  2. SomePoorBastard commented on Jun 28, 2020

    @SomePoorBastard
    Author

    Not sure if not having a bridge affects the ability for VM to operate on switch config.

    [root@lunashine /pool/vmstore/ns2]# vm switch list
    NAME            TYPE      IFACE    ADDRESS  PRIVATE  MTU  VLAN  PORTS
    luna            standard  -        -        no       -    -     igb0 tap0 tap1
    test-switch-01  standard  bridge0  -        no       -    -     -
    
  3. SomePoorBastard commented on Jun 28, 2020

    @SomePoorBastard
    Author

    During testing, I created test-switch-01, to see if I can interact with this just fine. I added the tap interfaces to the switch after starting the vm machines first (as the tap interfaces are created only on start, and destroyed on stop).

    An ifconfig bridge0; created by using vm switch create test-switch-01:

    bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
            description: vm-test-switch-01
            ether f6:d8:98:5f:3b:03
            id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
            maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
            root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
            member: igb0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                    ifmaxaddr 0 port 1 priority 128 path cost 20000
            groups: bridge vm-switch viid-9da43@
            nd6 options=1<PERFORMNUD>
    

    I was also able to remove the test switch just fine:

    [root@lunashine /pool/vmstore]# vm switch destroy luna
    [...] Debugging Test Messages
    /usr/local/sbin/vm: ERROR: failed to remove virtual switch
    [root@lunashine /pool/vmstore]# vm switch destroy test-switch-01
    [...] Debugging Test Messages
    [root@lunashine /pool/vmstore]#
    

    My conclusion is that I probably removed the bridge specifically created for "luna" (a boneheaded move when testing other networking issues), which caused the issue.

    The workaround was to remove the entries in system.config.

  4. SomePoorBastard commented on Jun 28, 2020

    @SomePoorBastard
    Author

    Proof of workaround after removing the appropriate entries in system.conf:

    [root@lunashine /pool/vmstore]# vm switch create luna
    [root@lunashine /pool/vmstore]# ifconfig
    [...]
    vm-luna: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
            ether de:c8:56:af:59:fd
            id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
            maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
            root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
            groups: bridge vm-switch viid-ba8a4@
            nd6 options=1<PERFORMNUD>
    

    Adding the tap interfaces:

    [root@lunashine /pool/vmstore]# vm switch add luna tap0
    [root@lunashine /pool/vmstore]# vm switch add luna tap1
    
    [root@lunashine /pool/vmstore]# vm switch list
    NAME  TYPE      IFACE    ADDRESS  PRIVATE  MTU  VLAN  PORTS
    luna  standard  vm-luna  -        no       -    -     igb0 tap0 tap1
    [root@lunashine /pool/vmstore]# vm switch info
    ------------------------
    Virtual Switch: luna
    ------------------------
      type: standard
      ident: vm-luna
      vlan: -
      physical-ports: igb0 tap0 tap1
      bytes-in: 19661 (19.200K)
      bytes-out: 1154981 (1.101M)
    
      virtual-port
        device: tap1
        vm: ariel
    
      virtual-port
        device: tap0
        vm: ns2
    
    [root@lunashine /pool/vmstore]# ifconfig
    vm-luna: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
            ether de:c8:56:af:59:fd
            id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
            maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
            root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
            member: tap1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                    ifmaxaddr 0 port 6 priority 128 path cost 2000000
            member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                    ifmaxaddr 0 port 5 priority 128 path cost 2000000
            member: igb0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                    ifmaxaddr 0 port 1 priority 128 path cost 20000
            groups: bridge vm-switch viid-ba8a4@
            nd6 options=1<PERFORMNUD>
    
    

    Left as documentation for others in case they're wondering why they can't delete a switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions