Feature: KVM: port isolation for guest VLANs on linux bridge (PVLAN-like isolation without OVS)

Open
#14,712 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
java, linux

Research direction

Start by tracing InterfaceDef and the domain XML parser, then inspect BridgeVifDriver and the agent configuration that controls KVM networking. The issue describes the desired behavior and limitations, but leaves open whether isolation should be configured per host or through the network’s PVLAN setting. Done means user VM NICs on configured tagged VLANs are isolated, system VM NICs remain non-isolated, and the agent handles unsupported libvirt versions.

Written by the indexing model from the issue text.

Description

The required feature described as a wish

As having KVM hosts with linux bridge, I would like VMs on selected shared guest VLANs to be unable to reach each other, while still reaching the gateway and the virtual router.

Use case: advanced zone without security groups, plus a shared subnet where tenants must not talk to each other. PVLAN is the natural fit, but on KVM it is only implemented for OVS (the #13521 might be related).
On linux bridge there is no supported way to get this.

Today we work around it with a groovy agent hook that adds <port isolated='yes'/> to the NIC.
But that proven to be unreliable:

  • the hook only runs on VM start, so NIC hot-plug, replug and live NIC updates might
    produce non-isolated ports;
  • a failing hook is skipped and the VM starts without isolation;
  • the hook also isolates the virtual router's NIC.
Proposal

Use the kernel's bridge port isolation, which libvirt exposes as
<port isolated='yes'/>:

  1. InterfaceDef can emit the element, and the domain XML parser reads it back,
    so NIC definitions rebuilt from a running domain keep it.
  2. A new agent property, network.bridge.port.isolation.vlans, lists the guest
    VLANs to isolate. An entry is a VLAN ID, or label:vlan to match only the
    physical network with that KVM traffic label, e.g. cloudbr1:100,200.
  3. BridgeVifDriver plugs user VM guest NICs on those VLANs as isolated ports.
    System VM NICs stay non-isolated.
  4. The agent refuses to start if the property is set and libvirt is too old.

Isolation between hosts still relies on the uplink switch (e.g. PVLAN there).

Limitations / open questions
  • Configuration is per host, not per network. Would maintainers prefer this to
    be driven by the network's existing PVLAN setting instead? Part 1 above is
    needed either way.
  • Only isolated/promiscuous semantics; community PVLANs cannot be expressed.
  • Tagged VLAN guest networks only (no untagged, no VXLAN).

I have a working patch proposal (AI generated -- https://github.com/durdin85/cloudstack/tree/kvm-bridge-port-isolation ) and can open a PR if needed, but it would be good to have some human control over this.
Thank you.

Dominant language
Java
Stars
3.1k
Forks
1.4k
Avg merge
7d 4h
Merged PRs (30d)
13

Getting set up

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.

More from apache/cloudstack

All issues in apache/cloudstack

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.