You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by fr...@apache.org on 2014/09/23 00:53:09 UTC
git commit: updated refs/heads/master to b8795d8
Repository: cloudstack
Updated Branches:
refs/heads/master 6655d8f5b -> b8795d887
CLOUDSTACK-6278
Baremetal Advanced Networking support
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b8795d88
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b8795d88
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b8795d88
Branch: refs/heads/master
Commit: b8795d88796aa5b9a736fff3ad6fbcf5d6f2b825
Parents: 6655d8f
Author: Frank Zhang <fr...@citrix.com>
Authored: Mon Sep 22 15:56:57 2014 -0700
Committer: Frank Zhang <fr...@citrix.com>
Committed: Mon Sep 22 15:56:57 2014 -0700
----------------------------------------------------------------------
.../baremetal/manager/BaremetalVlanManager.java | 2 +
.../manager/BaremetalVlanManagerImpl.java | 15 +++++
.../cloudstack/api/ListBaremetalRctCmd.java | 69 ++++++++++++++++++++
3 files changed, 86 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8795d88/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManager.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManager.java
index 9527f08..203d8fe 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManager.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManager.java
@@ -39,4 +39,6 @@ public interface BaremetalVlanManager extends Manager, PluggableService {
void releaseVlan(Network nw, VirtualMachineProfile vm);
void registerSwitchBackend(BaremetalSwitchBackend backend);
+
+ BaremetalRctResponse listRct();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8795d88/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java
index 6cb91f8..5a560c1 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalVlanManagerImpl.java
@@ -40,6 +40,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VirtualMachineProfile;
import com.google.gson.Gson;
import org.apache.cloudstack.api.AddBaremetalRctCmd;
+import org.apache.cloudstack.api.ListBaremetalRctCmd;
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
import org.springframework.web.client.RestTemplate;
@@ -169,6 +170,19 @@ public class BaremetalVlanManagerImpl extends ManagerBase implements BaremetalVl
backends.put(backend.getSwitchBackendType(), backend);
}
+ @Override
+ public BaremetalRctResponse listRct() {
+ List<BaremetalRctVO> vos = rctDao.listAll();
+ if (!vos.isEmpty()) {
+ BaremetalRctVO vo = vos.get(0);
+ BaremetalRctResponse rsp = new BaremetalRctResponse();
+ rsp.setId(vo.getUuid());
+ rsp.setUrl(vo.getUrl());
+ return rsp;
+ }
+ return null;
+ }
+
private BaremetalSwitchBackend getSwitchBackend(String type) {
BaremetalSwitchBackend backend = backends.get(type);
if (backend == null) {
@@ -201,6 +215,7 @@ public class BaremetalVlanManagerImpl extends ManagerBase implements BaremetalVl
public List<Class<?>> getCommands() {
List<Class<?>> cmds = new ArrayList<Class<?>>();
cmds.add(AddBaremetalRctCmd.class);
+ cmds.add(ListBaremetalRctCmd.class);
return cmds;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8795d88/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalRctCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalRctCmd.java b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalRctCmd.java
new file mode 100755
index 0000000..3a69f3c
--- /dev/null
+++ b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalRctCmd.java
@@ -0,0 +1,69 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// Automatically generated by addcopyright.py at 01/29/2013
+package org.apache.cloudstack.api;
+
+import com.cloud.baremetal.manager.BaremetalVlanManager;
+import com.cloud.baremetal.networkservice.BaremetalRctResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.List;
+
+@APICommand(name = "listBaremetalRct", description = "list baremetal rack configuration", responseObject = BaremetalRctResponse.class,
+ requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin})
+public class ListBaremetalRctCmd extends BaseListCmd {
+ private static final Logger s_logger = Logger.getLogger(ListBaremetalRctCmd.class);
+ private static final String s_name = "listbaremetalrctresponse";
+ @Inject
+ BaremetalVlanManager vlanMgr;
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
+ ResourceAllocationException, NetworkRuleConflictException {
+ try {
+ ListResponse<BaremetalRctResponse> response = new ListResponse<>();
+ List<BaremetalRctResponse> rctResponses = new ArrayList<>();
+ BaremetalRctResponse rsp = vlanMgr.listRct();
+ if (rsp != null) {
+ rctResponses.add(rsp);
+ }
+ response.setResponses(rctResponses);
+ response.setResponseName(getCommandName());
+ response.setObjectName("baremetalrcts");
+ this.setResponseObject(response);
+ } catch (Exception e) {
+ s_logger.debug("Exception happened while executing ListBaremetalRctCmd", e);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+ }
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+}
Re: git commit: updated refs/heads/master to b8795d8
Posted by Daan Hoogland <da...@gmail.com>.
Frank I had a look at this commit and found an issue with it. Please look
at my comments in the last file:
On Tue, Sep 23, 2014 at 12:53 AM, <fr...@apache.org> wrote:
...
>
> Branch: refs/heads/master
> Commit: b8795d88796aa5b9a736fff3ad6fbcf5d6f2b825
> Parents: 6655d8f
> Author: Frank Zhang <fr...@citrix.com>
> Authored: Mon Sep 22 15:56:57 2014 -0700
> Committer: Frank Zhang <fr...@citrix.com>
> Committed: Mon Sep 22 15:56:57 2014 -0700
>
...
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8795d88/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalRctCmd.java
> ----------------------------------------------------------------------
> diff --git
> a/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalRctCmd.java
> b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalRctCmd.java
> new file mode 100755
> index 0000000..3a69f3c
> --- /dev/null
> +++
> b/plugins/hypervisors/baremetal/src/org/apache/cloudstack/api/ListBaremetalRctCmd.java
> @@ -0,0 +1,69 @@
> +// Licensed to the Apache Software Foundation (ASF) under one
> +// or more contributor license agreements. See the NOTICE file
> +// distributed with this work for additional information
> +// regarding copyright ownership. The ASF licenses this file
> +// to you under the Apache License, Version 2.0 (the
> +// "License"); you may not use this file except in compliance
> +// with the License. You may obtain a copy of the License at
> +//
> +// http://www.apache.org/licenses/LICENSE-2.0
> +//
> +// Unless required by applicable law or agreed to in writing,
> +// software distributed under the License is distributed on an
> +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +// KIND, either express or implied. See the License for the
> +// specific language governing permissions and limitations
> +// under the License.
> +//
> +// Automatically generated by addcopyright.py at 01/29/2013
> +package org.apache.cloudstack.api;
> +
> +import com.cloud.baremetal.manager.BaremetalVlanManager;
> +import com.cloud.baremetal.networkservice.BaremetalRctResponse;
> +import com.cloud.exception.ConcurrentOperationException;
> +import com.cloud.exception.InsufficientCapacityException;
> +import com.cloud.exception.NetworkRuleConflictException;
> +import com.cloud.exception.ResourceAllocationException;
> +import com.cloud.exception.ResourceUnavailableException;
> +import org.apache.cloudstack.acl.RoleType;
> +import org.apache.cloudstack.api.response.ListResponse;
> +import org.apache.log4j.Logger;
> +
> +import javax.inject.Inject;
> +import java.util.ArrayList;
> +import java.util.List;
> +
> +@APICommand(name = "listBaremetalRct", description = "list baremetal rack
> configuration", responseObject = BaremetalRctResponse.class,
> + requestHasSensitiveInfo = false, responseHasSensitiveInfo =
> false, authorized = {RoleType.Admin})
> +public class ListBaremetalRctCmd extends BaseListCmd {
> + private static final Logger s_logger =
> Logger.getLogger(ListBaremetalRctCmd.class);
> + private static final String s_name = "listbaremetalrctresponse";
> + @Inject
> + BaremetalVlanManager vlanMgr;
> +
>
here Exception is caught, only ServerApiException is thrown but a long
list of exceptions is declared:
> + @Override
> + public void execute() throws ResourceUnavailableException,
> InsufficientCapacityException, ServerApiException,
> ConcurrentOperationException,
> + ResourceAllocationException, NetworkRuleConflictException {
> + try {
> + ListResponse<BaremetalRctResponse> response = new
> ListResponse<>();
> + List<BaremetalRctResponse> rctResponses = new ArrayList<>();
> + BaremetalRctResponse rsp = vlanMgr.listRct();
> + if (rsp != null) {
> + rctResponses.add(rsp);
> + }
> + response.setResponses(rctResponses);
> + response.setResponseName(getCommandName());
> + response.setObjectName("baremetalrcts");
> + this.setResponseObject(response);
>
only what is actually thrown
should be caught
> + } catch (Exception e) {
> + s_logger.debug("Exception happened while executing
> ListBaremetalRctCmd", e);
> + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
> e.getMessage());
> + }
> + }
> +
> + @Override
> + public String getCommandName() {
> + return s_name;
> + }
> +
> +}
>
>
--
Daan