Skip to content

Commit 10d9c01

Browse files
author
Alex Huang
committed
All merge conflicts resolved
2 parents 593b60c + ce4b49d commit 10d9c01

448 files changed

Lines changed: 14710 additions & 9491 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/src/com/cloud/exception/ErrorCode.java renamed to api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,27 @@
1414
// KIND, either express or implied. See the License for the
1515
// specific language governing permissions and limitations
1616
// under the License.
17-
package com.cloud.exception;
17+
package com.cloud.agent.api.storage;
1818

19-
import java.util.HashSet;
19+
import com.cloud.agent.api.Answer;
2020

21-
/**
22-
*/
23-
public class ErrorCode {
24-
String code;
25-
private static HashSet<ErrorCode> s_codes = new HashSet<ErrorCode>();
21+
public class ResizeVolumeAnswer extends Answer {
22+
private long newSize;
2623

27-
public ErrorCode(String code) {
28-
this.code = code;
29-
assert !s_codes.contains(this) : "There is already an error code registered for this code: " + code;
30-
s_codes.add(this);
31-
}
24+
protected ResizeVolumeAnswer() {
3225

33-
public String getCode() {
34-
return code;
3526
}
3627

37-
@Override
38-
public int hashCode() {
39-
return code.hashCode();
28+
public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details, long newSize) {
29+
super(cmd, result, details);
30+
this.newSize = newSize;
4031
}
4132

42-
@Override
43-
public boolean equals(Object that) {
44-
if (!(that instanceof ErrorCode)) {
45-
return false;
46-
}
47-
48-
return this.code.equals(((ErrorCode)that).code);
33+
public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details) {
34+
super(cmd, result, details);
4935
}
5036

51-
public final static ErrorCode UnableToReachResource = new ErrorCode("resource.unavailable");
37+
public long getNewSize() {
38+
return newSize;
39+
}
5240
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api.storage;
18+
19+
import com.cloud.agent.api.Command;
20+
import com.cloud.agent.api.to.StorageFilerTO;
21+
import com.cloud.storage.StoragePool;
22+
23+
public class ResizeVolumeCommand extends Command {
24+
private String path;
25+
private StorageFilerTO pool;
26+
private String vmInstance;
27+
private Long newSize;
28+
private Long currentSize;
29+
private boolean shrinkOk;
30+
31+
protected ResizeVolumeCommand() {
32+
33+
}
34+
35+
public ResizeVolumeCommand(String path,
36+
StorageFilerTO pool,
37+
Long currentSize,
38+
Long newSize,
39+
boolean shrinkOk,
40+
String vmInstance)
41+
{
42+
this.path = path;
43+
this.pool = pool;
44+
this.vmInstance = vmInstance;
45+
this.currentSize = currentSize;
46+
this.newSize = newSize;
47+
this.shrinkOk = shrinkOk;
48+
}
49+
50+
public String getPath() {
51+
return path;
52+
}
53+
54+
public String getPoolUuid() {
55+
return pool.getUuid();
56+
}
57+
58+
public StorageFilerTO getPool() {
59+
return pool;
60+
}
61+
62+
public long getNewSize() {
63+
return newSize;
64+
}
65+
66+
public long getCurrentSize() {
67+
return currentSize;
68+
}
69+
70+
public boolean getShrinkOk() {
71+
return shrinkOk;
72+
}
73+
74+
public String getInstanceName() {
75+
return vmInstance;
76+
}
77+
78+
/**
79+
* {@inheritDoc}
80+
*/
81+
@Override
82+
public boolean executeInSequence() {
83+
return false;
84+
}
85+
86+
}

api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,17 @@ public void create() throws ResourceAllocationException {
145145
} catch (InsufficientCapacityException ex){
146146
s_logger.info(ex);
147147
s_logger.trace(ex);
148-
throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
148+
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
149149
} catch (ConcurrentOperationException ex) {
150150
s_logger.warn("Exception: ", ex);
151-
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
151+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
152152
}
153153

154154
if (result != null) {
155155
this.setEntityId(result.getId());
156156
this.setEntityUuid(result.getUuid());
157157
} else {
158-
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a Private network");
158+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a Private network");
159159
}
160160
}
161161

@@ -167,7 +167,7 @@ public void execute() throws InsufficientCapacityException, ConcurrentOperationE
167167
response.setResponseName(getCommandName());
168168
this.setResponseObject(response);
169169
} else {
170-
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private network");
170+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private network");
171171
}
172172
}
173173

api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void execute(){
8484
SuccessResponse response = new SuccessResponse(getCommandName());
8585
this.setResponseObject(response);
8686
} else {
87-
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy console proxy");
87+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy console proxy");
8888
}
8989
}
9090
}

api/src/com/cloud/event/EventTypes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public class EventTypes {
108108
public static final String EVENT_VOLUME_EXTRACT = "VOLUME.EXTRACT";
109109
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
110110
public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE";
111+
public static final String EVENT_VOLUME_RESIZE = "VOLUME.RESIZE";
111112

112113
// Domains
113114
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";

api/src/com/cloud/exception/CloudAuthenticationException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
package com.cloud.exception;
1818

1919
import com.cloud.utils.SerialVersionUID;
20-
import com.cloud.utils.exception.RuntimeCloudException;
20+
import com.cloud.utils.exception.CloudRuntimeException;
2121

22-
public class CloudAuthenticationException extends RuntimeCloudException {
22+
public class CloudAuthenticationException extends CloudRuntimeException {
2323
private static final long serialVersionUID = SerialVersionUID.CloudAuthenticationException;
2424

2525
public CloudAuthenticationException(String message) {

api/src/com/cloud/exception/CloudException.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public void addProxyObject(String uuid) {
5454
return;
5555
}
5656

57-
5857
public ArrayList<String> getIdProxyList() {
5958
return idList;
6059
}

api/src/com/cloud/exception/CloudExecutionException.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

api/src/com/cloud/network/Network.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ public static class Capability {
170170
public static final Capability AllowDnsSuffixModification = new Capability("AllowDnsSuffixModification");
171171
public static final Capability RedundantRouter = new Capability("RedundantRouter");
172172
public static final Capability ElasticIp = new Capability("ElasticIp");
173-
public static final Capability AssociatePublicIP = new Capability("AssociatePublicIP");
174173
public static final Capability ElasticLb = new Capability("ElasticLb");
175174
public static final Capability AutoScaleCounters = new Capability("AutoScaleCounters");
176175
public static final Capability InlineMode = new Capability("InlineMode");

0 commit comments

Comments
 (0)