@@ -11,11 +11,14 @@ import (
11
11
12
12
"github.com/cosi-project/runtime/pkg/controller"
13
13
"github.com/cosi-project/runtime/pkg/safe"
14
+ "github.com/cosi-project/runtime/pkg/state"
14
15
"github.com/hashicorp/go-multierror"
16
+ "github.com/siderolabs/gen/optional"
15
17
"github.com/siderolabs/go-cmd/pkg/cmd"
16
18
"go.uber.org/zap"
17
19
18
20
"github.com/siderolabs/talos/pkg/machinery/resources/block"
21
+ "github.com/siderolabs/talos/pkg/machinery/resources/v1alpha1"
19
22
)
20
23
21
24
// LVMActivationController activates LVM volumes when they are discovered by the block.DiscoveryController.
@@ -37,6 +40,12 @@ func (ctrl *LVMActivationController) Inputs() []controller.Input {
37
40
Type : block .DiscoveredVolumeType ,
38
41
Kind : controller .InputWeak ,
39
42
},
43
+ {
44
+ Namespace : v1alpha1 .NamespaceName ,
45
+ Type : v1alpha1 .ServiceType ,
46
+ ID : optional .Some ("udevd" ),
47
+ Kind : controller .InputWeak ,
48
+ },
40
49
}
41
50
}
42
51
@@ -64,6 +73,23 @@ func (ctrl *LVMActivationController) Run(ctx context.Context, r controller.Runti
64
73
case <- r .EventCh ():
65
74
}
66
75
76
+ udevdService , err := safe .ReaderGetByID [* v1alpha1.Service ](ctx , r , "udevd" )
77
+ if err != nil && ! state .IsNotFoundError (err ) {
78
+ return fmt .Errorf ("failed to get udevd service: %w" , err )
79
+ }
80
+
81
+ if udevdService == nil {
82
+ logger .Debug ("udevd service not registered yet" )
83
+
84
+ continue
85
+ }
86
+
87
+ if ! (udevdService .TypedSpec ().Running && udevdService .TypedSpec ().Healthy ) {
88
+ logger .Debug ("waiting for udevd service to be running and healthy" )
89
+
90
+ continue
91
+ }
92
+
67
93
discoveredVolumes , err := safe .ReaderListAll [* block.DiscoveredVolume ](ctx , r )
68
94
if err != nil {
69
95
return fmt .Errorf ("failed to list discovered volumes: %w" , err )
0 commit comments