Skip to content

Commit f5ef4e6

Browse files
committed
kvm: remove unused methods from storage and utility classes
Each of these has no caller anywhere in the tree, tests included: LibvirtSecretDef: getEphemeral, getVolumeVolume, getCephName LibvirtStorageVolumeXMLParser: getBackingFileNameIfExists LibvirtStorageAdaptor: storagePoolRefresh KVMStorageProcessor: getDefaultStorageScriptsDir LibvirtMigrateCommandWrapper: hasClvmDestinationDisks MultipathSCSIAdapterBase / FiberChannelAdapter: isStoragePoolTypeSupported QemuImg: supportsSkipZeros KVMHostInfo: getTotalCpus
1 parent 1a598b7 commit f5ef4e6

9 files changed

Lines changed: 0 additions & 95 deletions

File tree

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtSecretDef.java‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ public LibvirtSecretDef(Usage usage, String uuid, String description) {
5151
_description = description;
5252
}
5353

54-
public boolean getEphemeral() {
55-
return _ephemeral;
56-
}
57-
5854
public void setEphemeral(boolean ephemeral) { _ephemeral = ephemeral; }
5955

6056
public boolean getPrivate() {
@@ -71,14 +67,6 @@ public String getDescription() {
7167
return _description;
7268
}
7369

74-
public String getVolumeVolume() {
75-
return _volumeVolume;
76-
}
77-
78-
public String getCephName() {
79-
return _cephName;
80-
}
81-
8270
public void setVolumeVolume(String volume) {
8371
_volumeVolume = volume;
8472
}

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeXMLParser.java‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,6 @@ public LibvirtStorageVolumeDef parseStorageVolumeXML(String volXML) {
6161
return null;
6262
}
6363

64-
public String getBackingFileNameIfExists(String volXML) {
65-
try {
66-
DocumentBuilder builder = ParserUtils.getSaferDocumentBuilderFactory().newDocumentBuilder();
67-
68-
InputSource is = new InputSource();
69-
is.setCharacterStream(new StringReader(volXML));
70-
Document doc = builder.parse(is);
71-
72-
Element rootElement = doc.getDocumentElement();
73-
Element backingStore = (Element)rootElement.getElementsByTagName("backingStore").item(0);
74-
if (backingStore != null) {
75-
String[] paths = getTagValue("path", backingStore).split("/");
76-
return paths[paths.length-1];
77-
}
78-
} catch (ParserConfigurationException | SAXException | IOException e) {
79-
logger.error(e.toString(), e);
80-
}
81-
return null;
82-
}
83-
8464
private static String getTagValue(String tag, Element eElement) {
8565
NodeList nlList = eElement.getElementsByTagName(tag).item(0).getChildNodes();
8666
Node nValue = nlList.item(0);

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,34 +1082,6 @@ public static String maskSensitiveInfoInXML(String xmlDesc) {
10821082
"$1*****$3");
10831083
}
10841084

1085-
/**
1086-
* Checks if any of the destination disks in the migration target a CLVM or CLVM_NG storage pool.
1087-
* This is used to determine if incremental migration should be disabled to avoid libvirt
1088-
* precreate errors with QCOW2-on-LVM setups.
1089-
*
1090-
* @param mapMigrateStorage the map containing migration disk information with destination pool types
1091-
* @return true if any destination disk targets CLVM or CLVM_NG, false otherwise
1092-
*/
1093-
protected boolean hasClvmDestinationDisks(Map<String, MigrateCommand.MigrateDiskInfo> mapMigrateStorage) {
1094-
if (MapUtils.isEmpty(mapMigrateStorage)) {
1095-
return false;
1096-
}
1097-
1098-
try {
1099-
for (Map.Entry<String, MigrateCommand.MigrateDiskInfo> entry : mapMigrateStorage.entrySet()) {
1100-
MigrateCommand.MigrateDiskInfo diskInfo = entry.getValue();
1101-
if (isClvmBlockDevice(diskInfo)) {
1102-
logger.debug("Found disk targeting CLVM/CLVM_NG destination pool");
1103-
return true;
1104-
}
1105-
}
1106-
} catch (final Exception e) {
1107-
logger.debug("Failed to check for CLVM destination disks: {}. Assuming no CLVM disks.", e.getMessage());
1108-
}
1109-
1110-
return false;
1111-
}
1112-
11131085
private boolean isClvmBlockDevice(MigrateCommand.MigrateDiskInfo diskInfo) {
11141086
if (diskInfo == null ||diskInfo.getDestPoolType() == null) {
11151087
return false;

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/FiberChannelAdapter.java‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,6 @@ public String getName() {
6969
return "FiberChannelAdapter";
7070
}
7171

72-
public boolean isStoragePoolTypeSupported(Storage.StoragePoolType type) {
73-
if (Storage.StoragePoolType.FiberChannel.equals(type)) {
74-
return true;
75-
}
76-
return false;
77-
}
78-
7972
@Override
8073
public AddressInfo parseAndValidatePath(String inPath) {
8174
// type=FIBERWWN; address=<address>; connid=<connid>

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,6 @@ public KVMStorageProcessor(final KVMStoragePoolManager storagePoolMgr, final Lib
262262
this.resource = resource;
263263
}
264264

265-
protected String getDefaultStorageScriptsDir() {
266-
return "scripts/storage/qcow2";
267-
}
268-
269265
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
270266
storageLayer = new JavaStorageLayer();
271267
storageLayer.configure("StorageLayer", params);

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,6 @@ public StorageVol createVolume(Connect conn, StoragePool pool, String uuid, long
282282
return pool.storageVolCreateXML(volDef.toString(), 0);
283283
}
284284

285-
public void storagePoolRefresh(StoragePool pool) {
286-
try {
287-
synchronized (getStoragePool(pool.getUUIDString())) {
288-
refreshPool(pool);
289-
}
290-
} catch (LibvirtException e) {
291-
logger.debug("refresh storage pool failed: " + e.toString());
292-
}
293-
}
294-
295285
private void checkNetfsStoragePoolMounted(String uuid) {
296286
String targetPath = _mountPoint + File.separator + uuid;
297287
int mountpointResult = Script.runSimpleBashScriptForExitValue("mountpoint -q " + targetPath);

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/MultipathSCSIAdapterBase.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ public KVMStoragePool getStoragePool(String uuid, boolean refreshInfo) {
139139

140140
public abstract String getName();
141141

142-
public abstract boolean isStoragePoolTypeSupported(Storage.StoragePoolType type);
143-
144142
public abstract AddressInfo parseAndValidatePath(String path);
145143

146144
@Override

‎plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux/KVMHostInfo.java‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ public KVMHostInfo(long reservedMemory, long overCommitMemory, long manualSpeed,
7474
}
7575
}
7676

77-
public int getTotalCpus() {
78-
return this.totalCpus;
79-
}
80-
8177
public int getAllocatableCpus() {
8278
return this.allocatableCpus;
8379
}

‎plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/qemu/QemuImg.java‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -999,14 +999,6 @@ protected Script createScript(String path, long timeout) {
999999
return new Script(path, timeout);
10001000
}
10011001

1002-
/**
1003-
* Does qemu-img support --target-is-zero
1004-
* @return boolean
1005-
*/
1006-
public boolean supportsSkipZeros() {
1007-
return this.skipZero;
1008-
}
1009-
10101002
public void setSkipZero(boolean skipZero) {
10111003
this.skipZero = skipZero;
10121004
}

0 commit comments

Comments
 (0)