Add support DEPLOYMENT_MODE to control nova scheduler filters

This commit is contained in:
James Slagle 2014-09-11 15:55:30 -04:00
parent 98ebe71228
commit 03ac1aec2c
10 changed files with 73 additions and 14 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
export CPU=1
export MEM=2048
export MEM=3072
export DISK=30
export ARCH=amd64
export MACS=""

View File

@ -1,6 +1,6 @@
#!/bin/bash
export CPU=1
export MEM=2048
export MEM=3072
export DISK=30
export ARCH=amd64
export NeutronPublicInterface=eth0

View File

@ -37,7 +37,22 @@
"reserved_host_memory_mb": "0"
},
"metadata-proxy": "false",
"service-password": "{{UNDERCLOUD_NOVA_PASSWORD}}"
"service-password": "{{UNDERCLOUD_NOVA_PASSWORD}}",
"config": [
{"section": "DEFAULT",
"values": [
{"option": "scheduler_use_baremetal_filters",
"value": "{{SCHEDULER_USE_BAREMETAL_FILTERS}}"
},
{"option": "scheduler_default_filters",
"value": "{{SCHEDULER_DEFAULT_FILTERS}}"
},
{"option": "baremetal_scheduler_default_filters",
"value": "{{BAREMETAL_SCHEDULER_DEFAULT_FILTERS}}"
}
]
}
]
},
"ironic": {
"db": "mysql://ironic:{{UNDERCLOUD_DB_PASSWORD}}@localhost/ironic",

View File

@ -16,6 +16,31 @@ template = os.path.join(os.path.dirname(__file__),
context = {
'DEPLOYMENT_MODE': os.environ.get('DEPLOYMENT_MODE', 'poc'),
'SCHEDULER_DEFAULT_FILTERS':
os.environ.get('SCHEDULER_DEFAULT_FILTERS',
'RetryFilter,'
'AvailabilityZoneFilter,'
'RamFilter,'
'DiskFilter,'
'CoreFilter,'
'ComputeFilter,'
'ComputeCapabilitiesFilter,'
'ImagePropertiesFilter,'
'ServerGroupAntiAffinityFilter,'
'ServerGroupAffinityFilter'),
'BAREMETAL_SCHEDULER_DEFAULT_FILTERS':
os.environ.get('BAREMETAL_SCHEDULER_DEFAULT_FILTERS',
'RetryFilter,'
'AvailabilityZoneFilter,'
'ComputeFilter,'
'ComputeCapabilitiesFilter,'
'ImagePropertiesFilter,'
'ExactRamFilter,'
'ExactDiskFilter,'
'ExactCoreFilter,'
'ServerGroupAntiAffinityFilter,'
'ServerGroupAffinityFilter'),
'LOCAL_IP': os.environ.get('LOCAL_IP', '192.0.2.1'),
'LOCAL_INTERFACE': os.environ.get('LOCAL_INTERFACE', 'eth1'),
'DNSMASQ_START': os.environ.get('DNSMASQ_START', '192.0.2.4'),
@ -38,6 +63,11 @@ context = {
'UNDERCLOUD_IRONIC_PASSWORD': os.environ.get('UNDERCLOUD_IRONIC_PASSWORD', 'unset')
}
if context['DEPLOYMENT_MODE'] == 'scale':
context['SCHEDULER_USE_BAREMETAL_FILTERS'] = 'True'
else:
context['SCHEDULER_USE_BAREMETAL_FILTERS'] = 'False'
with open(template) as f:
config_json = renderer.render(f.read(), context)

View File

@ -1,5 +1,12 @@
# instack answers file
### DEPLOYMENT_MODE ###
# Deployment mode to setup on this Undercloud.
# Choices are poc and scale:
# poc will allow deployment of a single role to heterogenous hardware
# scale will allow deployment of a single role only to homogenous hardware.
DEPLOYMENT_MODE=poc
### LOCAL_IP ###
# IP address to assign to the interface on the Undercloud that will
# be handling the PXE boots and DHCP for Overcloud instances.

View File

@ -8,6 +8,7 @@ vi ~/instack.answers
echo "Sourcing answers file from instack.answers..."
source ~/instack.answers
export DEPLOYMENT_MODE
export LOCAL_IP
export DNSMASQ_START
export DNSMASQ_END
@ -20,7 +21,6 @@ export DHCP_START
export DHCP_END
export NETWORK_CIDR
export NETWORK_GATEWAY
export SSH_KEY
export UNDERCLOUD_DB_PASSWORD=${UNDERCLOUD_DB_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_ADMIN_TOKEN=${UNDERCLOUD_ADMIN_TOKEN:-$(tripleo os-make-password)}

View File

@ -13,5 +13,3 @@ node_ids=$(ironic node-list | tail -n +4 | head -n -1 | awk -F "| " '{print $2}'
for id in $node_ids; do
ironic node-delete $id
done
nova flavor-delete baremetal || true

View File

@ -47,13 +47,7 @@ echo $JSON | python -mjson.tool
echo $JSON > $JSONFILE
for i in ramdisk kernel; do
if glance image-show bm-deploy-$i 2>&1 1>/dev/null; then
glance image-delete bm-deploy-$i
fi
done
tripleo setup-baremetal --service-host undercloud --nodes <(jq '.nodes' $JSONFILE)
register-nodes --service-host undercloud --nodes <(jq '.nodes' $JSONFILE)
# Must wait for baremetal nodes to register as nova hypervisors
sleep 60

View File

@ -19,6 +19,7 @@ export ELEMENTS_PATH=${ELEMENTS_PATH:-"/usr/share/diskimage-builder/elements/ \
echo "Sourcing answers file from instack.answers..."
source ~/instack.answers
export DEPLOYMENT_MODE
export LOCAL_IP
export DNSMASQ_START
export DNSMASQ_END
@ -31,7 +32,6 @@ export DHCP_START
export DHCP_END
export NETWORK_CIDR
export NETWORK_GATEWAY
export SSH_KEY
export UNDERCLOUD_DB_PASSWORD=${UNDERCLOUD_DB_PASSWORD:-$(tripleo os-make-password)}
export UNDERCLOUD_ADMIN_TOKEN=${UNDERCLOUD_ADMIN_TOKEN:-$(tripleo os-make-password)}

View File

@ -66,3 +66,18 @@ glance image-create --name bm-deploy-kernel --public \
glance image-delete bm-deploy-ramdisk 2>/dev/null || :
glance image-create --name bm-deploy-ramdisk --public \
--disk-format ari < $DEPLOY_NAME.initramfs
DEPLOYMENT_MODE=${DEPLOYMENT_MODE:-"poc"}
if [ "$DEPLOYMENT_MODE" = "poc" ]; then
if ! nova flavor-show baremetal 2>&1 1>/dev/null; then
nova flavor-create baremetal auto 3072 30 1
deploy_kernel_id=$(glance image-show bm-deploy-kernel | awk ' / id / {print $4}')
deploy_ramdisk_id=$(glance image-show bm-deploy-ramdisk | awk ' / id / {print $4}')
nova flavor-key baremetal set \
"cpu_arch"="amd64" \
"baremetal:deploy_kernel_id"="$deploy_kernel_id" \
"baremetal:deploy_ramdisk_id"="$deploy_ramdisk_id"
fi
fi