Skip to content

Broker configuration #2

Description

@nirs

Support multiple networks based on the config file.

Configuration flow

  • search current configs for used subnet
    e.g. jq .subnet < /etc/vmnet-broker.d/*.json
  • create network config file
  • stat vm using network name
  • delete the file to remove the network

Implementation notes

  • read config on every request if the config changed since last read

    • restart to update config is not possible, delete current networks and break the network if clients are using it.
    • compare file stat (inode, size, timestamp)
  • log error for invalid config

    • return VMNET_BROKER_NOT_FOUND to client since there is no such config
  • Single file per network

    • need to read single file per request
    • easier for 3rd party applications - use drop-in files
  • How to handle conflicting networks

    • different name, same config
    • overlapping subnet (e.g. 192.168.1.1/24, 192.168.1.1/28)
    • first used network win, next network will fail in vment_network_create
  • format: json or plist? both?

  • cache networks in CFDictionary

Network state

struct network_state {
    const char    *name;
    struct version {
        struct timespec  st_mtimespec;
        ino_t            st_ino;
        off_t            st_size;
    };
    
    vmnet_mode_t  mode;
    const char    *subnet;
    const char    *mask;
    const char    ipv6_prefix;
    int           prefix_len;

    vmnet_network_ref     ref;
    xpc_object_t          serialization;
    uint64_t              refcount;
};

Possible director layout

/etc/
    vmnet-broker.d/
        shared.json
        host.json
        ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions