func (pe *ProbeEvent) deleteBlockDeviceEvent(msg controller.EventMessage) {
	bdAPIList, err := pe.Controller.ListBlockDeviceResource(false)
	if err != nil {
		klog.Error(err)
	}

	isDeactivated := true
	isGPTBasedUUIDEnabled := features.FeatureGates.IsEnabled(features.GPTBasedUUID)

	for _, device := range msg.Devices {
		if isGPTBasedUUIDEnabled {
			_ = pe.deleteBlockDevice(*device, bdAPIList)
		} else {
			existingBlockDeviceResource := pe.Controller.GetExistingBlockDeviceResource(bdAPIList, device.UUID)
			if existingBlockDeviceResource == nil {
				// do nothing, may be the disk was filtered, or it was not created
				isDeactivated = false
				continue
			}
			pe.Controller.DeactivateBlockDevice(*existingBlockDeviceResource)
		}
	}

	// rescan only if GPT based UUID is disabled.
	if !isDeactivated && !isGPTBasedUUIDEnabled {
		go Rescan(pe.Controller)
	}
}
// deleteBlockDeviceEvent deactivate blockdevice resource using uuid from etcd
deleteBlockDeviceEvent deactivate blockdevice resource using uuid from etcd
// deleteBlockDeviceEvent deactivate blockdevice resource using uuid from etcd
func (pe *ProbeEvent) deleteBlockDeviceEvent(msg controller.EventMessage) {
	bdAPIList, err := pe.Controller.ListBlockDeviceResource(false)
	if err != nil {
		klog.Error(err)
	}
	isDeactivated := true
	isGPTBasedUUIDEnabled := features.FeatureGates.IsEnabled(features.GPTBasedUUID)
	for _, device := range msg.Devices {
		if isGPTBasedUUIDEnabled {
			_ = pe.deleteBlockDevice(*device, bdAPIList)
		} else {
			existingBlockDeviceResource := pe.Controller.GetExistingBlockDeviceResource(bdAPIList, device.UUID)
			if existingBlockDeviceResource == nil {
				isDeactivated = false
				continue
			}
			pe.Controller.DeactivateBlockDevice(*existingBlockDeviceResource)
		}
	}
	if !isDeactivated && !isGPTBasedUUIDEnabled {
		go Rescan(pe.Controller)
	}
}
func ( pe * ProbeEvent ) deleteBlockDeviceEvent ( msg controller . EventMessage ) { bdAPIList , err := pe . Controller . ListBlockDeviceResource ( false ) if err != nil { klog . Error ( err ) } isDeactivated := true isGPTBasedUUIDEnabled := features . FeatureGates . IsEnabled ( features . GPTBasedUUID ) for _ , device := range msg . Devices { if isGPTBasedUUIDEnabled { _ = pe . deleteBlockDevice ( * device , bdAPIList ) } else { existingBlockDeviceResource := pe . Controller . GetExistingBlockDeviceResource ( bdAPIList , device . UUID ) if existingBlockDeviceResource == nil { isDeactivated = false continue } pe . Controller . DeactivateBlockDevice ( * existingBlockDeviceResource ) } } if ! isDeactivated && ! isGPTBasedUUIDEnabled { go Rescan ( pe . Controller ) } }
deleteBlockDeviceEvent deactivate blockdevice resource using uuid from etcd
deleteBlockDeviceEvent deactivate blockdevice resource using uuid from etcd
// do nothing, may be the disk was filtered, or it was not created // rescan only if GPT based UUID is disabled.