...
 
Commits (16)
......@@ -111,11 +111,29 @@ pc.defineParameter("multiplexFlatLans", "Multiplex Flat Networks",
portal.ParameterType.BOOLEAN, False,
longDescription="Multiplex any flat networks (i.e., management and all of the flat data networks) over physical interfaces, using VLANs. These VLANs are invisible to OpenStack, unlike the NUmber of VLAN Data Networks option, where OpenStack assigns the real VLAN tags to create its networks. On CloudLab, many physical machines have only a single experiment network interface, so if you want multiple flat networks, you have to multiplex. Currently, if you select this option, you *must* specify 0 for VLAN Data Networks; we cannot support both simultaneously yet.",
advanced=True)
pc.defineParameter("connectSharedVlan","Connect Shared VLAN",
portal.ParameterType.STRING,"",
longDescription="Connect the controller node to a shared VLAN. This allows your OpenStack experiment to connect to one more separate experiments. This requires a non-multiplexed physical network interface, so you can only use this parameter on node types that provide two or more physical network interfaces! If the shared VLAN does not yet exist (e.g. was not manually created for you by an administrator, or created in another experiment), enable the next option to create it.",
advanced=True)
pc.defineParameter("createSharedVlan","Create Shared VLAN",
portal.ParameterType.BOOLEAN,False,
longDescription="Create a new shared VLAN with the name above, and connect the controller node to it. This requires a non-multiplexed physical network interface, so you can only use this parameter on node types that provide two or more physical network interfaces!",
advanced=True)
pc.defineParameter("sharedVlanAddress","Shared VLAN IP Address",
portal.ParameterType.STRING,"10.10.10.1/255.255.255.0",
longDescription="Set the IP address and subnet mask for the shared VLAN interface. Make sure you choose an unused address within the subnet of an existing shared vlan! Also ensure that you specify the subnet mask as a dotted quad.",
advanced=True)
pc.defineParameter("computeNodeCountSite2", "Number of compute nodes at Site 2",
portal.ParameterType.INTEGER, 0,advanced=True,
longDescription="You can add additional compute nodes from other CloudLab clusters, allowing you to experiment with remote VMs controlled from the central controller at the first site.")
pc.defineParameter("osNodeTypeSite2", "Site 2 Hardware Type",
portal.ParameterType.NODETYPE, "",
longDescription="A specific hardware type to use for each node at Site 2. Cloudlab clusters all have machines of specific types. When you set this field to a value that is a specific hardware type, you will only be able to instantiate this profile on clusters with machines of that type. If unset, when you instantiate the profile, the resulting experiment may have machines of any available type allocated.",
advanced=True)
pc.defineParameter("resizeRoot","Resize Root Filesystem",
portal.ParameterType.STRING,"",advanced=True,
longDescription="If set to 0 or integer, this will expand your root filesystem on each node. In order to make the expansion possible, the swap and other unused partitions will be deleted. If you set this parameter to 0, the maximum amount of space on the device hosting the root filesystem will be used. If set to integer >0, your root filesystem will be expanding to that size in GB. Do not append a postfix; even if you do, it will be ignored and the integer value will be interpreted in GB.")
pc.defineParameter("swiftLVSize", "Swift Logical Volume Size",
portal.ParameterType.INTEGER,4,advanced=True,
longDescription="The necessary space in GB to reserve for each of two Swift backing store volumes, when it is possible to use logical volumes. Nearly all Cloudlab machines do support logical volumes. Ensure that the total disk space requested (20GB root + 2x Swift LV size + 1x Glance LV size) is less than the total disk space available on the node type you want to run on.")
......@@ -494,6 +512,11 @@ ipdb = {}
if params.managementLanType == 'flat':
ipdb['mgmt-lan'] = { 'base':'192.168','netmask':'255.255.0.0','values':[-1,-1,0,0] }
pass
#
# Note that some things below the dataOffset of 10, we use for other
# things; for instance, shared vlan addresses should be allocated in the
# 10.10/16 or 10.10.10/24 subnets.
#
dataOffset = 10
ipSubnetsUsed = 0
for i in range(1,params.flatDataLanCount + 1):
......@@ -735,6 +758,22 @@ if params.tempBlockstoreMountPoint != "":
pc.verifyParameters()
pass
#
# Handle shared vlan address param.
#
(sharedVlanAddress,sharedVlanNetmask) = (None,None)
if params.sharedVlanAddress:
aa = params.sharedVlanAddress.split('/')
if len(aa) != 2:
perr = portal.ParameterError(
"Invalid shared VLAN address!",
['sharedVlanAddress'])
pc.reportError(perr)
pc.verifyParameters()
else:
(sharedVlanAddress,sharedVlanNetmask) = (aa[0],aa[1])
pass
#
# Add the controller node.
#
......@@ -779,6 +818,18 @@ if params.tempBlockstoreMountPoint \
params.controllerHost+"-temp-bs",params.tempBlockstoreMountPoint)
bs.size = str(params.tempBlockstoreSize) + "GB"
bs.placement = "any"
sharedvlan = None
if params.connectSharedVlan:
iface = controller.addInterface("ifSharedVlan")
if sharedVlanAddress:
iface.addAddress(
RSpec.IPv4Address(sharedVlanAddress,sharedVlanNetmask))
sharedvlan = RSpec.LAN('shared-vlan')
sharedvlan.addInterface(iface)
if params.createSharedVlan:
sharedvlan.createSharedVlan(params.connectSharedVlan)
else:
sharedvlan.connectSharedVlan(params.connectSharedVlan)
if params.controllerHost != params.networkManagerHost:
#
......@@ -793,7 +844,14 @@ if params.controllerHost != params.networkManagerHost:
if params.networkManagerDiskImage:
networkManager.disk_image = params.networkManagerDiskImage
else:
networkManager.disk_image = "urn:publicid:IDN+%s+image+%s//%s%s%s" % (image_urn,image_project,image_os,image_tag_nm,image_tag_rel)
nmreltag = image_tag_rel
# If we don't have an image tag, or we are using a standard
# image, there will be no release tag either. The latter case
# is possible because we no longer build OSNM images for >=
# Rocky.
if image_tag_nm == '' or image_tag_nm == '-STD':
nmreltag = ''
networkManager.disk_image = "urn:publicid:IDN+%s+image+%s//%s%s%s" % (image_urn,image_project,image_os,image_tag_nm,nmreltag)
if firewalling and setfwdesire:
networkManager.Desire('firewallable','1.0')
i = 0
......@@ -854,9 +912,10 @@ for (siteNumber,cpnameList) in computeNodeNamesBySite.iteritems():
for cpname in cpnameList:
cpnode = RSpec.RawPC(cpname)
nodes[cpname] = cpnode
if params.osNodeType:
if params.osNodeType and siteNumber == 1:
cpnode.hardware_type = params.osNodeType
pass
elif params.osNodeTypeSite2 and siteNumber == 2:
cpnode.hardware_type = params.osNodeTypeSite2
cpnode.Site(str(siteNumber))
if params.computeDiskImage:
cpnode.disk_image = params.computeDiskImage
......@@ -976,6 +1035,8 @@ if mgmtlan:
if bslink:
rspec.addResource(bslink)
pass
if sharedvlan:
rspec.addResource(sharedvlan)
#
# Grab a few public IP addresses.
......@@ -1141,6 +1202,9 @@ class Parameters(RSpec.Resource):
param = ET.SubElement(el,paramXML)
param.text = "GLANCE_LV_SIZE=%d" % (int(params.glanceLVSize))
param = ET.SubElement(el,paramXML)
param.text = "RESIZEROOT=%s" % (params.resizeRoot)
return el
pass
......
......@@ -83,7 +83,7 @@ if [ $? -eq 0 -a "$COMPUTE_EXTRA_NOVA_DISK_SPACE" = "1" ]; then
mkfs.ext3 /dev/$VGNAME/nova
fi
mkdir -p /mnt/var-lib-nova
echo "/dev/$VGNAME/nova /mnt/var-lib-nova none defaults,bind 0 0" \
echo "/dev/$VGNAME/nova /mnt/var-lib-nova none defaults 0 0" \
>> /etc/fstab
mount /dev/$VGNAME/nova /mnt/var-lib-nova
chown nova:nova /mnt/var-lib-nova
......@@ -108,7 +108,7 @@ elif [ "$COMPUTE_EXTRA_NOVA_DISK_SPACE" = "1" ]; then
mkfs.ext3 /dev/$VGNAME/nova
fi
mkdir -p /mnt/var-lib-nova
echo "/dev/$VGNAME/nova /mnt/var-lib-nova none defaults,bind 0 0" \
echo "/dev/$VGNAME/nova /mnt/var-lib-nova none defaults 0 0" \
>> /etc/fstab
mount /dev/$VGNAME/nova /mnt/var-lib-nova
chown nova:nova /mnt/var-lib-nova
......@@ -341,6 +341,8 @@ if [ "$ARCH" = "aarch64" ] ; then
crudini --set /etc/nova/nova-compute.conf DEFAULT pointer_model ps2mouse
elif [ $OSVERSION -eq $OSQUEENS ]; then
patch -d / -p0 < $DIRNAME/etc/nova-queens-aarch64-libvirt-bios-default.patch
elif [ $OSVERSION -eq $OSROCKY ]; then
patch -d / -p0 < $DIRNAME/etc/nova-rocky-aarch64-libvirt-bios-default.patch
fi
elif [ "$ARCH" = "ppc64le" ] ; then
ppc64_cpu --smt=off
......
......@@ -352,7 +352,7 @@ EOF
chmod 750 /etc/etcd
else
cat <<EOF >/etc/default/etcd
ETCD_NAME="controller"
ETCD_NAME="$CONTROLLER"
ETCD_DATA_DIR="/var/lib/etcd"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
......@@ -1629,6 +1629,8 @@ if [ -z "${NEUTRON_DBPASS}" ]; then
if [ $OSVERSION -eq $OSROCKY ]; then
crudini --set /etc/neutron/neutron.conf oslo_concurrency \
lock_path /var/lib/neutron/lock
crudini --set /etc/neutron/neutron.conf DEFAULT \
lock_path /var/lib/neutron/lock
mkdir -p /var/lib/neutron/lock/
chown neutron:neutron /var/lib/neutron/lock
fi
......
......@@ -26,9 +26,9 @@ if [ "$HOSTNAME" = "$CONTROLLER" ]; then
# Handle case where nginx won't start because the default site
# (which is enabled!) needs port 80, and apache might be listening
# there.
rm -f /etc/nginx/sites-available/default \
/etc/nginx/sites-enabled/default
if [ ! $? -eq 0 ]; then
rm -f /etc/nginx/sites-available/default \
/etc/nginx/sites-enabled/default
maybe_install_packages nginx
fi
echo "$ADMIN_PASS" | htpasswd -n -i admin > /etc/nginx/htpasswd
......@@ -61,6 +61,11 @@ EOF
fi
logtstart "driver"
#
# Maybe expand the rootfs.
#
$DIRNAME/setup-grow-rootfs.sh 1> $OURDIR/setup-grow-rootfs.log 2>&1
# Copy our source code into $OURDIR for future use:
echo "*** Copying source code into $OURDIR/bin ..."
mkdir -p $OURDIR/bin
......
#!/bin/sh
#
# If user wants to resize the rootfs to the max, try to do that.
#
set -x
if [ $EUID -ne 0 ] ; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Grab our libs
. "`dirname $0`/setup-lib.sh"
logtstart "grow-rootfs"
if [ -z "$RESIZEROOT" ]; then
logtend "grow-rootfs"
exit 0
fi
if [ -z "$IMPOTENT" ]; then
IMPOTENT=0
fi
if [ -z "$NODELETE" ]; then
NODELETE=0
fi
# Remove any existing temp files.
rm -fv /tmp/sfdisk.orig /tmp/sfdisk.new /tmp/sfdisk.new \
/tmp/sfdisk.nextstart /tmp/sfdisk.parts-to-delete
# Find the root partition's parent disk.
eval `lsblk -n -P -b -o NAME,FSTYPE,MOUNTPOINT,PARTTYPE,PARTUUID,TYPE,PKNAME,SIZE | grep 'MOUNTPOINT="/"'`
ROOTPARENT=$PKNAME
ROOT=$NAME
if [ -z "$ROOTPARENT" -o -z "$ROOT" ]; then
echo "ERROR: unable to find root device or root parent disk; aborting!"
exit 1
fi
# Find root partition number.
ROOTPARTNO=`echo "$ROOT" | sed -ne "s/^${ROOTPARENT}p\([0-9]*\)$/\1/p"`
if [ ! $? -eq 0 -o -z "$ROOTPARTNO" ]; then
ROOTPARTNO=`echo "$NAME" | sed -ne "s/^${ROOTPARENT}\([0-9]*\)$/\1/p"`
fi
if [ -z "$ROOTPARTNO" ]; then
echo "ERROR: could not determine the root partition number; aborting!"
exit 1
fi
# Save off the original partition table, and create a new one to modify.
sfdisk -d /dev/$ROOTPARENT > /tmp/sfdisk.orig
cp -p /tmp/sfdisk.orig /tmp/sfdisk.new
if [ $NODELETE -eq 0 ]; then
# Swapoff all swap devices if we are not impotent; they will be
# removed.
for dev in `blkid -t TYPE=swap | cut -d: -f1 | xargs` ; do
if [ ! $IMPOTENT -eq 1 ]; then
swapoff $dev
if [ ! $? -eq 0 ]; then
echo "ERROR: failed to swapoff $dev; aborting!"
exit 1
fi
fi
done
# Figure out which partitions to remove. We remove any partition on
# the rootparent with FSTYPE="" and MOUNTPOINT="" and
# PARTUUID=(0fc63daf-8483-4772-8e79-3d69d8477de4|00000000-0000-0000-0000-000000000000|0657FD6D-A4AB-43C4-84E5-0933C84B4F4F|0x83|0x82|0x0).
PARTS=""
lsblk -a -n -P -b -o NAME,FSTYPE,MOUNTPOINT,PARTTYPE,PARTUUID,TYPE,PKNAME,SIZE | grep "PKNAME=\"${ROOTPARENT}\"" | while read line ; do
eval "$line"
if [ "$FSTYPE" != swap -a \( -n "$FSTYPE" -o -n "$MOUNTPOINT" \) ]; then
continue
fi
echo "$PARTTYPE" | grep -qEi '^(0fc63daf-8483-4772-8e79-3d69d8477de4|00000000-0000-0000-0000-000000000000|0657FD6D-A4AB-43C4-84E5-0933C84B4F4F|0x83|0x82|0x0)$'
if [ ! $? -eq 0 ]; then
continue
fi
# Now extract the partition number (to feed to parted). Partition
# number is not reported by most Linux tools nor by sysfs, so we
# have to extract via regexp. Right now we only worry about nvme
# devices (or any device that ends with a "p\d+"), and assume that
# anything else is "standard".
PARTNO=`echo "$NAME" | sed -ne "s/^${PKNAME}p\([0-9]*\)$/\1/p"`
if [ ! $? -eq 0 -o -z "$PARTNO" ]; then
PARTNO=`echo "$NAME" | sed -ne "s/^${PKNAME}\([0-9]*\)$/\1/p"`
fi
if [ ! $? -eq 0 -o -z "$PARTNO" ]; then
continue
fi
PARTS="$PARTNO $PARTS"
echo $PARTNO >> /tmp/sfdisk.parts-to-delete
done
if [ -e /tmp/sfdisk.parts-to-delete ]; then
PARTS=`cat /tmp/sfdisk.parts-to-delete | xargs`
rm -f /tmp/sfdisk.tmp
cat /tmp/sfdisk.new | while read line ; do
delete=0
for part in $PARTS ; do
echo "$line" | grep -q "^/dev/${ROOTPARENT}$part :"
if [ $? -eq 0 ]; then
delete=1
break
fi
done
if [ $delete -eq 0 ]; then
echo "$line" >> /tmp/sfdisk.tmp
fi
done
diff -u /tmp/sfdisk.new /tmp/sfdisk.tmp
mv /tmp/sfdisk.tmp /tmp/sfdisk.new
fi
fi
#
# Now we need to figure out the max sector we can end on. If there is a
# partition further up the disk, we can't stomp it.
#
DISKSIZE=`sfdisk -l /dev/$ROOTPARENT | sed -ne 's/^Disk.*, \([0-9]*\) sectors$/\1/p'`
ROOTSTART=`sfdisk -l -o device,start,end /dev/$ROOTPARENT | sed -ne "s|/dev/${ROOT} *\([0-9]*\) *\([0-9]*\)$|\1|p"`
ROOTEND=`sfdisk -l -o device,start,end /dev/$ROOTPARENT | sed -ne "s|/dev/${ROOT} *\([0-9]*\) *\([0-9]*\)$|\2|p"`
ROOTSIZE=`expr $ROOTEND - $ROOTSTART + 1`
# First, we find the max size of the new root partition in sectors. If
# we find a partition with a start greater than ROOTEND, that value -
# 2048 is the new end. Otherwise, it is DISKSIZE - 2048.
nextstart=$DISKSIZE
cat /tmp/sfdisk.new | grep "^/dev" | while read line ; do
nstart=`echo $line | sed -ne "s|/dev/[^ ]* *: *start= *\([0-9]*\),.*$|\1|p"`
if [ -z "$nstart" ] ; then
continue
fi
if [ $nstart -gt $ROOTSTART -a $nstart -lt $nextstart ]; then
nextstart=$nstart
echo $nextstart > /tmp/sfdisk.nextstart
fi
done
if [ -e /tmp/sfdisk.nextstart -a -s /tmp/sfdisk.nextstart ]; then
nextstart=`cat /tmp/sfdisk.nextstart`
fi
align=0
if [ ! `expr $nextstart \% 2048` -eq 0 ]; then
align=2048
fi
maxsize=`expr $nextstart - $align - $ROOTSTART`
# Sanitize the size. We only support GB.
RESIZEROOT=`echo "$RESIZEROOT" | sed -ne 's/^\([0-9]*\)[^0-9]*$/\1/p'`
if [ -z "$RESIZEROOT" ]; then
echo "ERROR: could not determine size of root disk $ROOTPARENT; aborting!"
exit 1
fi
if [ $RESIZEROOT -eq 0 ]; then
newsize=$maxsize
else
usersectors=`expr $RESIZEROOT \* 1024 \* 1024 \* 1024 / 512`
if [ $usersectors -gt $maxsize ]; then
newsize=$maxsize
else
newsize=$usersectors
fi
fi
if [ -z "$newsize" ]; then
echo "ERROR: failed to calculate new root partition size; aborting!"
exit 1
fi
if [ $newsize -eq $ROOTSIZE ]; then
echo "Nothing to do: newsize ($newsize) same as current root size ($ROOTSIZE)."
exit 0
fi
if [ $newsize -lt $ROOTSIZE ]; then
echo "ERROR: newsize ($newsize) less than current root size ($ROOTSIZE); aborting!"
exit 1
fi
if [ $newsize -lt 2048 ]; then
echo "WARNING: cannot expand root partition; skipping!"
exit 0
fi
# Finally, edit the sfdisk.new file to change the root device's size.
cat /tmp/sfdisk.new | while read line ; do
echo "$line" | grep -q "^/dev/${ROOT} :"
if [ $? -eq 0 ]; then
echo "$line" | sed -e "s|^\(/dev/${ROOT} :.*\)\(size= *[0-9]*,\)\(.*\)$|\1size=${newsize}\3|" >> /tmp/sfdisk.tmp
else
echo "$line" >> /tmp/sfdisk.tmp
fi
done
mv /tmp/sfdisk.tmp /tmp/sfdisk.new
diff -u /tmp/sfdisk.orig /tmp/sfdisk.new
if [ $IMPOTENT -eq 1 ]; then
exit 0
fi
sfdisk --force /dev/$ROOTPARENT < /tmp/sfdisk.new
partprobe /dev/$ROOTPARENT
resize2fs /dev/$ROOT
if [ ! $? -eq 0 ]; then
echo "ERROR: failed to resize /dev/$ROOT filesystem; aborting!"
exit 1
fi
echo "Resized /dev/$ROOT."
logtend "grow-rootfs"
exit 0
......@@ -127,6 +127,11 @@ USE_NEUTRON_LBAAS=1
ENABLE_OPENSTACK_SLOTHD=0
# The input OpenStack release, if any, from profile params.
OSRELEASE=""
# If "", no resizing. If set to number, that is GB. Even if you
# specify MB, the MB will be stripped and assumed to be GB. If set to
# 0, the max amount of space after removing swap and extra partitions
# will be used.
RESIZEROOT=""
#
# We have an 'adminapi' user that gets a random password. Then, we have
......
......@@ -115,7 +115,7 @@ iface ${EXTERNAL_NETWORK_BRIDGE} inet static
dns-search $DNSDOMAIN
dns-nameservers $DNSSERVER
up echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/run/cnet
up echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/emulab/boot/controlif
up echo "${EXTERNAL_NETWORK_INTERFACE}" > /var/emulab/boot/controlif
EOF
else
mv /etc/udev/rules.d/99-emulab-networkd.rules \
......@@ -149,7 +149,7 @@ EOF
# that were previously done in /etc/network/interfaces via "up" hook.
#
echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/run/cnet
echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/emulab/boot/controlif
echo "${EXTERNAL_NETWORK_INTERFACE}" > /var/emulab/boot/controlif
EOF
chmod 755 $OURDIR/testbed-pre-static-control-network.sh
systemctl daemon-reload
......@@ -182,7 +182,7 @@ fi
# Also restart slothd so it listens on the new control iface.
echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/run/cnet
echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/emulab/boot/controlif
echo "${EXTERNAL_NETWORK_INTERFACE}" > /var/emulab/boot/controlif
/usr/local/etc/emulab/rc/rc.slothd stop
pkill slothd
sleep 1
......
......@@ -60,6 +60,8 @@ fi
if [ $OSVERSION -eq $OSROCKY ]; then
crudini --set /etc/neutron/neutron.conf oslo_concurrency \
lock_path /var/lib/neutron/lock
crudini --set /etc/neutron/neutron.conf DEFAULT \
lock_path /var/lib/neutron/lock
mkdir -p /var/lib/neutron/lock/
chown neutron:neutron /var/lib/neutron/lock
fi
......
......@@ -126,7 +126,7 @@ iface ${EXTERNAL_NETWORK_BRIDGE} inet static
dns-search $DNSDOMAIN
dns-nameservers $DNSSERVER
up echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/run/cnet
up echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/emulab/boot/controlif
up echo "${EXTERNAL_NETWORK_INTERFACE}" > /var/emulab/boot/controlif
$readdflows
auto ${EXTERNAL_NETWORK_INTERFACE}
......@@ -165,7 +165,7 @@ EOF
# that were previously done in /etc/network/interfaces via "up" hook.
#
echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/run/cnet
echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/emulab/boot/controlif
echo "${EXTERNAL_NETWORK_INTERFACE}" > /var/emulab/boot/controlif
EOF
chmod 755 $OURDIR/testbed-pre-static-control-network.sh
systemctl daemon-reload
......@@ -223,7 +223,7 @@ service_restart openvswitch-switch
# Also restart slothd so it listens on the new control iface.
echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/run/cnet
echo "${EXTERNAL_NETWORK_BRIDGE}" > /var/emulab/boot/controlif
echo "${EXTERNAL_NETWORK_INTERFACE}" > /var/emulab/boot/controlif
/usr/local/etc/emulab/rc/rc.slothd stop
pkill slothd
sleep 1
......