@@ -6,12 +6,10 @@ use crate::blippy::Blippy;
6
6
use crate :: blippy:: Severity ;
7
7
use crate :: blippy:: SledKind ;
8
8
use nexus_sled_agent_shared:: inventory:: ZoneKind ;
9
- use nexus_types:: deployment:: blueprint_zone_type;
10
9
use nexus_types:: deployment:: BlueprintDatasetConfig ;
11
10
use nexus_types:: deployment:: BlueprintDatasetFilter ;
12
11
use nexus_types:: deployment:: BlueprintZoneConfig ;
13
12
use nexus_types:: deployment:: BlueprintZoneFilter ;
14
- use nexus_types:: deployment:: BlueprintZoneType ;
15
13
use nexus_types:: deployment:: OmicronZoneExternalIp ;
16
14
use omicron_common:: address:: DnsSubnet ;
17
15
use omicron_common:: address:: Ipv6Subnet ;
@@ -415,10 +413,6 @@ fn check_datasets(blippy: &mut Blippy<'_>) {
415
413
}
416
414
}
417
415
418
- // In a check below, we want to look up Crucible zones by zpool; build that
419
- // map as we perform the next set of checks.
420
- let mut crucible_zone_by_zpool = BTreeMap :: new ( ) ;
421
-
422
416
// There should be a dataset for every dataset referenced by a running zone
423
417
// (filesystem or durable).
424
418
for ( sled_id, zone_config) in blippy
@@ -437,7 +431,7 @@ fn check_datasets(blippy: &mut Blippy<'_>) {
437
431
Some ( dataset) => {
438
432
match sled_datasets
439
433
. get ( & dataset. pool ( ) . id ( ) )
440
- . and_then ( |by_zpool| by_zpool. get ( dataset. kind ( ) ) )
434
+ . and_then ( |by_zpool| by_zpool. get ( dataset. dataset ( ) ) )
441
435
{
442
436
Some ( dataset) => {
443
437
expected_datasets. insert ( dataset. id ) ;
@@ -477,21 +471,6 @@ fn check_datasets(blippy: &mut Blippy<'_>) {
477
471
) ;
478
472
}
479
473
}
480
-
481
- if dataset. kind == DatasetKind :: Crucible {
482
- match & zone_config. zone_type {
483
- BlueprintZoneType :: Crucible ( crucible_zone_config) => {
484
- crucible_zone_by_zpool. insert (
485
- dataset. dataset . pool_name . id ( ) ,
486
- crucible_zone_config,
487
- ) ;
488
- }
489
- _ => unreachable ! (
490
- "zone_type.durable_dataset() returned Crucible for \
491
- non-Crucible zone type"
492
- ) ,
493
- }
494
- }
495
474
}
496
475
}
497
476
@@ -554,50 +533,6 @@ fn check_datasets(blippy: &mut Blippy<'_>) {
554
533
continue ;
555
534
}
556
535
}
557
-
558
- // All Crucible datasets should have their address set to the address of the
559
- // Crucible zone on their same zpool, and all non-Crucible datasets should
560
- // not have addresses.
561
- for ( sled_id, dataset) in blippy
562
- . blueprint ( )
563
- . all_omicron_datasets ( BlueprintDatasetFilter :: InService )
564
- {
565
- match dataset. kind {
566
- DatasetKind :: Crucible => {
567
- let Some ( blueprint_zone_type:: Crucible { address, .. } ) =
568
- crucible_zone_by_zpool. get ( & dataset. pool . id ( ) )
569
- else {
570
- // We already checked above that all datasets have
571
- // corresponding zones, so a failure to find the zone for
572
- // this dataset would have already produced a note; just
573
- // skip it.
574
- continue ;
575
- } ;
576
- if dataset. address != Some ( * address) {
577
- blippy. push_sled_note (
578
- sled_id,
579
- Severity :: Fatal ,
580
- SledKind :: CrucibleDatasetWithIncorrectAddress {
581
- dataset : dataset. clone ( ) ,
582
- expected_address : * address,
583
- } ,
584
- ) ;
585
- }
586
- }
587
- _ => {
588
- if let Some ( address) = dataset. address {
589
- blippy. push_sled_note (
590
- sled_id,
591
- Severity :: Fatal ,
592
- SledKind :: NonCrucibleDatasetWithAddress {
593
- dataset : dataset. clone ( ) ,
594
- address,
595
- } ,
596
- ) ;
597
- }
598
- }
599
- }
600
- }
601
536
}
602
537
603
538
#[ cfg( test) ]
@@ -1359,7 +1294,7 @@ mod tests {
1359
1294
== durable_zone. zone_type . durable_dataset ( ) . unwrap ( ) . kind ) ;
1360
1295
let root_dataset = root_zone. filesystem_dataset ( ) . unwrap ( ) ;
1361
1296
let matches_root = ( dataset. pool == * root_dataset. pool ( ) )
1362
- && ( dataset. kind == * root_dataset. kind ( ) ) ;
1297
+ && ( dataset. kind == * root_dataset. dataset ( ) ) ;
1363
1298
!matches_durable && !matches_root
1364
1299
} ) ;
1365
1300
@@ -1530,7 +1465,7 @@ mod tests {
1530
1465
if ( dataset. pool == durable_dataset. dataset . pool_name
1531
1466
&& dataset. kind == durable_dataset. kind )
1532
1467
|| ( dataset. pool == * root_dataset. pool ( )
1533
- && dataset. kind == * root_dataset. kind ( ) )
1468
+ && dataset. kind == * root_dataset. dataset ( ) )
1534
1469
{
1535
1470
Some ( Note {
1536
1471
severity : Severity :: Fatal ,
@@ -1626,108 +1561,4 @@ mod tests {
1626
1561
1627
1562
logctx. cleanup_successful ( ) ;
1628
1563
}
1629
-
1630
- #[ test]
1631
- fn test_dataset_with_bad_address ( ) {
1632
- static TEST_NAME : & str = "test_dataset_with_bad_address" ;
1633
- let logctx = test_setup_log ( TEST_NAME ) ;
1634
- let ( _, _, mut blueprint) = example ( & logctx. log , TEST_NAME ) ;
1635
-
1636
- let crucible_addr_by_zpool = blueprint
1637
- . all_omicron_zones ( BlueprintZoneFilter :: ShouldBeRunning )
1638
- . filter_map ( |( _, z) | match z. zone_type {
1639
- BlueprintZoneType :: Crucible (
1640
- blueprint_zone_type:: Crucible { address, .. } ,
1641
- ) => {
1642
- let zpool_id = z
1643
- . zone_type
1644
- . durable_zpool ( )
1645
- . expect ( "crucible zone has durable zpool" )
1646
- . id ( ) ;
1647
- Some ( ( zpool_id, address) )
1648
- }
1649
- _ => None ,
1650
- } )
1651
- . collect :: < BTreeMap < _ , _ > > ( ) ;
1652
-
1653
- // We have three ways a dataset address can be wrong:
1654
- //
1655
- // * A Crucible dataset has no address
1656
- // * A Crucible dataset has an address but it doesn't match its zone
1657
- // * A non-Crucible dataset has an address
1658
- //
1659
- // Make all three kinds of modifications to three different datasets and
1660
- // ensure we see all three noted.
1661
- let mut cleared_crucible_addr = false ;
1662
- let mut changed_crucible_addr = false ;
1663
- let mut set_non_crucible_addr = false ;
1664
- let mut expected_notes = Vec :: new ( ) ;
1665
-
1666
- for ( sled_id, datasets_config) in
1667
- blueprint. blueprint_datasets . iter_mut ( )
1668
- {
1669
- for dataset in datasets_config. datasets . values_mut ( ) {
1670
- match dataset. kind {
1671
- DatasetKind :: Crucible => {
1672
- let bad_address = if !cleared_crucible_addr {
1673
- cleared_crucible_addr = true ;
1674
- None
1675
- } else if !changed_crucible_addr {
1676
- changed_crucible_addr = true ;
1677
- Some ( "[1234:5678:9abc::]:0" . parse ( ) . unwrap ( ) )
1678
- } else {
1679
- continue ;
1680
- } ;
1681
-
1682
- dataset. address = bad_address;
1683
- let expected_address = * crucible_addr_by_zpool
1684
- . get ( & dataset. pool . id ( ) )
1685
- . expect ( "found crucible zone for zpool" ) ;
1686
- expected_notes. push ( Note {
1687
- severity : Severity :: Fatal ,
1688
- kind : Kind :: Sled {
1689
- sled_id : * sled_id,
1690
- kind : SledKind :: CrucibleDatasetWithIncorrectAddress {
1691
- dataset : dataset. clone ( ) ,
1692
- expected_address,
1693
- } ,
1694
- } ,
1695
- } ) ;
1696
- }
1697
- _ => {
1698
- if !set_non_crucible_addr {
1699
- set_non_crucible_addr = true ;
1700
- let address = "[::1]:0" . parse ( ) . unwrap ( ) ;
1701
- dataset. address = Some ( address) ;
1702
- expected_notes. push ( Note {
1703
- severity : Severity :: Fatal ,
1704
- kind : Kind :: Sled {
1705
- sled_id : * sled_id,
1706
- kind : SledKind :: NonCrucibleDatasetWithAddress {
1707
- dataset : dataset. clone ( ) ,
1708
- address,
1709
- } ,
1710
- } ,
1711
- } ) ;
1712
- }
1713
- }
1714
- }
1715
- }
1716
- }
1717
-
1718
- // We should have modified 3 datasets.
1719
- assert_eq ! ( expected_notes. len( ) , 3 ) ;
1720
-
1721
- let report =
1722
- Blippy :: new ( & blueprint) . into_report ( BlippyReportSortKey :: Kind ) ;
1723
- eprintln ! ( "{}" , report. display( ) ) ;
1724
- for note in expected_notes {
1725
- assert ! (
1726
- report. notes( ) . contains( & note) ,
1727
- "did not find expected note {note:?}"
1728
- ) ;
1729
- }
1730
-
1731
- logctx. cleanup_successful ( ) ;
1732
- }
1733
1564
}
0 commit comments