mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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
This commit is contained in:
parent
87d4171c53
commit
e350f1e76f
@ -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
|
||||
|
||||
@ -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";
|
||||
@ -450,7 +451,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";
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -450,6 +450,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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1488,7 +1488,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
|
||||
@ -1504,7 +1506,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");
|
||||
|
||||
@ -467,6 +467,7 @@ dictionary = {
|
||||
'label.CIDR.list': '<fmt:message key="label.CIDR.list" />',
|
||||
'label.CIDR.of.destination.network': '<fmt:message key="label.CIDR.of.destination.network" />',
|
||||
'label.clean.up': '<fmt:message key="label.clean.up" />',
|
||||
'label.make.redundant': '<fmt:message key="label.make.redundant" />',
|
||||
'label.clear.list': '<fmt:message key="label.clear.list" />',
|
||||
'label.close': '<fmt:message key="label.close" />',
|
||||
'label.cloud.console': '<fmt:message key="label.cloud.console" />',
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user