From 992723ecceb6431710cc3c9eed2f843730fa9de1 Mon Sep 17 00:00:00 2001 From: jmpfar Date: Thu, 22 Oct 2020 07:56:43 +0000 Subject: [PATCH] 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 --- client/api/system/v1alpha1/api.pb.go | 170 +++++++++--------- client/api/system/v1alpha1/api.proto | 94 +++++----- integrationtests/system_test.go | 8 +- internal/server/system/internal/types.go | 6 +- .../client/api/system/v1alpha1/api.pb.go | 170 +++++++++--------- .../client/api/system/v1alpha1/api.proto | 94 +++++----- 6 files changed, 289 insertions(+), 253 deletions(-) diff --git a/client/api/system/v1alpha1/api.pb.go b/client/api/system/v1alpha1/api.pb.go index e6ba4de1..6204cf55 100644 --- a/client/api/system/v1alpha1/api.pb.go +++ b/client/api/system/v1alpha1/api.pb.go @@ -28,36 +28,36 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type ServiceStatus int32 const ( - ServiceStatus_SERVICE_STATUS_UNKNOWN ServiceStatus = 0 - ServiceStatus_SERVICE_STATUS_STOPPED ServiceStatus = 1 - ServiceStatus_SERVICE_STATUS_START_PENDING ServiceStatus = 2 - ServiceStatus_SERVICE_STATUS_STOP_PENDING ServiceStatus = 3 - ServiceStatus_SERVICE_STATUS_RUNNING ServiceStatus = 4 - ServiceStatus_SERVICE_STATUS_CONTINUE_PENDING ServiceStatus = 5 - ServiceStatus_SERVICE_STATUS_PAUSE_PENDING ServiceStatus = 6 - ServiceStatus_SERVICE_STATUS_PAUSED ServiceStatus = 7 + ServiceStatus_UNKNOWN ServiceStatus = 0 + ServiceStatus_STOPPED ServiceStatus = 1 + ServiceStatus_START_PENDING ServiceStatus = 2 + ServiceStatus_STOP_PENDING ServiceStatus = 3 + ServiceStatus_RUNNING ServiceStatus = 4 + ServiceStatus_CONTINUE_PENDING ServiceStatus = 5 + ServiceStatus_PAUSE_PENDING ServiceStatus = 6 + ServiceStatus_PAUSED ServiceStatus = 7 ) var ServiceStatus_name = map[int32]string{ - 0: "SERVICE_STATUS_UNKNOWN", - 1: "SERVICE_STATUS_STOPPED", - 2: "SERVICE_STATUS_START_PENDING", - 3: "SERVICE_STATUS_STOP_PENDING", - 4: "SERVICE_STATUS_RUNNING", - 5: "SERVICE_STATUS_CONTINUE_PENDING", - 6: "SERVICE_STATUS_PAUSE_PENDING", - 7: "SERVICE_STATUS_PAUSED", + 0: "UNKNOWN", + 1: "STOPPED", + 2: "START_PENDING", + 3: "STOP_PENDING", + 4: "RUNNING", + 5: "CONTINUE_PENDING", + 6: "PAUSE_PENDING", + 7: "PAUSED", } var ServiceStatus_value = map[string]int32{ - "SERVICE_STATUS_UNKNOWN": 0, - "SERVICE_STATUS_STOPPED": 1, - "SERVICE_STATUS_START_PENDING": 2, - "SERVICE_STATUS_STOP_PENDING": 3, - "SERVICE_STATUS_RUNNING": 4, - "SERVICE_STATUS_CONTINUE_PENDING": 5, - "SERVICE_STATUS_PAUSE_PENDING": 6, - "SERVICE_STATUS_PAUSED": 7, + "UNKNOWN": 0, + "STOPPED": 1, + "START_PENDING": 2, + "STOP_PENDING": 3, + "RUNNING": 4, + "CONTINUE_PENDING": 5, + "PAUSE_PENDING": 6, + "PAUSED": 7, } func (x ServiceStatus) String() string { @@ -72,27 +72,27 @@ func (ServiceStatus) EnumDescriptor() ([]byte, []int) { type StartType int32 const ( - StartType_START_TYPE_BOOT StartType = 0 - StartType_START_TYPE_SYSTEM StartType = 1 - StartType_START_TYPE_AUTOMATIC StartType = 2 - StartType_START_TYPE_MANUAL StartType = 3 - StartType_START_TYPE_DISABLED StartType = 4 + StartType_BOOT StartType = 0 + StartType_SYSTEM StartType = 1 + StartType_AUTOMATIC StartType = 2 + StartType_MANUAL StartType = 3 + StartType_DISABLED StartType = 4 ) var StartType_name = map[int32]string{ - 0: "START_TYPE_BOOT", - 1: "START_TYPE_SYSTEM", - 2: "START_TYPE_AUTOMATIC", - 3: "START_TYPE_MANUAL", - 4: "START_TYPE_DISABLED", + 0: "BOOT", + 1: "SYSTEM", + 2: "AUTOMATIC", + 3: "MANUAL", + 4: "DISABLED", } var StartType_value = map[string]int32{ - "START_TYPE_BOOT": 0, - "START_TYPE_SYSTEM": 1, - "START_TYPE_AUTOMATIC": 2, - "START_TYPE_MANUAL": 3, - "START_TYPE_DISABLED": 4, + "BOOT": 0, + "SYSTEM": 1, + "AUTOMATIC": 2, + "MANUAL": 3, + "DISABLED": 4, } func (x StartType) String() string { @@ -368,9 +368,11 @@ func (m *GetServiceRequest) GetName() string { type GetServiceResponse struct { // Service display name DisplayName string `protobuf:"bytes,1,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` - // Service start type + // Service start type. + // Used to control whether a service will start on boot, and if so on which + // boot phase. StartType StartType `protobuf:"varint,2,opt,name=start_type,json=startType,proto3,enum=v1alpha1.StartType" json:"start_type,omitempty"` - // Service status + // Service status, e.g. stopped, running, paused Status ServiceStatus `protobuf:"varint,3,opt,name=status,proto3,enum=v1alpha1.ServiceStatus" json:"status,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -413,14 +415,14 @@ func (m *GetServiceResponse) GetStartType() StartType { if m != nil { return m.StartType } - return StartType_START_TYPE_BOOT + return StartType_BOOT } func (m *GetServiceResponse) GetStatus() ServiceStatus { if m != nil { return m.Status } - return ServiceStatus_SERVICE_STATUS_UNKNOWN + return ServiceStatus_UNKNOWN } func init() { @@ -441,44 +443,42 @@ func init() { } var fileDescriptor_4066a9d4a9264c6f = []byte{ - // 589 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x5f, 0x6f, 0xd2, 0x50, - 0x1c, 0x5d, 0xd9, 0x86, 0xdb, 0x6f, 0x9b, 0x76, 0x97, 0xfd, 0x41, 0x60, 0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e0, 0x9b, 0x3f, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x78, 0x82, 0xf1, 0x4c, 0x05, 0x00, 0x00, + // 553 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x61, 0x6f, 0xd2, 0x40, + 0x18, 0x5e, 0x81, 0x31, 0x78, 0x01, 0xd3, 0x1d, 0xa8, 0x84, 0x31, 0x33, 0xab, 0xc6, 0xb9, 0x64, + 0x34, 0xc3, 0xef, 0x8b, 0x65, 0x10, 0xac, 0xc2, 0x95, 0xf4, 0xda, 0x18, 0xfd, 0x42, 0x4a, 0x77, + 0xba, 0x46, 0xa0, 0xb5, 0x77, 0x2c, 0xf2, 0x2f, 0xfc, 0x01, 0xfe, 0x30, 0x7f, 0x8e, 0xb9, 0x52, + 0xa0, 0x10, 0xc8, 0x4c, 0xfc, 0x76, 0xef, 0xf3, 0x3c, 0xef, 0xd3, 0xf7, 0xbd, 0x3e, 0x39, 0x78, + 0xff, 0xcd, 0xe3, 0x77, 0xb3, 0x51, 0xc3, 0xf5, 0x27, 0xea, 0xf7, 0xd9, 0x88, 0x86, 0x53, 0xca, + 0x29, 0xbb, 0x74, 0x99, 0xa7, 0xba, 0xcc, 0xbb, 0x0c, 0x42, 0xff, 0xe7, 0x5c, 0x75, 0xc7, 0x1e, + 0x9d, 0x72, 0xd5, 0x09, 0x3c, 0x95, 0xcd, 0x19, 0xa7, 0x13, 0xf5, 0xfe, 0xca, 0x19, 0x07, 0x77, + 0xce, 0x95, 0xc0, 0x1a, 0x41, 0xe8, 0x73, 0x1f, 0xe5, 0x96, 0x98, 0x52, 0x87, 0x5a, 0x97, 0xf2, + 0x96, 0x6e, 0x10, 0x42, 0x43, 0xcf, 0x19, 0xe3, 0xd9, 0x64, 0x44, 0x43, 0x93, 0xfe, 0x98, 0x51, + 0xc6, 0x95, 0x16, 0x9c, 0xec, 0x64, 0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, 0xf5, 0xff, 0xbd, 0x29, 0xa3, 0x6c, 0xf4, 0xa0, 0xbc, 0xfd, 0x1b, 0x00, 0x00, 0xff, + 0xff, 0x4d, 0x70, 0x16, 0x4a, 0x9c, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -496,8 +496,12 @@ type SystemClient interface { // GetBIOSSerialNumber returns the device's serial number GetBIOSSerialNumber(ctx context.Context, in *GetBIOSSerialNumberRequest, opts ...grpc.CallOption) (*GetBIOSSerialNumberResponse, error) // StartService starts a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. StartService(ctx context.Context, in *StartServiceRequest, opts ...grpc.CallOption) (*StartServiceResponse, error) // StopService stops a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. StopService(ctx context.Context, in *StopServiceRequest, opts ...grpc.CallOption) (*StopServiceResponse, error) // GetService queries a Windows service state GetService(ctx context.Context, in *GetServiceRequest, opts ...grpc.CallOption) (*GetServiceResponse, error) @@ -552,8 +556,12 @@ type SystemServer interface { // GetBIOSSerialNumber returns the device's serial number GetBIOSSerialNumber(context.Context, *GetBIOSSerialNumberRequest) (*GetBIOSSerialNumberResponse, error) // StartService starts a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. StartService(context.Context, *StartServiceRequest) (*StartServiceResponse, error) // StopService stops a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. StopService(context.Context, *StopServiceRequest) (*StopServiceResponse, error) // GetService queries a Windows service state GetService(context.Context, *GetServiceRequest) (*GetServiceResponse, error) diff --git a/client/api/system/v1alpha1/api.proto b/client/api/system/v1alpha1/api.proto index 04ee006c..25e07807 100644 --- a/client/api/system/v1alpha1/api.proto +++ b/client/api/system/v1alpha1/api.proto @@ -5,83 +5,89 @@ package v1alpha1; option go_package = "github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1"; service System { - // GetBIOSSerialNumber returns the device's serial number - rpc GetBIOSSerialNumber(GetBIOSSerialNumberRequest) returns (GetBIOSSerialNumberResponse) {} - - // StartService starts a Windows service - rpc StartService(StartServiceRequest) returns (StartServiceResponse) {} - - // StopService stops a Windows service - rpc StopService(StopServiceRequest) returns (StopServiceResponse) {} - - // GetService queries a Windows service state - rpc GetService(GetServiceRequest) returns (GetServiceResponse) {} + // GetBIOSSerialNumber returns the device's serial number + rpc GetBIOSSerialNumber(GetBIOSSerialNumberRequest) + returns (GetBIOSSerialNumberResponse) {} + + // StartService starts a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. + rpc StartService(StartServiceRequest) returns (StartServiceResponse) {} + + // StopService stops a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. + rpc StopService(StopServiceRequest) returns (StopServiceResponse) {} + + // GetService queries a Windows service state + rpc GetService(GetServiceRequest) returns (GetServiceResponse) {} } message GetBIOSSerialNumberRequest { - // Intentionally empty + // Intentionally empty } message GetBIOSSerialNumberResponse { - // Serial number - string serial_number = 1; + // Serial number + string serial_number = 1; } message StartServiceRequest { - // Service name (as listed in System\CCS\Services keys) - string name = 1; + // Service name (as listed in System\CCS\Services keys) + string name = 1; } message StartServiceResponse { - // Intentionally empty + // Intentionally empty } message StopServiceRequest { - // Service name (as listed in System\CCS\Services keys) - string name = 1; + // Service name (as listed in System\CCS\Services keys) + string name = 1; - // Forces stopping of services that has dependant services - bool force = 2; + // Forces stopping of services that has dependant services + bool force = 2; } message StopServiceResponse { - // Intentionally empty + // Intentionally empty } - // https://docs.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_status#members enum ServiceStatus { - SERVICE_STATUS_UNKNOWN = 0; - SERVICE_STATUS_STOPPED = 1; - SERVICE_STATUS_START_PENDING = 2; - SERVICE_STATUS_STOP_PENDING = 3; - SERVICE_STATUS_RUNNING = 4; - SERVICE_STATUS_CONTINUE_PENDING = 5; - SERVICE_STATUS_PAUSE_PENDING = 6; - SERVICE_STATUS_PAUSED = 7; + UNKNOWN = 0; + STOPPED = 1; + START_PENDING = 2; + STOP_PENDING = 3; + RUNNING = 4; + CONTINUE_PENDING = 5; + PAUSE_PENDING = 6; + PAUSED = 7; } // https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfiga enum StartType { - START_TYPE_BOOT = 0; - START_TYPE_SYSTEM = 1; - START_TYPE_AUTOMATIC = 2; - START_TYPE_MANUAL = 3; - START_TYPE_DISABLED = 4; + BOOT = 0; + SYSTEM = 1; + AUTOMATIC = 2; + MANUAL = 3; + DISABLED = 4; } message GetServiceRequest { - // Service name (as listed in System\CCS\Services keys) - string name = 1; + // Service name (as listed in System\CCS\Services keys) + string name = 1; } message GetServiceResponse { - // Service display name - string display_name = 1; + // Service display name + string display_name = 1; - // Service start type - StartType start_type = 2; + // Service start type. + // Used to control whether a service will start on boot, and if so on which + // boot phase. + StartType start_type = 2; - // Service status - ServiceStatus status = 3; + // Service status, e.g. stopped, running, paused + ServiceStatus status = 3; } diff --git a/integrationtests/system_test.go b/integrationtests/system_test.go index 270e8d86..7373cda8 100644 --- a/integrationtests/system_test.go +++ b/integrationtests/system_test.go @@ -42,6 +42,11 @@ func TestServiceCommands(t *testing.T) { require.Nil(t, err) defer client.Close() + // Make sure service is stopped + _, err = runPowershellCmd(fmt.Sprintf(`Stop-Service -Name "%s"`, ServiceName)) + require.NoError(t, err) + assertServiceStopped(t, ServiceName) + request := &v1alpha1.GetServiceRequest{Name: ServiceName} response, err := client.GetService(context.TODO(), request) require.NoError(t, err) @@ -62,6 +67,7 @@ func TestServiceCommands(t *testing.T) { require.NoError(t, err, "failed unmarshalling json out=%v", out) assert.Equal(t, serviceInfo.Status, uint32(response.Status)) + assert.Equal(t, v1alpha1.ServiceStatus_STOPPED, response.Status) assert.Equal(t, serviceInfo.StartType, uint32(response.StartType)) assert.Equal(t, serviceInfo.DisplayName, response.DisplayName) }) @@ -72,7 +78,7 @@ func TestServiceCommands(t *testing.T) { require.Nil(t, err) defer client.Close() - _, err = runPowershellCmd(`Stop-Service -Name "MSiSCSI"`) + _, err = runPowershellCmd(fmt.Sprintf(`Stop-Service -Name "%s"`, ServiceName)) require.NoError(t, err) assertServiceStopped(t, ServiceName) diff --git a/internal/server/system/internal/types.go b/internal/server/system/internal/types.go index 388f18db..e55644ae 100644 --- a/internal/server/system/internal/types.go +++ b/internal/server/system/internal/types.go @@ -60,9 +60,11 @@ type GetServiceResponse struct { // Service display name DisplayName string - // Service start type + // Service start type. + // Used to control whether a service will start on boot, and if so on which + // boot phase. StartType Startype - // Service status + // Service status, e.g. stopped, running, paused Status ServiceStatus } diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1/api.pb.go b/vendor/github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1/api.pb.go index e6ba4de1..6204cf55 100644 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1/api.pb.go +++ b/vendor/github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1/api.pb.go @@ -28,36 +28,36 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type ServiceStatus int32 const ( - ServiceStatus_SERVICE_STATUS_UNKNOWN ServiceStatus = 0 - ServiceStatus_SERVICE_STATUS_STOPPED ServiceStatus = 1 - ServiceStatus_SERVICE_STATUS_START_PENDING ServiceStatus = 2 - ServiceStatus_SERVICE_STATUS_STOP_PENDING ServiceStatus = 3 - ServiceStatus_SERVICE_STATUS_RUNNING ServiceStatus = 4 - ServiceStatus_SERVICE_STATUS_CONTINUE_PENDING ServiceStatus = 5 - ServiceStatus_SERVICE_STATUS_PAUSE_PENDING ServiceStatus = 6 - ServiceStatus_SERVICE_STATUS_PAUSED ServiceStatus = 7 + ServiceStatus_UNKNOWN ServiceStatus = 0 + ServiceStatus_STOPPED ServiceStatus = 1 + ServiceStatus_START_PENDING ServiceStatus = 2 + ServiceStatus_STOP_PENDING ServiceStatus = 3 + ServiceStatus_RUNNING ServiceStatus = 4 + ServiceStatus_CONTINUE_PENDING ServiceStatus = 5 + ServiceStatus_PAUSE_PENDING ServiceStatus = 6 + ServiceStatus_PAUSED ServiceStatus = 7 ) var ServiceStatus_name = map[int32]string{ - 0: "SERVICE_STATUS_UNKNOWN", - 1: "SERVICE_STATUS_STOPPED", - 2: "SERVICE_STATUS_START_PENDING", - 3: "SERVICE_STATUS_STOP_PENDING", - 4: "SERVICE_STATUS_RUNNING", - 5: "SERVICE_STATUS_CONTINUE_PENDING", - 6: "SERVICE_STATUS_PAUSE_PENDING", - 7: "SERVICE_STATUS_PAUSED", + 0: "UNKNOWN", + 1: "STOPPED", + 2: "START_PENDING", + 3: "STOP_PENDING", + 4: "RUNNING", + 5: "CONTINUE_PENDING", + 6: "PAUSE_PENDING", + 7: "PAUSED", } var ServiceStatus_value = map[string]int32{ - "SERVICE_STATUS_UNKNOWN": 0, - "SERVICE_STATUS_STOPPED": 1, - "SERVICE_STATUS_START_PENDING": 2, - "SERVICE_STATUS_STOP_PENDING": 3, - "SERVICE_STATUS_RUNNING": 4, - "SERVICE_STATUS_CONTINUE_PENDING": 5, - "SERVICE_STATUS_PAUSE_PENDING": 6, - "SERVICE_STATUS_PAUSED": 7, + "UNKNOWN": 0, + "STOPPED": 1, + "START_PENDING": 2, + "STOP_PENDING": 3, + "RUNNING": 4, + "CONTINUE_PENDING": 5, + "PAUSE_PENDING": 6, + "PAUSED": 7, } func (x ServiceStatus) String() string { @@ -72,27 +72,27 @@ func (ServiceStatus) EnumDescriptor() ([]byte, []int) { type StartType int32 const ( - StartType_START_TYPE_BOOT StartType = 0 - StartType_START_TYPE_SYSTEM StartType = 1 - StartType_START_TYPE_AUTOMATIC StartType = 2 - StartType_START_TYPE_MANUAL StartType = 3 - StartType_START_TYPE_DISABLED StartType = 4 + StartType_BOOT StartType = 0 + StartType_SYSTEM StartType = 1 + StartType_AUTOMATIC StartType = 2 + StartType_MANUAL StartType = 3 + StartType_DISABLED StartType = 4 ) var StartType_name = map[int32]string{ - 0: "START_TYPE_BOOT", - 1: "START_TYPE_SYSTEM", - 2: "START_TYPE_AUTOMATIC", - 3: "START_TYPE_MANUAL", - 4: "START_TYPE_DISABLED", + 0: "BOOT", + 1: "SYSTEM", + 2: "AUTOMATIC", + 3: "MANUAL", + 4: "DISABLED", } var StartType_value = map[string]int32{ - "START_TYPE_BOOT": 0, - "START_TYPE_SYSTEM": 1, - "START_TYPE_AUTOMATIC": 2, - "START_TYPE_MANUAL": 3, - "START_TYPE_DISABLED": 4, + "BOOT": 0, + "SYSTEM": 1, + "AUTOMATIC": 2, + "MANUAL": 3, + "DISABLED": 4, } func (x StartType) String() string { @@ -368,9 +368,11 @@ func (m *GetServiceRequest) GetName() string { type GetServiceResponse struct { // Service display name DisplayName string `protobuf:"bytes,1,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` - // Service start type + // Service start type. + // Used to control whether a service will start on boot, and if so on which + // boot phase. StartType StartType `protobuf:"varint,2,opt,name=start_type,json=startType,proto3,enum=v1alpha1.StartType" json:"start_type,omitempty"` - // Service status + // Service status, e.g. stopped, running, paused Status ServiceStatus `protobuf:"varint,3,opt,name=status,proto3,enum=v1alpha1.ServiceStatus" json:"status,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -413,14 +415,14 @@ func (m *GetServiceResponse) GetStartType() StartType { if m != nil { return m.StartType } - return StartType_START_TYPE_BOOT + return StartType_BOOT } func (m *GetServiceResponse) GetStatus() ServiceStatus { if m != nil { return m.Status } - return ServiceStatus_SERVICE_STATUS_UNKNOWN + return ServiceStatus_UNKNOWN } func init() { @@ -441,44 +443,42 @@ func init() { } var fileDescriptor_4066a9d4a9264c6f = []byte{ - // 589 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x5f, 0x6f, 0xd2, 0x50, - 0x1c, 0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, 0x6f, 0x3f, 0x5d, 0xff, 0xdf, 0x1d, 0xd8, 0xcd, 0x46, 0x17, 0xe0, 0x9b, 0x3f, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x78, 0x82, 0xf1, 0x4c, 0x05, 0x00, 0x00, + // 553 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x61, 0x6f, 0xd2, 0x40, + 0x18, 0x5e, 0x81, 0x31, 0x78, 0x01, 0xd3, 0x1d, 0xa8, 0x84, 0x31, 0x33, 0xab, 0xc6, 0xb9, 0x64, + 0x34, 0xc3, 0xef, 0x8b, 0x65, 0x10, 0xac, 0xc2, 0x95, 0xf4, 0xda, 0x18, 0xfd, 0x42, 0x4a, 0x77, + 0xba, 0x46, 0xa0, 0xb5, 0x77, 0x2c, 0xf2, 0x2f, 0xfc, 0x01, 0xfe, 0x30, 0x7f, 0x8e, 0xb9, 0x52, + 0xa0, 0x10, 0xc8, 0x4c, 0xfc, 0x76, 0xef, 0xf3, 0x3c, 0xef, 0xd3, 0xf7, 0xbd, 0x3e, 0x39, 0x78, + 0xff, 0xcd, 0xe3, 0x77, 0xb3, 0x51, 0xc3, 0xf5, 0x27, 0xea, 0xf7, 0xd9, 0x88, 0x86, 0x53, 0xca, + 0x29, 0xbb, 0x74, 0x99, 0xa7, 0xba, 0xcc, 0xbb, 0x0c, 0x42, 0xff, 0xe7, 0x5c, 0x75, 0xc7, 0x1e, + 0x9d, 0x72, 0xd5, 0x09, 0x3c, 0x95, 0xcd, 0x19, 0xa7, 0x13, 0xf5, 0xfe, 0xca, 0x19, 0x07, 0x77, + 0xce, 0x95, 0xc0, 0x1a, 0x41, 0xe8, 0x73, 0x1f, 0xe5, 0x96, 0x98, 0x52, 0x87, 0x5a, 0x97, 0xf2, + 0x96, 0x6e, 0x10, 0x42, 0x43, 0xcf, 0x19, 0xe3, 0xd9, 0x64, 0x44,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56, 0x5b, 0x5e, 0xf5, 0xdd, 0xe4, 0xd2, 0xaa, 0xf5, + 0xee, 0xcb, 0xf5, 0xff, 0xbd, 0x29, 0xa3, 0x6c, 0xf4, 0xa0, 0xbc, 0xfd, 0x1b, 0x00, 0x00, 0xff, + 0xff, 0x4d, 0x70, 0x16, 0x4a, 0x9c, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -496,8 +496,12 @@ type SystemClient interface { // GetBIOSSerialNumber returns the device's serial number GetBIOSSerialNumber(ctx context.Context, in *GetBIOSSerialNumberRequest, opts ...grpc.CallOption) (*GetBIOSSerialNumberResponse, error) // StartService starts a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. StartService(ctx context.Context, in *StartServiceRequest, opts ...grpc.CallOption) (*StartServiceResponse, error) // StopService stops a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. StopService(ctx context.Context, in *StopServiceRequest, opts ...grpc.CallOption) (*StopServiceResponse, error) // GetService queries a Windows service state GetService(ctx context.Context, in *GetServiceRequest, opts ...grpc.CallOption) (*GetServiceResponse, error) @@ -552,8 +556,12 @@ type SystemServer interface { // GetBIOSSerialNumber returns the device's serial number GetBIOSSerialNumber(context.Context, *GetBIOSSerialNumberRequest) (*GetBIOSSerialNumberResponse, error) // StartService starts a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. StartService(context.Context, *StartServiceRequest) (*StartServiceResponse, error) // StopService stops a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. StopService(context.Context, *StopServiceRequest) (*StopServiceResponse, error) // GetService queries a Windows service state GetService(context.Context, *GetServiceRequest) (*GetServiceResponse, error) diff --git a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1/api.proto b/vendor/github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1/api.proto index 04ee006c..25e07807 100644 --- a/vendor/github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1/api.proto +++ b/vendor/github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1/api.proto @@ -5,83 +5,89 @@ package v1alpha1; option go_package = "github.com/kubernetes-csi/csi-proxy/client/api/system/v1alpha1"; service System { - // GetBIOSSerialNumber returns the device's serial number - rpc GetBIOSSerialNumber(GetBIOSSerialNumberRequest) returns (GetBIOSSerialNumberResponse) {} - - // StartService starts a Windows service - rpc StartService(StartServiceRequest) returns (StartServiceResponse) {} - - // StopService stops a Windows service - rpc StopService(StopServiceRequest) returns (StopServiceResponse) {} - - // GetService queries a Windows service state - rpc GetService(GetServiceRequest) returns (GetServiceResponse) {} + // GetBIOSSerialNumber returns the device's serial number + rpc GetBIOSSerialNumber(GetBIOSSerialNumberRequest) + returns (GetBIOSSerialNumberResponse) {} + + // StartService starts a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. + rpc StartService(StartServiceRequest) returns (StartServiceResponse) {} + + // StopService stops a Windows service + // NOTE: This method affects global node state and should only be used + // with consideration to other CSI drivers that run concurrently. + rpc StopService(StopServiceRequest) returns (StopServiceResponse) {} + + // GetService queries a Windows service state + rpc GetService(GetServiceRequest) returns (GetServiceResponse) {} } message GetBIOSSerialNumberRequest { - // Intentionally empty + // Intentionally empty } message GetBIOSSerialNumberResponse { - // Serial number - string serial_number = 1; + // Serial number + string serial_number = 1; } message StartServiceRequest { - // Service name (as listed in System\CCS\Services keys) - string name = 1; + // Service name (as listed in System\CCS\Services keys) + string name = 1; } message StartServiceResponse { - // Intentionally empty + // Intentionally empty } message StopServiceRequest { - // Service name (as listed in System\CCS\Services keys) - string name = 1; + // Service name (as listed in System\CCS\Services keys) + string name = 1; - // Forces stopping of services that has dependant services - bool force = 2; + // Forces stopping of services that has dependant services + bool force = 2; } message StopServiceResponse { - // Intentionally empty + // Intentionally empty } - // https://docs.microsoft.com/en-us/windows/win32/api/winsvc/ns-winsvc-service_status#members enum ServiceStatus { - SERVICE_STATUS_UNKNOWN = 0; - SERVICE_STATUS_STOPPED = 1; - SERVICE_STATUS_START_PENDING = 2; - SERVICE_STATUS_STOP_PENDING = 3; - SERVICE_STATUS_RUNNING = 4; - SERVICE_STATUS_CONTINUE_PENDING = 5; - SERVICE_STATUS_PAUSE_PENDING = 6; - SERVICE_STATUS_PAUSED = 7; + UNKNOWN = 0; + STOPPED = 1; + START_PENDING = 2; + STOP_PENDING = 3; + RUNNING = 4; + CONTINUE_PENDING = 5; + PAUSE_PENDING = 6; + PAUSED = 7; } // https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-changeserviceconfiga enum StartType { - START_TYPE_BOOT = 0; - START_TYPE_SYSTEM = 1; - START_TYPE_AUTOMATIC = 2; - START_TYPE_MANUAL = 3; - START_TYPE_DISABLED = 4; + BOOT = 0; + SYSTEM = 1; + AUTOMATIC = 2; + MANUAL = 3; + DISABLED = 4; } message GetServiceRequest { - // Service name (as listed in System\CCS\Services keys) - string name = 1; + // Service name (as listed in System\CCS\Services keys) + string name = 1; } message GetServiceResponse { - // Service display name - string display_name = 1; + // Service display name + string display_name = 1; - // Service start type - StartType start_type = 2; + // Service start type. + // Used to control whether a service will start on boot, and if so on which + // boot phase. + StartType start_type = 2; - // Service status - ServiceStatus status = 3; + // Service status, e.g. stopped, running, paused + ServiceStatus status = 3; }