Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing ConfigDrive entries on existing zones after upgrade #3007

Merged
merged 2 commits into from Nov 12, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions server/src/com/cloud/network/NetworkServiceImpl.java
Expand Up @@ -37,6 +37,7 @@
import javax.inject.Inject;
import javax.naming.ConfigurationException;

import org.apache.commons.collections.CollectionUtils;
import org.apache.log4j.Logger;

import org.apache.cloudstack.acl.ControlledEntity.ACLType;
Expand Down Expand Up @@ -623,11 +624,42 @@ public boolean configure(final String name, final Map<String, Object> params) th

_allowSubdomainNetworkAccess = Boolean.valueOf(_configs.get(Config.SubDomainNetworkAccess.key()));

verifyConfigDriveEntriesOnZones();

s_logger.info("Network Service is configured.");

return true;
}

/**
* Verifies ConfigDrive entries on a zone. Adds Diabled ConfigDrive provider if missing
nvazquez marked this conversation as resolved.
Show resolved Hide resolved
*/
private void checkConfigDriveEntriesOnZone(DataCenterVO zone) {
nvazquez marked this conversation as resolved.
Show resolved Hide resolved
if (zone.getNetworkType() == NetworkType.Advanced) {
List<PhysicalNetworkVO> physicalNetworks = _physicalNetworkDao.listByZoneAndTrafficType(
zone.getId(), TrafficType.Guest);
for (PhysicalNetworkVO physicalNetworkVO : physicalNetworks) {
PhysicalNetworkServiceProviderVO provider = _pNSPDao.findByServiceProvider(
physicalNetworkVO.getId(), Provider.ConfigDrive.getName());
if (provider == null) {
addConfigDriveToPhysicalNetwork(physicalNetworkVO.getId());
}
}
}
}

/**
* Verifies ConfigDrive entries on enabled zones. Adds Diabled ConfigDrive provider if missing.
nvazquez marked this conversation as resolved.
Show resolved Hide resolved
*/
private void verifyConfigDriveEntriesOnZones() {
nvazquez marked this conversation as resolved.
Show resolved Hide resolved
List<DataCenterVO> zones = _dcDao.listEnabledZones();
if (CollectionUtils.isNotEmpty(zones)) {
for (DataCenterVO zone : zones) {
checkConfigDriveEntriesOnZone(zone);
}
}
}

@Override
public boolean start() {
return true;
Expand Down