Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5F8DC10728 for ; Mon, 16 Feb 2015 16:47:54 +0000 (UTC) Received: (qmail 51364 invoked by uid 500); 16 Feb 2015 16:47:44 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 51288 invoked by uid 500); 16 Feb 2015 16:47:44 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 50235 invoked by uid 99); 16 Feb 2015 16:47:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Feb 2015 16:47:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 43543E0663; Mon, 16 Feb 2015 16:47:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dahn@apache.org To: commits@cloudstack.apache.org Date: Mon, 16 Feb 2015 16:48:10 -0000 Message-Id: In-Reply-To: <01c69cd6b912462c96d5f8bdd3339ac2@git.apache.org> References: <01c69cd6b912462c96d5f8bdd3339ac2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [29/50] [abbrv] git commit: updated refs/heads/feature/systemvm-persistent-config to 8620642 Turn a single VPC into a redundant VPC - when restarting a VPC, the user can check the option Make Redundant in order to change the VPC offering and make it redundant Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/89b3d2a6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/89b3d2a6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/89b3d2a6 Branch: refs/heads/feature/systemvm-persistent-config Commit: 89b3d2a62c02ac24b8355cb42ff1c8d35a7d9def Parents: 109134c Author: wilderrodrigues Authored: Tue Feb 3 16:27:54 2015 +0100 Committer: wilderrodrigues Committed: Mon Feb 16 16:08:42 2015 +0100 ---------------------------------------------------------------------- api/src/com/cloud/network/vpc/VpcService.java | 4 +- .../org/apache/cloudstack/api/ApiConstants.java | 3 +- .../api/command/user/vpc/RestartVPCCmd.java | 12 +++++- .../classes/resources/messages.properties | 1 + .../classes/resources/messages_ar.properties | 1 + .../classes/resources/messages_es.properties | 1 + .../classes/resources/messages_fr_FR.properties | 1 + .../classes/resources/messages_ja_JP.properties | 1 + .../classes/resources/messages_ko_KR.properties | 1 + .../classes/resources/messages_nb_NO.properties | 1 + .../classes/resources/messages_nl_NL.properties | 1 + .../classes/resources/messages_pl.properties | 1 + .../classes/resources/messages_pt_BR.properties | 1 + .../classes/resources/messages_ru_RU.properties | 1 + .../classes/resources/messages_zh_CN.properties | 1 + .../schema/src/com/cloud/network/vpc/VpcVO.java | 41 ++++++++++++-------- .../com/cloud/network/vpc/VpcManagerImpl.java | 22 ++++++++++- ui/dictionary.jsp | 1 + ui/scripts/network.js | 9 ++++- 19 files changed, 82 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/api/src/com/cloud/network/vpc/VpcService.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java index a2a6fe7..241e27b 100644 --- a/api/src/com/cloud/network/vpc/VpcService.java +++ b/api/src/com/cloud/network/vpc/VpcService.java @@ -127,10 +127,12 @@ public interface VpcService { * Restarts the VPC. VPC gets shutdown and started as a part of it * * @param id + * @param cleanUp + * @param makeredundant * @return * @throws InsufficientCapacityException */ - boolean restartVpc(long id, boolean cleanUp) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException; + boolean restartVpc(long id, boolean cleanUp, boolean makeredundant) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException; /** * Returns a Private gateway found in the VPC by id http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/api/src/org/apache/cloudstack/api/ApiConstants.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java index 75f3743..df6c22b 100644 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@ -48,6 +48,7 @@ public class ApiConstants { public static final String IP6_CIDR = "ip6cidr"; public static final String CIDR_LIST = "cidrlist"; public static final String CLEANUP = "cleanup"; + public static final String MAKEREDUNDANTE = "makeredundant"; public static final String CLUSTER_ID = "clusterid"; public static final String CLUSTER_NAME = "clustername"; public static final String CLUSTER_TYPE = "clustertype"; @@ -449,7 +450,7 @@ public class ApiConstants { public static final String EXTERNAL_SWITCH_MGMT_DEVICE_NAME = "vsmdevicename"; public static final String EXTERNAL_SWITCH_MGMT_DEVICE_STATE = "vsmdevicestate"; // Would we need to have a capacity field for Cisco N1KV VSM? Max hosts managed by it perhaps? May remove this -// later. + // later. public static final String EXTERNAL_SWITCH_MGMT_DEVICE_CAPACITY = "vsmdevicecapacity"; public static final String CISCO_NEXUS_VSM_NAME = "vsmname"; public static final String VSM_USERNAME = "vsmusername"; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java index 20df9ea..ea34c6a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java @@ -51,6 +51,9 @@ public class RestartVPCCmd extends BaseAsyncCmd { @Parameter(name = ApiConstants.CLEANUP, type = CommandType.BOOLEAN, required = false, description = "If cleanup old network elements") private Boolean cleanup; + @Parameter(name = ApiConstants.MAKEREDUNDANTE, type = CommandType.BOOLEAN, required = false, description = "Turn a single VPC into a redundant one.") + private Boolean makeredundant; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -66,6 +69,13 @@ public class RestartVPCCmd extends BaseAsyncCmd { return true; } + public Boolean getMakeredundant() { + if (makeredundant != null) { + return makeredundant; + } + return true; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -87,7 +97,7 @@ public class RestartVPCCmd extends BaseAsyncCmd { @Override public void execute() { try { - final boolean result = _vpcService.restartVpc(getId(), getCleanup()); + final boolean result = _vpcService.restartVpc(getId(), getCleanup(), getMakeredundant()); if (result) { final SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index 6d47ac0..da4e5a9 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -448,6 +448,7 @@ label.cidr.list=Source CIDR label.CIDR.of.destination.network=CIDR of destination network label.cidr=CIDR label.clean.up=Clean up +label.make.redundant=Make redundant label.clear.list=Clear list label.close=Close label.cloud.console=Cloud Management Console http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_ar.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_ar.properties b/client/WEB-INF/classes/resources/messages_ar.properties index de90c43..a36399f 100644 --- a/client/WEB-INF/classes/resources/messages_ar.properties +++ b/client/WEB-INF/classes/resources/messages_ar.properties @@ -47,6 +47,7 @@ label.change.value=\u062a\u063a\u064a\u0631 \u0627\u0644\u0642\u064a\u0645\u0629 label.CIDR.list=\u0642\u0627\u0626\u0645\u0629 CIDR label.CIDR.of.destination.network=CIDR \u0627\u0644\u062e\u0627\u0635 \u0628\u0627\u0644\u0634\u0628\u0643\u0629 \u0627\u0644\u0645\u0648\u062c\u0647\u0629. label.clean.up=\u062a\u0646\u0638\u064a\u0641 +label.make.redundant=\u062c\u0639\u0644 \u0632\u0627\u0626\u062f\u0629 \u0639\u0646 \u0627\u0644\u062d\u0627\u062c\u0629 label.clear.list=\u0645\u0633\u062d \u0627\u0644\u0642\u0627\u0626\u0645\u0629 label.configuration=\u0627\u0644\u062a\u0643\u0648\u064a\u0646 label.configure.network.ACLs=\u0636\u0628\u0637 \u0634\u0628\u0643\u0629 ACLs http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_es.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_es.properties b/client/WEB-INF/classes/resources/messages_es.properties index 6b51c38..91faf77 100644 --- a/client/WEB-INF/classes/resources/messages_es.properties +++ b/client/WEB-INF/classes/resources/messages_es.properties @@ -332,6 +332,7 @@ label.cidr=CIDR label.cidr.list=fuente CIDR label.CIDR.list=Lista CIDR label.clean.up=Limpiar +label.make.redundant=\u0068\u0061\u0063\u0065\u0072 \u0072\u0065\u0064\u0075\u006e\u0064\u0061\u006e\u0074\u0065 label.clear.list=Limpiar lista label.close=Cerrar label.cloud.console=Cloud Management Console http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_fr_FR.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_fr_FR.properties b/client/WEB-INF/classes/resources/messages_fr_FR.properties index 1272442..73f96a1 100644 --- a/client/WEB-INF/classes/resources/messages_fr_FR.properties +++ b/client/WEB-INF/classes/resources/messages_fr_FR.properties @@ -455,6 +455,7 @@ label.cisco.nexus1000v.password=Mot de passe Nexus 1000v label.cisco.nexus1000v.username=Identifiant Nexus 1000v label.ciscovnmc.resource.details=D\u00e9tails ressource CiscoVNMC label.clean.up=Nettoyage +label.make.redundant=\u006c\u0069\u0063\u0065\u006e\u0063\u0069\u0065\u0072 label.clear.list=Purger la liste label.close=Fermer label.cloud.console=Console d\\'Administration du Cloud http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_ja_JP.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_ja_JP.properties b/client/WEB-INF/classes/resources/messages_ja_JP.properties index 0510f43..550d12a 100644 --- a/client/WEB-INF/classes/resources/messages_ja_JP.properties +++ b/client/WEB-INF/classes/resources/messages_ja_JP.properties @@ -445,6 +445,7 @@ label.cidr.list=\u9001\u4fe1\u5143 CIDR label.CIDR.of.destination.network=\u5b9b\u5148\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306e CIDR label.cidr=CIDR label.clean.up=\u30af\u30ea\u30fc\u30f3 \u30a2\u30c3\u30d7\u3059\u308b +label.make.redundant=\u5197\u9577\u5316 label.clear.list=\u4e00\u89a7\u306e\u6d88\u53bb label.close=\u9589\u3058\u308b label.cloud.console=\u30af\u30e9\u30a6\u30c9\u7ba1\u7406\u30b3\u30f3\u30bd\u30fc\u30eb http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_ko_KR.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_ko_KR.properties b/client/WEB-INF/classes/resources/messages_ko_KR.properties index badb7f3..4b7e090 100644 --- a/client/WEB-INF/classes/resources/messages_ko_KR.properties +++ b/client/WEB-INF/classes/resources/messages_ko_KR.properties @@ -375,6 +375,7 @@ label.CIDR.list=CIDR \ubaa9\ub85d label.cidr.list=\uc804\uc1a1\uc6d0 CIDR label.CIDR.of.destination.network=\ub300\uc0c1 \ub124\ud2b8\uc6cc\ud06c CIDR label.clean.up=\uc0ad\uc81c\ud558\uae30 +label.make.redundant=\uc911\ubcf5 \ud655\uc778 label.clear.list=\ubaa9\ub85d \uc0ad\uc81c label.close=\ub2eb\uae30 label.cloud.console=\ud074\ub77c\uc6b0\ub4dc \uad00\ub9ac \ucf58\uc194 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_nb_NO.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_nb_NO.properties b/client/WEB-INF/classes/resources/messages_nb_NO.properties index bf88907..b9ade48 100644 --- a/client/WEB-INF/classes/resources/messages_nb_NO.properties +++ b/client/WEB-INF/classes/resources/messages_nb_NO.properties @@ -314,6 +314,7 @@ label.cidr=CIDR label.CIDR.list=CIDR liste label.cidr.list=Kilde-CIDR label.clean.up=Rydd opp +label.make.redundant=\u0067\u006a\u00f8\u0072\u0065 \u006f\u0076\u0065\u0072\u0066\u006c\u00f8\u0064\u0069\u0067 label.clear.list=T\u00f8m liste label.close=Lukk label.cloud.console=Cloud http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_nl_NL.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_nl_NL.properties b/client/WEB-INF/classes/resources/messages_nl_NL.properties index 35cd86c..a296088 100644 --- a/client/WEB-INF/classes/resources/messages_nl_NL.properties +++ b/client/WEB-INF/classes/resources/messages_nl_NL.properties @@ -432,6 +432,7 @@ label.cisco.nexus1000v.password=Nexus 1000v Wachtwoord label.cisco.nexus1000v.username=Nexus 1000v Gebruikersnaam label.ciscovnmc.resource.details=CiscoVNMC resource details label.clean.up=Opschonen +label.make.redundant=\u0072\u0065\u0064\u0075\u006e\u0064\u0061\u006e\u0074\u0065 \u006d\u0061\u006b\u0065\u006e label.clear.list=Schoon lijst op label.close=Sluiten label.cloud.console=Cloud Beheers Console http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_pl.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_pl.properties b/client/WEB-INF/classes/resources/messages_pl.properties index 0388b3f..e9c9ae9 100644 --- a/client/WEB-INF/classes/resources/messages_pl.properties +++ b/client/WEB-INF/classes/resources/messages_pl.properties @@ -187,6 +187,7 @@ label.certificate=Certyfikat label.cidr=CIDR label.CIDR.list=Lista CIDR label.clean.up=Wyczy\u015b\u0107 +label.make.redundant=\u0073\u0069\u0119 \u007a\u0062\u0119\u0064\u006e\u0065 label.clear.list=Wyczy\u015b\u0107 list\u0119 label.close=Zamknij label.clvm=CLVM http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_pt_BR.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_pt_BR.properties b/client/WEB-INF/classes/resources/messages_pt_BR.properties index c925e6d..4eb6997 100644 --- a/client/WEB-INF/classes/resources/messages_pt_BR.properties +++ b/client/WEB-INF/classes/resources/messages_pt_BR.properties @@ -398,6 +398,7 @@ label.cidr.list=CIDR de Origem label.CIDR.list=Lista CIDR label.CIDR.of.destination.network=CIDR da rede de destino label.clean.up=Limpar +label.make.redundant=\u0074\u006f\u0072\u006e\u0061\u0072 \u0072\u0065\u0064\u0075\u006e\u0064\u0061\u006e\u0074\u0065 label.clear.list=Limpar lista label.close=Fechar label.cloud.console=Console de Gerenciamento da Nuvem http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_ru_RU.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_ru_RU.properties b/client/WEB-INF/classes/resources/messages_ru_RU.properties index 16427a1..e825605 100644 --- a/client/WEB-INF/classes/resources/messages_ru_RU.properties +++ b/client/WEB-INF/classes/resources/messages_ru_RU.properties @@ -386,6 +386,7 @@ label.cidr.list=CIDR \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 label.CIDR.list=\u0421\u043f\u0438\u0441\u043e\u043a CIDR label.CIDR.of.destination.network=CIDR \u0441\u0435\u0442\u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f label.clean.up=\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c +label.make.redundant=\u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437\u043b\u0438\u0448\u043d\u0438\u043c label.clear.list=\u041e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a label.close=\u0417\u0430\u043a\u0440\u044b\u0442\u044c label.cloud.console=\u041a\u043e\u043d\u0441\u043e\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u043b\u0430\u043a\u043e\u043c http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/client/WEB-INF/classes/resources/messages_zh_CN.properties ---------------------------------------------------------------------- diff --git a/client/WEB-INF/classes/resources/messages_zh_CN.properties b/client/WEB-INF/classes/resources/messages_zh_CN.properties index a527fcb..427b060 100644 --- a/client/WEB-INF/classes/resources/messages_zh_CN.properties +++ b/client/WEB-INF/classes/resources/messages_zh_CN.properties @@ -445,6 +445,7 @@ label.cidr.list=\u6e90 CIDR label.CIDR.of.destination.network=\u76ee\u7684\u5730\u7f51\u7edc\u7684 CIDR label.cidr=CIDR label.clean.up=\u6e05\u7406 +label.make.redundant=\u4f7f\u591a\u9918 label.clear.list=\u6e05\u9664\u5217\u8868 label.close=\u5173\u95ed label.cloud.console=\u4e91\u7ba1\u7406\u63a7\u5236\u53f0 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/engine/schema/src/com/cloud/network/vpc/VpcVO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/network/vpc/VpcVO.java b/engine/schema/src/com/cloud/network/vpc/VpcVO.java index b400d95..b78f22f 100644 --- a/engine/schema/src/com/cloud/network/vpc/VpcVO.java +++ b/engine/schema/src/com/cloud/network/vpc/VpcVO.java @@ -16,7 +16,8 @@ // under the License. package com.cloud.network.vpc; -import com.cloud.utils.db.GenericDao; +import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -24,8 +25,8 @@ import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; -import java.util.Date; -import java.util.UUID; + +import com.cloud.utils.db.GenericDao; @Entity @Table(name = "vpc") @@ -61,7 +62,7 @@ public class VpcVO implements Vpc { State state; @Column(name = "redundant") - boolean isRedundant; + boolean redundant; @Column(name = "vpc_offering_id") long vpcOfferingId; @@ -92,8 +93,8 @@ public class VpcVO implements Vpc { } public VpcVO(final long zoneId, final String name, final String displayText, final long accountId, final long domainId, - final long vpcOffId, String cidr, final String networkDomain, final boolean useDistributedRouter, - final boolean regionLevelVpc, final boolean isRedundant) { + final long vpcOffId, final String cidr, final String networkDomain, final boolean useDistributedRouter, + final boolean regionLevelVpc, final boolean isRedundant) { this.zoneId = zoneId; this.name = name; this.displayText = displayText; @@ -104,9 +105,9 @@ public class VpcVO implements Vpc { state = State.Enabled; this.networkDomain = networkDomain; vpcOfferingId = vpcOffId; - this.usesDistributedRouter = useDistributedRouter; + usesDistributedRouter = useDistributedRouter; this.regionLevelVpc = regionLevelVpc; - this.isRedundant = isRedundant; + redundant = isRedundant; } @Override @@ -149,7 +150,7 @@ public class VpcVO implements Vpc { return state; } - public void setState(State state) { + public void setState(final State state) { this.state = state; } @@ -158,6 +159,10 @@ public class VpcVO implements Vpc { return vpcOfferingId; } + public void setVpcOfferingId(final long vpcOfferingId) { + this.vpcOfferingId = vpcOfferingId; + } + public Date getRemoved() { return removed; } @@ -167,17 +172,17 @@ public class VpcVO implements Vpc { return displayText; } - public void setName(String name) { + public void setName(final String name) { this.name = name; } - public void setDisplayText(String displayText) { + public void setDisplayText(final String displayText) { this.displayText = displayText; } @Override public String toString() { - StringBuilder buf = new StringBuilder("[VPC ["); + final StringBuilder buf = new StringBuilder("[VPC ["); return buf.append(id).append("-").append(name).append("]").toString(); } @@ -186,7 +191,7 @@ public class VpcVO implements Vpc { return networkDomain; } - public void setRestartRequired(boolean restartRequired) { + public void setRestartRequired(final boolean restartRequired) { this.restartRequired = restartRequired; } @@ -195,7 +200,7 @@ public class VpcVO implements Vpc { return restartRequired; } - public void setUuid(String uuid) { + public void setUuid(final String uuid) { this.uuid = uuid; } @@ -205,7 +210,7 @@ public class VpcVO implements Vpc { } - public void setDisplay(boolean display) { + public void setDisplay(final boolean display) { this.display = display; } @@ -216,7 +221,11 @@ public class VpcVO implements Vpc { @Override public boolean isRedundant() { - return this.isRedundant; + return redundant; + } + + public void setRedundant(final boolean isRedundant) { + redundant = isRedundant; } @Override http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/server/src/com/cloud/network/vpc/VpcManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java index cafa210..4fe1397 100644 --- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java +++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java @@ -1487,7 +1487,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis @Override @ActionEvent(eventType = EventTypes.EVENT_VPC_RESTART, eventDescription = "restarting vpc") - public boolean restartVpc(final long vpcId, final boolean cleanUp) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + public boolean restartVpc(final long vpcId, final boolean cleanUp, final boolean makeRedundant) throws ConcurrentOperationException, + ResourceUnavailableException, InsufficientCapacityException { + final Account caller = CallContext.current().getCallingAccount(); // Verify input parameters @@ -1503,7 +1505,23 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis s_logger.debug("Restarting VPC " + vpc); boolean restartRequired = false; try { - if (cleanUp) { + + boolean forceCleanup = cleanUp; + if (!vpc.isRedundant() && makeRedundant) { + final VpcOfferingVO redundantOffering = _vpcOffDao.findByUniqueName(VpcOffering.redundantVPCOfferingName); + + final VpcVO entity = _vpcDao.findById(vpcId); + entity.setRedundant(makeRedundant); + entity.setVpcOfferingId(redundantOffering.getId()); + + // Change the VPC in order to get it updated after the end of the restart procedure. + _vpcDao.update(vpc.getId(), entity); + + //If the offering and redundant column are changing, force the clean up. + forceCleanup = true; + } + + if (forceCleanup) { s_logger.debug("Shutting down VPC " + vpc + " as a part of VPC restart process"); if (!shutdownVpc(vpcId)) { s_logger.warn("Failed to shutdown vpc as a part of VPC " + vpc + " restart process"); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/ui/dictionary.jsp ---------------------------------------------------------------------- diff --git a/ui/dictionary.jsp b/ui/dictionary.jsp index e283d49..895f426 100644 --- a/ui/dictionary.jsp +++ b/ui/dictionary.jsp @@ -467,6 +467,7 @@ dictionary = { 'label.CIDR.list': '', 'label.CIDR.of.destination.network': '', 'label.clean.up': '', +'label.make.redundant': '', 'label.clear.list': '', 'label.close': '', 'label.cloud.console': '', http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89b3d2a6/ui/scripts/network.js ---------------------------------------------------------------------- diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 3b3b2a2..91086f5 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -5523,11 +5523,17 @@ }); args.$form.find('.form-item[rel=cleanup]').find('input').attr('checked', 'checked'); //checked args.$form.find('.form-item[rel=cleanup]').css('display', 'inline-block'); //shown + args.$form.find('.form-item[rel=makeredundant]').find('input').attr('checked', 'checked'); //checked + args.$form.find('.form-item[rel=makeredundant]').css('display', 'inline-block'); //shown }, fields: { cleanup: { label: 'label.clean.up', isBoolean: true + }, + makeredundant: { + label: 'label.make.redundant', + isBoolean: true } } }, @@ -5545,7 +5551,8 @@ url: createURL("restartVPC"), data: { id: args.context.vpc[0].id, - cleanup: (args.data.cleanup == "on") + cleanup: (args.data.cleanup == "on"), + makeredundant: (args.data.makeredundant == "on") }, success: function(json) { var jid = json.restartvpcresponse.jobid;