Skip to main content
Version: Next

Machiner

The Machiner handles creation and deletion of virtual machines in the openstack environment from already deployed templates by the Templater. Due to the nature of the openstack, there are some optional fields in the request message that are mandatory.

Endpoints

The Machiner has two gRPC endpoints:

create

During the virtual machine creation phase, if there are links assigned to the VM then network devices are added to the VM and assigned to the given networks.

message DeployVirtualMachine {
VirtualMachine virtualMachine = 1;
MetaInfo metaInfo = 2;
}

For reference, the VirtualMachine, Configuration, MetaInfo and Properties messages are defined as follows:

message Configuration {
uint32 cpu = 1;
uint64 ram = 2;
}

message VirtualMachine {
string name = 1;
Configuration configuration = 2;
string templateId = 3;
repeated string links = 4;
}


message MetaInfo {
string exerciseName = 1;
string deploymentName = 2;
Properties properties = 3;
}

message Properties {
string cidr = 1;
string gateway = 2;
}

delete

The virtual machine is deleted from the openstack environment.

Request

message Identifier {
string value = 1;
}

Successful Response

message Empty {}

Configuration

The following environment variables are available for the Machiner handler configuration:

Global Settings

VariableMandatoryTypeDescription
GLOBAL_HOSTYesstringAddress where the Machiner handler listens
GLOBAL_INSECUREYesboolEnables or disables SSL certificate verification

Service Ports

VariableMandatoryTypeDescription
Machiner_PORTYesintegerPort where the Machiner handler listens

DevStack Credentials

VariableMandatoryTypeDescription
AUTH_URLYesstringOpenStack authentication endpoint
CREDENTIAL_IDYesstringOpenStack credential username
CREDENTIAL_SECRETYesstringOpenStack credential password
DOMAINYesstringOpenStack domain (default: Default)
PROJECTYesstringOpenStack project name
GATEWAY_NETWORKYesstringGateway network for the OpenStack environment
REGIONYesstringRegion name for the OpenStack environment
HYPERVISORYesstringOpenStack hypervisor connection URL
HYPERVISOR_USERYesstringUsername for the OpenStack hypervisor
HYPERVISOR_PASSWORDYesstringPassword for the OpenStack hypervisor

Logging Configuration

VariableMandatoryTypeDescription
LOG_LEVELNostringLogging level (e.g., INFO, DEBUG, WARN)
LOG_DIRNostringDirectory where logs are stored
LOG_FILE_NAMENostringName of the log file

Redis Configuration

VariableMandatoryTypeDescription
REDIS_HOSTYesstringRedis server address
REDIS_PORTYesintegerPort where the Redis server is running
REDIS_PASSWORDYesstringPassword for Redis authentication

Optional Environment Variables

VariableMandatoryTypeDescription
HYPERVISOR_WAIT_TIMEOUTNointegerTimeout in seconds for the hypervisor to be ready
HYPERVISOR_WAIT_INTERVALNointegerInterval in seconds to check if the hypervisor is ready

Example .env Configuration

# Global Settings
GLOBAL_HOST=0.0.0.0
GLOBAL_INSECURE=True

# Service Ports
MACHINER_PORT=9000

# DevStack Credentials
AUTH_URL=https://openstack-auth-url:5000/v3
CREDENTIAL_ID=openstack_client_id
CREDENTIAL_SECRET=openstack_application_secret
DOMAIN=openstack_domain
PROJECT=openstack_project
GATEWAY_NETWORK=openstack_gateway_network
REGION=openstack_region
HYPERVISOR=qemu+tcp://hostname/system
HYPERVISOR_USER=openstack_hypervisor_user
HYPERVISOR_PASSWORD=openstack_hypervisor_password

# Logging Configuration
LOG_LEVEL=INFO
LOG_DIR=/var/log
LOG_FILE_NAME=ocr_openstack_plugin

# Redis Configuration
REDIS_HOST=redis-host
REDIS_PORT=6379
REDIS_PASSWORD=redis_password

# Optional
HYPERVISOR_WAIT_TIMEOUT=300
HYPERVISOR_WAIT_INTERVAL=5