xenapi: kernel_cmdline moved out from template
The kernel's cmdline was set during the initial devstack machine installation. Thus, during second runs, the kernel's cmdline was not updated. This patch extracts append_kernel_cmdline, and configures domU's kernel cmdline every time. As some networking parameters are passed through the kernel cmdline, this patch makes it possible to change the network configuration, even if a cached devstack exists. Related to blueprint xenapi-devstack-cleanup Change-Id: I3b7175f4e83326c3e28825ac50625f6bd2a9a029
This commit is contained in:
parent
f652e0fb6d
commit
8ff33ce75f
@ -94,6 +94,14 @@ function find_ip_by_name() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _vm_uuid() {
|
||||||
|
local vm_name_label
|
||||||
|
|
||||||
|
vm_name_label="$1"
|
||||||
|
|
||||||
|
xe vm-list name-label="$vm_name_label" --minimal
|
||||||
|
}
|
||||||
|
|
||||||
function _create_new_network() {
|
function _create_new_network() {
|
||||||
local name_label
|
local name_label
|
||||||
name_label=$1
|
name_label=$1
|
||||||
@ -135,17 +143,17 @@ function _network_uuid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function add_interface() {
|
function add_interface() {
|
||||||
local vm_name
|
local vm_name_label
|
||||||
local bridge_or_network_name
|
local bridge_or_network_name
|
||||||
|
|
||||||
vm_name="$1"
|
vm_name_label="$1"
|
||||||
bridge_or_network_name="$2"
|
bridge_or_network_name="$2"
|
||||||
device_number="$3"
|
device_number="$3"
|
||||||
|
|
||||||
local vm
|
local vm
|
||||||
local net
|
local net
|
||||||
|
|
||||||
vm=$(xe vm-list name-label="$vm_name" --minimal)
|
vm=$(_vm_uuid "$vm_name_label")
|
||||||
net=$(_network_uuid "$bridge_or_network_name")
|
net=$(_network_uuid "$bridge_or_network_name")
|
||||||
xe vif-create network-uuid=$net vm-uuid=$vm device=$device_number
|
xe vif-create network-uuid=$net vm-uuid=$vm device=$device_number
|
||||||
}
|
}
|
||||||
@ -200,3 +208,19 @@ function parameter_is_specified() {
|
|||||||
|
|
||||||
compgen -v | grep "$parameter_name"
|
compgen -v | grep "$parameter_name"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function append_kernel_cmdline()
|
||||||
|
{
|
||||||
|
local vm_name_label
|
||||||
|
local kernel_args
|
||||||
|
|
||||||
|
vm_name_label="$1"
|
||||||
|
kernel_args="$2"
|
||||||
|
|
||||||
|
local vm
|
||||||
|
local pv_args
|
||||||
|
|
||||||
|
vm=$(_vm_uuid "$vm_name_label")
|
||||||
|
pv_args=$(xe vm-param-get param-name=PV-args uuid=$vm)
|
||||||
|
xe vm-param-set PV-args="$pv_args $kernel_args" uuid=$vm
|
||||||
|
}
|
||||||
|
@ -200,21 +200,13 @@ if [ -z "$templateuuid" ]; then
|
|||||||
|
|
||||||
# create a new VM with the given template
|
# create a new VM with the given template
|
||||||
# creating the correct VIFs and metadata
|
# creating the correct VIFs and metadata
|
||||||
FLAT_NETWORK_BRIDGE=$(bridge_for "$VM_BRIDGE_OR_NET_NAME")
|
|
||||||
|
|
||||||
KERNEL_PARAMS_FOR_QUANTUM=""
|
|
||||||
if is_service_enabled quantum; then
|
|
||||||
XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME")
|
|
||||||
KERNEL_PARAMS_FOR_QUANTUM="xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}"
|
|
||||||
fi
|
|
||||||
$THIS_DIR/scripts/install-os-vpx.sh \
|
$THIS_DIR/scripts/install-os-vpx.sh \
|
||||||
-t "$UBUNTU_INST_TEMPLATE_NAME" \
|
-t "$UBUNTU_INST_TEMPLATE_NAME" \
|
||||||
-v "$VM_BRIDGE_OR_NET_NAME" \
|
-v "$VM_BRIDGE_OR_NET_NAME" \
|
||||||
-m "$MGT_BRIDGE_OR_NET_NAME" \
|
-m "$MGT_BRIDGE_OR_NET_NAME" \
|
||||||
-p "$PUB_BRIDGE_OR_NET_NAME" \
|
-p "$PUB_BRIDGE_OR_NET_NAME" \
|
||||||
-l "$GUEST_NAME" \
|
-l "$GUEST_NAME" \
|
||||||
-r "$OSDOMU_MEM_MB" \
|
-r "$OSDOMU_MEM_MB"
|
||||||
-k "flat_network_bridge=${FLAT_NETWORK_BRIDGE} ${KERNEL_PARAMS_FOR_QUANTUM}"
|
|
||||||
|
|
||||||
# wait for install to finish
|
# wait for install to finish
|
||||||
wait_for_VM_to_halt
|
wait_for_VM_to_halt
|
||||||
@ -253,11 +245,20 @@ fi
|
|||||||
$THIS_DIR/build_xva.sh "$GUEST_NAME"
|
$THIS_DIR/build_xva.sh "$GUEST_NAME"
|
||||||
|
|
||||||
# Attach a network interface for the integration network (so that the bridge
|
# Attach a network interface for the integration network (so that the bridge
|
||||||
# is created by XenServer). This is required for Quantum.
|
# is created by XenServer). This is required for Quantum. Also pass that as a
|
||||||
|
# kernel parameter for DomU
|
||||||
if is_service_enabled quantum; then
|
if is_service_enabled quantum; then
|
||||||
add_interface "$GUEST_NAME" "$XEN_INT_BRIDGE_OR_NET_NAME" "4"
|
add_interface "$GUEST_NAME" "$XEN_INT_BRIDGE_OR_NET_NAME" "4"
|
||||||
|
|
||||||
|
XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME")
|
||||||
|
append_kernel_cmdline \
|
||||||
|
"$GUEST_NAME" \
|
||||||
|
"xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
FLAT_NETWORK_BRIDGE=$(bridge_for "$VM_BRIDGE_OR_NET_NAME")
|
||||||
|
append_kernel_cmdline "$GUEST_NAME" "flat_network_bridge=${FLAT_NETWORK_BRIDGE}"
|
||||||
|
|
||||||
# create a snapshot before the first boot
|
# create a snapshot before the first boot
|
||||||
# to allow a quick re-run with the same settings
|
# to allow a quick re-run with the same settings
|
||||||
xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_FIRST_BOOT"
|
xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_FIRST_BOOT"
|
||||||
|
@ -25,7 +25,6 @@ NAME="XenServer OpenStack VPX"
|
|||||||
DATA_VDI_SIZE="500MiB"
|
DATA_VDI_SIZE="500MiB"
|
||||||
BRIDGE_M=
|
BRIDGE_M=
|
||||||
BRIDGE_P=
|
BRIDGE_P=
|
||||||
KERNEL_PARAMS=
|
|
||||||
VPX_FILE=os-vpx.xva
|
VPX_FILE=os-vpx.xva
|
||||||
AS_TEMPLATE=
|
AS_TEMPLATE=
|
||||||
FROM_TEMPLATE=
|
FROM_TEMPLATE=
|
||||||
@ -38,7 +37,7 @@ usage()
|
|||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
Usage: $0 [-f FILE_PATH] [-d DISK_SIZE] [-v BRIDGE_NAME] [-m BRIDGE_NAME] [-p BRIDGE_NAME]
|
Usage: $0 [-f FILE_PATH] [-d DISK_SIZE] [-v BRIDGE_NAME] [-m BRIDGE_NAME] [-p BRIDGE_NAME]
|
||||||
[-k PARAMS] [-r RAM] [-i|-c] [-w] [-b] [-l NAME_LABEL] [-t TEMPLATE_NW_INSTALL]
|
[-r RAM] [-i|-c] [-w] [-b] [-l NAME_LABEL] [-t TEMPLATE_NW_INSTALL]
|
||||||
|
|
||||||
Installs XenServer OpenStack VPX.
|
Installs XenServer OpenStack VPX.
|
||||||
|
|
||||||
@ -57,7 +56,6 @@ cat << EOF
|
|||||||
Defaults to xenbr0.
|
Defaults to xenbr0.
|
||||||
-v bridge Specifies the bridge for the vm network
|
-v bridge Specifies the bridge for the vm network
|
||||||
-p bridge Specifies the bridge for the externally facing network.
|
-p bridge Specifies the bridge for the externally facing network.
|
||||||
-k params Specifies kernel parameters.
|
|
||||||
-r MiB Specifies RAM used by the VPX, in MiB.
|
-r MiB Specifies RAM used by the VPX, in MiB.
|
||||||
By default it will take the value from the XVA.
|
By default it will take the value from the XVA.
|
||||||
-l name Specifies the name label for the VM.
|
-l name Specifies the name label for the VM.
|
||||||
@ -81,15 +79,12 @@ cat << EOF
|
|||||||
using the default for management traffic:
|
using the default for management traffic:
|
||||||
install-os-vpx.sh -m xapi4
|
install-os-vpx.sh -m xapi4
|
||||||
|
|
||||||
Create a VPX that automatically becomes the master:
|
|
||||||
install-os-vpx.sh -k geppetto_master=true
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
get_params()
|
get_params()
|
||||||
{
|
{
|
||||||
while getopts "hicwbf:d:v:m:p:k:r:l:t:" OPTION;
|
while getopts "hicwbf:d:v:m:p:r:l:t:" OPTION;
|
||||||
do
|
do
|
||||||
case $OPTION in
|
case $OPTION in
|
||||||
h) usage
|
h) usage
|
||||||
@ -119,9 +114,6 @@ get_params()
|
|||||||
p)
|
p)
|
||||||
BRIDGE_P=$OPTARG
|
BRIDGE_P=$OPTARG
|
||||||
;;
|
;;
|
||||||
k)
|
|
||||||
KERNEL_PARAMS=$OPTARG
|
|
||||||
;;
|
|
||||||
r)
|
r)
|
||||||
RAM=$OPTARG
|
RAM=$OPTARG
|
||||||
;;
|
;;
|
||||||
@ -328,20 +320,6 @@ create_data_disk()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
set_kernel_params()
|
|
||||||
{
|
|
||||||
local v="$1"
|
|
||||||
local args=$KERNEL_PARAMS
|
|
||||||
if [ "$args" != "" ]
|
|
||||||
then
|
|
||||||
echo "Passing Geppetto args to VPX: $args."
|
|
||||||
pvargs=$(xe vm-param-get param-name=PV-args uuid="$v")
|
|
||||||
args="$pvargs $args"
|
|
||||||
xe vm-param-set PV-args="$args" uuid="$v"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
set_memory()
|
set_memory()
|
||||||
{
|
{
|
||||||
local v="$1"
|
local v="$1"
|
||||||
@ -367,7 +345,6 @@ set_auto_start()
|
|||||||
set_all()
|
set_all()
|
||||||
{
|
{
|
||||||
local v="$1"
|
local v="$1"
|
||||||
set_kernel_params "$v"
|
|
||||||
set_memory "$v"
|
set_memory "$v"
|
||||||
set_auto_start "$v"
|
set_auto_start "$v"
|
||||||
label_system_disk "$v"
|
label_system_disk "$v"
|
||||||
@ -430,7 +407,6 @@ then
|
|||||||
create_vm_vif "$vm_uuid"
|
create_vm_vif "$vm_uuid"
|
||||||
create_management_vif "$vm_uuid"
|
create_management_vif "$vm_uuid"
|
||||||
create_public_vif "$vm_uuid"
|
create_public_vif "$vm_uuid"
|
||||||
set_kernel_params "$vm_uuid"
|
|
||||||
xe vm-param-set other-config:os-vpx=true uuid="$vm_uuid"
|
xe vm-param-set other-config:os-vpx=true uuid="$vm_uuid"
|
||||||
xe vm-param-set actions-after-reboot=Destroy uuid="$vm_uuid"
|
xe vm-param-set actions-after-reboot=Destroy uuid="$vm_uuid"
|
||||||
set_memory "$vm_uuid"
|
set_memory "$vm_uuid"
|
||||||
|
Loading…
Reference in New Issue
Block a user