Skip to content

Commit 6da46f7

Browse files
committed
Remove agent commands that the management server stopped sending
These commands belong to the storage model that predates the storage subsystem introduced in 4.2. Nothing in the management server creates or subclasses any of them any more, so the handlers in every hypervisor resource were unreachable: AttachIsoCommand, BackupSnapshotCommand, CheckConsoleProxyLoadCommand, WatchConsoleProxyLoadCommand, CheckStorageAvailabilityCommand, CreateCommand, CreatePrivateTemplateFromSnapshotCommand, CreatePrivateTemplateFromVolumeCommand, CreateVolumeFromSnapshotCommand, ManageSnapshotCommand, PrimaryStorageDownloadCommand, RebootRouterCommand, UpgradeSnapshotCommand Removed with them: - the Answer classes only they produced: AttachIsoAnswer, BackupSnapshotAnswer, CreateAnswer, CreateVolumeFromSnapshotAnswer, ManageSnapshotAnswer, CreatePrivateTemplateAnswer. PrimaryStorageDownloadAnswer stays, the KVM storage processor still uses it as a plain failure answer. - the XenServer wrappers and the VMware, simulator and console proxy handlers, the corresponding VmwareStorageManager and mock manager methods, and the dispatch branches that routed to them. - the execute(PrimaryStorageDownloadCommand) method of the StoragePoolResource interface and the CreateCommand entry in AgentAttache's list of commands refused while connecting. - the unit tests in core, XenServer, Hyper-V and KVM that built these commands. - the ManagedNFS storage pool type. Its only adaptor was removed earlier and no code has ever created a pool of that type. Not touched: the ovm and ovm3 plugins, which are not part of the build and still reference these classes; the Hyper-V .NET agent, which has its own C# handlers for CreateCommand and PrimaryStorageDownloadCommand; and log messages and configuration descriptions that merely mention the old command names. The vmware plugin needs the non redistributable vSphere SDK to compile, which is not available in this build environment; its changes were reviewed but not compiled.
1 parent cc2fd2d commit 6da46f7

52 files changed

Lines changed: 11 additions & 3646 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,11 @@
1616
// under the License.
1717
package com.cloud.agent.resource.consoleproxy;
1818

19-
import java.io.BufferedReader;
2019
import java.io.BufferedWriter;
2120
import java.io.FileWriter;
2221
import java.io.IOException;
23-
import java.io.InputStream;
24-
import java.io.InputStreamReader;
2522
import java.lang.reflect.InvocationTargetException;
2623
import java.lang.reflect.Method;
27-
import java.net.URL;
28-
import java.net.URLConnection;
2924
import java.util.HashMap;
3025
import java.util.Map;
3126
import java.util.Properties;
@@ -49,10 +44,7 @@
4944
import com.cloud.agent.api.ReadyCommand;
5045
import com.cloud.agent.api.StartupCommand;
5146
import com.cloud.agent.api.StartupProxyCommand;
52-
import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand;
53-
import com.cloud.agent.api.proxy.ConsoleProxyLoadAnswer;
5447
import com.cloud.agent.api.proxy.StartConsoleProxyAgentHttpHandlerCommand;
55-
import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand;
5648
import com.cloud.exception.AgentControlChannelException;
5749
import com.cloud.host.Host;
5850
import com.cloud.host.Host.Type;
@@ -94,11 +86,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
9486

9587
@Override
9688
public Answer executeRequest(final Command cmd) {
97-
if (cmd instanceof CheckConsoleProxyLoadCommand) {
98-
return execute((CheckConsoleProxyLoadCommand)cmd);
99-
} else if (cmd instanceof WatchConsoleProxyLoadCommand) {
100-
return execute((WatchConsoleProxyLoadCommand)cmd);
101-
} else if (cmd instanceof ReadyCommand) {
89+
if (cmd instanceof ReadyCommand) {
10290
logger.info("Receive ReadyCommand, response with ReadyAnswer");
10391
return new ReadyAnswer((ReadyCommand)cmd);
10492
} else if (cmd instanceof CheckHealthCommand) {
@@ -142,51 +130,6 @@ private void disableRpFilter() {
142130
}
143131
}
144132

145-
protected Answer execute(final CheckConsoleProxyLoadCommand cmd) {
146-
return executeProxyLoadScan(cmd, cmd.getProxyVmId(), cmd.getProxyVmName(), cmd.getProxyManagementIp(), cmd.getProxyCmdPort());
147-
}
148-
149-
protected Answer execute(final WatchConsoleProxyLoadCommand cmd) {
150-
return executeProxyLoadScan(cmd, cmd.getProxyVmId(), cmd.getProxyVmName(), cmd.getProxyManagementIp(), cmd.getProxyCmdPort());
151-
}
152-
153-
private Answer executeProxyLoadScan(final Command cmd, final long proxyVmId, final String proxyVmName, final String proxyManagementIp, final int cmdPort) {
154-
String result = null;
155-
156-
final StringBuffer sb = new StringBuffer();
157-
sb.append("http://").append(proxyManagementIp).append(":" + cmdPort).append("/cmd/getstatus");
158-
159-
boolean success = true;
160-
try {
161-
final URL url = new URL(sb.toString());
162-
final URLConnection conn = url.openConnection();
163-
164-
final InputStream is = conn.getInputStream();
165-
final BufferedReader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
166-
final StringBuilder sb2 = new StringBuilder();
167-
String line = null;
168-
try {
169-
while ((line = reader.readLine()) != null)
170-
sb2.append(line + "\n");
171-
result = sb2.toString();
172-
} catch (final IOException e) {
173-
success = false;
174-
} finally {
175-
try {
176-
is.close();
177-
} catch (final IOException e) {
178-
logger.warn("Exception when closing , console proxy address: {}", proxyManagementIp);
179-
success = false;
180-
}
181-
}
182-
} catch (final IOException e) {
183-
logger.warn("Unable to open console proxy command port url, console proxy address: {}", proxyManagementIp);
184-
success = false;
185-
}
186-
187-
return new ConsoleProxyLoadAnswer(cmd, proxyVmId, proxyVmName, success, result);
188-
}
189-
190133
@Override
191134
protected String getDefaultScriptsDir() {
192135
return null;

‎api/src/main/java/com/cloud/storage/Storage.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ public static enum StoragePoolType {
181181
SMB(true, false, EncryptionSupport.Unsupported),
182182
Gluster(true, false, EncryptionSupport.Unsupported),
183183
PowerFlex(true, true, EncryptionSupport.Hypervisor), // Dell EMC PowerFlex/ScaleIO (formerly VxFlexOS)
184-
ManagedNFS(true, false, EncryptionSupport.Unsupported),
185184
Linstor(true, true, EncryptionSupport.Storage),
186185
DatastoreCluster(true, true, EncryptionSupport.Unsupported), // for VMware, to abstract pool of clusters
187186
StorPool(true, true, EncryptionSupport.Hypervisor),

‎api/src/test/java/com/cloud/storage/StorageTest.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public void isSharedStoragePool() {
4646
Assert.assertTrue(StoragePoolType.OCFS2.isShared());
4747
Assert.assertTrue(StoragePoolType.SMB.isShared());
4848
Assert.assertTrue(StoragePoolType.Gluster.isShared());
49-
Assert.assertTrue(StoragePoolType.ManagedNFS.isShared());
5049
Assert.assertTrue(StoragePoolType.DatastoreCluster.isShared());
5150
Assert.assertTrue(StoragePoolType.Linstor.isShared());
5251
}
@@ -70,7 +69,6 @@ public void supportsOverProvisioningTestAllStoragePoolTypes() {
7069
Assert.assertFalse(StoragePoolType.OCFS2.supportsOverProvisioning());
7170
Assert.assertFalse(StoragePoolType.SMB.supportsOverProvisioning());
7271
Assert.assertFalse(StoragePoolType.Gluster.supportsOverProvisioning());
73-
Assert.assertFalse(StoragePoolType.ManagedNFS.supportsOverProvisioning());
7472
Assert.assertTrue(StoragePoolType.DatastoreCluster.supportsOverProvisioning());
7573
Assert.assertTrue(StoragePoolType.Linstor.supportsOverProvisioning());
7674
}

‎core/src/main/java/com/cloud/agent/api/AttachIsoAnswer.java‎

Lines changed: 0 additions & 55 deletions
This file was deleted.

‎core/src/main/java/com/cloud/agent/api/AttachIsoCommand.java‎

Lines changed: 0 additions & 86 deletions
This file was deleted.

‎core/src/main/java/com/cloud/agent/api/BackupSnapshotAnswer.java‎

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)