Skip to content

Commit 25cb545

Browse files
committed
Merge remote-tracking branch 'apache/4.22'
2 parents 66665b8 + 276eb81 commit 25cb545

File tree

16 files changed

+95
-68
lines changed

16 files changed

+95
-68
lines changed

agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ private void launchConsoleProxy(final byte[] ksBits, final String ksPassword, fi
331331
final Object resource = this;
332332
logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy");
333333
if (consoleProxyMain == null) {
334-
logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password={}", encryptorPassword);
334+
logger.info("Running com.cloud.consoleproxy.ConsoleProxy");
335335
consoleProxyMain = new Thread(new ManagedContextRunnable() {
336336
@Override
337337
protected void runInContext() {

engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@
4747
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
4848
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
4949
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
50+
import org.apache.cloudstack.secstorage.heuristics.HeuristicType;
5051
import org.apache.cloudstack.storage.RemoteHostEndPoint;
5152
import org.apache.cloudstack.storage.command.CopyCommand;
5253
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
5354
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
55+
import org.apache.cloudstack.storage.heuristics.HeuristicRuleHelper;
5456
import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity;
5557
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
5658
import org.apache.logging.log4j.Logger;
@@ -112,6 +114,9 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
112114
@Inject
113115
SnapshotDao snapshotDao;
114116

117+
@Inject
118+
HeuristicRuleHelper heuristicRuleHelper;
119+
115120
@Override
116121
public StrategyPriority canHandle(DataObject srcData, DataObject destData) {
117122
return StrategyPriority.DEFAULT;
@@ -379,7 +384,13 @@ protected Answer copyVolumeBetweenPools(DataObject srcData, DataObject destData)
379384
}
380385
// need to find a nfs or cifs image store, assuming that can't copy volume
381386
// directly to s3
382-
ImageStoreEntity imageStore = (ImageStoreEntity)dataStoreMgr.getImageStoreWithFreeCapacity(destScope.getScopeId());
387+
Long zoneId = destScope.getScopeId();
388+
ImageStoreEntity imageStore = (ImageStoreEntity) heuristicRuleHelper.getImageStoreIfThereIsHeuristicRule(zoneId, HeuristicType.VOLUME, destData);
389+
if (imageStore == null) {
390+
logger.debug("Secondary storage selector did not direct volume migration to a specific secondary storage; using secondary storage with the most free capacity.");
391+
imageStore = (ImageStoreEntity) dataStoreMgr.getImageStoreWithFreeCapacity(zoneId);
392+
}
393+
383394
if (imageStore == null || !imageStore.getProtocol().equalsIgnoreCase("nfs") && !imageStore.getProtocol().equalsIgnoreCase("cifs")) {
384395
String errMsg = "can't find a nfs (or cifs) image store to satisfy the need for a staging store";
385396
Answer answer = new Answer(null, false, errMsg);

plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
4646
com.trilead.ssh2.Connection sshConnection = null;
4747
try {
4848
super.configure(name, params);
49-
logger.debug(String.format("Trying to connect to DHCP server(IP=%1$s, username=%2$s, password=%3$s)", _ip, _username, _password));
49+
logger.debug(String.format("Trying to connect to DHCP server(IP=%1$s, username=%2$s", _ip, _username));
5050
sshConnection = SSHCmdHelper.acquireAuthorizedConnection(_ip, _username, _password);
5151
if (sshConnection == null) {
52-
throw new ConfigurationException(String.format("Cannot connect to DHCP server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
52+
throw new ConfigurationException(String.format("Cannot connect to DHCP server(IP=%1$s, username=%2$s", _ip, _username));
5353
}
5454

5555
if (!SSHCmdHelper.sshExecuteCmd(sshConnection, "[ -f '/usr/sbin/dnsmasq' ]")) {

plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ private Answer execute(VmDataCommand cmd) {
130130

131131
sshConnection.connect(null, 60000, 60000);
132132
if (!sshConnection.authenticateWithPassword(_username, _password)) {
133-
logger.debug("SSH Failed to authenticate");
134-
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
133+
logger.debug("SSH Failed to authenticate with user {} credentials", _username);
134+
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s", _ip, _username));
135135
}
136136

137137
String script = String.format("python /usr/bin/baremetal_user_data.py '%s'", arg);
@@ -167,7 +167,7 @@ private Answer execute(PrepareKickstartPxeServerCommand cmd) {
167167
sshConnection.connect(null, 60000, 60000);
168168
if (!sshConnection.authenticateWithPassword(_username, _password)) {
169169
logger.debug("SSH Failed to authenticate");
170-
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
170+
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s", _ip, _username));
171171
}
172172

173173
String copyTo = String.format("%s/%s", _tftpDir, cmd.getTemplateUuid());

plugins/hypervisors/baremetal/src/main/java/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
101101
sshConnection.connect(null, 60000, 60000);
102102
if (!sshConnection.authenticateWithPassword(_username, _password)) {
103103
logger.debug("SSH Failed to authenticate");
104-
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******"));
104+
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=******", _ip, _username));
105105
}
106106

107107
String cmd = String.format("[ -f /%1$s/pxelinux.0 ] && [ -f /%2$s/kernel ] && [ -f /%3$s/initrd.gz ] ", _tftpDir, _tftpDir, _tftpDir);
@@ -150,8 +150,8 @@ protected PreparePxeServerAnswer execute(PreparePxeServerCommand cmd) {
150150
try {
151151
sshConnection.connect(null, 60000, 60000);
152152
if (!sshConnection.authenticateWithPassword(_username, _password)) {
153-
logger.debug("SSH Failed to authenticate");
154-
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
153+
logger.debug("SSH Failed to authenticate with user {} credentials", _username);
154+
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s", _ip, _username));
155155
}
156156

157157
String script =
@@ -179,7 +179,7 @@ protected Answer execute(PrepareCreateTemplateCommand cmd) {
179179
sshConnection.connect(null, 60000, 60000);
180180
if (!sshConnection.authenticateWithPassword(_username, _password)) {
181181
logger.debug("SSH Failed to authenticate");
182-
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
182+
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s", _ip, _username));
183183
}
184184

185185
String script =
@@ -237,7 +237,7 @@ private Answer execute(VmDataCommand cmd) {
237237
sshConnection.connect(null, 60000, 60000);
238238
if (!sshConnection.authenticateWithPassword(_username, _password)) {
239239
logger.debug("SSH Failed to authenticate");
240-
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
240+
throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s", _ip, _username));
241241
}
242242

243243
String script = String.format("python /usr/bin/baremetal_user_data.py '%s'", arg);

plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ private boolean isKubernetesServiceNetworkOfferingConfigured(DataCenter zone, Lo
477477
logger.warn("Network offering: {} does not have necessary services to provision Kubernetes cluster", networkOffering);
478478
return false;
479479
}
480-
if (!networkOffering.isEgressDefaultPolicy()) {
480+
if (!networkOffering.isForVpc() && !networkOffering.isEgressDefaultPolicy()) {
481481
logger.warn("Network offering: {} has egress default policy turned off should be on to provision Kubernetes cluster", networkOffering);
482482
return false;
483483
}

server/src/main/java/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5427,6 +5427,7 @@ private void fillVMOrTemplateDetailOptions(final Map<String, List<String>> optio
54275427
options.put(VmDetailConstants.VIRTUAL_TPM_VERSION, Arrays.asList("1.2", "2.0"));
54285428
options.put(VmDetailConstants.GUEST_CPU_MODE, Arrays.asList("custom", "host-model", "host-passthrough"));
54295429
options.put(VmDetailConstants.GUEST_CPU_MODEL, Collections.emptyList());
5430+
options.put(VmDetailConstants.KVM_GUEST_OS_MACHINE_TYPE, Collections.emptyList());
54305431
options.put(VmDetailConstants.KVM_SKIP_FORCE_DISK_CONTROLLER, Arrays.asList("true", "false"));
54315432
}
54325433

server/src/main/java/com/cloud/network/element/VpcVirtualRouterElement.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,15 @@ public boolean applyNetworkACLs(final Network network, final List<? extends Netw
550550

551551
@Override
552552
public boolean reorderAclRules(Vpc vpc, List<? extends Network> networks, List<? extends NetworkACLItem> networkACLItems) {
553-
return true;
553+
boolean result = true;
554+
try {
555+
for (Network network : networks) {
556+
result = result && applyNetworkACLs(network, networkACLItems);
557+
}
558+
} catch (ResourceUnavailableException ex) {
559+
result = false;
560+
}
561+
return result;
554562
}
555563

556564
@Override

server/src/main/java/com/cloud/network/vpc/NetworkACLServiceImpl.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
109109
private NsxProviderDao nsxProviderDao;
110110
@Inject
111111
private NetrisProviderDao netrisProviderDao;
112+
@Inject
113+
private VpcManager vpcManager;
112114

113115
private String supportedProtocolsForAclRules = "tcp,udp,icmp,all";
114116

@@ -1037,13 +1039,20 @@ public NetworkACLItem moveNetworkAclRuleToNewPosition(MoveNetworkAclItemCmd move
10371039
if (Objects.isNull(vpc)) {
10381040
return networkACLItem;
10391041
}
1042+
List<NetworkVO> networks = _networkDao.listByAclId(lockedAcl.getId());
1043+
if (networks.isEmpty()) {
1044+
return networkACLItem;
1045+
}
1046+
10401047
final DataCenter dc = _entityMgr.findById(DataCenter.class, vpc.getZoneId());
10411048
final NsxProviderVO nsxProvider = nsxProviderDao.findByZoneId(dc.getId());
10421049
final NetrisProviderVO netrisProvider = netrisProviderDao.findByZoneId(dc.getId());
1043-
List<NetworkVO> networks = _networkDao.listByAclId(lockedAcl.getId());
1044-
if (ObjectUtils.anyNotNull(nsxProvider, netrisProvider) && !networks.isEmpty()) {
1050+
boolean isVpcNetworkACLProvider = vpcManager.isProviderSupportServiceInVpc(vpc.getId(), Network.Service.NetworkACL, Network.Provider.VPCVirtualRouter);
1051+
1052+
if (ObjectUtils.anyNotNull(nsxProvider, netrisProvider) || isVpcNetworkACLProvider) {
10451053
allAclRules = getAllAclRulesSortedByNumber(lockedAcl.getId());
1046-
Network.Provider networkProvider = nsxProvider != null ? Network.Provider.Nsx : Network.Provider.Netris;
1054+
Network.Provider networkProvider = isVpcNetworkACLProvider ? Network.Provider.VPCVirtualRouter
1055+
: (nsxProvider != null ? Network.Provider.Nsx : Network.Provider.Netris);
10471056
_networkAclMgr.reorderAclRules(vpc, networks, allAclRules, networkProvider);
10481057
}
10491058
return networkACLItem;

server/src/main/java/org/apache/cloudstack/storage/heuristics/HeuristicRuleHelper.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ protected void buildPresetVariables(JsInterpreter jsInterpreter, HeuristicType h
117117
accountId = ((SnapshotInfo) obj).getAccountId();
118118
break;
119119
case VOLUME:
120-
presetVariables.setVolume(setVolumePresetVariable((VolumeVO) obj));
121-
accountId = ((VolumeVO) obj).getAccountId();
120+
presetVariables.setVolume(setVolumePresetVariable((com.cloud.storage.Volume) obj));
121+
accountId = ((com.cloud.storage.Volume) obj).getAccountId();
122122
break;
123123
}
124124
presetVariables.setAccount(setAccountPresetVariable(accountId));
@@ -191,14 +191,14 @@ protected Template setTemplatePresetVariable(VMTemplateVO templateVO) {
191191
return template;
192192
}
193193

194-
protected Volume setVolumePresetVariable(VolumeVO volumeVO) {
195-
Volume volume = new Volume();
194+
protected Volume setVolumePresetVariable(com.cloud.storage.Volume volumeVO) {
195+
Volume volumePresetVariable = new Volume();
196196

197-
volume.setName(volumeVO.getName());
198-
volume.setFormat(volumeVO.getFormat());
199-
volume.setSize(volumeVO.getSize());
197+
volumePresetVariable.setName(volumeVO.getName());
198+
volumePresetVariable.setFormat(volumeVO.getFormat());
199+
volumePresetVariable.setSize(volumeVO.getSize());
200200

201-
return volume;
201+
return volumePresetVariable;
202202
}
203203

204204
protected Snapshot setSnapshotPresetVariable(SnapshotInfo snapshotInfo) {

0 commit comments

Comments
 (0)