Quantcast
Channel: Cloudbase Solutions
Viewing all articles
Browse latest Browse all 84

reBot – using Lego for bare metal deployments on Intel NUC

$
0
0

Here at Cloudbase, we use a lot of Intel Next Unit of Computing (NUC) for our internal testing and development work. The NUC is a small form factor computer, designed and manufactured by Intel, very compact and powerful, sporting a Haswell i5 processor, up to 16 GB of RAM and a mSATA SSD.

You can see our NUC tempest testing rig in action here.

What those NUCs are lacking (except for a single older model, as of today) is the ability to power them on and off remotely, like higher grade servers do with technologies like IPMI, AMT, iLO. Unfortunately, the NUCs don’t have any of those, so we invented our own to have some fun. :-)

 

Lego to the rescue

Since we had a lot of Lego just lying around, we though, why not building a Lego Mindstorms robot to remotely push the NUC power button?

After a bunch of prototypes, we came out with this:

reBot prototyping

 

We call it reBot

Our first implementation of reBot was for Ubuntu Metal as a Service (MAAS). MAAS is the bare-metal deployment service for Ubuntu, which spins physical machines up just like virtual machines in OpenStack. I won’t go into the details of how MAAS & Juju work, but you can read more about our Windows implementation here.

Right now we also have a working proof-of-concept power adapter for OpenStack Ironic.

This is how a 4-node reBot MAAS setup is deploying a full OpenStack bare-metal cloud, all unattended:

The Empire deployed Close up of a node

 

Software

The Mindstorms EV3 brick runs a custom firmware, called leJos which provides some remote control abilities via Java RMI (ok, it ain’t Python, but we can live with it :-)). We connected it to the MAAS controller (the sitting on top of the switches in the picture) via an ethernet-over-USB connection.
Here are some of the motor actions that we wrote for pushing the lever up/down and reset the NUC. Here is an example:

import lejos.remote.ev3.*;
import lejos.utility.Delay;

class BarePlasticAction {
    public static void main(String[] args) {

       if(args.length != 4) {
            System.out.println("usage: BarePlasticAction <EV3 address> <A|B|C|D> <degrees> <pause>");
            System.exit(1);
        }

        String host = args[0];
        String port = args[1];
        int degrees = Integer.parseInt(args[2]);
        int pause = Integer.parseInt(args[3]); 

        RMIRegulatedMotor m = null;

        try {
            RemoteEV3 ev3 = new RemoteEV3(host);

            m = ev3.createRegulatedMotor(port, 'L');

            m.setAcceleration(6000);

            float speed = m.getMaxSpeed();
            m.setSpeed((int)speed);

            m.rotateTo(degrees);

            if (pause >= 0) {
                Delay.msDelay(pause);
                m.rotateTo(0);
            }
        }
        catch(Exception ex) {
            ex.printStackTrace();
        }
        finally {
            if (m != null) {
                try {
                    m.close();
                }
                catch(Exception ex) {
                    // ignore
                }

            }
        }
    }
}

All we needed to do at this point was to call it from MAAS, specifying the EV3 port, degrees of rotation and time to keep the power button pushed down (de facto simulating what you’d do with your finger when resetting a PC).

Power on:

java  -cp ../ev3classes.jar:.. BarePlasticAction 10.0.1.1 B 1440 1500

Power off:

java  -cp ../ev3classes.jar:.. BarePlasticAction 10.0.1.1 B 1440 5000

And this is how the MAAS configuration page looks like:

MAAS configuration page

 

The code and Lego model are available as open source on GitHub, so go ahead and build your own, or even improve on the design:

https://github.com/cloudbase/reBot

here’s also a handy bill of materials with all the required Lego parts.

The post reBot – using Lego for bare metal deployments on Intel NUC appeared first on Cloudbase Solutions.


Viewing all articles
Browse latest Browse all 84

Trending Articles