Skip to content

Commit 992723e

Browse files
committed
Improvements to System API group
1. Remove enum prefixes from proto as they are already added by protoc 2. Add comments to clarify that the service methods can affect global node state and break other drivers 3. Minor improvements in services integration tests Change-Id: I2c271cd99d4d6faed462c47b825519a756c0b797
1 parent e68936e commit 992723e

File tree

6 files changed

+289
-253
lines changed

6 files changed

+289
-253
lines changed

client/api/system/v1alpha1/api.pb.go

Lines changed: 89 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/api/system/v1alpha1/api.proto

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,83 +5,89 @@ package v1alpha1;
55
option go_package = "github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1";
66

77
service System {
8-
// GetBIOSSerialNumber returns the device's serial number
9-
rpc GetBIOSSerialNumber(GetBIOSSerialNumberRequest) returns (GetBIOSSerialNumberResponse) {}
10-
11-
// StartService starts a Windows service
12-
rpc StartService(StartServiceRequest) returns (StartServiceResponse) {}
13-
14-
// StopService stops a Windows service
15-
rpc StopService(StopServiceRequest) returns (StopServiceResponse) {}
16-
17-
// GetService queries a Windows service state
18-
rpc GetService(GetServiceRequest) returns (GetServiceResponse) {}
8+
// GetBIOSSerialNumber returns the device's serial number
9+
rpc GetBIOSSerialNumber(GetBIOSSerialNumberRequest)
10+
returns (GetBIOSSerialNumberResponse) {}
11+
12+
// StartService starts a Windows service
13+
// NOTE: This method affects global node state and should only be used
14+
// with consideration to other CSI drivers that run concurrently.
15+
rpc StartService(StartServiceRequest) returns (StartServiceResponse) {}
16+
17+
// StopService stops a Windows service
18+
// NOTE: This method affects global node state and should only be used
19+
// with consideration to other CSI drivers that run concurrently.
20+
rpc StopService(StopServiceRequest) returns (StopServiceResponse) {}
21+
22+
// GetService queries a Windows service state
23+
rpc GetService(GetServiceRequest) returns (GetServiceResponse) {}
1924
}
2025

2126
message GetBIOSSerialNumberRequest {
22-
// Intentionally empty
27+
// Intentionally empty
2328
}
2429

2530
message GetBIOSSerialNumberResponse {
26-
// Serial number
27-
string serial_number = 1;
31+
// Serial number
32+
string serial_number = 1;
2833
}
2934

3035
message StartServiceRequest {
31-
// Service name (as listed in System\CCS\Services keys)
32-
string name = 1;
36+
// Service name (as listed in System\CCS\Services keys)
37+
string name = 1;
3338
}
3439

3540
message StartServiceResponse {
36-
// Intentionally empty
41+
// Intentionally empty
3742
}
3843

3944
message StopServiceRequest {
40-
// Service name (as listed in System\CCS\Services keys)
41-
string name = 1;
45+
// Service name (as listed in System\CCS\Services keys)
46+
string name = 1;
4247

43-
// Forces stopping of services that has dependant services
44-
bool force = 2;
48+
// Forces stopping of services that has dependant services
49+
bool force = 2;
4550
}
4651

4752
message StopServiceResponse {
48-
// Intentionally empty
53+
// Intentionally empty
4954
}
5055

51-
5256
// https://docs.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_status#members
5357
enum ServiceStatus {
54-
SERVICE_STATUS_UNKNOWN = 0;
55-
SERVICE_STATUS_STOPPED = 1;
56-
SERVICE_STATUS_START_PENDING = 2;
57-
SERVICE_STATUS_STOP_PENDING = 3;
58-
SERVICE_STATUS_RUNNING = 4;
59-
SERVICE_STATUS_CONTINUE_PENDING = 5;
60-
SERVICE_STATUS_PAUSE_PENDING = 6;
61-
SERVICE_STATUS_PAUSED = 7;
58+
UNKNOWN = 0;
59+
STOPPED = 1;
60+
START_PENDING = 2;
61+
STOP_PENDING = 3;
62+
RUNNING = 4;
63+
CONTINUE_PENDING = 5;
64+
PAUSE_PENDING = 6;
65+
PAUSED = 7;
6266
}
6367

6468
// https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfiga
6569
enum StartType {
66-
START_TYPE_BOOT = 0;
67-
START_TYPE_SYSTEM = 1;
68-
START_TYPE_AUTOMATIC = 2;
69-
START_TYPE_MANUAL = 3;
70-
START_TYPE_DISABLED = 4;
70+
BOOT = 0;
71+
SYSTEM = 1;
72+
AUTOMATIC = 2;
73+
MANUAL = 3;
74+
DISABLED = 4;
7175
}
7276

7377
message GetServiceRequest {
74-
// Service name (as listed in System\CCS\Services keys)
75-
string name = 1;
78+
// Service name (as listed in System\CCS\Services keys)
79+
string name = 1;
7680
}
7781

7882
message GetServiceResponse {
79-
// Service display name
80-
string display_name = 1;
83+
// Service display name
84+
string display_name = 1;
8185

82-
// Service start type
83-
StartType start_type = 2;
86+
// Service start type.
87+
// Used to control whether a service will start on boot, and if so on which
88+
// boot phase.
89+
StartType start_type = 2;
8490

85-
// Service status
86-
ServiceStatus status = 3;
91+
// Service status, e.g. stopped, running, paused
92+
ServiceStatus status = 3;
8793
}

0 commit comments

Comments
 (0)