| ... | ... |
@@ -25,15 +25,9 @@ Steps to follow: |
| 25 | 25 |
The `install_os_domU.sh` script will: |
| 26 | 26 |
- Setup XenAPI plugins |
| 27 | 27 |
- Create the named networks, if they don't exist |
| 28 |
- - Install an Ubuntu Virtual Machine, with 4 network interfaces: |
|
| 29 |
- - eth0 - internal xapi interface |
|
| 30 |
- - eth1 - VM interface, connected to `VM_BRIDGE_OR_NET_NAME` defaults to |
|
| 31 |
- `"OpenStack VM Network"`. |
|
| 32 |
- - eth2 - Management interface, connected to `MGT_BRIDGE_OR_NET_NAME`, |
|
| 33 |
- defaults to `xenbr0`, XenServer's bridge associated with the Hypervisors |
|
| 34 |
- `eth0`. |
|
| 35 |
- - eth3 - Public interface, connected to `PUB_BRIDGE_OR_NET_NAME` defaults to |
|
| 36 |
- `"OpenStack Public Network"`. |
|
| 28 |
+ - Preseed-Netinstall an Ubuntu Virtual Machine, with 1 network interface: |
|
| 29 |
+ - eth0 - Connected to `UBUNTU_INST_BRIDGE_OR_NET_NAME`, defaults to |
|
| 30 |
+ `MGT_BRIDGE_OR_NET_NAME` |
|
| 37 | 31 |
- After the Ubuntu install process finished, the network configuration is |
| 38 | 32 |
modified to: |
| 39 | 33 |
- eth0 - Management interface, connected to `MGT_BRIDGE_OR_NET_NAME` |
| ... | ... |
@@ -100,9 +94,6 @@ Of course, use real passwords if this machine is exposed. |
| 100 | 100 |
# Give extra time for boot |
| 101 | 101 |
ACTIVE_TIMEOUT=45 |
| 102 | 102 |
|
| 103 |
- # Settings for netinstalling Ubuntu |
|
| 104 |
- UBUNTU_INST_RELEASE=precise |
|
| 105 |
- |
|
| 106 | 103 |
# NOTE: the value of FLAT_NETWORK_BRIDGE will automatically be determined |
| 107 | 104 |
# by install_os_domU.sh script. |
| 108 | 105 |
EOF |
| ... | ... |
@@ -199,13 +199,11 @@ if [ -z "$templateuuid" ]; then |
| 199 | 199 |
# Update the template |
| 200 | 200 |
$THIS_DIR/scripts/install_ubuntu_template.sh $PRESEED_URL |
| 201 | 201 |
|
| 202 |
- # create a new VM with the given template |
|
| 203 |
- # creating the correct VIFs and metadata |
|
| 202 |
+ # create a new VM from the given template with eth0 attached to the given |
|
| 203 |
+ # network |
|
| 204 | 204 |
$THIS_DIR/scripts/install-os-vpx.sh \ |
| 205 | 205 |
-t "$UBUNTU_INST_TEMPLATE_NAME" \ |
| 206 |
- -v "$VM_BRIDGE_OR_NET_NAME" \ |
|
| 207 |
- -m "$MGT_BRIDGE_OR_NET_NAME" \ |
|
| 208 |
- -p "$PUB_BRIDGE_OR_NET_NAME" \ |
|
| 206 |
+ -n "$UBUNTU_INST_BRIDGE_OR_NET_NAME" \ |
|
| 209 | 207 |
-l "$GUEST_NAME" \ |
| 210 | 208 |
-r "$OSDOMU_MEM_MB" |
| 211 | 209 |
|
| ... | ... |
@@ -19,106 +19,48 @@ |
| 19 | 19 |
|
| 20 | 20 |
set -eux |
| 21 | 21 |
|
| 22 |
-[[ -f "/etc/xensource-inventory" ]] && source "/etc/xensource-inventory" || source "/etc/xcp/inventory" |
|
| 23 |
- |
|
| 24 |
-NAME="XenServer OpenStack VPX" |
|
| 25 |
-DATA_VDI_SIZE="500MiB" |
|
| 26 |
-BRIDGE_M= |
|
| 27 |
-BRIDGE_P= |
|
| 28 |
-VPX_FILE=os-vpx.xva |
|
| 29 |
-AS_TEMPLATE= |
|
| 30 |
-FROM_TEMPLATE= |
|
| 22 |
+BRIDGE= |
|
| 31 | 23 |
RAM= |
| 32 |
-WAIT_FOR_NETWORK= |
|
| 33 | 24 |
BALLOONING= |
| 25 |
+NAME_LABEL= |
|
| 26 |
+TEMPLATE_NAME= |
|
| 34 | 27 |
|
| 35 | 28 |
usage() |
| 36 | 29 |
{
|
| 37 | 30 |
cat << EOF |
| 38 | 31 |
|
| 39 |
- Usage: $0 [-f FILE_PATH] [-d DISK_SIZE] [-v BRIDGE_NAME] [-m BRIDGE_NAME] [-p BRIDGE_NAME] |
|
| 40 |
- [-r RAM] [-i|-c] [-w] [-b] [-l NAME_LABEL] [-t TEMPLATE_NW_INSTALL] |
|
| 32 |
+ Usage: $0 -t TEMPLATE_NW_INSTALL -l NAME_LABEL [-n BRIDGE] [-r RAM] [-b] |
|
| 41 | 33 |
|
| 42 |
- Installs XenServer OpenStack VPX. |
|
| 34 |
+ Install a VM from a template |
|
| 43 | 35 |
|
| 44 | 36 |
OPTIONS: |
| 45 | 37 |
|
| 46 | 38 |
-h Shows this message. |
| 47 |
- -i Install OpenStack VPX as template. |
|
| 48 |
- -c Clone from existing template. |
|
| 49 |
- -w Wait for the network settings to show up before exiting. |
|
| 39 |
+ -t template VM template to use |
|
| 50 | 40 |
-b Enable memory ballooning. When set min_RAM=RAM/2 max_RAM=RAM. |
| 51 |
- -f path Specifies the path to the XVA. |
|
| 52 |
- Default to ./os-vpx.xva. |
|
| 53 |
- -d disk-size Specifies the size in MiB for the data disk. |
|
| 54 |
- Defaults to 500 MiB. |
|
| 55 |
- -m bridge Specifies the bridge for the isolated management network. |
|
| 56 |
- Defaults to xenbr0. |
|
| 57 |
- -v bridge Specifies the bridge for the vm network |
|
| 58 |
- -p bridge Specifies the bridge for the externally facing network. |
|
| 59 | 41 |
-r MiB Specifies RAM used by the VPX, in MiB. |
| 60 | 42 |
By default it will take the value from the XVA. |
| 61 | 43 |
-l name Specifies the name label for the VM. |
| 62 |
- -t template Network install an openstack domU from this template |
|
| 63 |
- |
|
| 64 |
- EXAMPLES: |
|
| 65 |
- |
|
| 66 |
- Create a VPX that connects to the isolated management network using the |
|
| 67 |
- default bridge with a data disk of 1GiB: |
|
| 68 |
- install-os-vpx.sh -f /root/os-vpx-devel.xva -d 1024 |
|
| 69 |
- |
|
| 70 |
- Create a VPX that connects to the isolated management network using xenbr1 |
|
| 71 |
- as bridge: |
|
| 72 |
- install-os-vpx.sh -m xenbr1 |
|
| 73 |
- |
|
| 74 |
- Create a VPX that connects to both the management and public networks |
|
| 75 |
- using xenbr1 and xapi4 as bridges: |
|
| 76 |
- install-os-vpx.sh -m xenbr1 -p xapi4 |
|
| 77 |
- |
|
| 78 |
- Create a VPX that connects to both the management and public networks |
|
| 79 |
- using the default for management traffic: |
|
| 80 |
- install-os-vpx.sh -m xapi4 |
|
| 81 |
- |
|
| 44 |
+ -n bridge The bridge/network to use for eth0. Defaults to xenbr0 |
|
| 82 | 45 |
EOF |
| 83 | 46 |
} |
| 84 | 47 |
|
| 85 | 48 |
get_params() |
| 86 | 49 |
{
|
| 87 |
- while getopts "hicwbf:d:v:m:p:r:l:t:" OPTION; |
|
| 50 |
+ while getopts "hbn:r:l:t:" OPTION; |
|
| 88 | 51 |
do |
| 89 | 52 |
case $OPTION in |
| 90 | 53 |
h) usage |
| 91 | 54 |
exit 1 |
| 92 | 55 |
;; |
| 93 |
- i) |
|
| 94 |
- AS_TEMPLATE=1 |
|
| 95 |
- ;; |
|
| 96 |
- c) |
|
| 97 |
- FROM_TEMPLATE=1 |
|
| 98 |
- ;; |
|
| 99 |
- w) |
|
| 100 |
- WAIT_FOR_NETWORK=1 |
|
| 101 |
- ;; |
|
| 102 | 56 |
b) |
| 103 | 57 |
BALLOONING=1 |
| 104 | 58 |
;; |
| 105 |
- f) |
|
| 106 |
- VPX_FILE=$OPTARG |
|
| 107 |
- ;; |
|
| 108 |
- d) |
|
| 109 |
- DATA_VDI_SIZE="${OPTARG}MiB"
|
|
| 110 |
- ;; |
|
| 111 |
- m) |
|
| 112 |
- BRIDGE_M=$OPTARG |
|
| 113 |
- ;; |
|
| 114 |
- p) |
|
| 115 |
- BRIDGE_P=$OPTARG |
|
| 116 |
- ;; |
|
| 117 | 59 |
r) |
| 118 | 60 |
RAM=$OPTARG |
| 119 | 61 |
;; |
| 120 |
- v) |
|
| 121 |
- BRIDGE_V=$OPTARG |
|
| 62 |
+ n) |
|
| 63 |
+ BRIDGE=$OPTARG |
|
| 122 | 64 |
;; |
| 123 | 65 |
l) |
| 124 | 66 |
NAME_LABEL=$OPTARG |
| ... | ... |
@@ -132,9 +74,19 @@ get_params() |
| 132 | 132 |
;; |
| 133 | 133 |
esac |
| 134 | 134 |
done |
| 135 |
- if [[ -z $BRIDGE_M ]] |
|
| 135 |
+ if [[ -z $BRIDGE ]] |
|
| 136 | 136 |
then |
| 137 |
- BRIDGE_M=xenbr0 |
|
| 137 |
+ BRIDGE=xenbr0 |
|
| 138 |
+ fi |
|
| 139 |
+ |
|
| 140 |
+ if [[ -z $TEMPLATE_NAME ]]; then |
|
| 141 |
+ echo "Please specify a template name" >&2 |
|
| 142 |
+ exit 1 |
|
| 143 |
+ fi |
|
| 144 |
+ |
|
| 145 |
+ if [[ -z $NAME_LABEL ]]; then |
|
| 146 |
+ echo "Please specify a name-label for the new VM" >&2 |
|
| 147 |
+ exit 1 |
|
| 138 | 148 |
fi |
| 139 | 149 |
} |
| 140 | 150 |
|
| ... | ... |
@@ -147,34 +99,6 @@ xe_min() |
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
|
| 150 |
-get_dest_sr() |
|
| 151 |
-{
|
|
| 152 |
- IFS=, |
|
| 153 |
- sr_uuids=$(xe sr-list --minimal other-config:i18n-key=local-storage) |
|
| 154 |
- dest_sr="" |
|
| 155 |
- for sr_uuid in $sr_uuids |
|
| 156 |
- do |
|
| 157 |
- pbd=$(xe pbd-list --minimal sr-uuid=$sr_uuid host-uuid=$INSTALLATION_UUID) |
|
| 158 |
- if [ "$pbd" ] |
|
| 159 |
- then |
|
| 160 |
- echo "$sr_uuid" |
|
| 161 |
- unset IFS |
|
| 162 |
- return |
|
| 163 |
- fi |
|
| 164 |
- done |
|
| 165 |
- unset IFS |
|
| 166 |
- |
|
| 167 |
- dest_sr=$(xe_min sr-list uuid=$(xe_min pool-list params=default-SR)) |
|
| 168 |
- if [ "$dest_sr" = "" ] |
|
| 169 |
- then |
|
| 170 |
- echo "No local storage and no default storage; cannot import VPX." >&2 |
|
| 171 |
- exit 1 |
|
| 172 |
- else |
|
| 173 |
- echo "$dest_sr" |
|
| 174 |
- fi |
|
| 175 |
-} |
|
| 176 |
- |
|
| 177 |
- |
|
| 178 | 150 |
find_network() |
| 179 | 151 |
{
|
| 180 | 152 |
result=$(xe_min network-list bridge="$1") |
| ... | ... |
@@ -186,137 +110,12 @@ find_network() |
| 186 | 186 |
} |
| 187 | 187 |
|
| 188 | 188 |
|
| 189 |
-find_template() |
|
| 190 |
-{
|
|
| 191 |
- xe_min template-list other-config:os-vpx=true |
|
| 192 |
-} |
|
| 193 |
- |
|
| 194 |
- |
|
| 195 |
-renumber_system_disk() |
|
| 196 |
-{
|
|
| 197 |
- local v="$1" |
|
| 198 |
- local vdi_uuid=$(xe_min vbd-list vm-uuid="$v" type=Disk userdevice=xvda \ |
|
| 199 |
- params=vdi-uuid) |
|
| 200 |
- if [ "$vdi_uuid" ] |
|
| 201 |
- then |
|
| 202 |
- local vbd_uuid=$(xe_min vbd-list vm-uuid="$v" vdi-uuid="$vdi_uuid") |
|
| 203 |
- xe vbd-destroy uuid="$vbd_uuid" |
|
| 204 |
- local new_vbd_uuid=$(xe vbd-create vm-uuid="$v" vdi-uuid="$vdi_uuid" \ |
|
| 205 |
- device=0 bootable=true type=Disk) |
|
| 206 |
- xe vbd-param-set other-config:owner uuid="$new_vbd_uuid" |
|
| 207 |
- fi |
|
| 208 |
-} |
|
| 209 |
- |
|
| 210 |
- |
|
| 211 | 189 |
create_vif() |
| 212 | 190 |
{
|
| 213 |
- xe vif-create vm-uuid="$1" network-uuid="$2" device="$3" |
|
| 214 |
-} |
|
| 215 |
- |
|
| 216 |
-create_gi_vif() |
|
| 217 |
-{
|
|
| 218 |
- local v="$1" |
|
| 219 |
- # Note that we've made the outbound device eth1, so that it comes up after |
|
| 220 |
- # the guest installer VIF, which means that the outbound one wins in terms |
|
| 221 |
- # of gateway. |
|
| 222 |
- local gi_network_uuid=$(xe_min network-list \ |
|
| 223 |
- other-config:is_guest_installer_network=true) |
|
| 224 |
- create_vif "$v" "$gi_network_uuid" "0" >/dev/null |
|
| 225 |
-} |
|
| 226 |
- |
|
| 227 |
-create_vm_vif() |
|
| 228 |
-{
|
|
| 229 |
- local v="$1" |
|
| 230 |
- echo "Installing VM interface on $BRIDGE_V." |
|
| 231 |
- local out_network_uuid=$(find_network "$BRIDGE_V") |
|
| 232 |
- create_vif "$v" "$out_network_uuid" "1" >/dev/null |
|
| 233 |
-} |
|
| 234 |
- |
|
| 235 |
-create_management_vif() |
|
| 236 |
-{
|
|
| 237 | 191 |
local v="$1" |
| 238 |
- echo "Installing management interface on $BRIDGE_M." |
|
| 239 |
- local out_network_uuid=$(find_network "$BRIDGE_M") |
|
| 240 |
- create_vif "$v" "$out_network_uuid" "2" >/dev/null |
|
| 241 |
-} |
|
| 242 |
- |
|
| 243 |
- |
|
| 244 |
-# This installs the interface for public traffic, only if a bridge is specified |
|
| 245 |
-# The interface is not configured at this stage, but it will be, once the admin |
|
| 246 |
-# tasks are complete for the services of this VPX |
|
| 247 |
-create_public_vif() |
|
| 248 |
-{
|
|
| 249 |
- local v="$1" |
|
| 250 |
- if [[ -z $BRIDGE_P ]] |
|
| 251 |
- then |
|
| 252 |
- echo "Skipping installation of interface for public traffic." |
|
| 253 |
- else |
|
| 254 |
- echo "Installing public interface on $BRIDGE_P." |
|
| 255 |
- pub_network_uuid=$(find_network "$BRIDGE_P") |
|
| 256 |
- create_vif "$v" "$pub_network_uuid" "3" >/dev/null |
|
| 257 |
- fi |
|
| 258 |
-} |
|
| 259 |
- |
|
| 260 |
- |
|
| 261 |
-label_system_disk() |
|
| 262 |
-{
|
|
| 263 |
- local v="$1" |
|
| 264 |
- local vdi_uuid=$(xe_min vbd-list vm-uuid="$v" type=Disk userdevice=0 \ |
|
| 265 |
- params=vdi-uuid) |
|
| 266 |
- xe vdi-param-set \ |
|
| 267 |
- name-label="$NAME system disk" \ |
|
| 268 |
- other-config:os-vpx=true \ |
|
| 269 |
- uuid=$vdi_uuid |
|
| 270 |
-} |
|
| 271 |
- |
|
| 272 |
- |
|
| 273 |
-create_data_disk() |
|
| 274 |
-{
|
|
| 275 |
- local v="$1" |
|
| 276 |
- |
|
| 277 |
- local sys_vdi_uuid=$(xe_min vbd-list vm-uuid="$v" type=Disk params=vdi-uuid) |
|
| 278 |
- local data_vdi_uuid=$(xe_min vdi-list other-config:os-vpx-data=true) |
|
| 279 |
- |
|
| 280 |
- if echo "$data_vdi_uuid" | grep -q , |
|
| 281 |
- then |
|
| 282 |
- echo "Multiple data disks found -- assuming that you want a new one." |
|
| 283 |
- data_vdi_uuid="" |
|
| 284 |
- else |
|
| 285 |
- data_in_use=$(xe_min vbd-list vdi-uuid="$data_vdi_uuid") |
|
| 286 |
- if [ "$data_in_use" != "" ] |
|
| 287 |
- then |
|
| 288 |
- echo "Data disk already in use -- will create another one." |
|
| 289 |
- data_vdi_uuid="" |
|
| 290 |
- fi |
|
| 291 |
- fi |
|
| 292 |
- |
|
| 293 |
- if [ "$data_vdi_uuid" = "" ] |
|
| 294 |
- then |
|
| 295 |
- echo -n "Creating new data disk ($DATA_VDI_SIZE)... " |
|
| 296 |
- sr_uuid=$(xe_min vdi-list params=sr-uuid uuid="$sys_vdi_uuid") |
|
| 297 |
- data_vdi_uuid=$(xe vdi-create name-label="$NAME data disk" \ |
|
| 298 |
- sr-uuid="$sr_uuid" \ |
|
| 299 |
- type=user \ |
|
| 300 |
- virtual-size="$DATA_VDI_SIZE") |
|
| 301 |
- xe vdi-param-set \ |
|
| 302 |
- other-config:os-vpx-data=true \ |
|
| 303 |
- uuid="$data_vdi_uuid" |
|
| 304 |
- dom0_uuid=$(xe_min vm-list is-control-domain=true) |
|
| 305 |
- vbd_uuid=$(xe vbd-create device=autodetect type=Disk \ |
|
| 306 |
- vdi-uuid="$data_vdi_uuid" vm-uuid="$dom0_uuid") |
|
| 307 |
- xe vbd-plug uuid=$vbd_uuid |
|
| 308 |
- dev=$(xe_min vbd-list params=device uuid=$vbd_uuid) |
|
| 309 |
- mke2fs -q -j -m0 /dev/$dev |
|
| 310 |
- e2label /dev/$dev vpxstate |
|
| 311 |
- xe vbd-unplug uuid=$vbd_uuid |
|
| 312 |
- xe vbd-destroy uuid=$vbd_uuid |
|
| 313 |
- else |
|
| 314 |
- echo -n "Attaching old data disk... " |
|
| 315 |
- fi |
|
| 316 |
- vbd_uuid=$(xe vbd-create device=2 type=Disk \ |
|
| 317 |
- vdi-uuid="$data_vdi_uuid" vm-uuid="$v") |
|
| 318 |
- xe vbd-param-set other-config:os-vpx-data=true uuid=$vbd_uuid |
|
| 319 |
- echo "done." |
|
| 192 |
+ echo "Installing VM interface on [$BRIDGE]" |
|
| 193 |
+ local out_network_uuid=$(find_network "$BRIDGE") |
|
| 194 |
+ xe vif-create vm-uuid="$v" network-uuid="$out_network_uuid" device="0" |
|
| 320 | 195 |
} |
| 321 | 196 |
|
| 322 | 197 |
|
| ... | ... |
@@ -342,34 +141,6 @@ set_auto_start() |
| 342 | 342 |
} |
| 343 | 343 |
|
| 344 | 344 |
|
| 345 |
-set_all() |
|
| 346 |
-{
|
|
| 347 |
- local v="$1" |
|
| 348 |
- set_memory "$v" |
|
| 349 |
- set_auto_start "$v" |
|
| 350 |
- label_system_disk "$v" |
|
| 351 |
- create_gi_vif "$v" |
|
| 352 |
- create_vm_vif "$v" |
|
| 353 |
- create_management_vif "$v" |
|
| 354 |
- create_public_vif "$v" |
|
| 355 |
-} |
|
| 356 |
- |
|
| 357 |
- |
|
| 358 |
-log_vifs() |
|
| 359 |
-{
|
|
| 360 |
- local v="$1" |
|
| 361 |
- |
|
| 362 |
- (IFS=, |
|
| 363 |
- for vif in $(xe_min vif-list vm-uuid="$v") |
|
| 364 |
- do |
|
| 365 |
- dev=$(xe_min vif-list uuid="$vif" params=device) |
|
| 366 |
- mac=$(xe_min vif-list uuid="$vif" params=MAC | sed -e 's/:/-/g') |
|
| 367 |
- echo "eth$dev has MAC $mac." |
|
| 368 |
- done |
|
| 369 |
- unset IFS) | sort |
|
| 370 |
-} |
|
| 371 |
- |
|
| 372 |
- |
|
| 373 | 345 |
destroy_vifs() |
| 374 | 346 |
{
|
| 375 | 347 |
local v="$1" |
| ... | ... |
@@ -384,116 +155,11 @@ destroy_vifs() |
| 384 | 384 |
|
| 385 | 385 |
get_params "$@" |
| 386 | 386 |
|
| 387 |
-thisdir=$(dirname "$0") |
|
| 388 |
- |
|
| 389 |
-if [ "$FROM_TEMPLATE" ] |
|
| 390 |
-then |
|
| 391 |
- template_uuid=$(find_template) |
|
| 392 |
- name=$(xe_min template-list params=name-label uuid="$template_uuid") |
|
| 393 |
- echo -n "Cloning $name... " |
|
| 394 |
- vm_uuid=$(xe vm-clone vm="$template_uuid" new-name-label="$name") |
|
| 395 |
- xe vm-param-set is-a-template=false uuid="$vm_uuid" |
|
| 396 |
- echo $vm_uuid. |
|
| 397 |
- |
|
| 398 |
- destroy_vifs "$vm_uuid" |
|
| 399 |
- set_all "$vm_uuid" |
|
| 400 |
-elif [ "$TEMPLATE_NAME" ] |
|
| 401 |
-then |
|
| 402 |
- echo $TEMPLATE_NAME |
|
| 403 |
- vm_uuid=$(xe_min vm-install template="$TEMPLATE_NAME" new-name-label="$NAME_LABEL") |
|
| 404 |
- destroy_vifs "$vm_uuid" |
|
| 405 |
- set_auto_start "$vm_uuid" |
|
| 406 |
- create_gi_vif "$vm_uuid" |
|
| 407 |
- create_vm_vif "$vm_uuid" |
|
| 408 |
- create_management_vif "$vm_uuid" |
|
| 409 |
- create_public_vif "$vm_uuid" |
|
| 410 |
- xe vm-param-set other-config:os-vpx=true uuid="$vm_uuid" |
|
| 411 |
- xe vm-param-set actions-after-reboot=Destroy uuid="$vm_uuid" |
|
| 412 |
- set_memory "$vm_uuid" |
|
| 413 |
-else |
|
| 414 |
- if [ ! -f "$VPX_FILE" ] |
|
| 415 |
- then |
|
| 416 |
- # Search $thisdir/$VPX_FILE too. In particular, this is used when |
|
| 417 |
- # installing the VPX from the supp-pack, because we want to be able to |
|
| 418 |
- # invoke this script from the RPM and the firstboot script. |
|
| 419 |
- if [ -f "$thisdir/$VPX_FILE" ] |
|
| 420 |
- then |
|
| 421 |
- VPX_FILE="$thisdir/$VPX_FILE" |
|
| 422 |
- else |
|
| 423 |
- echo "$VPX_FILE does not exist." >&2 |
|
| 424 |
- exit 1 |
|
| 425 |
- fi |
|
| 426 |
- fi |
|
| 427 |
- |
|
| 428 |
- echo "Found OS-VPX File: $VPX_FILE. " |
|
| 429 |
- |
|
| 430 |
- dest_sr=$(get_dest_sr) |
|
| 431 |
- |
|
| 432 |
- echo -n "Installing $NAME... " |
|
| 433 |
- vm_uuid=$(xe vm-import filename=$VPX_FILE sr-uuid="$dest_sr") |
|
| 434 |
- echo $vm_uuid. |
|
| 435 |
- |
|
| 436 |
- renumber_system_disk "$vm_uuid" |
|
| 437 |
- |
|
| 438 |
- nl=${NAME_LABEL:-$(xe_min vm-list params=name-label uuid=$vm_uuid)}
|
|
| 439 |
- xe vm-param-set \ |
|
| 440 |
- "name-label=${nl/ import/}" \
|
|
| 441 |
- other-config:os-vpx=true \ |
|
| 442 |
- uuid=$vm_uuid |
|
| 443 |
- |
|
| 444 |
- set_all "$vm_uuid" |
|
| 445 |
- create_data_disk "$vm_uuid" |
|
| 446 |
- |
|
| 447 |
- if [ "$AS_TEMPLATE" ] |
|
| 448 |
- then |
|
| 449 |
- xe vm-param-set uuid="$vm_uuid" is-a-template=true \ |
|
| 450 |
- other-config:instant=true |
|
| 451 |
- echo -n "Installing VPX from template... " |
|
| 452 |
- vm_uuid=$(xe vm-clone vm="$vm_uuid" new-name-label="${nl/ import/}")
|
|
| 453 |
- xe vm-param-set is-a-template=false uuid="$vm_uuid" |
|
| 454 |
- echo "$vm_uuid." |
|
| 455 |
- fi |
|
| 456 |
-fi |
|
| 457 |
- |
|
| 458 |
- |
|
| 459 |
-log_vifs "$vm_uuid" |
|
| 460 |
- |
|
| 461 |
-echo -n "Starting VM... " |
|
| 387 |
+vm_uuid=$(xe_min vm-install template="$TEMPLATE_NAME" new-name-label="$NAME_LABEL") |
|
| 388 |
+destroy_vifs "$vm_uuid" |
|
| 389 |
+set_auto_start "$vm_uuid" |
|
| 390 |
+create_vif "$vm_uuid" |
|
| 391 |
+xe vm-param-set other-config:os-vpx=true uuid="$vm_uuid" |
|
| 392 |
+xe vm-param-set actions-after-reboot=Destroy uuid="$vm_uuid" |
|
| 393 |
+set_memory "$vm_uuid" |
|
| 462 | 394 |
xe vm-start uuid=$vm_uuid |
| 463 |
-echo "done." |
|
| 464 |
- |
|
| 465 |
- |
|
| 466 |
-show_ip() |
|
| 467 |
-{
|
|
| 468 |
- ip_addr=$(echo "$1" | sed -n "s,^.*"$2"/ip: \([^;]*\).*$,\1,p") |
|
| 469 |
- echo -n "IP address for $3: " |
|
| 470 |
- if [ "$ip_addr" = "" ] |
|
| 471 |
- then |
|
| 472 |
- echo "did not appear." |
|
| 473 |
- else |
|
| 474 |
- echo "$ip_addr." |
|
| 475 |
- fi |
|
| 476 |
-} |
|
| 477 |
- |
|
| 478 |
- |
|
| 479 |
-if [ "$WAIT_FOR_NETWORK" ] |
|
| 480 |
-then |
|
| 481 |
- echo "Waiting for network configuration... " |
|
| 482 |
- i=0 |
|
| 483 |
- while [ $i -lt 600 ] |
|
| 484 |
- do |
|
| 485 |
- ip=$(xe_min vm-list params=networks uuid=$vm_uuid) |
|
| 486 |
- if [ "$ip" != "<not in database>" ] |
|
| 487 |
- then |
|
| 488 |
- show_ip "$ip" "1" "$BRIDGE_M" |
|
| 489 |
- if [[ $BRIDGE_P ]] |
|
| 490 |
- then |
|
| 491 |
- show_ip "$ip" "2" "$BRIDGE_P" |
|
| 492 |
- fi |
|
| 493 |
- echo "Installation complete." |
|
| 494 |
- exit 0 |
|
| 495 |
- fi |
|
| 496 |
- sleep 10 |
|
| 497 |
- let i=i+1 |
|
| 498 |
- done |
|
| 499 |
-fi |
| ... | ... |
@@ -53,7 +53,7 @@ disk_size=$(($OSDOMU_VDI_GB * 1024 * 1024 * 1024)) |
| 53 | 53 |
pvargs="-- quiet console=hvc0 partman/default_filesystem=ext3 \ |
| 54 | 54 |
console-setup/ask_detect=false locale=${UBUNTU_INST_LOCALE} \
|
| 55 | 55 |
keyboard-configuration/layoutcode=${UBUNTU_INST_KEYBOARD} \
|
| 56 |
-netcfg/choose_interface=${UBUNTU_INST_IFACE} \
|
|
| 56 |
+netcfg/choose_interface=eth0 \ |
|
| 57 | 57 |
netcfg/get_hostname=os netcfg/get_domain=os auto \ |
| 58 | 58 |
url=${preseed_url}"
|
| 59 | 59 |
|
| ... | ... |
@@ -60,8 +60,8 @@ PUB_IP=${PUB_IP:-172.24.4.10}
|
| 60 | 60 |
PUB_NETMASK=${PUB_NETMASK:-255.255.255.0}
|
| 61 | 61 |
|
| 62 | 62 |
# Ubuntu install settings |
| 63 |
-UBUNTU_INST_RELEASE="oneiric" |
|
| 64 |
-UBUNTU_INST_TEMPLATE_NAME="Ubuntu 11.10 (64-bit) for DevStack" |
|
| 63 |
+UBUNTU_INST_RELEASE="precise" |
|
| 64 |
+UBUNTU_INST_TEMPLATE_NAME="Ubuntu 12.04 (64-bit) for DevStack" |
|
| 65 | 65 |
# For 12.04 use "precise" and update template name |
| 66 | 66 |
# However, for 12.04, you should be using |
| 67 | 67 |
# XenServer 6.1 and later or XCP 1.6 or later |
| ... | ... |
@@ -72,11 +72,8 @@ UBUNTU_INST_HTTP_DIRECTORY="/ubuntu" |
| 72 | 72 |
UBUNTU_INST_HTTP_PROXY="" |
| 73 | 73 |
UBUNTU_INST_LOCALE="en_US" |
| 74 | 74 |
UBUNTU_INST_KEYBOARD="us" |
| 75 |
-# network configuration for ubuntu netinstall. |
|
| 76 |
-# TODO(matelakat): get rid of legacy network interfaces |
|
| 77 |
-# specify "eth2" to use the management network |
|
| 78 |
-# specify "eth3" to use the public network |
|
| 79 |
-UBUNTU_INST_IFACE="eth2" |
|
| 75 |
+# network configuration for ubuntu netinstall |
|
| 76 |
+UBUNTU_INST_BRIDGE_OR_NET_NAME=${UBUNTU_INST_BRIDGE_OR_NET_NAME:-"$MGT_BRIDGE_OR_NET_NAME"}
|
|
| 80 | 77 |
UBUNTU_INST_IP="dhcp" |
| 81 | 78 |
UBUNTU_INST_NAMESERVERS="" |
| 82 | 79 |
UBUNTU_INST_NETMASK="" |