address comments and cleanup

This commit is contained in:
Pearl Dsilva 2023-10-23 08:12:45 -04:00
parent 2aadd328cb
commit 1f90b12fc2
8 changed files with 8 additions and 23 deletions

View File

@ -1054,7 +1054,7 @@ public class ApiConstants {
public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid";
public static final String HAS_RULES = "hasrules";
public static final String nsxDetail = "forNsx";
public static final String NSX_DETAIL_KEY = "forNsx";
/**
* This enum specifies IO Drivers, each option controls specific policies on I/O.

View File

@ -285,5 +285,3 @@ GROUP BY
-- Set removed state for all removed accounts
UPDATE `cloud`.`account` SET state='removed' WHERE `removed` IS NOT NULL;
--

View File

@ -931,7 +931,7 @@ public class ApiResponseHelper implements ResponseGenerator {
}
}
vlanResponse.setForSystemVms(isForSystemVms(vlan.getId()));
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(vlan.getId(), ApiConstants.nsxDetail);
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(vlan.getId(), ApiConstants.NSX_DETAIL_KEY);
vlanResponse.setForNsx(Objects.nonNull(vlanDetail) && vlanDetail.getValue().equals("true"));
vlanResponse.setObjectName("vlan");
return vlanResponse;

View File

@ -4898,7 +4898,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
continue;
}
// from here, subnet overlaps
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(vlan.getId(), ApiConstants.nsxDetail);
VlanDetailsVO vlanDetail = vlanDetailsDao.findDetail(vlan.getId(), ApiConstants.NSX_DETAIL_KEY);
if ((Objects.isNull(vlanId) && Objects.nonNull(vlanDetail) && vlanDetail.getValue().equals("true")) || Objects.nonNull(vlanId) &&
(vlanId.toLowerCase().contains(Vlan.UNTAGGED) || UriUtils.checkVlanUriOverlap(
BroadcastDomainType.getValue(BroadcastDomainType.fromString(vlanId)),
@ -4954,7 +4954,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
VlanVO vlan = new VlanVO(vlanType, vlanId, vlanGateway, vlanNetmask, zone.getId(), ipRange, networkId, physicalNetworkId, vlanIp6Gateway, vlanIp6Cidr, ipv6Range);
s_logger.debug("Saving vlan range " + vlan);
vlan = _vlanDao.persist(vlan);
vlanDetailsDao.addDetail(vlan.getId(), ApiConstants.nsxDetail, String.valueOf(forNsx), true);
vlanDetailsDao.addDetail(vlan.getId(), ApiConstants.NSX_DETAIL_KEY, String.valueOf(forNsx), true);
// IPv6 use a used ip map, is different from ipv4, no need to save
// public ip range

View File

@ -18,6 +18,7 @@
package org.apache.cloudstack.networkoffering;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.dc.dao.VlanDetailsDao;
import com.cloud.event.dao.UsageEventDao;
import com.cloud.event.dao.UsageEventDetailsDao;
import com.cloud.exception.InvalidParameterValueException;
@ -100,6 +101,8 @@ public class CreateNetworkOfferingTest extends TestCase {
@Inject
AnnotationDao annotationDao;
@Inject
VlanDetailsDao vlanDetailsDao;
@Override
@Before

View File

@ -73,4 +73,5 @@
<bean id="configurationGroupDaoImpl" class="org.apache.cloudstack.framework.config.dao.ConfigurationGroupDaoImpl" />
<bean id="configurationSubGroupDaoImpl" class="org.apache.cloudstack.framework.config.dao.ConfigurationSubGroupDaoImpl" />
<bean id="nsxControllerDaoImpl" class="com.cloud.network.dao.NsxProviderDaoImpl" />
<bean id="vlanDetailsDao" class="com.cloud.dc.dao.VlanDetailsDaoImpl" />
</beans>

View File

@ -226,7 +226,6 @@ export default {
const prefilledIpRangesKey = this.traffic + '-ipranges'
if (this.prefillContent[prefilledIpRangesKey]) {
this.ipRanges = this.prefillContent[prefilledIpRangesKey]
console.log(this.ipRanges)
}
},
created () {

View File

@ -905,8 +905,6 @@ export default {
let stopNow = false
this.stepData.returnedPublicTraffic = this.stepData?.returnedPublicTraffic || []
console.log(this.prefillContent['public-ipranges'])
console.log('pir')
for (let index = 0; index < this.prefillContent['public-ipranges'].length; index++) {
const publicVlanIpRange = this.prefillContent['public-ipranges'][index]
let isExisting = false
@ -952,40 +950,29 @@ export default {
}
try {
console.log('is nsx zone: ', this.stepData.isNsxZone)
// for not add vlan ; next phase add the check: && this.stepData.isNsxZone
if (!this.stepData.stepMove.includes('createPublicVlanIpRange' + index)) {
console.log('create vlan ip range:')
console.log(params)
const vlanIpRangeItem = await this.createVlanIpRange(params)
this.stepData.returnedPublicTraffic.push(vlanIpRangeItem)
console.log('create public vlan ip range')
this.stepData.stepMove.push('createPublicVlanIpRange' + index)
}
} catch (e) {
console.log('error')
this.messageError = e
this.processStatus = STATUS_FAILED
this.setStepStatus(STATUS_FAILED)
stopNow = true
}
console.log('added public vlan range')
if (stopNow) {
console.log('stop now - break')
break
}
}
if (stopNow) {
console.log('stop now - return')
return
}
if (this.stepData.isTungstenZone) {
await this.stepCreateTungstenFabricPublicNetwork()
} else if (this.stepData.isNsxZone) {
console.log('added nsx controller')
await this.stepAddNsxController()
} else {
await this.stepConfigureStorageTraffic()
@ -1002,7 +989,6 @@ export default {
if (storageExists && storageExists.length > 0) {
await this.stepConfigureStorageTraffic()
} else {
console.log('conf guest traffic')
await this.stepConfigureGuestTraffic()
}
}
@ -2072,8 +2058,6 @@ export default {
createVlanIpRange (args) {
return new Promise((resolve, reject) => {
let message = ''
console.log('args:')
console.log(args)
api('createVlanIpRange', args).then(json => {
const item = json.createvlaniprangeresponse.vlan