@@ -53,8 +53,6 @@ func (d *driveEventHandler) setDriveStatus(device *sys.Device, drive *directcsi.
5353 updatedDrive := drive .DeepCopy ()
5454 updatedDrive .Status .NodeName = d .nodeID
5555 updatedDrive .Status .Topology = d .topology
56- updatedDrive .Status .Filesystem = device .FSType
57- updatedDrive .Status .FilesystemUUID = device .FSUUID
5856 updatedDrive .Status .UeventFSUUID = device .UeventFSUUID
5957 updatedDrive .Status .MajorNumber = uint32 (device .Major )
6058 updatedDrive .Status .MinorNumber = uint32 (device .Minor )
@@ -72,6 +70,14 @@ func (d *driveEventHandler) setDriveStatus(device *sys.Device, drive *directcsi.
7270 updatedDrive .Status .Partitioned = device .Partitioned
7371 updatedDrive .Status .PCIPath = device .PCIPath
7472
73+ // do not update FS info for managed drives
74+ if updatedDrive .Status .Filesystem == "" || ! utils .IsManagedDrive (updatedDrive ) {
75+ updatedDrive .Status .Filesystem = device .FSType
76+ }
77+ if updatedDrive .Status .FilesystemUUID == "" || ! utils .IsManagedDrive (updatedDrive ) {
78+ updatedDrive .Status .FilesystemUUID = device .FSUUID
79+ }
80+
7581 // populate mount infos
7682 updatedDrive .Status .MountOptions = device .FirstMountOptions
7783 updatedDrive .Status .Mountpoint = device .FirstMountPoint
@@ -93,6 +99,10 @@ func (d *driveEventHandler) setDriveStatus(device *sys.Device, drive *directcsi.
9399 if strings .EqualFold (updatedDrive .Status .PartitionUUID , device .PartUUID ) {
94100 updatedDrive .Status .PartitionUUID = device .PartUUID
95101 }
102+ // bugfix: for versions < 3.0.0, the partitionUUID has to be unset or set to empty for root partitions
103+ if device .Partition == int (0 ) {
104+ updatedDrive .Status .PartitionUUID = device .PartUUID
105+ }
96106 }
97107
98108 if updatedDrive .Status .DMUUID == "" || ! utils .IsManagedDrive (updatedDrive ) {
@@ -149,22 +159,27 @@ func validateDrive(drive *directcsi.DirectCSIDrive, device *sys.Device) error {
149159 var err error
150160 switch drive .Status .DriveStatus {
151161 case directcsi .DriveStatusInUse , directcsi .DriveStatusReady :
152- if ! mount .ValidDirectPVMounts (device .MountPoints ) {
162+ // Check if the drive is umounted or if the directpv mount is not found
163+ if device .FirstMountPoint == "" || ! mount .ValidDirectPVMounts (device .MountPoints ) {
153164 err = multierr .Append (err , errInvalidMount )
154165 }
155- if device .FirstMountPoint != filepath .Join (sys .MountRoot , drive .Name ) &&
156- device .FirstMountPoint != filepath .Join (sys .MountRoot , drive .Status .FilesystemUUID ) {
157- err = multierr .Append (err , errInvalidDrive (
158- "Mountpoint" ,
159- filepath .Join (sys .MountRoot , drive .Name ),
160- device .FirstMountPoint ))
161- }
162- if ! mount .ValidDirectPVMountOpts (device .FirstMountOptions ) {
163- err = multierr .Append (err , errInvalidDrive (
164- "MountpointOptions" ,
165- mount .MountOptRW ,
166- device .FirstMountOptions ))
166+ // Verify drive mount and mountopts
167+ if device .FirstMountPoint != "" {
168+ if device .FirstMountPoint != filepath .Join (sys .MountRoot , drive .Name ) &&
169+ device .FirstMountPoint != filepath .Join (sys .MountRoot , drive .Status .FilesystemUUID ) {
170+ err = multierr .Append (err , errInvalidDrive (
171+ "Mountpoint" ,
172+ filepath .Join (sys .MountRoot , drive .Name ),
173+ device .FirstMountPoint ))
174+ }
175+ if ! mount .ValidDirectPVMountOpts (device .FirstMountOptions ) {
176+ err = multierr .Append (err , errInvalidDrive (
177+ "MountpointOptions" ,
178+ mount .MountOptRW ,
179+ device .FirstMountOptions ))
180+ }
167181 }
182+ // Check other device attributes
168183 if device .Size < sys .MinSupportedDeviceSize {
169184 err = multierr .Append (err , fmt .Errorf (
170185 "the size of the drive is less than %v" ,
@@ -182,12 +197,6 @@ func validateDrive(drive *directcsi.DirectCSIDrive, device *sys.Device) error {
182197 false ,
183198 device .Hidden ))
184199 }
185- if device .Removable {
186- err = multierr .Append (err , errInvalidDrive (
187- "Removable" ,
188- false ,
189- device .Removable ))
190- }
191200 if device .SwapOn {
192201 err = multierr .Append (err , errInvalidDrive (
193202 "SwapOn" ,
0 commit comments