Merge "Make devstack work with xcp-xapi package on Ubuntu 12.04"
This commit is contained in:
commit
8df3823c52
5
stack.sh
5
stack.sh
@ -1705,7 +1705,7 @@ fi
|
|||||||
# For Example: EXTRA_OPTS=(foo=true bar=2)
|
# For Example: EXTRA_OPTS=(foo=true bar=2)
|
||||||
for I in "${EXTRA_OPTS[@]}"; do
|
for I in "${EXTRA_OPTS[@]}"; do
|
||||||
# Attempt to convert flags to options
|
# Attempt to convert flags to options
|
||||||
add_nova_opt ${I//-}
|
add_nova_opt ${I//--}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
@ -1716,8 +1716,9 @@ if [ "$VIRT_DRIVER" = 'xenserver' ]; then
|
|||||||
read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN."
|
read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN."
|
||||||
add_nova_opt "connection_type=xenapi"
|
add_nova_opt "connection_type=xenapi"
|
||||||
XENAPI_CONNECTION_URL=${XENAPI_CONNECTION_URL:-"http://169.254.0.1"}
|
XENAPI_CONNECTION_URL=${XENAPI_CONNECTION_URL:-"http://169.254.0.1"}
|
||||||
|
XENAPI_USER=${XENAPI_USER:-"root"}
|
||||||
add_nova_opt "xenapi_connection_url=$XENAPI_CONNECTION_URL"
|
add_nova_opt "xenapi_connection_url=$XENAPI_CONNECTION_URL"
|
||||||
add_nova_opt "xenapi_connection_username=root"
|
add_nova_opt "xenapi_connection_username=$XENAPI_USER"
|
||||||
add_nova_opt "xenapi_connection_password=$XENAPI_PASSWORD"
|
add_nova_opt "xenapi_connection_password=$XENAPI_PASSWORD"
|
||||||
add_nova_opt "flat_injected=False"
|
add_nova_opt "flat_injected=False"
|
||||||
# Need to avoid crash due to new firewall support
|
# Need to avoid crash due to new firewall support
|
||||||
|
@ -118,6 +118,13 @@ else
|
|||||||
sed -e "s,@ETH3_NETMASK@,$PUB_NETMASK,g" -i $INTERFACES
|
sed -e "s,@ETH3_NETMASK@,$PUB_NETMASK,g" -i $INTERFACES
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$ENABLE_GI" == "true" ]; then
|
||||||
|
cat <<EOF >>$INTERFACES
|
||||||
|
auto eth0
|
||||||
|
iface eth0 inet dhcp
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
# Gracefully cp only if source file/dir exists
|
# Gracefully cp only if source file/dir exists
|
||||||
function cp_it {
|
function cp_it {
|
||||||
if [ -e $1 ] || [ -d $1 ]; then
|
if [ -e $1 ] || [ -d $1 ]; then
|
||||||
|
@ -7,64 +7,74 @@ vm="$2"
|
|||||||
device="${3-0}"
|
device="${3-0}"
|
||||||
part="${4-}"
|
part="${4-}"
|
||||||
|
|
||||||
xe_min()
|
function xe_min() {
|
||||||
{
|
|
||||||
local cmd="$1"
|
local cmd="$1"
|
||||||
shift
|
shift
|
||||||
xe "$cmd" --minimal "$@"
|
xe "$cmd" --minimal "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function run_udev_settle() {
|
||||||
|
which_udev=$(which udevsettle) || true
|
||||||
|
if [ -n "$which_udev" ]; then
|
||||||
|
udevsettle
|
||||||
|
else
|
||||||
|
udevadm settle
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
vm_uuid=$(xe_min vm-list name-label="$vm")
|
vm_uuid=$(xe_min vm-list name-label="$vm")
|
||||||
vdi_uuid=$(xe_min vbd-list params=vdi-uuid vm-uuid="$vm_uuid" \
|
vdi_uuid=$(xe_min vbd-list params=vdi-uuid vm-uuid="$vm_uuid" \
|
||||||
userdevice="$device")
|
userdevice="$device")
|
||||||
|
|
||||||
dom0_uuid=$(xe_min vm-list is-control-domain=true)
|
dom0_uuid=$(xe_min vm-list is-control-domain=true)
|
||||||
|
|
||||||
get_mount_device()
|
function get_mount_device() {
|
||||||
{
|
|
||||||
vbd_uuid=$1
|
vbd_uuid=$1
|
||||||
|
|
||||||
dev=$(xe_min vbd-list params=device uuid="$vbd_uuid")
|
dev=$(xe_min vbd-list params=device uuid="$vbd_uuid")
|
||||||
if [[ "$dev" =~ "sm/" ]]; then
|
if [[ "$dev" =~ "sm/" ]]; then
|
||||||
DEBIAN_FRONTEND=noninteractive \
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
apt-get --option "Dpkg::Options::=--force-confold" --assume-yes \
|
apt-get --option "Dpkg::Options::=--force-confold" --assume-yes \
|
||||||
install kpartx || true &> /dev/null
|
install kpartx &> /dev/null || true
|
||||||
mapping=$(kpartx -av "/dev/$dev" | sed -ne 's,^add map \([a-f0-9\-]*\).*$,\1,p' | sed -ne "s,^\(.*${part}\)\$,\1,p")
|
mapping=$(kpartx -av "/dev/$dev" | sed -ne 's,^add map \([a-z0-9\-]*\).*$,\1,p' | sed -ne "s,^\(.*${part}\)\$,\1,p")
|
||||||
if [ -z "$mapping" ]; then
|
if [ -z "$mapping" ]; then
|
||||||
echo "Failed to find mapping"
|
echo "Failed to find mapping"
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
echo "mapper/${mapping}"
|
echo "/dev/mapper/${mapping}"
|
||||||
else
|
else
|
||||||
echo "/dev/$dev$part"
|
echo "/dev/$dev$part"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
open_vdi()
|
function clean_dev_mappings() {
|
||||||
{
|
dev=$(xe_min vbd-list params=device uuid="$vbd_uuid")
|
||||||
|
if [[ "$dev" =~ "sm/" ]]; then
|
||||||
|
kpartx -dv "/dev/$dev"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function open_vdi() {
|
||||||
vbd_uuid=$(xe vbd-create vm-uuid="$dom0_uuid" vdi-uuid="$vdi_uuid" \
|
vbd_uuid=$(xe vbd-create vm-uuid="$dom0_uuid" vdi-uuid="$vdi_uuid" \
|
||||||
device=autodetect)
|
device=autodetect)
|
||||||
mp=$(mktemp -d)
|
mp=$(mktemp -d)
|
||||||
xe vbd-plug uuid="$vbd_uuid"
|
xe vbd-plug uuid="$vbd_uuid"
|
||||||
|
|
||||||
which_udev=$(which udevsettle) || true
|
run_udev_settle
|
||||||
if [ -n "$which_udev" ]; then
|
|
||||||
udevsettle
|
|
||||||
else
|
|
||||||
udevadm settle
|
|
||||||
fi
|
|
||||||
|
|
||||||
mount_device=$(get_mount_device "$vbd_uuid")
|
mount_device=$(get_mount_device "$vbd_uuid")
|
||||||
mount "$mount_device" "$mp"
|
mount "$mount_device" "$mp"
|
||||||
echo "Your vdi is mounted at $mp"
|
echo "Your vdi is mounted at $mp"
|
||||||
}
|
}
|
||||||
|
|
||||||
close_vdi()
|
function close_vdi() {
|
||||||
{
|
|
||||||
vbd_uuid=$(xe_min vbd-list vm-uuid="$dom0_uuid" vdi-uuid="$vdi_uuid")
|
vbd_uuid=$(xe_min vbd-list vm-uuid="$dom0_uuid" vdi-uuid="$vdi_uuid")
|
||||||
mount_device=$(get_mount_device "$vbd_uuid")
|
mount_device=$(get_mount_device "$vbd_uuid")
|
||||||
|
run_udev_settle
|
||||||
umount "$mount_device"
|
umount "$mount_device"
|
||||||
|
|
||||||
|
clean_dev_mappings
|
||||||
|
|
||||||
xe vbd-unplug uuid=$vbd_uuid
|
xe vbd-unplug uuid=$vbd_uuid
|
||||||
xe vbd-destroy uuid=$vbd_uuid
|
xe vbd-destroy uuid=$vbd_uuid
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,3 @@ auto eth2
|
|||||||
iface eth2 inet static
|
iface eth2 inet static
|
||||||
address @ETH2_IP@
|
address @ETH2_IP@
|
||||||
netmask @ETH2_NETMASK@
|
netmask @ETH2_NETMASK@
|
||||||
|
|
||||||
auto eth0
|
|
||||||
iface eth0 inet dhcp
|
|
||||||
|
@ -38,5 +38,8 @@ MGT_BR=${MGT_BR:-""}
|
|||||||
MGT_VLAN=${MGT_VLAN:-101}
|
MGT_VLAN=${MGT_VLAN:-101}
|
||||||
MGT_DEV=${MGT_DEV:-eth0}
|
MGT_DEV=${MGT_DEV:-eth0}
|
||||||
|
|
||||||
|
# Guest installer network
|
||||||
|
ENABLE_GI=true
|
||||||
|
|
||||||
# Source params
|
# Source params
|
||||||
cd ../.. && source ./stackrc && cd $TOP_DIR
|
cd ../.. && source ./stackrc && cd $TOP_DIR
|
||||||
|
Loading…
Reference in New Issue
Block a user