Skip to content

Commit 8534d77

Browse files
committed
Update remaining files
1 parent b903796 commit 8534d77

File tree

47 files changed

+340
-234
lines changed

Some content is hidden

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

47 files changed

+340
-234
lines changed

api/src/main/java/org/apache/cloudstack/cluster/ClusterDrsAlgorithm.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import com.cloud.host.Host;
2323
import com.cloud.offering.ServiceOffering;
24+
import com.cloud.org.Cluster;
2425
import com.cloud.utils.Pair;
2526
import com.cloud.utils.Ternary;
2627
import com.cloud.utils.component.Adapter;
@@ -55,8 +56,8 @@ public interface ClusterDrsAlgorithm extends Adapter {
5556
* @throws ConfigurationException
5657
* if there is an error in the configuration
5758
*/
58-
boolean needsDrs(long clusterId, List<Ternary<Long, Long, Long>> cpuList,
59-
List<Ternary<Long, Long, Long>> memoryList) throws ConfigurationException;
59+
boolean needsDrs(Cluster cluster, List<Ternary<Long, Long, Long>> cpuList,
60+
List<Ternary<Long, Long, Long>> memoryList) throws ConfigurationException;
6061

6162

6263
/**
@@ -79,7 +80,7 @@ boolean needsDrs(long clusterId, List<Ternary<Long, Long, Long>> cpuList,
7980
*
8081
* @return a ternary containing improvement, cost, benefit
8182
*/
82-
Ternary<Double, Double, Double> getMetrics(long clusterId, VirtualMachine vm, ServiceOffering serviceOffering,
83+
Ternary<Double, Double, Double> getMetrics(Cluster cluster, VirtualMachine vm, ServiceOffering serviceOffering,
8384
Host destHost, Map<Long, Ternary<Long, Long, Long>> hostCpuMap,
8485
Map<Long, Ternary<Long, Long, Long>> hostMemoryMap,
8586
Boolean requiresStorageMotion) throws ConfigurationException;

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,22 @@
1919
package org.apache.cloudstack.engine.subsystem.api.storage;
2020

2121
import com.cloud.exception.StorageConflictException;
22+
import com.cloud.host.Host;
23+
import com.cloud.storage.StoragePool;
2224

2325
public interface HypervisorHostListener {
2426
boolean hostAdded(long hostId);
2527

28+
default boolean hostConnect(Host host, StoragePool pool) throws StorageConflictException {
29+
return hostConnect(host.getId(), pool.getId());
30+
}
31+
2632
boolean hostConnect(long hostId, long poolId) throws StorageConflictException;
2733

34+
default boolean hostDisconnected(Host host, StoragePool pool) throws StorageConflictException {
35+
return hostDisconnected(host.getId(), pool.getId());
36+
}
37+
2838
boolean hostDisconnected(long hostId, long poolId);
2939

3040
boolean hostAboutToBeRemoved(long hostId);

engine/components-api/src/main/java/com/cloud/storage/StorageManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static Boolean getFullCloneConfiguration(Long storeId) {
367367

368368
boolean connectHostToSharedPool(Host host, long poolId) throws StorageUnavailableException, StorageConflictException;
369369

370-
void disconnectHostFromSharedPool(long hostId, long poolId) throws StorageUnavailableException, StorageConflictException;
370+
void disconnectHostFromSharedPool(Host host, StoragePool pool) throws StorageUnavailableException, StorageConflictException;
371371

372372
void enableHost(long hostId) throws StorageUnavailableException, StorageConflictException;
373373

engine/schema/src/main/java/com/cloud/vm/snapshot/VMSnapshotVO.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.apache.cloudstack.engine.subsystem.api.storage.VMSnapshotOptions;
3737

3838
import com.cloud.utils.db.GenericDao;
39+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
3940

4041
@Entity
4142
@Table(name = "vm_snapshots")
@@ -145,6 +146,13 @@ public VMSnapshotVO(Long accountId, Long domainId, Long vmId, String description
145146
this.serviceOfferingId = serviceOfferingId;
146147
}
147148

149+
@Override
150+
public String toString() {
151+
return String.format("VMSnapshot %s",
152+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
153+
this, "id", "uuid", "name", "vmId"));
154+
}
155+
148156
@Override
149157
public String getDescription() {
150158
return description;

engine/schema/src/main/java/org/apache/cloudstack/cluster/ClusterDrsPlanMigrationVO.java

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

2222
import org.apache.cloudstack.jobs.JobInfo;
23+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2324

2425
import javax.persistence.Column;
2526
import javax.persistence.Entity;
@@ -66,6 +67,13 @@ protected ClusterDrsPlanMigrationVO() {
6667

6768
}
6869

70+
@Override
71+
public String toString() {
72+
return String.format("ClusterDrsPlanMigration %s",
73+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
74+
this, "id", "planId", "vmId", "jobId"));
75+
}
76+
6977
public long getId() {
7078
return id;
7179
}

engine/schema/src/main/java/org/apache/cloudstack/cluster/ClusterDrsPlanVO.java

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

2222
import com.cloud.utils.db.GenericDao;
23+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2324

2425
import javax.persistence.Column;
2526
import javax.persistence.Entity;
@@ -68,6 +69,13 @@ protected ClusterDrsPlanVO() {
6869
uuid = UUID.randomUUID().toString();
6970
}
7071

72+
@Override
73+
public String toString() {
74+
return String.format("ClusterDrsPlan %s",
75+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
76+
this, "id", "uuid", "clusterId"));
77+
}
78+
7179
public long getId() {
7280
return id;
7381
}

engine/schema/src/main/java/org/apache/cloudstack/network/BgpPeerVO.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import javax.persistence.Table;
2929

3030
import com.cloud.utils.db.GenericDao;
31+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
3132

3233
@Entity
3334
@Table(name = "bgp_peers")
@@ -83,7 +84,9 @@ public BgpPeerVO(long dcId, String ip4Address, String ip6Address, Long asNumber,
8384

8485
@Override
8586
public String toString() {
86-
return String.format("BgpPeerVO [%s|%s|%s]", asNumber, ip4Address, ip6Address);
87+
return String.format("BgpPeer %s",
88+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
89+
this, "id", "uuid", "asNumber", "ip4Address", "ip6Address"));
8790
}
8891

8992
@Override

engine/schema/src/main/java/org/apache/cloudstack/storage/sharedfs/SharedFSVO.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.UUID;
2424

2525
import com.cloud.utils.db.GenericDao;
26+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2627

2728
import javax.persistence.Column;
2829
import javax.persistence.Entity;
@@ -120,6 +121,13 @@ public SharedFSVO(String name, String description, long domainId, long accountId
120121
this.uuid = UUID.randomUUID().toString();
121122
}
122123

124+
@Override
125+
public String toString() {
126+
return String.format("SharedFS %s",
127+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
128+
this, "id", "name", "uuid"));
129+
}
130+
123131
@Override
124132
public Class<?> getEntityType() {
125133
return SharedFS.class;

engine/schema/src/main/java/org/apache/cloudstack/vm/schedule/VMScheduleVO.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.apache.cloudstack.vm.schedule;
2020

2121
import com.cloud.utils.db.GenericDao;
22+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
2223

2324
import javax.persistence.Column;
2425
import javax.persistence.Entity;
@@ -95,6 +96,11 @@ public VMScheduleVO(long vmId, String description, String schedule, String timeZ
9596
this.enabled = enabled;
9697
}
9798

99+
@Override
100+
public String toString() {
101+
return String.format("VMSchedule %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "uuid", "action", "description"));
102+
}
103+
98104
@Override
99105
public String getUuid() {
100106
return uuid;

engine/schema/src/main/java/org/apache/cloudstack/vm/schedule/VMScheduledJobVO.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
package org.apache.cloudstack.vm.schedule;
2020

21+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
22+
2123
import javax.persistence.Column;
2224
import javax.persistence.Entity;
2325
import javax.persistence.EnumType;
@@ -71,6 +73,14 @@ public VMScheduledJobVO(long vmId, long vmScheduleId, VMSchedule.Action action,
7173
this.scheduledTime = scheduledTime;
7274
}
7375

76+
77+
@Override
78+
public String toString() {
79+
return String.format("VMScheduledJob %s",
80+
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
81+
this, "id", "uuid", "action", "vmScheduleId", "vmId"));
82+
}
83+
7484
@Override
7585
public String getUuid() {
7686
return uuid;

0 commit comments

Comments
 (0)