aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah Rumancik <leah.rumancik@gmail.com>2022-07-26 14:56:33 -0700
committerLeah Rumancik <leah.rumancik@gmail.com>2022-09-27 12:36:34 -0700
commitea81a60aa81199e8d6ceb2ade65c85343168ae9a (patch)
tree3d75428d231c9bf23617efac90ea951d79c6fe64
parent23020e266941c73928563554627a713d92462e70 (diff)
downloadxfstests-bld-ea81a60aa81199e8d6ceb2ade65c85343168ae9a.tar.gz
gce-xfstests: enable running ltm servers on different projects in parallel
gce-xfstests stores data locally in files such as .ltm_instance/.kcs_instance. Previously, switching between projects required regenerating these files. Update these file names to include the project name to ease switching between projects. Tested: Launched ltm command Launched kcs job with and without kcs already running With Project 1 config gce-xfstests launch-ltm gce-xfstests ltm-info Switch to Project 2 config gce-xfstests ltm-info -> showed ltm not running gce-xfstests launch-ltm gce-xfstests ltm-info -> succeeded Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
-rw-r--r--run-fstests/.gitignore10
-rwxr-xr-xrun-fstests/gce-xfstests12
-rw-r--r--run-fstests/util/gce-kcs-funcs12
-rwxr-xr-xrun-fstests/util/gce-launch-kcs34
-rwxr-xr-xrun-fstests/util/gce-launch-ltm34
-rw-r--r--run-fstests/util/gce-ltm-funcs14
-rwxr-xr-xtest-appliance/files/usr/local/lib/gce-fetch-gs-files26
-rw-r--r--test-appliance/files/usr/local/lib/gce-server/util/gcp/config.go18
-rw-r--r--test-appliance/files/usr/local/lib/gce-server/util/server/server.go9
9 files changed, 93 insertions, 76 deletions
diff --git a/run-fstests/.gitignore b/run-fstests/.gitignore
index a4beae42..3f0ca5b3 100644
--- a/run-fstests/.gitignore
+++ b/run-fstests/.gitignore
@@ -2,9 +2,9 @@ disks
logs
baseline.*
*~
-.ltm_instance
-.gce_xfstests_cert.pem
-.ltm_cookie
-.kcs_instance
-.kcs_cookie
+.ltm_instance*
+.gce_xfstests_cert*.pem
+.ltm_cookie*
+.kcs_instance*
+.kcs_cookie*
/config-*
diff --git a/run-fstests/gce-xfstests b/run-fstests/gce-xfstests
index a5fa6bfa..1eda563f 100755
--- a/run-fstests/gce-xfstests
+++ b/run-fstests/gce-xfstests
@@ -618,8 +618,8 @@ case "$1" in
;;
ltm)
shift
- if [ ! -f "$DIR/.ltm_instance" ]; then
- echo "The .ltm_instance file is not present! Please launch the LTM before"
+ if [ ! -f "$DIR/.ltm_instance_$GCE_PROJECT" ]; then
+ echo "The .ltm_instance_$GCE_PROJECT file is not present! Please launch the LTM before"
echo "using this option."
exit 1
fi
@@ -628,8 +628,8 @@ case "$1" in
;;
kcs)
shift
- if [ ! -f "$DIR/.kcs_instance" ]; then
- echo "The .kcs_instance file is not present! Please launch the compile server before"
+ if [ ! -f "$DIR/.kcs_instance_$GCE_PROJECT" ]; then
+ echo "The .kcs_instance_$GCE_PROJECT file is not present! Please launch the compile server before"
echo "using this option."
exit 1
fi
@@ -639,8 +639,8 @@ case "$1" in
;;
ltm-info)
shift
- if [ ! -f "$DIR/.ltm_instance" ]; then
- echo "The .ltm_instance file is not present! Please launch the LTM before"
+ if [ ! -f "$DIR/.ltm_instance_$GCE_PROJECT" ]; then
+ echo "The .ltm_instance_$GCE_PROJECT file is not present! Please launch the LTM before"
echo "using this option."
exit 1
fi
diff --git a/run-fstests/util/gce-kcs-funcs b/run-fstests/util/gce-kcs-funcs
index 84f3467e..2b1c2d7f 100644
--- a/run-fstests/util/gce-kcs-funcs
+++ b/run-fstests/util/gce-kcs-funcs
@@ -1,4 +1,4 @@
-. $DIR/.kcs_instance
+. $DIR/.kcs_instance_$GCE_PROJECT
# The hostname has to match the common name field of the certificate, as set
# in util/gce-do-setup when running openssl to create a self-signed cert.
@@ -17,14 +17,14 @@ function kcs_post_json() {
function kcs_post_failed() {
if run_gcloud compute instances describe "xfstests-kcs" &> /dev/null; then
echo "The build server instance seems to be running. Try deleting the"
- echo "$DIR/.kcs_instance file and re-running launch-kcs to recreate"
+ echo "$DIR/.kcs_instance_$GCE_PROJECT file and re-running launch-kcs to recreate"
echo "the file. If the issue persists, try relaunching the build server"
echo "If configuration changes have been made, it may be necessary"
echo "to delete and re-launch the build server."
else
echo "The build server doesn't seem to be running. Try launching the build server"
echo "instance with launch-kcs. This will recreate the"
- echo ".kcs_instance file."
+ echo ".kcs_instance_$GCE_PROJECT file."
fi
}
@@ -32,9 +32,9 @@ function send_to_kcs() {
local cmd_to_send=$1
shift
- if test ! -f "$DIR/.kcs_cookie"; then
+ if test ! -f "$DIR/.kcs_cookie_$GCE_PROJECT"; then
# just create a new login session and store it in the cookie
- kcs_post_json -c $DIR/.kcs_cookie -d "{\"password\":\"$GCE_KCS_PWD\"}" \
+ kcs_post_json -c $DIR/.kcs_cookie_$GCE_PROJECT -d "{\"password\":\"$GCE_KCS_PWD\"}" \
"https://$KCS_HOSTNAME/login"
if [ ! $? = 0 ]; then
@@ -60,7 +60,7 @@ function send_to_kcs() {
fi
# Create OPTS.
- kcs_post_json -b $DIR/.kcs_cookie -d \
+ kcs_post_json -b $DIR/.kcs_cookie_$GCE_PROJECT -d \
"{\"orig_cmdline\": \"$cmd_to_send\"${KCS_OPTS:+, $KCS_OPTS}}" \
"https://$KCS_HOSTNAME/gce-xfstests"
diff --git a/run-fstests/util/gce-launch-kcs b/run-fstests/util/gce-launch-kcs
index 2492a1e4..127d6065 100755
--- a/run-fstests/util/gce-launch-kcs
+++ b/run-fstests/util/gce-launch-kcs
@@ -29,22 +29,22 @@ fi
INSTANCE="xfstests-kcs"
-if test -f "$DIR/.kcs_cookie"; then
+if test -f "$DIR/.kcs_cookie_$GCE_PROJECT"; then
echo "Removing old cookies..."
- rm -f "$DIR/.kcs_cookie"
+ rm -f "$DIR/.kcs_cookie_$GCE_PROJECT"
fi
NO_ACTION=
if run_gcloud compute instances describe --zone $GCE_ZONE \
$INSTANCE >& /dev/null
then
- if [ -f $DIR/.kcs_instance ]
+ if [ -f $DIR/.kcs_instance_$GCE_PROJECT ]
then
echo "The KCS instance already exists!"
exit 1
else
- echo "The KCS server instance already exists, but .kcs_instance is not present."
- echo "Re-creating .kcs_instance..."
+ echo "The KCS server instance already exists, but .kcs_instance_$GCE_PROJECT is not present."
+ echo "Re-creating .kcs_instance_$GCE_PROJECT..."
NO_ACTION=": "
fi
fi
@@ -95,9 +95,9 @@ then
fi
echo "Launching build server..."
-touch $DIR/.kcs_instance
+touch $DIR/.kcs_instance_$GCE_PROJECT
LAUNCH_KCS_EXIT_STATUS=1
-trap 'if [ $LAUNCH_KCS_EXIT_STATUS != 0 ]; then rm $DIR/.kcs_instance; fi' EXIT
+trap 'if [ $LAUNCH_KCS_EXIT_STATUS != 0 ]; then rm $DIR/.kcs_instance_$GCE_PROJECT; fi' EXIT
run_gcloud compute \
instances create "$INSTANCE" --zone "$GCE_ZONE" \
@@ -117,14 +117,14 @@ then
exit 1
fi
-if [ ! -f $DIR/.gce_xfstests_cert.pem ]
+if [ ! -f $DIR/.gce_xfstests_cert_$GCE_PROJECT.pem ]
then
- gsutil cat gs://$GS_BUCKET/gce-xfstests-cert.pem > $DIR/.gce_xfstests_cert.pem
+ gsutil cat gs://$GS_BUCKET/gce-xfstests-cert.pem > $DIR/.gce_xfstests_cert_$GCE_PROJECT.pem
fi
-echo "GCE_KCS_SERVER_CERT=$DIR/.gce_xfstests_cert.pem" > $DIR/.kcs_instance
-echo "GCE_KCS_NAME=$INSTANCE" >> $DIR/.kcs_instance
-echo -n "GCE_KCS_EXT_IP=" >> $DIR/.kcs_instance
+echo "GCE_KCS_SERVER_CERT=$DIR/.gce_xfstests_cert_$GCE_PROJECT.pem" > $DIR/.kcs_instance_$GCE_PROJECT
+echo "GCE_KCS_NAME=$INSTANCE" >> $DIR/.kcs_instance_$GCE_PROJECT
+echo -n "GCE_KCS_EXT_IP=" >> $DIR/.kcs_instance_$GCE_PROJECT
echo -n "Waiting for VM to boot to grab external IP..."
function wait_for_command() {
@@ -146,20 +146,20 @@ echo " Done!"
NO_ACTION=
run_gcloud compute instances describe "$INSTANCE" --zone "$GCE_ZONE" \
- --format="get(networkInterfaces[0].accessConfigs[0].natIP)" >> $DIR/.kcs_instance
+ --format="get(networkInterfaces[0].accessConfigs[0].natIP)" >> $DIR/.kcs_instance_$GCE_PROJECT
# use internal ip if this machine is in the same GCE project
if test -n "$RUN_INTERNAL"; then
echo "Runs on same GCE project so grab internal IP"
- echo -n "GCE_KCS_INT_IP=" >> $DIR/.kcs_instance
+ echo -n "GCE_KCS_INT_IP=" >> $DIR/.kcs_instance_$GCE_PROJECT
run_gcloud compute instances describe "$INSTANCE" --zone "$GCE_ZONE" \
- --format="get(networkInterfaces[0].networkIP)" >> $DIR/.kcs_instance
+ --format="get(networkInterfaces[0].networkIP)" >> $DIR/.kcs_instance_$GCE_PROJECT
fi
echo -n "Fetching password..."
wait_for_command "gsutil -q stat gs://$GS_BUCKET/ltm-pass"
-echo -n "GCE_KCS_PWD=" >> $DIR/.kcs_instance
-gsutil cat gs://$GS_BUCKET/ltm-pass >> $DIR/.kcs_instance
+echo -n "GCE_KCS_PWD=" >> $DIR/.kcs_instance_$GCE_PROJECT
+gsutil cat gs://$GS_BUCKET/ltm-pass >> $DIR/.kcs_instance_$GCE_PROJECT
LAUNCH_KCS_EXIT_STATUS=0
echo "Done!"
diff --git a/run-fstests/util/gce-launch-ltm b/run-fstests/util/gce-launch-ltm
index 265666b4..de805a1d 100755
--- a/run-fstests/util/gce-launch-ltm
+++ b/run-fstests/util/gce-launch-ltm
@@ -29,23 +29,23 @@ fi
INSTANCE="xfstests-ltm"
-if test -f "$DIR/.ltm_cookie"; then
+if test -f "$DIR/.ltm_cookie_$GCE_PROJECT"; then
echo "Removing old cookies..."
- rm -f "$DIR/.ltm_cookie"
+ rm -f "$DIR/.ltm_cookie_$GCE_PROJECT"
fi
NO_ACTION=
if run_gcloud compute instances describe --zone $GCE_ZONE \
$INSTANCE >& /dev/null
then
- if [ -f $DIR/.ltm_instance ]
+ if [ -f $DIR/.ltm_instance_$GCE_PROJECT ]
then
echo "The LTM instance already exists!"
echo "Launch new tests on the ltm with gce-xfstests ltm <more>"
exit 1
else
- echo "The LTM instance already exists, but .ltm_instance is not present."
- echo "Re-creating .ltm_instance..."
+ echo "The LTM instance already exists, but .ltm_instance_$GCE_PROJECT is not present."
+ echo "Re-creating .ltm_instance_$GCE_PROJECT..."
NO_ACTION=": "
fi
fi
@@ -96,9 +96,9 @@ then
fi
echo "Launching LTM server..."
-touch $DIR/.ltm_instance
+touch $DIR/.ltm_instance_$GCE_PROJECT
LAUNCH_LTM_EXIT_STATUS=1
-trap 'if [ $LAUNCH_LTM_EXIT_STATUS != 0 ]; then rm $DIR/.ltm_instance; fi' EXIT
+trap 'if [ $LAUNCH_LTM_EXIT_STATUS != 0 ]; then rm $DIR/.ltm_instance_$GCE_PROJECT; fi' EXIT
run_gcloud compute instances create "$INSTANCE" --zone "$GCE_ZONE" \
--machine-type "$GCE_LTM_MACHTYPE" --network "$GCE_NETWORK" \
@@ -117,14 +117,14 @@ then
exit 1
fi
-if [ ! -f $DIR/.gce_xfstests_cert.pem ]
+if [ ! -f $DIR/.gce_xfstests_cert_$GCE_PROJECT.pem ]
then
- gsutil cat gs://$GS_BUCKET/gce-xfstests-cert.pem > $DIR/.gce_xfstests_cert.pem
+ gsutil cat gs://$GS_BUCKET/gce-xfstests-cert.pem > $DIR/.gce_xfstests_cert_$GCE_PROJECT.pem
fi
-echo "GCE_LTM_SERVER_CERT=$DIR/.gce_xfstests_cert.pem" > $DIR/.ltm_instance
-echo "GCE_LTM_NAME=$INSTANCE" >> $DIR/.ltm_instance
-echo -n "GCE_LTM_EXT_IP=" >> $DIR/.ltm_instance
+echo "GCE_LTM_SERVER_CERT=$DIR/.gce_xfstests_cert_$GCE_PROJECT.pem" > $DIR/.ltm_instance_$GCE_PROJECT
+echo "GCE_LTM_NAME=$INSTANCE" >> $DIR/.ltm_instance_$GCE_PROJECT
+echo -n "GCE_LTM_EXT_IP=" >> $DIR/.ltm_instance_$GCE_PROJECT
echo -n "Waiting for VM to boot to grab external IP..."
function wait_for_command() {
@@ -146,20 +146,20 @@ echo " Done!"
NO_ACTION=
run_gcloud compute instances describe "$INSTANCE" --zone "$GCE_ZONE" \
- --format="get(networkInterfaces[0].accessConfigs[0].natIP)" >> $DIR/.ltm_instance
+ --format="get(networkInterfaces[0].accessConfigs[0].natIP)" >> $DIR/.ltm_instance_$GCE_PROJECT
# use internal ip if this machine is in the same GCE project
if test -n "$RUN_INTERNAL"; then
echo "Runs on same GCE project so grab internal IP"
- echo -n "GCE_LTM_INT_IP=" >> $DIR/.ltm_instance
+ echo -n "GCE_LTM_INT_IP=" >> $DIR/.ltm_instance_$GCE_PROJECT
run_gcloud compute instances describe "$INSTANCE" --zone "$GCE_ZONE" \
- --format="get(networkInterfaces[0].networkIP)" >> $DIR/.ltm_instance
+ --format="get(networkInterfaces[0].networkIP)" >> $DIR/.ltm_instance_$GCE_PROJECT
fi
echo -n "Fetching password..."
wait_for_command "gsutil -q stat gs://$GS_BUCKET/ltm-pass"
-echo -n "GCE_LTM_PWD=" >> $DIR/.ltm_instance
-gsutil cat gs://$GS_BUCKET/ltm-pass >> $DIR/.ltm_instance
+echo -n "GCE_LTM_PWD=" >> $DIR/.ltm_instance_$GCE_PROJECT
+gsutil cat gs://$GS_BUCKET/ltm-pass >> $DIR/.ltm_instance_$GCE_PROJECT
LAUNCH_LTM_EXIT_STATUS=0
echo "Done!"
diff --git a/run-fstests/util/gce-ltm-funcs b/run-fstests/util/gce-ltm-funcs
index f7f9b8a1..98899ce3 100644
--- a/run-fstests/util/gce-ltm-funcs
+++ b/run-fstests/util/gce-ltm-funcs
@@ -1,4 +1,4 @@
-. $DIR/.ltm_instance
+. $DIR/.ltm_instance_$GCE_PROJECT
# The hostname has to match the common name field of the certificate, as set
# in util/gce-do-setup when running openssl to create a self-signed cert.
@@ -17,14 +17,14 @@ function ltm_post_json() {
function ltm_post_failed() {
if run_gcloud compute instances describe "xfstests-ltm" &> /dev/null; then
echo "The ltm instance seems to be running. Try deleting the"
- echo "$DIR/.ltm_instance file and re-running launch-ltm to recreate"
+ echo "$DIR/.ltm_instance_$GCE_PROJECT file and re-running launch-ltm to recreate"
echo "the file. If the issue persists, try relaunching the LTM"
echo "If configuration changes have been made, it may be necessary"
echo "to delete and re-launch the LTM."
else
echo "The ltm doesn't seem to be running. Try launching the ltm"
echo "instance with launch-ltm. This will recreate the"
- echo ".ltm_instance file."
+ echo ".ltm_instance_$GCE_PROJECT file."
fi
}
@@ -32,9 +32,9 @@ function send_to_ltm() {
local cmd_to_send=$1
shift
- if test ! -f "$DIR/.ltm_cookie"; then
+ if test ! -f "$DIR/.ltm_cookie_$GCE_PROJECT"; then
# just create a new login session and store it in the cookie
- ltm_post_json -c $DIR/.ltm_cookie -d "{\"password\":\"$GCE_LTM_PWD\"}" \
+ ltm_post_json -c $DIR/.ltm_cookie_$GCE_PROJECT -d "{\"password\":\"$GCE_LTM_PWD\"}" \
"https://$LTM_HOSTNAME/login"
if [ ! $? = 0 ]; then
@@ -46,7 +46,7 @@ function send_to_ltm() {
fi
if test -n "$LTM_INFO"; then
- ltm_post_json -b $DIR/.ltm_cookie "https://$LTM_HOSTNAME/status"
+ ltm_post_json -b $DIR/.ltm_cookie_$GCE_PROJECT "https://$LTM_HOSTNAME/status"
if [ $? != 0 ]; then
echo "Request failed."
ltm_post_failed
@@ -99,7 +99,7 @@ function send_to_ltm() {
fi
# Create OPTS.
- ltm_post_json -b $DIR/.ltm_cookie -d \
+ ltm_post_json -b $DIR/.ltm_cookie_$GCE_PROJECT -d \
"{\"orig_cmdline\": \"$cmd_to_send\"${LTM_OPTS:+, $LTM_OPTS}}" \
"https://$LTM_HOSTNAME/gce-xfstests"
diff --git a/test-appliance/files/usr/local/lib/gce-fetch-gs-files b/test-appliance/files/usr/local/lib/gce-fetch-gs-files
index 5ff325a6..283ab1bf 100755
--- a/test-appliance/files/usr/local/lib/gce-fetch-gs-files
+++ b/test-appliance/files/usr/local/lib/gce-fetch-gs-files
@@ -15,25 +15,27 @@ chmod 0400 /etc/lighttpd/server.pem
# installed in /root/xfstests_bld/run-fstesets
DIR=/root/xfstests_bld/run-fstests
+. "$GCE_CONFIG_FILE"
+
if [ "$(hostname)" = "xfstests-ltm" ]
then
gsutil cat gs://$GS_BUCKET/gce-xfstests-cert.pem \
- > $DIR/.gce_xfstests_cert.pem
- echo "GCE_LTM_SERVER_CERT=$DIR/.gce_xfstests_cert.pem" > $DIR/.ltm_instance
- echo "GCE_LTM_NAME=$(hostname)" >> $DIR/.ltm_instance
- echo "GCE_LTM_EXT_IP=127.0.0.1" >> $DIR/.ltm_instance
- echo -n "GCE_LTM_PWD=" >> $DIR/.ltm_instance
- gsutil cat gs://$GS_BUCKET/ltm-pass >> $DIR/.ltm_instance
+ > $DIR/.gce_xfstests_cert_$GCE_PROJECT.pem
+ echo "GCE_LTM_SERVER_CERT=$DIR/.gce_xfstests_cert_$GCE_PROJECT.pem" > $DIR/.ltm_instance_$GCE_PROJECT
+ echo "GCE_LTM_NAME=$(hostname)" >> $DIR/.ltm_instance_$GCE_PROJECT
+ echo "GCE_LTM_EXT_IP=127.0.0.1" >> $DIR/.ltm_instance_$GCE_PROJECT
+ echo -n "GCE_LTM_PWD=" >> $DIR/.ltm_instance_$GCE_PROJECT
+ gsutil cat gs://$GS_BUCKET/ltm-pass >> $DIR/.ltm_instance_$GCE_PROJECT
fi
if [ "$(hostname)" = "xfstests-kcs" ]
then
gsutil cat gs://$GS_BUCKET/gce-xfstests-cert.pem \
- > $DIR/.gce_xfstests_cert.pem
- echo "GCE_KCS_SERVER_CERT=$DIR/.gce_xfstests_cert.pem" > $DIR/.kcs_instance
- echo "GCE_KCS_NAME=$(hostname)" >> $DIR/.kcs_instance
- echo "GCE_KCS_EXT_IP=127.0.0.1" >> $DIR/.kcs_instance
- echo -n "GCE_KCS_PWD=" >> $DIR/.kcs_instance
- gsutil cat gs://$GS_BUCKET/ltm-pass >> $DIR/.kcs_instance
+ > $DIR/.gce_xfstests_cert_$GCE_PROJECT.pem
+ echo "GCE_KCS_SERVER_CERT=$DIR/.gce_xfstests_cert_$GCE_PROJECT.pem" > $DIR/.kcs_instance_$GCE_PROJECT
+ echo "GCE_KCS_NAME=$(hostname)" >> $DIR/.kcs_instance_$GCE_PROJECT
+ echo "GCE_KCS_EXT_IP=127.0.0.1" >> $DIR/.kcs_instance_$GCE_PROJECT
+ echo -n "GCE_KCS_PWD=" >> $DIR/.kcs_instance_$GCE_PROJECT
+ gsutil cat gs://$GS_BUCKET/ltm-pass >> $DIR/.kcs_instance_$GCE_PROJECT
fi
touch $DIR/config.common
cat "$GCE_CONFIG_FILE" >> $DIR/config.gce
diff --git a/test-appliance/files/usr/local/lib/gce-server/util/gcp/config.go b/test-appliance/files/usr/local/lib/gce-server/util/gcp/config.go
index a4a28d7a..9b7b2c15 100644
--- a/test-appliance/files/usr/local/lib/gce-server/util/gcp/config.go
+++ b/test-appliance/files/usr/local/lib/gce-server/util/gcp/config.go
@@ -9,11 +9,7 @@ import (
)
// config file locations on multiple machines
-const (
- gce = "/usr/local/lib/gce_xfstests.config"
- ltm = "/root/xfstests_bld/run-fstests/.ltm_instance"
- kcs = "/root/xfstests_bld/run-fstests/.kcs_instance"
-)
+const gce = "/usr/local/lib/gce_xfstests.config"
// Config stores the parsed config key value pairs.
type Config struct {
@@ -27,6 +23,8 @@ var (
LTMConfig *Config
KCSConfig *Config
configLock sync.RWMutex
+ ltm string
+ kcs string
)
func init() {
@@ -39,6 +37,16 @@ func init() {
panic("failed to parse gce config file")
}
+ // get GCE_PROJECT directly, do not go through Get function
+ // as init is already holding the configLock
+ var projID = GceConfig.kv["GCE_PROJECT"]
+ if projID == "" {
+ panic("failed to get GCE_PROJECT from gce config")
+ }
+
+ ltm = "/root/xfstests_bld/run-fstests/.ltm_instance_" + projID
+ kcs = "/root/xfstests_bld/run-fstests/.kcs_instance_" + projID
+
if check.FileExists(ltm) {
LTMConfig, err = Get(ltm)
if err != nil {
diff --git a/test-appliance/files/usr/local/lib/gce-server/util/server/server.go b/test-appliance/files/usr/local/lib/gce-server/util/server/server.go
index f492045c..f51cb856 100644
--- a/test-appliance/files/usr/local/lib/gce-server/util/server/server.go
+++ b/test-appliance/files/usr/local/lib/gce-server/util/server/server.go
@@ -40,7 +40,6 @@ const (
// KCSServer defines the instance name for KCS server
KCSServer = "xfstests-kcs"
// file paths for certificates and keys
- certPath = "/root/xfstests_bld/run-fstests/.gce_xfstests_cert.pem"
secretPath = "/etc/lighttpd/server.pem"
sessionsKeyPath = "/usr/local/lib/gce-server/.sessions_secret_key"
@@ -171,10 +170,12 @@ type Instance struct {
}
// server maintained secrets and mutex to avoid race conditions.
+// also, path to cert file, path must be genereated at runtime
var (
key []byte
password string
launchLock sync.Mutex
+ certPath string
)
func init() {
@@ -206,6 +207,12 @@ func init() {
panic(err)
}
+ projID, err := gcp.GceConfig.Get("GCE_PROJECT")
+ if err != nil || projID == "" {
+ panic("Failed to get project config in init()")
+ }
+
+ certPath = "/root/xfstests_bld/run-fstests/.gce_xfstests_cert_" + projID + ".pem"
}
// New sets up a new https server.