From 72b2e241ce6a4ca6d9faca0c162d70986fcbf616 Mon Sep 17 00:00:00 2001 From: karencfv Date: Thu, 11 Jan 2024 16:49:29 +1300 Subject: [PATCH 1/5] [smf] Use new zone network config service --- agent/agent_method_script.sh | 43 ---------------------------------- agent/smf/agent.xml | 10 +++++--- package-manifest.toml | 20 +++++++++++++--- pantry/pantry_method_script.sh | 34 --------------------------- pantry/smf/pantry.xml | 9 ++++--- 5 files changed, 30 insertions(+), 86 deletions(-) delete mode 100755 agent/agent_method_script.sh delete mode 100755 pantry/pantry_method_script.sh diff --git a/agent/agent_method_script.sh b/agent/agent_method_script.sh deleted file mode 100755 index 880bf20ac..000000000 --- a/agent/agent_method_script.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail -set -o xtrace - -. /lib/svc/share/smf_include.sh - -DATALINK="$(svcprop -c -p config/datalink "${SMF_FMRI}")" -GATEWAY="$(svcprop -c -p config/gateway "${SMF_FMRI}")" -DATASET="$(svcprop -c -p config/dataset "${SMF_FMRI}")" -LISTEN_ADDR="$(svcprop -c -p config/listen_addr "${SMF_FMRI}")" -LISTEN_PORT="$(svcprop -c -p config/listen_port "${SMF_FMRI}")" -PORTBASE="$(svcprop -c -p config/portbase "${SMF_FMRI}")" -DOWNSTAIRS_PREFIX="$(svcprop -c -p config/downstairs_prefix "${SMF_FMRI}")" -SNAPSHOT_PREFIX="$(svcprop -c -p config/snapshot_prefix "${SMF_FMRI}")" - -if [[ $DATALINK == unknown ]] || [[ $GATEWAY == unknown ]]; then - printf 'ERROR: missing datalink or gateway' >&2 - exit "$SMF_EXIT_ERR_CONFIG" -fi - -# TODO remove when https://github.com/oxidecomputer/stlouis/issues/435 is addressed -ipadm delete-if "$DATALINK" || true -ipadm create-if -t "$DATALINK" - -ipadm set-ifprop -t -p mtu=9000 -m ipv4 "$DATALINK" -ipadm set-ifprop -t -p mtu=9000 -m ipv6 "$DATALINK" - -ipadm show-addr "$DATALINK/ll" || ipadm create-addr -t -T addrconf "$DATALINK/ll" -ipadm show-addr "$DATALINK/omicron6" || ipadm create-addr -t -T static -a "$LISTEN_ADDR" "$DATALINK/omicron6" -route get -inet6 default -inet6 "$GATEWAY" || route add -inet6 default -inet6 "$GATEWAY" - -args=( - '-D' '/opt/oxide/crucible/bin/crucible-downstairs' - '--dataset' "$DATASET" - '-l' "[$LISTEN_ADDR]:$LISTEN_PORT" - '-P' "$PORTBASE" - '-p' "$DOWNSTAIRS_PREFIX" - '-s' "$SNAPSHOT_PREFIX" -) - -exec /opt/oxide/crucible/bin/crucible-agent run "${args[@]}" diff --git a/agent/smf/agent.xml b/agent/smf/agent.xml index 53ae3bcb1..62c341ce9 100644 --- a/agent/smf/agent.xml +++ b/agent/smf/agent.xml @@ -13,8 +13,13 @@ + + + + @@ -25,11 +30,10 @@ - - + diff --git a/package-manifest.toml b/package-manifest.toml index 37cac4646..1fbe0dc53 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -1,22 +1,36 @@ [package.crucible] service_name = "crucible" +only_for_targets.image = "standard" +source.type = "composite" +source.packages = [ "crucible-svc.tar.gz", "zone-network-setup.tar.gz" ] +output.type = "zone" + +[package.crucible-svc] +service_name = "crucible-svc" source.type = "local" source.rust.binary_names = ["crucible-agent", "crucible-downstairs"] source.rust.release = true source.paths = [ { from = "agent/smf", to = "/var/svc/manifest/site/crucible" }, { from = "agent/downstairs_method_script.sh", to = "/opt/oxide/lib/svc/manifest/crucible/downstairs.sh" }, - { from = "agent/agent_method_script.sh", to = "/opt/oxide/lib/svc/manifest/crucible/agent.sh" } ] output.type = "zone" +output.intermediate_only = true [package.crucible-pantry] -service_name = "pantry" +service_name = "crucible-pantry" +only_for_targets.image = "standard" +source.type = "composite" +source.packages = [ "crucible-pantry-svc.tar.gz", "zone-network-setup.tar.gz" ] +output.type = "zone" + +[package.crucible-pantry-svc] +service_name = "pantry-svc" source.type = "local" source.rust.binary_names = ["crucible-pantry"] source.rust.release = true source.paths = [ { from = "pantry/smf/pantry.xml", to = "/var/svc/manifest/site/crucible/pantry.xml" }, - { from = "pantry/pantry_method_script.sh", to = "/opt/oxide/lib/svc/manifest/crucible/pantry.sh" } ] output.type = "zone" +output.intermediate_only = true diff --git a/pantry/pantry_method_script.sh b/pantry/pantry_method_script.sh deleted file mode 100755 index 36d679e82..000000000 --- a/pantry/pantry_method_script.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -o errexit -set -o pipefail -set -o xtrace - -. /lib/svc/share/smf_include.sh - -DATALINK="$(svcprop -c -p config/datalink "${SMF_FMRI}")" -GATEWAY="$(svcprop -c -p config/gateway "${SMF_FMRI}")" -LISTEN_ADDR="$(svcprop -c -p config/listen_addr "${SMF_FMRI}")" -LISTEN_PORT="$(svcprop -c -p config/listen_port "${SMF_FMRI}")" - -if [[ $DATALINK == unknown ]] || [[ $GATEWAY == unknown ]]; then - printf 'ERROR: missing datalink or gateway' >&2 - exit "$SMF_EXIT_ERR_CONFIG" -fi - -# TODO remove when https://github.com/oxidecomputer/stlouis/issues/435 is addressed -ipadm delete-if "$DATALINK" || true -ipadm create-if -t "$DATALINK" - -ipadm set-ifprop -t -p mtu=9000 -m ipv4 "$DATALINK" -ipadm set-ifprop -t -p mtu=9000 -m ipv6 "$DATALINK" - -ipadm show-addr "$DATALINK/ll" || ipadm create-addr -t -T addrconf "$DATALINK/ll" -ipadm show-addr "$DATALINK/omicron6" || ipadm create-addr -t -T static -a "$LISTEN_ADDR" "$DATALINK/omicron6" -route get -inet6 default -inet6 "$GATEWAY" || route add -inet6 default -inet6 "$GATEWAY" - -args=( - '-l' "[$LISTEN_ADDR]:$LISTEN_PORT" -) - -exec /opt/oxide/pantry/bin/crucible-pantry run "${args[@]}" diff --git a/pantry/smf/pantry.xml b/pantry/smf/pantry.xml index ef4a19df1..06a9fbffd 100644 --- a/pantry/smf/pantry.xml +++ b/pantry/smf/pantry.xml @@ -13,8 +13,13 @@ + + + + @@ -25,8 +30,6 @@ - - From a0d2310a8310602310567edd5dc12532cfd63eba Mon Sep 17 00:00:00 2001 From: karencfv Date: Fri, 12 Jan 2024 14:10:12 +1300 Subject: [PATCH 2/5] fix test? --- .github/buildomat/jobs/build-release.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/buildomat/jobs/build-release.sh b/.github/buildomat/jobs/build-release.sh index d1edf3392..e702e94af 100644 --- a/.github/buildomat/jobs/build-release.sh +++ b/.github/buildomat/jobs/build-release.sh @@ -86,7 +86,9 @@ ptime -m cargo run --bin crucible-package banner contents tar tvfz out/crucible.tar.gz tar tvfz out/crucible-pantry.tar.gz -mv out/crucible.tar.gz out/crucible-pantry.tar.gz /out/ +tar tvfz out/crucible-svc.tar.gz +tar tvfz out/crucible-pantry-svc.tar.gz +mv out/crucible.tar.gz out/crucible-pantry.tar.gz out/crucible-svc.tar.gz out/crucible-pantry-svc.tar.gz /out/ # Build the nightly archive file which should include all the scripts # and binaries needed to run the nightly test. From 93897ebbe3f5d29c711374810a53c024fddc7f5b Mon Sep 17 00:00:00 2001 From: karencfv Date: Fri, 12 Jan 2024 14:54:10 +1300 Subject: [PATCH 3/5] fix test? --- .github/buildomat/jobs/build-release.sh | 4 +--- package-manifest.toml | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/buildomat/jobs/build-release.sh b/.github/buildomat/jobs/build-release.sh index e702e94af..d1edf3392 100644 --- a/.github/buildomat/jobs/build-release.sh +++ b/.github/buildomat/jobs/build-release.sh @@ -86,9 +86,7 @@ ptime -m cargo run --bin crucible-package banner contents tar tvfz out/crucible.tar.gz tar tvfz out/crucible-pantry.tar.gz -tar tvfz out/crucible-svc.tar.gz -tar tvfz out/crucible-pantry-svc.tar.gz -mv out/crucible.tar.gz out/crucible-pantry.tar.gz out/crucible-svc.tar.gz out/crucible-pantry-svc.tar.gz /out/ +mv out/crucible.tar.gz out/crucible-pantry.tar.gz /out/ # Build the nightly archive file which should include all the scripts # and binaries needed to run the nightly test. diff --git a/package-manifest.toml b/package-manifest.toml index 1fbe0dc53..afca07c3e 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -1,10 +1,3 @@ -[package.crucible] -service_name = "crucible" -only_for_targets.image = "standard" -source.type = "composite" -source.packages = [ "crucible-svc.tar.gz", "zone-network-setup.tar.gz" ] -output.type = "zone" - [package.crucible-svc] service_name = "crucible-svc" source.type = "local" @@ -17,11 +10,11 @@ source.paths = [ output.type = "zone" output.intermediate_only = true -[package.crucible-pantry] -service_name = "crucible-pantry" +[package.crucible] +service_name = "crucible" only_for_targets.image = "standard" source.type = "composite" -source.packages = [ "crucible-pantry-svc.tar.gz", "zone-network-setup.tar.gz" ] +source.packages = [ "crucible-svc.tar.gz", "zone-network-setup.tar.gz" ] output.type = "zone" [package.crucible-pantry-svc] @@ -34,3 +27,10 @@ source.paths = [ ] output.type = "zone" output.intermediate_only = true + +[package.crucible-pantry] +service_name = "crucible-pantry" +only_for_targets.image = "standard" +source.type = "composite" +source.packages = [ "crucible-pantry-svc.tar.gz", "zone-network-setup.tar.gz" ] +output.type = "zone" From 9a863f976f0763da725367ace301155fc7ed3ede Mon Sep 17 00:00:00 2001 From: karencfv Date: Tue, 30 Jan 2024 17:09:29 +1300 Subject: [PATCH 4/5] Extract composite packages to omicron --- package-manifest.toml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/package-manifest.toml b/package-manifest.toml index afca07c3e..8e2d8c226 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -1,5 +1,5 @@ -[package.crucible-svc] -service_name = "crucible-svc" +[package.crucible] +service_name = "crucible" source.type = "local" source.rust.binary_names = ["crucible-agent", "crucible-downstairs"] source.rust.release = true @@ -10,15 +10,8 @@ source.paths = [ output.type = "zone" output.intermediate_only = true -[package.crucible] -service_name = "crucible" -only_for_targets.image = "standard" -source.type = "composite" -source.packages = [ "crucible-svc.tar.gz", "zone-network-setup.tar.gz" ] -output.type = "zone" - -[package.crucible-pantry-svc] -service_name = "pantry-svc" +[package.crucible-pantry] +service_name = "pantry" source.type = "local" source.rust.binary_names = ["crucible-pantry"] source.rust.release = true @@ -27,10 +20,3 @@ source.paths = [ ] output.type = "zone" output.intermediate_only = true - -[package.crucible-pantry] -service_name = "crucible-pantry" -only_for_targets.image = "standard" -source.type = "composite" -source.packages = [ "crucible-pantry-svc.tar.gz", "zone-network-setup.tar.gz" ] -output.type = "zone" From 3e2bd7c5f79b59c66d848a6c19042394c28616ff Mon Sep 17 00:00:00 2001 From: karencfv Date: Wed, 7 Feb 2024 15:53:30 +1300 Subject: [PATCH 5/5] tars aren't built if intermediate-only is set --- package-manifest.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/package-manifest.toml b/package-manifest.toml index 8e2d8c226..6ac171342 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -8,7 +8,6 @@ source.paths = [ { from = "agent/downstairs_method_script.sh", to = "/opt/oxide/lib/svc/manifest/crucible/downstairs.sh" }, ] output.type = "zone" -output.intermediate_only = true [package.crucible-pantry] service_name = "pantry" @@ -19,4 +18,3 @@ source.paths = [ { from = "pantry/smf/pantry.xml", to = "/var/svc/manifest/site/crucible/pantry.xml" }, ] output.type = "zone" -output.intermediate_only = true