You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by we...@apache.org on 2024/12/06 07:51:50 UTC

(cloudstack) branch 4.20 updated: engine/schema: Add access modifier to `VolumeVO` (#9394)

This is an automated email from the ASF dual-hosted git repository.

weizhou pushed a commit to branch 4.20
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.20 by this push:
     new 810c4108c7b engine/schema: Add access modifier to `VolumeVO` (#9394)
810c4108c7b is described below

commit 810c4108c7b87e740c53e83ed5b5f54842e13598
Author: Felipe <12...@users.noreply.github.com>
AuthorDate: Fri Dec 6 04:51:42 2024 -0300

    engine/schema: Add access modifier to `VolumeVO` (#9394)
    
    * added private access modifiers to VolumeVO and fixed an occurrence where a field was being accessed without a getter
    
    * renamed the field hostip to hostIp and removed duplicated methods
    https://github.com/apache/cloudstack/pull/9394#issuecomment-2264816580
---
 .../src/main/java/com/cloud/storage/VolumeVO.java  | 58 +++++++++++-----------
 .../com/cloud/storage/VolumeApiServiceImpl.java    |  2 +-
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/engine/schema/src/main/java/com/cloud/storage/VolumeVO.java b/engine/schema/src/main/java/com/cloud/storage/VolumeVO.java
index 3e6999fad36..ea57ef91237 100644
--- a/engine/schema/src/main/java/com/cloud/storage/VolumeVO.java
+++ b/engine/schema/src/main/java/com/cloud/storage/VolumeVO.java
@@ -48,34 +48,34 @@ public class VolumeVO implements Volume {
     @TableGenerator(name = "volume_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "volume_seq", allocationSize = 1)
     @GeneratedValue(strategy = GenerationType.TABLE)
     @Column(name = "id")
-    long id;
+    private long id;
 
     @Column(name = "last_id")
     private long lastId;
 
     @Column(name = "name")
-    String name;
+    private String name;
 
     @Column(name = "pool_id")
-    Long poolId;
+    private Long poolId;
 
     @Column(name = "last_pool_id")
-    Long lastPoolId;
+    private Long lastPoolId;
 
     @Column(name = "account_id")
-    long accountId;
+    private long accountId;
 
     @Column(name = "domain_id")
-    long domainId;
+    private long domainId;
 
     @Column(name = "instance_id")
-    Long instanceId = null;
+    private Long instanceId = null;
 
     @Column(name = "device_id")
-    Long deviceId = null;
+    private Long deviceId = null;
 
     @Column(name = "size")
-    Long size;
+    private Long size;
 
     @Column(name = "min_iops")
     private Long minIops;
@@ -84,50 +84,50 @@ public class VolumeVO implements Volume {
     private Long maxIops;
 
     @Column(name = "folder")
-    String folder;
+    private String folder;
 
     @Column(name = "path")
-    String path;
+    private String path;
 
     @Column(name = "pod_id")
-    Long podId;
+    private Long podId;
 
     @Column(name = "created")
-    Date created;
+    private Date created;
 
     @Column(name = "attached")
     @Temporal(value = TemporalType.TIMESTAMP)
-    Date attached;
+    private Date attached;
 
     @Column(name = "data_center_id")
-    long dataCenterId;
+    private long dataCenterId;
 
     @Column(name = "host_ip")
-    String hostip;
+    private String hostIp;
 
     @Column(name = "disk_offering_id")
-    long diskOfferingId;
+    private long diskOfferingId;
 
     @Column(name = "template_id")
-    Long templateId;
+    private Long templateId;
 
     @Column(name = "first_snapshot_backup_uuid")
-    String firstSnapshotBackupUuid;
+    private String firstSnapshotBackupUuid;
 
     @Column(name = "volume_type")
     @Enumerated(EnumType.STRING)
-    Type volumeType = Volume.Type.UNKNOWN;
+    private Type volumeType = Volume.Type.UNKNOWN;
 
     @Column(name = "pool_type")
     @Convert(converter = StoragePoolTypeConverter.class)
-    StoragePoolType poolType;
+    private StoragePoolType poolType;
 
     @Column(name = GenericDao.REMOVED_COLUMN)
-    Date removed;
+    private Date removed;
 
     @Column(name = "updated")
     @Temporal(value = TemporalType.TIMESTAMP)
-    Date updated;
+    private Date updated;
 
     @Column(name = "update_count", updatable = true, nullable = false)
     protected long updatedCount; // This field should be updated everytime the
@@ -136,17 +136,17 @@ public class VolumeVO implements Volume {
                                  // dao code.
 
     @Column(name = "recreatable")
-    boolean recreatable;
+    private boolean recreatable;
 
     @Column(name = "state")
     @Enumerated(value = EnumType.STRING)
     private State state;
 
     @Column(name = "chain_info", length = 65535)
-    String chainInfo;
+    private String chainInfo;
 
     @Column(name = "uuid")
-    String uuid;
+    private String uuid;
 
     @Column(name = "format")
     private Storage.ImageFormat format;
@@ -171,7 +171,7 @@ public class VolumeVO implements Volume {
 
     @Transient
     // @Column(name="reservation")
-    String reservationId;
+    private String reservationId;
 
     @Column(name = "hv_ss_reserve")
     private Integer hypervisorSnapshotReserve;
@@ -431,11 +431,11 @@ public class VolumeVO implements Volume {
     }
 
     public String getHostIp() {
-        return hostip;
+        return hostIp;
     }
 
     public void setHostIp(String hostip) {
-        this.hostip = hostip;
+        this.hostIp = hostip;
     }
 
     public void setPodId(Long podId) {
diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
index b12575a8a08..689d159905f 100644
--- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
@@ -3388,7 +3388,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         }
         // In case of VMware, if ROOT volume is being cold-migrated, then ensure destination storage pool is in the same Datacenter as the VM.
         if (vm != null && vm.getHypervisorType().equals(HypervisorType.VMware)) {
-            if (!liveMigrateVolume && vol.volumeType.equals(Volume.Type.ROOT)) {
+            if (!liveMigrateVolume && vol.getVolumeType().equals(Volume.Type.ROOT)) {
                 Long hostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId();
                 HostVO host = _hostDao.findById(hostId);
                 if (host != null) {