Skip to content

Commit 4004dfc

Browse files
authored
StorPool storage plugin (#6007)
* StorPool storage plugin Adds volume storage plugin for StorPool SDS * Added support for alternative endpoint Added option to switch to alternative endpoint for SP primary storage * renamed all classes from Storpool to StorPool * Address review * removed unnecessary else * Removed check about the storage provider We don't need this check, we'll get if the snapshot is on StorPool be its name from path * Check that current plugin supports all functionality before upgrade CS * Smoke tests for StorPool plug-in * Fixed conflicts * Fixed conflicts and added missed Apache license header * Removed whitespaces in smoke tests * Added StorPool plugin jar for Debian the StorPool jar will be included into cloudstack-agent package for Debian/Ubuntu
1 parent 9067938 commit 4004dfc

60 files changed

Lines changed: 11084 additions & 5 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.

client/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@
9797
<artifactId>cloud-plugin-storage-volume-linstor</artifactId>
9898
<version>${project.version}</version>
9999
</dependency>
100+
<dependency>
101+
<groupId>org.apache.cloudstack</groupId>
102+
<artifactId>cloud-plugin-storage-volume-storpool</artifactId>
103+
<version>${project.version}</version>
104+
</dependency>
100105
<dependency>
101106
<groupId>org.apache.cloudstack</groupId>
102107
<artifactId>cloud-server</artifactId>
@@ -755,6 +760,12 @@
755760
<artifactId>bcpkix-jdk15on</artifactId>
756761
<overWrite>false</overWrite>
757762
<outputDirectory>${project.build.directory}/lib</outputDirectory>
763+
</artifactItem>
764+
<artifactItem>
765+
<groupId>org.apache.cloudstack</groupId>
766+
<artifactId>cloud-plugin-storage-volume-storpool</artifactId>
767+
<overWrite>false</overWrite>
768+
<outputDirectory>${project.build.directory}/lib</outputDirectory>
758769
</artifactItem>
759770
<artifactItem>
760771
<groupId>org.bouncycastle</groupId>
@@ -799,6 +810,7 @@
799810
<exclude>org.bouncycastle:bcpkix-jdk15on</exclude>
800811
<exclude>org.bouncycastle:bctls-jdk15on</exclude>
801812
<exclude>mysql:mysql-connector-java</exclude>
813+
<exclude>org.apache.cloudstack:cloud-plugin-storage-volume-storpool</exclude>
802814
</excludes>
803815
</artifactSet>
804816
<transformers>

core/src/main/java/org/apache/cloudstack/storage/command/CopyCmdAnswer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.apache.cloudstack.storage.command;
2121

2222
import com.cloud.agent.api.Answer;
23+
import com.cloud.agent.api.Command;
2324
import com.cloud.agent.api.to.DataTO;
2425

2526
public class CopyCmdAnswer extends Answer {
@@ -37,4 +38,8 @@ public DataTO getNewData() {
3738
public CopyCmdAnswer(String errMsg) {
3839
super(null, false, errMsg);
3940
}
41+
42+
public CopyCmdAnswer(Command cmd, Exception e) {
43+
super(cmd, e);
44+
}
4045
}

debian/rules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ override_dh_auto_install:
4141
mkdir $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib
4242
install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-$(VERSION).jar $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
4343
install -D plugins/hypervisors/kvm/target/dependencies/* $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
44+
install -D plugins/storage/volume/storpool/target/cloud-plugin-storage-volume-storpool-$(VERSION).jar $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
4445

4546
install -d -m0755 debian/$(PACKAGE)-agent/lib/systemd/system
4647
install -m0644 packaging/systemd/$(PACKAGE)-agent.service debian/$(PACKAGE)-agent/lib/systemd/system/$(PACKAGE)-agent.service

engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,33 @@ enum QualityOfServiceState { MIGRATION, NO_MIGRATION }
103103
* returns true if the host can access the storage pool
104104
*/
105105
boolean canHostAccessStoragePool(Host host, StoragePool pool);
106+
107+
/**
108+
* Used by storage pools which want to keep VMs' information
109+
* @return true if additional VM info is needed (intended for storage pools).
110+
*/
111+
boolean isVmInfoNeeded();
112+
113+
/**
114+
* Provides additional info for a VM (intended for storage pools).
115+
* E.g. the storage pool may want to keep/delete information if the volume is attached/detached to any VM.
116+
* @param vmId The ID of the virtual machine
117+
* @param volumeId the ID of the volume
118+
*/
119+
void provideVmInfo(long vmId, long volumeId);
120+
121+
/**
122+
* Returns true if the storage have to know about the VM's tags (intended for storage pools).
123+
* @param tagKey The name of the tag
124+
* @return true if the storage have to know about the VM's tags
125+
*/
126+
boolean isVmTagsNeeded(String tagKey);
127+
128+
/**
129+
* Provide VM's tags to storage (intended for storage pools).
130+
* @param vmId The ID of the virtual machine
131+
* @param volumeId The ID of the volume
132+
* @param tagValue The value of the VM's tag
133+
*/
134+
void provideVmTags(long vmId, long volumeId, String tagValue);
106135
}

engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/StorageStrategyFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ public interface StorageStrategyFactory {
3939
/**
4040
* Used only for KVM hypervisors when allocating a VM snapshot
4141
* @param vmId the ID of the virtual machine
42+
* @param rootPoolId volume pool ID
4243
* @param snapshotMemory for VM snapshots with memory
4344
* @return VMSnapshotStrategy
4445
*/
4546
VMSnapshotStrategy getVmSnapshotStrategy(Long vmId, Long rootPoolId, boolean snapshotMemory);
46-
4747
}

engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/VMSnapshotStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public interface VMSnapshotStrategy {
3030
StrategyPriority canHandle(VMSnapshot vmSnapshot);
3131

3232
/**
33-
* Used only for KVM hypervisors when allocating a VM snapshot
33+
* Verifies if the strategy can handle the VM snapshot. This method is used only for KVM hypervisors when allocating a VM snapshot.
3434
* @param vmId the ID of the virtual machine
3535
* @param snapshotMemory for VM snapshots with memory
3636
* @return StrategyPriority

engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
import com.cloud.storage.DiskOfferingVO;
5353
import com.cloud.storage.GuestOSHypervisorVO;
5454
import com.cloud.storage.GuestOSVO;
55-
import com.cloud.storage.VolumeVO;
5655
import com.cloud.storage.Storage.ImageFormat;
56+
import com.cloud.storage.VolumeVO;
5757
import com.cloud.storage.dao.DiskOfferingDao;
5858
import com.cloud.storage.dao.GuestOSDao;
5959
import com.cloud.storage.dao.GuestOSHypervisorDao;

packaging/centos7/cloud.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ install -D agent/target/transformed/cloudstack-agent-profile.sh ${RPM_BUILD_ROOT
351351
install -D agent/target/transformed/cloudstack-agent.logrotate ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}-agent
352352
install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%name-agent/lib/cloud-plugin-hypervisor-kvm-%{_maventag}.jar
353353
cp plugins/hypervisors/kvm/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib
354+
cp plugins/storage/volume/storpool/target/*.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib
354355

355356
# Usage server
356357
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/usage

packaging/centos8/cloud.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ install -D agent/target/transformed/cloudstack-agent-profile.sh ${RPM_BUILD_ROOT
344344
install -D agent/target/transformed/cloudstack-agent.logrotate ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}-agent
345345
install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%name-agent/lib/cloud-plugin-hypervisor-kvm-%{_maventag}.jar
346346
cp plugins/hypervisors/kvm/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib
347+
cp plugins/storage/volume/storpool/target/*.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib
347348

348349
# Usage server
349350
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/usage

packaging/suse15/cloud.spec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ install -D agent/target/transformed/cloudstack-agent-profile.sh ${RPM_BUILD_ROOT
346346
install -D agent/target/transformed/cloudstack-agent.logrotate ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}-agent
347347
install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%name-agent/lib/cloud-plugin-hypervisor-kvm-%{_maventag}.jar
348348
cp plugins/hypervisors/kvm/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib
349+
cp plugins/storage/volume/storpool/target/*.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib
349350

350351
# Usage server
351352
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/usage

0 commit comments

Comments
 (0)