软件的布局DevStack 通常在根目录下存放主要的脚本。 doc exercises extras.d files lib samples tests tools 脚本DevStack脚本通常在标识行调用env(1) #!/usr/bin/env bash 有时候脚本需要确定DevStack的安装目录。Sometimes the script needs to know the
location of the install
directory. # Keep track of the current DevStack directory. TOP_DIR=$(cd $(dirname "$0") && pwd) 很多脚本使用functions # Keep track of the current DevStack directory. TOP_DIR=$(cd $(dirname "$0") && pwd) # Import common functions source $TOP_DIR/functions # Import configuration source $TOP_DIR/openrc
stack.sh曾经是一个庞大的脚本,包含了整个流程。现在它被分解成一些lib目录下项目相关的子脚本(就像上面说到的那样), 这些子脚本有一些固定的入口,部分只是占个地方。这些入口会被stack.sh按下列顺序调用: install_XXXX configure_XXXX init_XXXX start_XXXX stop_XXXX cleanup_XXXX
在
为了显示依赖关系和在什么情况下项目的功能被调用,最上层的像is_service_enabled stackrc
stackrc是DevStack中的全局配置文件。它负责调用 stackrc
另外,在 练习ExercisesExercises目录下的脚本是用来:对OpenStack的部分功能进行基本的验证,说明OpenStack的命令行客户端是怎么用的。 除了上述说明之外,exercise
必须要遵从这里说明的结构。
· echo "**************************************************" echo "Begin DevStack Exercise: $0" echo "**************************************************" ... set +o xtrace echo "**************************************************" echo "End DevStack Exercise: $0" echo "**************************************************"
· # This script exits on an error so that errors don't compound and you see # only the first error that occurred. set -o errexit # Print the commands being run so that we can see the command that triggers # an error. set -o xtrace
· # Import exercise configuration source $TOP_DIR/exerciserc
· swift post $CONTAINER die_if_error "Failure creating container $CONTAINER" FLOATING_IP=`euca-allocate-address | cut -f2` die_if_not_set FLOATING_IP "Failure allocating floating IP"
·
·
·
·
|
|
来自: LZS2851 > 《OpenStack》