aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah Rumancik <leah.rumancik@gmail.com>2022-11-03 17:53:02 -0700
committerLeah Rumancik <leah.rumancik@gmail.com>2023-01-27 16:09:46 -0800
commit64ee4d7e4704c41b8e51ce5c372a615be2b12d67 (patch)
tree37015ee28d46d552eb7fa72941b6bed8e2d50bdb
parent8b00bfe79274a96b9dbb407cdd0be8b07f488d3c (diff)
downloadxfstests-bld-64ee4d7e4704c41b8e51ce5c372a615be2b12d67.tar.gz
ltm: update handling of image project for test VM
Previously, running LTM required you to build your own test appliance image and set GCE_IMAGE_PROJECT=$GCE_PROJECT. Consequently, when LTM launched test VMs, it would use the project ID in which LTM was running as the image project for the test VMs. Now that xfstests-cloud is publically readable, GCE_IMAGE_PROJECT might not be set to GCE_PROJECT when running LTM. In this case, we'd expect LTM to use the image from xfstests-cloud, but it is currently using the project from which LTM is running. When launching test VMs, make LTM read in GCE_IMAGE_PROJECT from config file and default to xfstests-cloud if none is set. Tested: gce-xfstests ltm options -> project to use to retreive image for test VM <default> -> xfstests-cloud --image-project=my_proj -> my_proj GCE_IMAGE_PROJECT=my_proj -> my_proj GCE_IMAGE_PROJECT=my_proj && --image-project= xfstests-cloud -> xfstests-cloud Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
-rwxr-xr-xrun-fstests/gce-xfstests1
-rw-r--r--test-appliance/files/usr/local/lib/gce-server/ltm/shard.go14
-rw-r--r--test-appliance/files/usr/local/lib/gce-server/ltm/sharder.go17
3 files changed, 20 insertions, 12 deletions
diff --git a/run-fstests/gce-xfstests b/run-fstests/gce-xfstests
index d3732128..4e532847 100755
--- a/run-fstests/gce-xfstests
+++ b/run-fstests/gce-xfstests
@@ -3,6 +3,7 @@
XFSTESTS_FLAVOR=gce
RUN_ON_LTM=
RUN_ON_KCS=
+GCE_IMAGE_PROJECT=
t=$(echo ${XFSTESTS_FLAVOR}_xfstests_dir | tr "[:lower:]" "[:upper:]")
eval DIR="\$$t"
if test -z "$DIR"
diff --git a/test-appliance/files/usr/local/lib/gce-server/ltm/shard.go b/test-appliance/files/usr/local/lib/gce-server/ltm/shard.go
index 25af29cd..68101c03 100644
--- a/test-appliance/files/usr/local/lib/gce-server/ltm/shard.go
+++ b/test-appliance/files/usr/local/lib/gce-server/ltm/shard.go
@@ -91,23 +91,25 @@ func NewShardWorker(sharder *ShardScheduler, shardID string, config string, zone
"--no-email",
"-c", config,
}
+
if sharder.arch != "" {
shard.args = append(shard.args, "--arch", sharder.arch)
}
- shard.args = append(shard.args, sharder.validArgs...)
- var defaultProj bool = true
- for _, arg := range shard.args {
+ var imgProjFlag bool = false
+ for _, arg := range sharder.validArgs {
if arg == "--image-project" {
- defaultProj = false
+ imgProjFlag = true
break
}
}
- if defaultProj {
- shard.args = append(shard.args, "--image-project", sharder.projID)
+ if ! imgProjFlag && len(sharder.imgProjID) > 0 {
+ shard.args = append(shard.args, "--image-project", sharder.imgProjID)
}
+ shard.args = append(shard.args, sharder.validArgs...)
+
return &shard
}
diff --git a/test-appliance/files/usr/local/lib/gce-server/ltm/sharder.go b/test-appliance/files/usr/local/lib/gce-server/ltm/sharder.go
index 957efa98..7023b5e5 100644
--- a/test-appliance/files/usr/local/lib/gce-server/ltm/sharder.go
+++ b/test-appliance/files/usr/local/lib/gce-server/ltm/sharder.go
@@ -39,9 +39,10 @@ const genResultsSummaryPath = "/usr/local/bin/gen_results_summary"
// ShardScheduler schedules tests and aggregates reports.
type ShardScheduler struct {
- testID string
- projID string
- origCmd string
+ testID string
+ projID string
+ imgProjID string
+ origCmd string
zone string
region string
@@ -101,6 +102,9 @@ func NewShardScheduler(c server.TaskRequest, testID string) *ShardScheduler {
projID, err := gcp.GceConfig.Get("GCE_PROJECT")
check.Panic(err, log, "Failed to get project config")
+ imgProjID, err := gcp.GceConfig.Get("GCE_IMAGE_PROJECT")
+ check.Panic(err, log, "Failed to get image project")
+
gsBucket, err := gcp.GceConfig.Get("GS_BUCKET")
check.Panic(err, log, "Failed to get gs bucket config")
@@ -108,9 +112,10 @@ func NewShardScheduler(c server.TaskRequest, testID string) *ShardScheduler {
log.Info("Initiating test sharder")
sharder := ShardScheduler{
- testID: testID,
- projID: projID,
- origCmd: origCmd,
+ testID: testID,
+ projID: projID,
+ imgProjID: imgProjID,
+ origCmd: origCmd,
zone: zone,
region: region,