• Stars
    star
    142
  • Rank 258,495 (Top 6 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

VirtualBox Power Driver for MAAS

vboxpower

GitHub license GitHub stars Twitter Follow LinkedIn Follow

Stargaze GitHub Repo stars if you find it useful.

VirtualBox Power Driver for MAAS (Metal as a Service)

A way to manage the power of VirtualBox virtual machines via the MAAS webhook driver.

What is MAAS?

MAAS (Metal as a Service) is a tool to turns real servers into bare-metal cloud. With MAAS, you can automate server provisioning and installing OS remotely on both physical and virtual servers. MAAS.io for more information.

What is vboxpower?

vboxpower is a wrapper to enabling MAAS to manage VirtualBox virtual machines power directly. As you know, MAAS does not natively support VirtualBox power management. Before vboxpower, you had to use manual power type for VirtualBox machines, the process of starting/stopping virtual machines did manually but with vboxpower this process is done automatically. So to speak, the prophecy of the vboxpower is translating power commands between VirtualBox and MAAS.

How to install vboxpower:

Both MAAS and vboxpower are written in Python language. So, you don't need another language to run vboxpower.

Prerequisites:

  1. VirtualBox 6+ installed and running.
  2. VirtualBox SDK https://www.virtualbox.org/wiki/Downloads
  3. VirtualBox Extension Pack to support PXE boot.

VirtualBox SDK installation tips:

Download and extract VirtualBox SDK and run the following command.

sudo VBOX_INSTALL_PATH=/usr/lib/virtualbox python3 vboxapisetup.py install

Get started:

To deploy vboxpower, you need python3-pip to install the required packages.

The deploy script creates systemd service and copies vboxpower.py to /opt/maas/vboxpower directory.

After deployment, the deploy script starts the vboxpower service.

sudo apt update && sudo apt install -y python3-pip python3
sudo ./deploy

Test vboxpower:

The vboxpower is listening on port 5241/tcp on all interfaces.

You should be able to see the list of available VirtualBox virtual machines with curl command.

curl 192.168.56.1:5241
{
  "machines": [
    {
      "links": {
        "off": "/pfsense/off",
        "on": "/pfsense/on",
        "status": "/pfsense/status"
      },
      "name": "pfsense",
      "status": "running"
    },
    {
      "links": {
        "off": "/maas/off",
        "on": "/maas/on",
        "status": "/maas/status"
      },
      "name": "maas",
      "status": "running"
    }
  ]
}

Integration with MAAS:

Each virtual machine exposes three endpoints that are used for vm power management.

  • http://HOST_IP:5241/VM_NAME/on
  • http://HOST_IP:5241/VM_NAME/off
  • http://HOST_IP:5241/VM_NAME/status

Use these endpoints on MAAS Webhook power URI, respectively.

I have tested the process on Ubuntu 20.04, MAAS 3.0, and VirtualBox 6.1.16 completely.

Other versions should be work without problem.

demo

Recommended Architecture

If you want to deploy MAAS inside a virtual machine as well, I recommend you to make an environment like the following architecture. In this architecture, you need two virtual machines to create the MAAS stack. The former is a firewall which I suggest use pfSense, OpenWrt, Ubuntu (MASQUERADE), and the latter is a virtual machine that the MAAS is deployed on that. In addition to these essential virtual machines, create target virtual machines, the machines that you want to be deployed by the MAAS platform.

vboxpower architecture

The PURPLE path shows the path of the way the MAAS machine accesses the internet.

The RED path shows the path of power management of the target machine.

The GREEN path shows the path of how the MAAS deploys the target machine.

The YELLOW path shows the path of the way the target machine accesses the internet.

How to contribute:

All contributions are welcomed. If you find any bugs, please file an issue.

Copyright 2021 Saeid Bostandoust [email protected]

More Repositories

1

jenkins-tutorial

The completest Jenkins tutorial, reference, awesome, examples
335
star
2

jenkins-stack-kubernetes

Scripts and manifests to deploy complete Jenkins on Kubernetes
Shell
192
star
3

kubernetes-complete-reference

Kubernetes reference, awesome, cheatsheet, concepts, tools, examples
183
star
4

maasta

MAAS Terraform Ansible
Python
157
star
5

jenkins-stack-docker

Docker-compose version of jenkins-stack-kubernetes
Dockerfile
150
star
6

tondra

Continuous Development on Kubernetes environments with Skaffold
Python
110
star
7

netmeter-exporter

Prometheus exporter for Netmeter
Python
104
star
8

netmeter

Network monitoring tool
Python
98
star
9

zagros

Zagros Open Source Operating System
Assembly
32
star
10

terraform-tutorial

The completest Terraform tutorial, reference, awesome, examples
HCL
31
star
11

devops-bash-scripts

The completest repository of BASH scripts for DevOps engineers
Shell
22
star
12

ssbostan

My Profile Project :)) Readme
13
star
13

prometheus-multi-tenant-proxy-server

Multi-tenant reverse proxy for Prometheus server
Go
12
star
14

xsocket

XSocket is a cross-platform Socket library
C
11
star
15

docker-with-saeid

Applications repository of Docker with Saeid tutorial
Python
10
star
16

docker-logging-awesome

Complete reference for Docker Logging systems and drivers
7
star
17

neptune

Simple API with Flask web framework
Python
6
star
18

vault-secrets-sdk-go

HCP Vault Secrets SDK for Go programming language
Go
5
star
19

librempc

Multiple Precision Arithmetic
C
5
star
20

telescope

Export kubernetes Pod info
Python
4
star
21

anakonda

Anakonda is an API-led container-based task runner
Python
3
star
22

argostart

Helm Chart to deploy the first ArgoCD Application to setup AppOfApps and AppOfAppSets patterns
Smarty
3
star
23

just-for-dockerize

Test your Dockerizing experience
Python
2
star
24

argoapps

Helm Charts to generate ArgoCD Applications for Kubernetes Platform management
2
star
25

kubernetes-opa-library

Kubernetes OPA Gatekeeper policies with a deployable Helm chart
Shell
1
star
26

vault-secrets-sdk-python

HCP Vault Secrets SDK for Python programming language
1
star
27

charts

Helm charts of my github projects
1
star
28

secret-injector

Helm Chart to deploy Sealed-Secrets and External-Secrets resources
1
star
29

london-tube-lines

An API-led container-based project for DevOps in 10 days
HCL
1
star
30

rafay-deploy-pipeline

Deploy Kubernetes workloads with Rafay Kubernetes platform
HCL
1
star
31

devops

DevOps Conference Website
HTML
1
star