libvirt: Add configuration files for mad and default
yaml files for mad and default Test plan: PASS: Create configuration files with all needed data PASS: Ensure all data is usable PASS: No Pylint/Bashate errors PASS: Regression test succeeded Story: 2010816 Task: 48350 Change-Id: Id7a380a64348501396b139ebb57ff0f42825ffce Signed-off-by: Bailey Henry <Henry.Bailey@windriver.com>
This commit is contained in:
parent
4eba315b7e
commit
92d5562f6d
@ -28,8 +28,9 @@ an interactive shell that configures everything. Here's an example::
|
||||
export EXTERNAL_NETWORK=172.30.20.0/24
|
||||
export EXTERNAL_IP=172.30.20.1/24
|
||||
|
||||
There is also a script ``cleanup_network.sh`` that will remove networking
|
||||
configuration from libvirt.
|
||||
Using ``./readconfig.sh madcloud.yaml`` also sets the madcloud
|
||||
environment variables. Use ``default.yaml`` or ``madcloud.yaml`` as
|
||||
templates to make custom configurations.
|
||||
|
||||
Networking
|
||||
----------
|
||||
@ -40,7 +41,11 @@ Set the BRIDGE_INTERFACE environment variable if you need to change stxbr to
|
||||
something unique.
|
||||
|
||||
The ``destroy_network.sh`` script does the reverse, and should not be used lightly.
|
||||
It should also only be used after all of the VMs created below have been destroyed.
|
||||
It should also only be used after all of the VMs created below have been
|
||||
destroyed.
|
||||
|
||||
There is also a script ``cleanup_network.sh`` that will remove networking
|
||||
configuration from libvirt.
|
||||
|
||||
Controllers
|
||||
-----------
|
||||
|
46
libvirt/config.py
Executable file
46
libvirt/config.py
Executable file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
def print_help():
|
||||
print("./config.py <config_file> <key>",
|
||||
file=sys.stderr)
|
||||
|
||||
def readvalue(config_file, key):
|
||||
|
||||
try:
|
||||
with open(config_file, 'r', encoding="utf-8") as f:
|
||||
data = yaml.load(f, Loader=yaml.Loader)
|
||||
|
||||
value = data[key]
|
||||
print(value)
|
||||
|
||||
except yaml.YAMLError as e:
|
||||
print('YAMLError: %s' % e, file=sys.stderr)
|
||||
except KeyError as e:
|
||||
print('KeyError: %s' % e, file=sys.stderr)
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = sys.argv[1:]
|
||||
|
||||
if '--help' in args:
|
||||
print_help()
|
||||
sys.exit(1)
|
||||
|
||||
if len(args) == 2:
|
||||
input_file = args[0]
|
||||
input_key = args[1]
|
||||
readvalue(input_file, input_key)
|
||||
|
||||
elif len(args) < 2:
|
||||
print("Error: missing required arguments.",
|
||||
file=sys.stderr)
|
||||
print_help()
|
||||
sys.exit(1)
|
||||
|
||||
else:
|
||||
print("Error: too many arguments.",
|
||||
file=sys.stderr)
|
||||
print_help()
|
||||
sys.exit(1)
|
10
libvirt/default.yaml
Executable file
10
libvirt/default.yaml
Executable file
@ -0,0 +1,10 @@
|
||||
---
|
||||
bridge_interface: stxbr
|
||||
ext_network: 10.10.10.0/24
|
||||
ext_IP: 10.10.10.1/24
|
||||
controller: controller
|
||||
worker: worker
|
||||
storage: storage
|
||||
worker_nodes_num: '1'
|
||||
storage_nodes_num: '1'
|
||||
domain_dir: 'vms'
|
10
libvirt/madcloud.yaml
Normal file
10
libvirt/madcloud.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
bridge_interface: madbr
|
||||
ext_network: 172.30.20.0/24
|
||||
ext_IP: 172.30.20.1/24
|
||||
controller: madcloud
|
||||
worker: madnode
|
||||
storage: storage
|
||||
worker_nodes_num: '1'
|
||||
storage_nodes_num: '1'
|
||||
domain_dir: 'vms'
|
13
libvirt/readconfig.sh
Executable file
13
libvirt/readconfig.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
GET_CFG="./config.py $1"
|
||||
|
||||
export BRIDGE_INTERFACE="$( ${GET_CFG} bridge_interface )"
|
||||
export EXTERNAL_NETWORK="$( ${GET_CFG} ext_network )"
|
||||
export EXTERNAL_IP="$( ${GET_CFG} ext_IP )"
|
||||
export CONTROLLER="$( ${GET_CFG} controller )"
|
||||
export WORKER="$( ${GET_CFG} worker )"
|
||||
export STORAGE="$( ${GET_CFG} storage )"
|
||||
export WORKER_NODES_NUMBER="$( ${GET_CFG} worker_nodes_num )"
|
||||
export STORAGE_NODES_NUMBER="$( ${GET_CFG} storage_nodes_num )"
|
||||
export DOMAIN_DIRECTORY="$( ${GET_CFG} domain_dir )"
|
Loading…
x
Reference in New Issue
Block a user