From 2c0b48e001db11e09f32667bce129395d1dc85d6 Mon Sep 17 00:00:00 2001 From: Surbhi Kakarya Date: Fri, 21 Nov 2025 20:01:27 +0000 Subject: [PATCH 01/12] This patch includes: 1. Device State: CLEAN, DIRTY, SCRUB, BUSY 2. DeviceStateUpdate RPC 3. DeviceChanged Event Signed-off-by: Surbhi Kakarya --- protect/control/v1/common.proto | 11 +++++++++++ protect/control/v1/control.proto | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/protect/control/v1/common.proto b/protect/control/v1/common.proto index 68e99b0..d7b319d 100644 --- a/protect/control/v1/common.proto +++ b/protect/control/v1/common.proto @@ -564,3 +564,14 @@ message OciRegistryAuthentication { string registry_token = 4; } } + +message PciDevice { + PciDeviceState state = 1; +} + +enum PciDeviceState { + CLEAN = 0; + DIRTY = 1; + SCRUB = 2; + BUSY = 3; +} diff --git a/protect/control/v1/control.proto b/protect/control/v1/control.proto index ce92150..7669a7c 100644 --- a/protect/control/v1/control.proto +++ b/protect/control/v1/control.proto @@ -55,6 +55,7 @@ service ControlService { rpc SetHostPowerManagementPolicy(SetHostPowerManagementPolicyRequest) returns (SetHostPowerManagementPolicyReply); rpc DialNetworkSocket(stream DialNetworkSocketRequest) returns (stream DialNetworkSocketReply); + rpc DeviceStateUpdate(DeviceStateRequest) returns (DeviceStateReply); } message GetHostStatusRequest {} @@ -69,6 +70,13 @@ message GetHostStatusReply { optional uint64 hyp_free_mem = 7; } +message DeviceStateRequest { + string name = 1; + protect.common.v1.PciDevice state = 2; +} + +message DeviceStateReply {} + message CreateZoneRequest { ZoneSpec spec = 1; } @@ -394,6 +402,7 @@ message WatchEventsReply { oneof event { ZoneChangedEvent zone_changed = 1; WorkloadChangedEvent workload_changed = 2; + DeviceChangedEvent device_changed = 3; } } @@ -405,6 +414,10 @@ message WorkloadChangedEvent { Workload workload = 1; } +message DeviceChangedEvent { + protect.common.v1.DeviceReferenceSpec device = 1; +} + message ReadZoneMetricsRequest { string zone_id = 1; } From 69cbc624548379d39febbb7adedcba78446875cb Mon Sep 17 00:00:00 2001 From: Surbhi Kakarya Date: Fri, 21 Nov 2025 20:21:54 +0000 Subject: [PATCH 02/12] Fixing the failure Signed-off-by: Surbhi Kakarya --- protect/control/v1/control.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protect/control/v1/control.proto b/protect/control/v1/control.proto index 7669a7c..7892f37 100644 --- a/protect/control/v1/control.proto +++ b/protect/control/v1/control.proto @@ -72,7 +72,7 @@ message GetHostStatusReply { message DeviceStateRequest { string name = 1; - protect.common.v1.PciDevice state = 2; + PciDevice state = 2; } message DeviceStateReply {} @@ -415,7 +415,7 @@ message WorkloadChangedEvent { } message DeviceChangedEvent { - protect.common.v1.DeviceReferenceSpec device = 1; + DeviceReferenceSpec device = 1; } message ReadZoneMetricsRequest { From cd5902eee431588f342ce2a3adab1187902855d9 Mon Sep 17 00:00:00 2001 From: Surbhi Kakarya Date: Fri, 21 Nov 2025 20:58:08 +0000 Subject: [PATCH 03/12] Fixing more failure Signed-off-by: Surbhi Kakarya --- protect/control/v1/common.proto | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/protect/control/v1/common.proto b/protect/control/v1/common.proto index d7b319d..9936fc2 100644 --- a/protect/control/v1/common.proto +++ b/protect/control/v1/common.proto @@ -566,12 +566,12 @@ message OciRegistryAuthentication { } message PciDevice { - PciDeviceState state = 1; + PciDeviceState state = 1; } enum PciDeviceState { - CLEAN = 0; - DIRTY = 1; - SCRUB = 2; - BUSY = 3; + PCI_DEVICE_STATE_CLEAN = 0; + PCI_DEVICE_STATE_DIRTY = 1; + PCI_DEVICE_STATE_SCRUB = 2; + PCI_DEVICE_STATE_BUSY = 3; } From 595e1a591656e9a6cff39e074f15314c1fb2f0cd Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Thu, 15 Jan 2026 10:07:18 -0800 Subject: [PATCH 04/12] prototype of device database api --- protect/control/v1/common.proto | 50 ++++++++++++++++++++++---------- protect/control/v1/control.proto | 40 ++++++++++++++++++++----- 2 files changed, 68 insertions(+), 22 deletions(-) diff --git a/protect/control/v1/common.proto b/protect/control/v1/common.proto index 9936fc2..d7aaea5 100644 --- a/protect/control/v1/common.proto +++ b/protect/control/v1/common.proto @@ -151,7 +151,7 @@ message AnnotationSpec { } message DeviceReferenceSpec { - string name = 1; + string id = 1; } message WorkloadBlockDeviceSpec { @@ -489,10 +489,41 @@ message OciImageProgressIndicationCompleted { bool is_bytes = 3; } -message DeviceInfo { +message PciDeviceSpec { + string location = 1; + bool permissive = 2; +} + +message BlockDeviceSpec { + string device_path = 1; +} + +message DeviceSpec { string name = 1; - bool claimed = 2; - string owner_zone = 3; + oneof device_type { + PciDeviceSpec pci = 2; + BlockDeviceSpec block = 3; + } + repeated string modules = 4; + repeated KernelModuleParameter module_parameters = 5; +} + +enum DeviceState { + DEVICE_STATE_UNKNOWN = 0; + DEVICE_STATE_AVAILABLE = 1; + DEVICE_STATE_TAINTED = 2; + DEVICE_STATE_USED = 3; +} + +message DeviceStatus { + DeviceState state = 1; + string zone_id = 2; +} + +message Device { + string id = 1; + DeviceSpec spec = 2; + DeviceStatus status = 3; } message ZoneScratchDiskSpec { @@ -564,14 +595,3 @@ message OciRegistryAuthentication { string registry_token = 4; } } - -message PciDevice { - PciDeviceState state = 1; -} - -enum PciDeviceState { - PCI_DEVICE_STATE_CLEAN = 0; - PCI_DEVICE_STATE_DIRTY = 1; - PCI_DEVICE_STATE_SCRUB = 2; - PCI_DEVICE_STATE_BUSY = 3; -} diff --git a/protect/control/v1/control.proto b/protect/control/v1/control.proto index 7892f37..f277a1d 100644 --- a/protect/control/v1/control.proto +++ b/protect/control/v1/control.proto @@ -9,7 +9,11 @@ service ControlService { rpc SnoopIdm(SnoopIdmRequest) returns (stream SnoopIdmReply); rpc GetHostCpuTopology(GetHostCpuTopologyRequest) returns (GetHostCpuTopologyReply); + rpc CreateDevice(CreateDeviceRequest) returns (CreateDeviceReply); rpc ListDevices(ListDevicesRequest) returns (ListDevicesReply); + rpc UpdateDeviceState(UpdateDeviceStateRequest) returns (UpdateDeviceStateReply); + rpc DestroyDevice(DestroyDeviceRequest) returns (DestroyDeviceReply); + rpc ResolveDeviceIds(ResolveDeviceIdsRequest) returns (ResolveDeviceIdsReply); rpc CreateNetworkReservation(CreateNetworkReservationRequest) returns (CreateNetworkReservationReply); rpc DestroyNetworkReservation(DestroyNetworkReservationRequest) returns (DestroyNetworkReservationReply); @@ -55,7 +59,6 @@ service ControlService { rpc SetHostPowerManagementPolicy(SetHostPowerManagementPolicyRequest) returns (SetHostPowerManagementPolicyReply); rpc DialNetworkSocket(stream DialNetworkSocketRequest) returns (stream DialNetworkSocketReply); - rpc DeviceStateUpdate(DeviceStateRequest) returns (DeviceStateReply); } message GetHostStatusRequest {} @@ -70,12 +73,12 @@ message GetHostStatusReply { optional uint64 hyp_free_mem = 7; } -message DeviceStateRequest { - string name = 1; - PciDevice state = 2; +message UpdateDeviceStateRequest { + string id = 1; + DeviceState state = 2; } -message DeviceStateReply {} +message UpdateDeviceStateReply {} message CreateZoneRequest { ZoneSpec spec = 1; @@ -415,7 +418,7 @@ message WorkloadChangedEvent { } message DeviceChangedEvent { - DeviceReferenceSpec device = 1; + Device device = 1; } message ReadZoneMetricsRequest { @@ -489,7 +492,8 @@ message ListImagesReply { message ListDevicesRequest {} message ListDevicesReply { - repeated DeviceInfo devices = 1; + reserved 1; + repeated Device devices = 2; } message GetHostCpuTopologyRequest {} @@ -626,3 +630,25 @@ message DialNetworkSocketData { message DialNetworkSocketReply { DialNetworkSocketData data = 1; } + +message CreateDeviceRequest { + DeviceSpec spec = 1; +} + +message CreateDeviceReply { + string id = 1; +} + +message DestroyDeviceRequest { + string id = 1; +} + +message DestroyDeviceReply {} + +message ResolveDeviceIdsRequest { + string name = 1; +} + +message ResolveDeviceIdsReply { + string device_ids = 1; +} From 1042bb79cd697ec3bca50a2ca71d42fe0d0db9d8 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Thu, 15 Jan 2026 10:20:46 -0800 Subject: [PATCH 05/12] change field name to device_id --- protect/control/v1/control.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protect/control/v1/control.proto b/protect/control/v1/control.proto index f277a1d..9fba575 100644 --- a/protect/control/v1/control.proto +++ b/protect/control/v1/control.proto @@ -636,7 +636,7 @@ message CreateDeviceRequest { } message CreateDeviceReply { - string id = 1; + string device_id = 1; } message DestroyDeviceRequest { From 7d013a11d8b799195992479eb329b370b64d99c6 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Thu, 15 Jan 2026 10:42:10 -0800 Subject: [PATCH 06/12] more fixes to device protos --- protect/control/v1/common.proto | 2 ++ protect/control/v1/control.proto | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/protect/control/v1/common.proto b/protect/control/v1/common.proto index d7aaea5..0c7f0a9 100644 --- a/protect/control/v1/common.proto +++ b/protect/control/v1/common.proto @@ -513,6 +513,8 @@ enum DeviceState { DEVICE_STATE_AVAILABLE = 1; DEVICE_STATE_TAINTED = 2; DEVICE_STATE_USED = 3; + DEVICE_STATE_DESTROYING = 4; + DEVICE_STATE_DESTROYED = 5; } message DeviceStatus { diff --git a/protect/control/v1/control.proto b/protect/control/v1/control.proto index 9fba575..bcc98d1 100644 --- a/protect/control/v1/control.proto +++ b/protect/control/v1/control.proto @@ -74,7 +74,7 @@ message GetHostStatusReply { } message UpdateDeviceStateRequest { - string id = 1; + string device_id = 1; DeviceState state = 2; } @@ -640,7 +640,7 @@ message CreateDeviceReply { } message DestroyDeviceRequest { - string id = 1; + string device_id = 1; } message DestroyDeviceReply {} @@ -650,5 +650,5 @@ message ResolveDeviceIdsRequest { } message ResolveDeviceIdsReply { - string device_ids = 1; + repeated string device_ids = 1; } From e7ee8771dba1ca20bc49f548e1f3c4396b606f4a Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Thu, 15 Jan 2026 10:57:29 -0800 Subject: [PATCH 07/12] add get device rpc --- protect/control/v1/control.proto | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/protect/control/v1/control.proto b/protect/control/v1/control.proto index bcc98d1..4bdd996 100644 --- a/protect/control/v1/control.proto +++ b/protect/control/v1/control.proto @@ -11,6 +11,7 @@ service ControlService { rpc CreateDevice(CreateDeviceRequest) returns (CreateDeviceReply); rpc ListDevices(ListDevicesRequest) returns (ListDevicesReply); + rpc GetDevice(GetDeviceRequest) returns (GetDeviceReply); rpc UpdateDeviceState(UpdateDeviceStateRequest) returns (UpdateDeviceStateReply); rpc DestroyDevice(DestroyDeviceRequest) returns (DestroyDeviceReply); rpc ResolveDeviceIds(ResolveDeviceIdsRequest) returns (ResolveDeviceIdsReply); @@ -652,3 +653,11 @@ message ResolveDeviceIdsRequest { message ResolveDeviceIdsReply { repeated string device_ids = 1; } + +message GetDeviceRequest { + string device_id = 1; +} + +message GetDeviceReply { + Device device = 1; +} From 6c4009dfe2867b480c0ec365c3bd764abf367f97 Mon Sep 17 00:00:00 2001 From: Surbhi Kakarya Date: Mon, 26 Jan 2026 20:21:39 +0000 Subject: [PATCH 08/12] Add pci device configurations to the pci spec. Signed-off-by: Surbhi Kakarya --- protect/control/v1/common.proto | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/protect/control/v1/common.proto b/protect/control/v1/common.proto index 0c7f0a9..0b25525 100644 --- a/protect/control/v1/common.proto +++ b/protect/control/v1/common.proto @@ -492,6 +492,16 @@ message OciImageProgressIndicationCompleted { message PciDeviceSpec { string location = 1; bool permissive = 2; + bool msi_translate = 3; + bool power_management = 4; + PciDeviceRdmReservePolicy rdm_reserve_policy = 5; +} + +enum PciDeviceRdmReservePolicy { + PCI_DEVICE_RDM_RESERVE_POLICY_UNKNOWN = 0; + PCI_DEVICE_RDM_RESERVE_POLICY_STRICT = 1; + PCI_DEVICE_RDM_RESERVE_POLICY_RELAXED = 2; + } message BlockDeviceSpec { From 088428581c4335a184e53fd34a2fe599c1683a09 Mon Sep 17 00:00:00 2001 From: Surbhi Kakarya Date: Tue, 3 Feb 2026 18:03:22 +0000 Subject: [PATCH 09/12] Adding "Creating" device to be used when a new device is created. This help us distinguish between creating and available state where available state will be marked for "Clean Device" especially after scrubbing. Signed-off-by: Surbhi Kakarya --- protect/control/v1/common.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/protect/control/v1/common.proto b/protect/control/v1/common.proto index 0b25525..ba0f932 100644 --- a/protect/control/v1/common.proto +++ b/protect/control/v1/common.proto @@ -525,6 +525,7 @@ enum DeviceState { DEVICE_STATE_USED = 3; DEVICE_STATE_DESTROYING = 4; DEVICE_STATE_DESTROYED = 5; + DEVICE_STATE_CREATING = 6; } message DeviceStatus { From 4a72cd28549adb8482bc4ccc3252d8d87b2988ef Mon Sep 17 00:00:00 2001 From: Surbhi Kakarya Date: Wed, 11 Feb 2026 17:31:44 +0000 Subject: [PATCH 10/12] Introduce a new Device State: Failed. This is marked when Scrub Zone or Workload fails due to any reason and prevent marking it from Tainted, otherwise it ends in a device reconciler endles loop. Signed-off-by: Surbhi Kakarya --- protect/control/v1/common.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/protect/control/v1/common.proto b/protect/control/v1/common.proto index ba0f932..b6756e1 100644 --- a/protect/control/v1/common.proto +++ b/protect/control/v1/common.proto @@ -526,6 +526,7 @@ enum DeviceState { DEVICE_STATE_DESTROYING = 4; DEVICE_STATE_DESTROYED = 5; DEVICE_STATE_CREATING = 6; + DEVICE_STATE_FAILED = 7; } message DeviceStatus { From b76f362cd72763dd9f01ad54c5aeb55f6a1faed5 Mon Sep 17 00:00:00 2001 From: Surbhi Kakarya Date: Thu, 12 Feb 2026 20:05:45 +0000 Subject: [PATCH 11/12] Minor modification Signed-off-by: Surbhi Kakarya --- protect/control/v1/common.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/protect/control/v1/common.proto b/protect/control/v1/common.proto index b6756e1..53f8d04 100644 --- a/protect/control/v1/common.proto +++ b/protect/control/v1/common.proto @@ -501,7 +501,6 @@ enum PciDeviceRdmReservePolicy { PCI_DEVICE_RDM_RESERVE_POLICY_UNKNOWN = 0; PCI_DEVICE_RDM_RESERVE_POLICY_STRICT = 1; PCI_DEVICE_RDM_RESERVE_POLICY_RELAXED = 2; - } message BlockDeviceSpec { From 57cea88f3e331ae01cec4079a899ff34057a7e7d Mon Sep 17 00:00:00 2001 From: Surbhi Kakarya Date: Fri, 13 Feb 2026 16:59:11 +0000 Subject: [PATCH 12/12] DeviceErrorStatus support Signed-off-by: Surbhi Kakarya --- protect/control/v1/common.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/protect/control/v1/common.proto b/protect/control/v1/common.proto index 53f8d04..a2776c8 100644 --- a/protect/control/v1/common.proto +++ b/protect/control/v1/common.proto @@ -531,6 +531,11 @@ enum DeviceState { message DeviceStatus { DeviceState state = 1; string zone_id = 2; + DeviceErrorStatus error_status = 3; +} + +message DeviceErrorStatus { + string message = 1; } message Device {