Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add LimitCpuRequest to warden protocol

[#62173454]

Signed-off-by: Maria Shaldibina <mariash@pivotallabs.com>
  • Loading branch information...
commit 406af4631854f9b149f81eb5ed9cd47757707867 1 parent fe46d1a
@ematpl ematpl authored mariash committed
View
25 warden-protocol/lib/warden/protocol/pb.rb
@@ -273,6 +273,30 @@ class LimitBandwidthResponse
end
end
end
+## Generated from limit_cpu.proto for warden
+require "beefcake"
+
+module Warden
+ module Protocol
+
+ class LimitCpuRequest
+ include Warden::Protocol::BaseMessage
+
+
+ required :handle, :string, 1
+ optional :limit_in_shares, :uint64, 2
+
+ end
+
+ class LimitCpuResponse
+ include Warden::Protocol::BaseMessage
+
+
+ optional :limit_in_shares, :uint64, 1
+
+ end
+ end
+end
## Generated from limit_disk.proto for warden
require "beefcake"
@@ -418,6 +442,7 @@ module Type
LimitMemory = 51
LimitDisk = 52
LimitBandwidth = 53
+ LimitCpu = 54
Ping = 91
List = 92
Echo = 93
View
32 warden-protocol/lib/warden/protocol/pb/limit_cpu.proto
@@ -0,0 +1,32 @@
+// Limits the cpu shares for a container.
+//
+// ### Request
+//
+// The field `limit_in_shares` is optional.
+// When it is not specified, the cpu limit will not be changed.
+//
+// * `handle`: Container handle.
+// * `limit_in_shares`: New cpu limit in shares.
+//
+// ### Response
+//
+// * `limit_in_shares`: CPU limit in shares.
+//
+// ### Errors
+//
+// > **TODO**
+//
+// ### Definition
+//
+
+package warden;
+
+message LimitCpuRequest {
+ required string handle = 1;
+
+ optional uint64 limit_in_shares = 2;
+}
+
+message LimitCpuResponse {
+ optional uint64 limit_in_shares = 1;
+}
View
1  warden-protocol/lib/warden/protocol/pb/message.proto
@@ -25,6 +25,7 @@ message Message {
LimitMemory = 51;
LimitDisk = 52;
LimitBandwidth = 53;
+ LimitCpu = 54;
Ping = 91;
List = 92;
View
47 warden-protocol/spec/limit_cpu_spec.rb
@@ -0,0 +1,47 @@
+# coding: UTF-8
+
+require "spec_helper"
+
+describe Warden::Protocol::LimitCpuRequest do
+ subject(:request) do
+ described_class.new(:handle => "handle")
+ end
+
+ it_should_behave_like "wrappable request"
+
+ its("class.type_camelized") { should == "LimitCpu" }
+ its("class.type_underscored") { should == "limit_cpu" }
+
+ field :handle do
+ it_should_be_required
+ it_should_be_typed_as_string
+ end
+
+ field :limit_in_shares do
+ it_should_be_optional
+ it_should_be_typed_as_uint64
+ end
+
+ it "should respond to #create_response" do
+ request.create_response.should be_a(Warden::Protocol::LimitCpuResponse)
+ end
+end
+
+describe Warden::Protocol::LimitCpuResponse do
+ subject(:response) do
+ described_class.new
+ end
+
+ it_should_behave_like "wrappable response"
+
+ its("class.type_camelized") { should == "LimitCpu" }
+ its("class.type_underscored") { should == "limit_cpu" }
+
+ it { should be_ok }
+ it { should_not be_error }
+
+ field :limit_in_shares do
+ it_should_be_optional
+ it_should_be_typed_as_uint64
+ end
+end
View
0  warden/spec/support/helpers/drain.rb
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.