4.0 KiB
Getting Started
Devops is the library to manage virtual test environments including virtual machines networks and baremetal servers. Management means here making, snapshotting, destroying. You can define as much environments as you need automatically allocating ip addresses to virtual machines avoiding ip clashes. Devops uses Django ORM to save and restore environments.
There are two ways of using devops:
- CLI and yaml template files
- Writing python code on top of devops API
Example of code
from devops.models import Environment
if __name__ == '__main__':
= Environment.create(name='myenv')
env
= env.add_address_pool(
address_pool ='fuelweb_admin-pool01',
name='10.109.0.0/16:24',
net=0)
tag
= env.add_group(
group ='rack-01',
group_name='devops.driver.libvirt.libvirt_driver',
driver_name=True,
stp=False)
hpet
= group.add_l2_network_device(
l2_net_dev ='myl2netdev',
name='fuelweb_admin-pool01',
address_pool=False,
dhcp=dict(mode='nat'))
forward
= group.add_network_pool(
net_pool ='fuelweb_admin',
name='fuelweb_admin-pool01')
address_pool
= group.add_node(
node ='mynode',
name='default',
role=2,
vcpu=3072)
memory
= node.add_interface(
interface ='eth0',
label='myl2netdev',
l2_network_device_name='e1000')
interface_model
= node.add_volume(
volume ='myvolume',
name=10, # 10 GB
capacityformat='qcow2')
node.add_network_config(='eth0',
label=['fuelweb_admin'])
networks
env.define()
This code creates environment 'myenv' with only one VM 'mynode' and attaches 10G qcow2 volume to it. It also creates libvirt network 'mynet' from the range 10.109.0.0/16.
See more information about API in apibasics
section.
Example of yaml template
---
template:
devops_settings:
env_name: myenv
address_pools:
fuelweb_admin-pool01:
net: 10.109.0.0/16:24
params:
tag: 0
groups:
- name: rack-01
driver:
name: devops.driver.libvirt.libvirt_driver
params:
stp: True
hpet: False
network_pools:
fuelweb_admin: fuelweb_admin-pool01
l2_network_devices:
myl2netdev:
address_pool: fuelweb_admin-pool01
dhcp: false
forward:
mode: nat
nodes:
- name: mynode
role: default
params:
vcpu: 2
memory: 3072
volumes:
- name: myvolume
capacity: 10
format: qcow2
interfaces:
- label: eth0
l2_network_device: myl2netdev
interface_model: e1000
network_config:
eth0:
networks:
- fuelweb_admin
This template describes the same environment as in previous exaple of code. Use the following CLI command to create it:
dos.py create-env example.yaml
Note
yaml file should be located in devops/templates directory.
See more information about templates in templates
section.
See more information about cli commands in commandline
section.