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/3ddc9e76 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3ddc9e76 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3ddc9e76 Branch: refs/heads/master Commit: 3ddc9e7674c4a12b0e12ca51bb8795dcff5de974 Parents: 7b44418 Author: Frank.Zhang <frank.zh...@citrix.com> Authored: Mon Jul 7 11:40:21 2014 -0700 Committer: Frank.Zhang <frank.zh...@citrix.com> Committed: Mon Jul 7 11:40:21 2014 -0700 ---------------------------------------------------------------------- server/src/com/cloud/configuration/Config.java | 8 ++++++++ .../VirtualNetworkApplianceManagerImpl.java | 20 +++++++++++++++++++- utils/src/com/cloud/utils/fsm/StateObject.java | 4 ++-- 3 files changed, 29 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ddc9e76/server/src/com/cloud/configuration/Config.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 196db93..7863001 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -1761,6 +1761,14 @@ public enum Config { "The maximum number of retrying times to search for an available IPv6 address in the table", null), + BaremetalPeerHypervisorType( + "Advanced", + ManagementServer.class, + String.class, + "baremetal.peer.hypervisor.type", + "XenServer", + "Hypervisor[Xenserver/KVM/VMWare] used to spring up virtual router for baremetal instances. The cluster having this hypervisor type must be in the same zone with baremetal cluster", + null), ExternalBaremetalSystemUrl( "Advanced", ManagementServer.class, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ddc9e76/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 1068a2f..d8e3761 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -1738,7 +1738,7 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine. int startRetry = 0; DomainRouterVO router = null; for (final Iterator<HypervisorType> iter = hypervisors.iterator(); iter.hasNext();) { - final HypervisorType hType = iter.next(); + HypervisorType hType = iter.next(); try { final long id = _routerDao.getNextInSequence(Long.class, "id"); if (s_logger.isDebugEnabled()) { @@ -1762,6 +1762,24 @@ VirtualMachineGuru, Listener, Configurable, StateListener<State, VirtualMachine. case LXC: templateName = RouterTemplateLxc.valueIn(dest.getDataCenter().getId()); break; + case BareMetal: + String peerHvType = _configDao.getValue(Config.BaremetalPeerHypervisorType.key()); + if (peerHvType == null) { + throw new CloudRuntimeException(String.format("To use baremetal in advanced networking, you must set %s to type of hypervisor(e.g XenServer)" + + " that exists in the same zone with baremetal host. That hyperivsor is used to spring up virtual router for baremetal instance", Config.BaremetalPeerHypervisorType.key())); + } + + hType = HypervisorType.getType(peerHvType); + if (HypervisorType.XenServer.toString().equals(peerHvType)) { + templateName = RouterTemplateXen.valueIn(dest.getDataCenter().getId()); + } else if (HypervisorType.KVM.toString().equals(peerHvType)) { + templateName = RouterTemplateKvm.valueIn(dest.getDataCenter().getId()); + } else if (HypervisorType.VMware.toString().equals(peerHvType)) { + templateName = RouterTemplateVmware.valueIn(dest.getDataCenter().getId()); + } else { + throw new CloudRuntimeException(String.format("Baremetal only supports peer hypervisor(XenServer/KVM/VMWare) right now, you specified %s", peerHvType)); + } + break; default: break; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ddc9e76/utils/src/com/cloud/utils/fsm/StateObject.java ---------------------------------------------------------------------- diff --git a/utils/src/com/cloud/utils/fsm/StateObject.java b/utils/src/com/cloud/utils/fsm/StateObject.java old mode 100644 new mode 100755 index 4ee4dac..85dd441 --- a/utils/src/com/cloud/utils/fsm/StateObject.java +++ b/utils/src/com/cloud/utils/fsm/StateObject.java @@ -21,7 +21,7 @@ package com.cloud.utils.fsm; public interface StateObject<S> { /** - * @return finite state. - */ + * @return finite state. + */ S getState(); }