Skip to content

Remove configuration hosts.<hostname>.quantity field #2067

@stevenengler

Description

@stevenengler

Shadow supports a hosts.<hostname>.quantity field to make it easier to start multiple hosts that run the same processes. For example, we use it in our curl example to start three clients:

hosts:
  # a host with the hostname 'server'
  server:
    network_node_id: 0
    processes:
    - path: /usr/bin/python3
      args: -m http.server 80
      start_time: 3s
  # three hosts with hostnames 'client1', 'client2', and 'client3'
  client:
    network_node_id: 0
    quantity: 3
    processes:
    - path: /usr/bin/curl
      args: -s server
      start_time: 5s

I think we should consider removing this option, and instead recommend using yaml anchors instead. The previous example can be replaced by:

hosts:
  server:
    network_node_id: 0
    processes:
    - path: /usr/bin/python3
      args: -m http.server 80
      start_time: 3s
  client1: &client_host
    network_node_id: 0
    processes:
    - path: /usr/bin/curl
      args: -s server
      start_time: 5s
  client2: *client_host
  client3: *client_host

There is also a hosts.<hostname>.processes[*].quantity field we may also want to consider removing.

This syntax is already supported in shadow today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: EnhancementNew functionality or improved design

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions