Skip to content

Commit 276eb81

Browse files
committed
Merge remote-tracking branch 'apache/4.20' into 4.22
2 parents 4761935 + 70d4c9d commit 276eb81

File tree

7 files changed

+37
-22
lines changed

7 files changed

+37
-22
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);

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) {

utils/src/main/java/com/cloud/utils/UriUtils.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,12 @@ public static InputStream getInputStreamFromUrl(String url, String user, String
500500
if ((user != null) && (password != null)) {
501501
httpclient.getParams().setAuthenticationPreemptive(true);
502502
Credentials defaultcreds = new UsernamePasswordCredentials(user, password);
503-
httpclient.getState().setCredentials(new AuthScope(hostAndPort.first(), hostAndPort.second(), AuthScope.ANY_REALM), defaultcreds);
504-
LOGGER.info("Added username=" + user + ", password=" + password + "for host " + hostAndPort.first() + ":" + hostAndPort.second());
503+
httpclient.getState().setCredentials(
504+
new AuthScope(hostAndPort.first(), hostAndPort.second(), AuthScope.ANY_REALM), defaultcreds);
505+
LOGGER.info("Added username={} along with password for host {}:{}"
506+
, user
507+
, hostAndPort.first()
508+
, hostAndPort.second());
505509
}
506510
// Execute the method.
507511
GetMethod method = new GetMethod(url);

0 commit comments

Comments
 (0)