Merge remote-tracking branch 'origin/4.15' into main

This commit is contained in:
Rohit Yadav 2021-08-18 16:56:19 +05:30
commit 953f5b81ed
5 changed files with 30 additions and 20 deletions

View File

@ -24,7 +24,7 @@ import org.apache.cloudstack.api.InternalIdentity;
public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdentity, Displayable {
enum State {
Pending, Connected, Disconnected, Error,
Pending, Connecting, Connected, Disconnected, Error,
}
@Override

View File

@ -819,7 +819,8 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
}
final List<String> ipList = new ArrayList<String>();
for (final Site2SiteVpnConnectionVO conn : conns) {
if (conn.getState() != Site2SiteVpnConnection.State.Connected && conn.getState() != Site2SiteVpnConnection.State.Disconnected) {
if (conn.getState() != Site2SiteVpnConnection.State.Connected && conn.getState() != Site2SiteVpnConnection.State.Disconnected
&& conn.getState() != Site2SiteVpnConnection.State.Connecting) {
continue;
}
final Site2SiteCustomerGateway gw = _s2sCustomerGatewayDao.findById(conn.getCustomerGatewayId());
@ -855,7 +856,7 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
throw new CloudRuntimeException("Unable to acquire lock for site to site vpn connection id " + conn.getId());
}
try {
if (conn.getState() != Site2SiteVpnConnection.State.Connected && conn.getState() != Site2SiteVpnConnection.State.Disconnected) {
if (conn.getState() != Site2SiteVpnConnection.State.Connected && conn.getState() != Site2SiteVpnConnection.State.Disconnected && conn.getState() != Site2SiteVpnConnection.State.Connecting) {
continue;
}
final Site2SiteVpnConnection.State oldState = conn.getState();

View File

@ -347,7 +347,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
if (conn.isPassive()) {
conn.setState(State.Disconnected);
} else {
conn.setState(State.Connected);
conn.setState(State.Connecting);
}
_vpnConnectionDao.persist(conn);
return conn;
@ -530,7 +530,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
continue;
}
try {
if (conn.getState() == State.Connected || conn.getState() == State.Error) {
if (conn.getState() == State.Connected || conn.getState() == State.Connecting || conn.getState() == State.Error) {
stopVpnConnection(conn.getId());
}
startVpnConnection(conn.getId());
@ -608,7 +608,8 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
if (conn.getState() == State.Pending) {
conn.setState(State.Disconnected);
}
if (conn.getState() == State.Connected || conn.getState() == State.Error || conn.getState() == State.Disconnected) {
if (conn.getState() == State.Connected || conn.getState() == State.Error
|| conn.getState() == State.Disconnected || conn.getState() == State.Connecting) {
stopVpnConnection(id);
}
startVpnConnection(id);
@ -795,7 +796,7 @@ public class Site2SiteVpnManagerImpl extends ManagerBase implements Site2SiteVpn
throw new CloudRuntimeException("Unable to acquire lock on " + conn);
}
try {
if (conn.getState() == Site2SiteVpnConnection.State.Connected) {
if (conn.getState() == Site2SiteVpnConnection.State.Connected || conn.getState() == Site2SiteVpnConnection.State.Connecting) {
conn.setState(Site2SiteVpnConnection.State.Disconnected);
_vpnConnectionDao.persist(conn);
}

View File

@ -618,7 +618,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
self.logger.debug("Network %s created in VPC %s" % (ntwk2.id, vpc2.id))
vm1 = None
# Deploy a vm in network 2
# Deploy a vm in network 1
try:
vm1 = VirtualMachine.create(self.apiclient, services=self.services["virtual_machine"],
templateid=self.template.id,
@ -990,7 +990,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
self.cleanup.append(ntwk2)
self.logger.debug("Network %s created in VPC %s" % (ntwk2.id, vpc2.id))
# Deploy a vm in network 2
# Deploy a vm in network 1
vm1 = None
try:
vm1 = VirtualMachine.create(self.apiclient, services=self.services["virtual_machine"],
@ -1370,7 +1370,7 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
self.logger.debug("Network %s created in VPC %s" % (ntwk2.id, vpc2.id))
vm1 = None
# Deploy a vm in network 2
# Deploy a vm in network 1
try:
vm1 = VirtualMachine.create(self.apiclient, services=self.services["virtual_machine"],
templateid=self.template.id,

View File

@ -26,11 +26,11 @@
<a-step
v-for="(step, index) in steps"
:ref="`resourceStep${index}`"
:key="step.title"
:key="step.formKey"
:title="$t(step.title)"></a-step>
</a-steps>
<static-inputs-form
v-if="currentStep === 0"
v-if="checkVisibleResource('clusterResource')"
@nextPressed="nextPressed"
@backPressed="handleBack"
@fieldsChanged="fieldsChanged"
@ -43,7 +43,7 @@
<div v-if="hypervisor !== 'VMware'">
<static-inputs-form
v-if="currentStep === 1"
v-if="checkVisibleResource('hostResource')"
@nextPressed="nextPressed"
@backPressed="handleBack"
@fieldsChanged="fieldsChanged"
@ -54,7 +54,7 @@
:isFixError="isFixError"
/>
<static-inputs-form
v-if="currentStep === 2"
v-if="(!localstorageenabled || !localstorageenabledforsystemvm) && checkVisibleResource('primaryResource')"
@nextPressed="nextPressed"
@backPressed="handleBack"
@fieldsChanged="fieldsChanged"
@ -65,7 +65,7 @@
:isFixError="isFixError"
/>
<static-inputs-form
v-if="currentStep === 3"
v-if="checkVisibleResource('secondaryResource')"
@nextPressed="nextPressed"
@backPressed="handleBack"
@fieldsChanged="fieldsChanged"
@ -78,7 +78,7 @@
</div>
<div v-else>
<static-inputs-form
v-if="currentStep === 1"
v-if="checkVisibleResource('primaryResource')"
@nextPressed="nextPressed"
@backPressed="handleBack"
@fieldsChanged="fieldsChanged"
@ -89,7 +89,7 @@
:isFixError="isFixError"
/>
<static-inputs-form
v-if="currentStep === 2"
v-if="checkVisibleResource('secondaryResource')"
@nextPressed="nextPressed"
@backPressed="handleBack"
@fieldsChanged="fieldsChanged"
@ -135,11 +135,15 @@ export default {
hypervisor () {
return this.prefillContent.hypervisor ? this.prefillContent.hypervisor.value : null
},
localstorageenabled () {
return this.prefillContent?.localstorageenabled?.value || false
},
localstorageenabledforsystemvm () {
return this.prefillContent?.localstorageenabledforsystemvm?.value || false
},
steps () {
const steps = []
const hypervisor = this.prefillContent.hypervisor ? this.prefillContent.hypervisor.value : null
const localStorageEnabled = this.prefillContent.localstorageenabled.value
const localStorageEnabledForSystemVM = this.prefillContent.localstorageenabledforsystemvm.value
steps.push({
title: 'label.cluster',
fromKey: 'clusterResource',
@ -152,7 +156,7 @@ export default {
description: 'message.desc.host'
})
}
if (!localStorageEnabled || !localStorageEnabledForSystemVM) {
if (!this.localstorageenabled || !this.localstorageenabledforsystemvm) {
steps.push({
title: 'label.primary.storage',
fromKey: 'primaryResource',
@ -926,6 +930,10 @@ export default {
},
submitLaunchZone () {
this.$emit('submitLaunchZone')
},
checkVisibleResource (key) {
const formKey = this.steps[this.currentStep]?.fromKey || ''
return formKey === key
}
}
}