... | ... |
@@ -40,6 +40,18 @@ IRONIC_CONF_FILE=$IRONIC_CONF_DIR/ironic.conf |
40 | 40 |
IRONIC_ROOTWRAP_CONF=$IRONIC_CONF_DIR/rootwrap.conf |
41 | 41 |
IRONIC_POLICY_JSON=$IRONIC_CONF_DIR/policy.json |
42 | 42 |
|
43 |
+# Deploy to hardware platform |
|
44 |
+IRONIC_HW_NODE_CPU=${IRONIC_HW_NODE_CPU:-1} |
|
45 |
+IRONIC_HW_NODE_RAM=${IRONIC_HW_NODE_RAM:-512} |
|
46 |
+IRONIC_HW_NODE_DISK=${IRONIC_HW_NODE_DISK:-10} |
|
47 |
+IRONIC_HW_EPHEMERAL_DISK=${IRONIC_HW_EPHEMERAL_DISK:-0} |
|
48 |
+# The file is composed of multiple lines, each line includes four field |
|
49 |
+# separated by white space: IPMI address, MAC address, IPMI username |
|
50 |
+# and IPMI password. |
|
51 |
+# An example: |
|
52 |
+# 192.168.110.107 00:1e:67:57:50:4c root otc123 |
|
53 |
+IRONIC_IPMIINFO_FILE=${IRONIC_IPMIINFO_FILE:-$IRONIC_DATA_DIR/hardware_info} |
|
54 |
+ |
|
43 | 55 |
# Set up defaults for functional / integration testing |
44 | 56 |
IRONIC_SCRIPTS_DIR=${IRONIC_SCRIPTS_DIR:-$TOP_DIR/tools/ironic/scripts} |
45 | 57 |
IRONIC_TEMPLATES_DIR=${IRONIC_TEMPLATES_DIR:-$TOP_DIR/tools/ironic/templates} |
... | ... |
@@ -51,6 +63,7 @@ IRONIC_SSH_KEY_FILENAME=${IRONIC_SSH_KEY_FILENAME:-ironic_key} |
51 | 51 |
IRONIC_KEY_FILE=$IRONIC_SSH_KEY_DIR/$IRONIC_SSH_KEY_FILENAME |
52 | 52 |
IRONIC_SSH_VIRT_TYPE=${IRONIC_SSH_VIRT_TYPE:-virsh} |
53 | 53 |
IRONIC_TFTPBOOT_DIR=${IRONIC_TFTPBOOT_DIR:-$IRONIC_DATA_DIR/tftpboot} |
54 |
+IRONIC_TFTPSERVER_IP=${IRONIC_TFTPSERVER_IP:-$HOST_IP} |
|
54 | 55 |
IRONIC_VM_SSH_PORT=${IRONIC_VM_SSH_PORT:-22} |
55 | 56 |
IRONIC_VM_SSH_ADDRESS=${IRONIC_VM_SSH_ADDRESS:-$HOST_IP} |
56 | 57 |
IRONIC_VM_COUNT=${IRONIC_VM_COUNT:-1} |
... | ... |
@@ -80,7 +93,7 @@ IRONIC_AGENT_KERNEL_URL=${IRONIC_AGENT_KERNEL_URL:-http://tarballs.openstack.org |
80 | 80 |
IRONIC_AGENT_RAMDISK_URL=${IRONIC_AGENT_RAMDISK_URL:-http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe_image-oem.cpio.gz} |
81 | 81 |
|
82 | 82 |
# Which deploy driver to use - valid choices right now |
83 |
-# are 'pxe_ssh' and 'agent_ssh'. |
|
83 |
+# are 'pxe_ssh', 'pxe_ipmitool' and 'agent_ssh'. |
|
84 | 84 |
IRONIC_DEPLOY_DRIVER=${IRONIC_DEPLOY_DRIVER:-pxe_ssh} |
85 | 85 |
|
86 | 86 |
#TODO(agordeev): replace 'ubuntu' with host distro name getting |
... | ... |
@@ -133,6 +146,11 @@ function is_ironic_enabled { |
133 | 133 |
return 1 |
134 | 134 |
} |
135 | 135 |
|
136 |
+function is_ironic_hardware { |
|
137 |
+ is_ironic_enabled && [[ -n "${IRONIC_DEPLOY_DRIVER##*_ssh}" ]] && return 0 |
|
138 |
+ return 1 |
|
139 |
+} |
|
140 |
+ |
|
136 | 141 |
# install_ironic() - Collect source and prepare |
137 | 142 |
function install_ironic { |
138 | 143 |
# make sure all needed service were enabled |
... | ... |
@@ -281,7 +299,7 @@ function configure_ironic_conductor { |
281 | 281 |
iniset $IRONIC_CONF_FILE DEFAULT rootwrap_config $IRONIC_ROOTWRAP_CONF |
282 | 282 |
iniset $IRONIC_CONF_FILE DEFAULT enabled_drivers $IRONIC_ENABLED_DRIVERS |
283 | 283 |
iniset $IRONIC_CONF_FILE conductor api_url http://$HOST_IP:6385 |
284 |
- iniset $IRONIC_CONF_FILE pxe tftp_server $HOST_IP |
|
284 |
+ iniset $IRONIC_CONF_FILE pxe tftp_server $IRONIC_TFTPSERVER_IP |
|
285 | 285 |
iniset $IRONIC_CONF_FILE pxe tftp_root $IRONIC_TFTPBOOT_DIR |
286 | 286 |
iniset $IRONIC_CONF_FILE pxe tftp_master_path $IRONIC_TFTPBOOT_DIR/master_images |
287 | 287 |
if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] ; then |
... | ... |
@@ -483,7 +501,7 @@ function create_bridge_and_vms { |
483 | 483 |
create_ovs_taps |
484 | 484 |
} |
485 | 485 |
|
486 |
-function enroll_vms { |
|
486 |
+function enroll_nodes { |
|
487 | 487 |
local chassis_id=$(ironic chassis-create -d "ironic test chassis" | grep " uuid " | get_field 2) |
488 | 488 |
local idx=0 |
489 | 489 |
|
... | ... |
@@ -495,34 +513,65 @@ function enroll_vms { |
495 | 495 |
local _IRONIC_DEPLOY_RAMDISK_KEY=deploy_ramdisk |
496 | 496 |
fi |
497 | 497 |
|
498 |
- while read MAC; do |
|
499 |
- |
|
500 |
- local node_id=$(ironic node-create --chassis_uuid $chassis_id \ |
|
501 |
- --driver $IRONIC_DEPLOY_DRIVER \ |
|
498 |
+ if ! is_ironic_hardware; then |
|
499 |
+ local ironic_node_cpu=$IRONIC_VM_SPECS_CPU |
|
500 |
+ local ironic_node_ram=$IRONIC_VM_SPECS_RAM |
|
501 |
+ local ironic_node_disk=$IRONIC_VM_SPECS_DISK |
|
502 |
+ local ironic_ephemeral_disk=$IRONIC_VM_EPHEMERAL_DISK |
|
503 |
+ local ironic_hwinfo_file=$IRONIC_VM_MACS_CSV_FILE |
|
504 |
+ local node_options="\ |
|
502 | 505 |
-i $_IRONIC_DEPLOY_KERNEL_KEY=$IRONIC_DEPLOY_KERNEL_ID \ |
503 | 506 |
-i $_IRONIC_DEPLOY_RAMDISK_KEY=$IRONIC_DEPLOY_RAMDISK_ID \ |
504 | 507 |
-i ssh_virt_type=$IRONIC_SSH_VIRT_TYPE \ |
505 | 508 |
-i ssh_address=$IRONIC_VM_SSH_ADDRESS \ |
506 | 509 |
-i ssh_port=$IRONIC_VM_SSH_PORT \ |
507 | 510 |
-i ssh_username=$IRONIC_SSH_USERNAME \ |
508 |
- -i ssh_key_filename=$IRONIC_SSH_KEY_DIR/$IRONIC_SSH_KEY_FILENAME \ |
|
509 |
- -p cpus=$IRONIC_VM_SPECS_CPU \ |
|
510 |
- -p memory_mb=$IRONIC_VM_SPECS_RAM \ |
|
511 |
- -p local_gb=$IRONIC_VM_SPECS_DISK \ |
|
511 |
+ -i ssh_key_filename=$IRONIC_SSH_KEY_DIR/$IRONIC_SSH_KEY_FILENAME" |
|
512 |
+ else |
|
513 |
+ local ironic_node_cpu=$IRONIC_HW_NODE_CPU |
|
514 |
+ local ironic_node_ram=$IRONIC_HW_NODE_RAM |
|
515 |
+ local ironic_node_disk=$IRONIC_HW_NODE_DISK |
|
516 |
+ local ironic_ephemeral_disk=$IRONIC_HW_EPHEMERAL_DISK |
|
517 |
+ if [[ -z "${IRONIC_DEPLOY_DRIVER##*_ipmitool}" ]]; then |
|
518 |
+ local ironic_hwinfo_file=$IRONIC_IPMIINFO_FILE |
|
519 |
+ fi |
|
520 |
+ fi |
|
521 |
+ |
|
522 |
+ while read hardware_info; do |
|
523 |
+ if ! is_ironic_hardware; then |
|
524 |
+ local mac_address=$hardware_info |
|
525 |
+ elif [[ -z "${IRONIC_DEPLOY_DRIVER##*_ipmitool}" ]]; then |
|
526 |
+ local ipmi_address=$(echo $hardware_info |awk '{print $1}') |
|
527 |
+ local mac_address=$(echo $hardware_info |awk '{print $2}') |
|
528 |
+ local ironic_ipmi_username=$(echo $hardware_info |awk '{print $3}') |
|
529 |
+ local ironic_ipmi_passwd=$(echo $hardware_info |awk '{print $4}') |
|
530 |
+ # Currently we require all hardware platform have same CPU/RAM/DISK info |
|
531 |
+ # in future, this can be enhanced to support different type, and then |
|
532 |
+ # we create the bare metal flavor with minimum value |
|
533 |
+ local node_options="-i ipmi_address=$ipmi_address -i ipmi_password=$ironic_ipmi_passwd\ |
|
534 |
+ -i ipmi_username=$ironic_ipmi_username" |
|
535 |
+ fi |
|
536 |
+ |
|
537 |
+ local node_id=$(ironic node-create --chassis_uuid $chassis_id \ |
|
538 |
+ --driver $IRONIC_DEPLOY_DRIVER \ |
|
539 |
+ -p cpus=$ironic_node_cpu\ |
|
540 |
+ -p memory_mb=$ironic_node_ram\ |
|
541 |
+ -p local_gb=$ironic_node_disk\ |
|
512 | 542 |
-p cpu_arch=x86_64 \ |
543 |
+ $node_options \ |
|
513 | 544 |
| grep " uuid " | get_field 2) |
514 | 545 |
|
515 |
- ironic port-create --address $MAC --node_uuid $node_id |
|
546 |
+ ironic port-create --address $mac_address --node_uuid $node_id |
|
516 | 547 |
|
517 | 548 |
idx=$((idx+1)) |
518 |
- done < $IRONIC_VM_MACS_CSV_FILE |
|
549 |
+ done < $ironic_hwinfo_file |
|
519 | 550 |
|
520 | 551 |
# create the nova flavor |
521 | 552 |
# NOTE(adam_g): Attempting to use an autogenerated UUID for flavor id here uncovered |
522 | 553 |
# bug (LP: #1333852) in Trove. This can be changed to use an auto flavor id when the |
523 | 554 |
# bug is fixed in Juno. |
524 |
- local adjusted_disk=$(($IRONIC_VM_SPECS_DISK - $IRONIC_VM_EPHEMERAL_DISK)) |
|
525 |
- nova flavor-create --ephemeral $IRONIC_VM_EPHEMERAL_DISK baremetal 551 $IRONIC_VM_SPECS_RAM $adjusted_disk $IRONIC_VM_SPECS_CPU |
|
555 |
+ local adjusted_disk=$(($ironic_node_disk - $ironic_ephemeral_disk)) |
|
556 |
+ nova flavor-create --ephemeral $ironic_ephemeral_disk baremetal 551 $ironic_node_ram $adjusted_disk $ironic_node_cpu |
|
526 | 557 |
|
527 | 558 |
# TODO(lucasagomes): Remove the 'baremetal:deploy_kernel_id' |
528 | 559 |
# and 'baremetal:deploy_ramdisk_id' parameters |
... | ... |
@@ -670,11 +719,15 @@ function upload_baremetal_ironic_deploy { |
670 | 670 |
|
671 | 671 |
function prepare_baremetal_basic_ops { |
672 | 672 |
upload_baremetal_ironic_deploy |
673 |
- create_bridge_and_vms |
|
674 |
- enroll_vms |
|
673 |
+ if ! is_ironic_hardware; then |
|
674 |
+ create_bridge_and_vms |
|
675 |
+ fi |
|
676 |
+ enroll_nodes |
|
675 | 677 |
configure_tftpd |
676 | 678 |
configure_iptables |
677 |
- configure_ironic_auxiliary |
|
679 |
+ if ! is_ironic_hardware; then |
|
680 |
+ configure_ironic_auxiliary |
|
681 |
+ fi |
|
678 | 682 |
} |
679 | 683 |
|
680 | 684 |
function cleanup_baremetal_basic_ops { |
... | ... |
@@ -523,7 +523,7 @@ function create_neutron_initial_network { |
523 | 523 |
die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK" |
524 | 524 |
die_if_not_set $LINENO PROVIDER_NETWORK_TYPE "You must specifiy the PROVIDER_NETWORK_TYPE" |
525 | 525 |
NET_ID=$(neutron net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type $PROVIDER_NETWORK_TYPE --provider:physical_network "$PHYSICAL_NETWORK" ${SEGMENTATION_ID:+--provider:segmentation_id $SEGMENTATION_ID} --shared | grep ' id ' | get_field 2) |
526 |
- SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) |
|
526 |
+ SUBNET_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --name $PROVIDER_SUBNET_NAME --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) |
|
527 | 527 |
SUBNET_V6_ID=$(neutron subnet-create --tenant_id $TENANT_ID --ip_version 6 --ipv6-address-mode slaac --gateway $V6_NETWORK_GATEWAY --name $PROVIDER_SUBNET_NAME_V6 $NET_ID $FIXED_RANGE_V6 | grep 'id' | get_field 2) |
528 | 528 |
sudo ip link set $OVS_PHYSICAL_BRIDGE up |
529 | 529 |
sudo ip link set br-int up |
... | ... |
@@ -678,6 +678,13 @@ function start_neutron_agents { |
678 | 678 |
sudo ip link set $OVS_PHYSICAL_BRIDGE up |
679 | 679 |
sudo ip link set br-int up |
680 | 680 |
sudo ip link set $PUBLIC_INTERFACE up |
681 |
+ if is_ironic_hardware; then |
|
682 |
+ for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do |
|
683 |
+ sudo ip addr del $IP dev $PUBLIC_INTERFACE |
|
684 |
+ sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE |
|
685 |
+ done |
|
686 |
+ sudo route add -net $FIXED_RANGE gw $NETWORK_GATEWAY dev $OVS_PHYSICAL_BRIDGE |
|
687 |
+ fi |
|
681 | 688 |
fi |
682 | 689 |
|
683 | 690 |
if is_service_enabled q-vpn; then |
... | ... |
@@ -729,6 +736,14 @@ function stop_neutron { |
729 | 729 |
# cleanup_neutron() - Remove residual data files, anything left over from previous |
730 | 730 |
# runs that a clean run would need to clean up |
731 | 731 |
function cleanup_neutron { |
732 |
+ if [[ is_provider_network && is_ironic_hardware ]]; then |
|
733 |
+ for IP in $(ip addr show dev $OVS_PHYSICAL_BRIDGE | grep ' inet ' | awk '{print $2}'); do |
|
734 |
+ sudo ip addr del $IP dev $OVS_PHYSICAL_BRIDGE |
|
735 |
+ sudo ip addr add $IP dev $PUBLIC_INTERFACE |
|
736 |
+ done |
|
737 |
+ sudo route del -net $FIXED_RANGE gw $NETWORK_GATEWAY dev $OVS_PHYSICAL_BRIDGE |
|
738 |
+ fi |
|
739 |
+ |
|
732 | 740 |
if is_neutron_ovs_base_plugin; then |
733 | 741 |
neutron_ovs_base_cleanup |
734 | 742 |
fi |