summaryrefslogtreecommitdiffstats
path: root/fuel/prototypes/auto-deploy/deploy/verify_dha.sh
blob: 6e2b75f44b5b766d75ca6c476bcd0f3ca1d2c5ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash -e
##############################################################################
# Copyright (c) 2015 Ericsson AB and others.
# stefan.k.berg@ericsson.com
# jonas.bjurel@ericsson.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

error_exit()
{
  echo "Error: $@" >&2
  exit 1
}

if [ $# -ne 2 ]; then
  echo "Syntax: `basename $0` adaptername dhafile"
  exit 1
fi

if [ ! -f dha-adapters/${1}.sh ]; then
    echo "No such adapter file: $1"
    exit 1
elif [ ! -f $2 ]; then
    echo "No such DHA file: $2"
    exit 1
fi

. dha-adapters/${1}.sh $2


err=1
echo "Verifying that expected functions are present..."
for function in \
    dha_getApiVersion  \
    dha_getAdapterName  \
    dha_getAllNodeIds \
    dha_getFuelNodeId \
    dha_getNodeProperty \
    dha_getNodePxeMac \
    dha_useFuelCustomInstall \
    dha_fuelCustomInstall \
    dha_getPowerOnStrategy \
    dha_nodePowerOn \
    dha_nodePowerOff \
    dha_nodeReset \
    dha_nodeCanSetBootOrderLive \
    dha_nodeSetBootOrder \
    dha_nodeCanSetIso \
    dha_nodeCanHandeIsoLive \
    dha_nodeInsertIso \
    dha_nodeEjectIso \
    dha_waitForIsoBoot \
    dha_nodeCanZeroMBR \
    dha_nodeZeroMBR \
    dha
do
    if type $function &>/dev/null; then
        echo "$function: OK"
    else
        echo "$function: Missing!"
        err=0
    fi
done


echo "Adapter API version: `dha getApiVersion`"
echo "Adapter name: `dha getAdapterName`"

echo "All PXE MAC addresses:"
for id in `(dha getAllNodeIds) | sort`
do
    if [ "`dha getAdapterName`" == "libvirt" ]; then
        libvirtName=`dha getNodeProperty $id libvirtName`
    else
        libvirtName=""
    fi

    if [ $id == "`dha getFuelNodeId`" ]; then
        echo "$id: `dha getNodeProperty $id pxeMac` $libvirtName  <--- Fuel master"
    else
        echo "$id: `dha getNodeProperty $id pxeMac` $libvirtName"
    fi
done


echo -n "Using Fuel custom install: "
if dha useFuelCustomInstall; then
  echo "yes"
else
  echo "no"
fi


echo -n "Can set boot order live: "
if dha nodeCanSetBootOrderLive; then
  echo "yes"
else
  echo "no"
fi

echo -n "Can operate on ISO media: "
if dha nodeCanSetIso; then
  echo "yes"
else
  echo "no"
fi

echo -n "Can insert/eject ISO without power toggle: "
if dha nodeCanHandeIsoLive; then
  echo "yes"
else
  echo "no"
fi

echo -n "Can erase the boot disk MBR: "
if dha nodeCanZeroMBR; then
  echo "yes"
else
  echo "no"
fi

echo "Done"