@@ -955,31 +955,42 @@ impl<'a> Planner<'a> {
955955 ) -> Result < ( ) , Error > {
956956 let zone_kind = zone. zone_type . kind ( ) ;
957957 let image_source = self . blueprint . zone_image_source ( zone_kind) ;
958- match zone_kind {
959- ZoneKind :: Crucible
960- | ZoneKind :: CockroachDb
961- | ZoneKind :: Clickhouse => {
962- info ! (
963- self . log, "updating zone image source in-place" ;
964- "sled_id" => %sled_id,
965- "zone_id" => %zone. id,
966- "kind" => ?zone. zone_type. kind( ) ,
967- "image_source" => %image_source,
968- ) ;
969- self . blueprint . sled_set_zone_source (
970- sled_id,
971- zone. id ,
972- image_source,
973- ) ?;
974- }
975- _ => {
976- info ! (
977- self . log, "expunging out-of-date zone" ;
978- "sled_id" => %sled_id,
979- "zone_id" => %zone. id,
980- "kind" => ?zone. zone_type. kind( ) ,
981- ) ;
982- self . blueprint . sled_expunge_zone ( sled_id, zone. id ) ?;
958+ if zone. image_source == image_source {
959+ // This should only happen in the event of a planning error above.
960+ warn ! (
961+ self . log, "zone is already up-to-date" ;
962+ "sled_id" => %sled_id,
963+ "zone_id" => %zone. id,
964+ "kind" => ?zone. zone_type. kind( ) ,
965+ "image_source" => %image_source,
966+ ) ;
967+ } else {
968+ match zone_kind {
969+ ZoneKind :: Crucible
970+ | ZoneKind :: CockroachDb
971+ | ZoneKind :: Clickhouse => {
972+ info ! (
973+ self . log, "updating zone image source in-place" ;
974+ "sled_id" => %sled_id,
975+ "zone_id" => %zone. id,
976+ "kind" => ?zone. zone_type. kind( ) ,
977+ "image_source" => %image_source,
978+ ) ;
979+ self . blueprint . sled_set_zone_source (
980+ sled_id,
981+ zone. id ,
982+ image_source,
983+ ) ?;
984+ }
985+ _ => {
986+ info ! (
987+ self . log, "expunging out-of-date zone" ;
988+ "sled_id" => %sled_id,
989+ "zone_id" => %zone. id,
990+ "kind" => ?zone. zone_type. kind( ) ,
991+ ) ;
992+ self . blueprint . sled_expunge_zone ( sled_id, zone. id ) ?;
993+ }
983994 }
984995 }
985996 Ok ( ( ) )
0 commit comments