In this module, you will learn about RackHD’s discovery, catalog and poller functionality by using the simulated virtual nodes created by Infrasim.
The infrsim/default.yml file (dir: RackHD/example) is used to defined the virutal node’s configuration. This demo uses an emulated quanta_d52 vnode. If you want to learn more about InfraSIM, you can go to https://github.com/InfraSIM.
UltraVNC Viewer is used to show the console of vnode. In this environment, the vnode console will be availabe on the rackhd_southbound network on port 5901.
To start a vnode, the follwing command should be run from the Rackhd/example/infrasim direcotry.
sudo docker-compose up -d
You can execute command on host to check whether quanta_d51 vnode is up successfully. If the status of quanta_d51 vnode is running
, quanta_d51 is up successfully.
sudo docker-compose ps
Once the virutual node is up, you can connect to it via a vnc viewer on port 5901. You first need to look at the log output to find the ip address of the bridge, br0, the virtual node is connected to.
sudo docker-compose logs
You can find the vnode’s ip&port is 172.31.128.100:5901. And you can use the vncviewer to connect this node. There are two scenes. - If your vncviewer tool and docker host are the same local network. You can connect the vnode using vncviewer tool directly. - If not, eg: your docker host is a remote machine with ubuntu system, and the vncviewer is installed in the local windows machine yte vncviewer is installed in the local windows machine. Please follow the three steps:
First, install vnc4server in your docker host (suppose its ip is 1.2.3.4). eg: install vnc4server in ubuntu 14.04 OS: sudo apt-get install vnc4server. Second, run vnodeDiscovery.sh script in your docker host, you can find the mapping port.
#/bin/bash -x
HOST_IP=`ifconfig eth0 | grep "inet addr" | awk 'BEGIN{FS=" "}{print $2}' | awk 'BEGIN{FS=":"}{print $2}'`
echo "Host eth0 IP is $HOST_IP"
for i in {2..255}
do
NUMBER=$i
IPADDR="172.31.128.$NUMBER"
PORTNUM=`expr 28000 + $NUMBER`
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo sysctl net.ipv4.ip_forward=1 > /dev/null
sudo iptables -A PREROUTING -t nat -p tcp -d $HOST_IP --dport $PORTNUM -j DNAT --to $IPADDR:5901
sudo iptables -t nat -A POSTROUTING -d $IPADDR -p tcp --dport 5901 -j MASQUERADE
echo "Setting VNC port $PORTNUM for IP $IPADDR"
done
Third, use vncviewer tool to connect the vnode using the vnc server address 1.2.3.4:28100. Vncviewer download address: http://www.uvnc.com/downloads/ultravnc.html
4.Retrieve the nodes by typing the following RackHD API to discover the node.
curl localhost:9090/api/2.0/nodes | jq '.'
You can see one or more vnodes whose type is “enclosure” or “compute”.
NodeId is the unique Identity of a node in RackHD. List all the compute type nodes being discovered on the rackhd-server SSH console by typing the following command. Append ”?type=compute” as a query string.
You will focus on compute type nodes in this module
curl 127.0.0.1:9090/api/2.0/nodes?type=compute | jq '.'
In the following json output, the compute node ID is 58b660116d20657f0c5d6466
. You will take it as a variable named <node_id> in the following module.
Note: The node_id varies for different nodes. Even for the same node, the Node ID changes if the RackHD database is being cleaned and the node rediscovered.
Do not use the example 58b660116d20657f0c5d6466
in your vLab. Use the displayed Node ID in your lab.
Catalogs are described as the following:
Examples of catalog sources include the following:
Specify The Catalogs Source
Note: the <node_id> is the Node-ID retrieved from Step 3.
curl 127.0.0.1:9090/api/2.0/nodes/<node_id>/catalogs/ | jq '.' | grep source
curl 127.0.0.1:9090/api/2.0/nodes/<node_id>/catalogs/ipmi-fru | jq '.'
or “driveId” as example
curl 127.0.0.1:9090/api/2.0/nodes/<node_id>/catalogs/driveId | jq '.'
curl 127.0.0.1:9090/api/2.0/pollers| jq '.'
Below is a definition of each field in the example output below:
Note: Record listed below is an example. The output on your screen will look similar with different data.
{
"id": "58b66105a36ced790cd01091",
"type": "ipmi",
"pollInterval": 30000,
"node": "/api/2.0/nodes/58b660116d20657f0c5d6466",
"config": {
"command": "sdr"
},
"lastStarted": "2017-03-01T06:22:35.417Z",
"lastFinished": "2017-03-01T06:22:55.241Z",
"paused": false,
"failureCount": 0
}
curl 127.0.0.1:9090/api/2.0/pollers/<poller_id>/data | jq '.'
curl -X PATCH -H 'Content-Type: application/json' -d '{"pollInterval":15000}' 127.0.0.1:9090/api/2.0/pollers/<poller_id>