cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject git commit: updated refs/heads/disk-cache to 26f8443
Date Thu, 01 Aug 2013 16:32:38 GMT
Updated Branches:
  refs/heads/disk-cache [created] 26f8443a6


CLOUDSTACK-1302: Initial work on disk cache settings

Per disk offering the setting none, writeback or writethrough can be set


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/26f8443a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/26f8443a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/26f8443a

Branch: refs/heads/disk-cache
Commit: 26f8443a619015429333b16bc5fc52f44cdcb2c0
Parents: 7b35260
Author: Wido den Hollander <wido@widodh.nl>
Authored: Thu Aug 1 16:49:15 2013 +0200
Committer: Wido den Hollander <wido@widodh.nl>
Committed: Thu Aug 1 18:32:17 2013 +0200

----------------------------------------------------------------------
 api/src/com/cloud/agent/api/to/VolumeTO.java    |  9 ++++++
 api/src/com/cloud/offering/DiskOffering.java    |  4 +++
 api/src/com/cloud/vm/DiskProfile.java           |  9 ++++++
 .../api/response/DiskOfferingResponse.java      | 11 +++++++
 .../cloud/agent/api/AttachVolumeCommand.java    |  9 ++++++
 .../cloudstack/storage/to/VolumeObjectTO.java   | 10 +++++++
 .../subsystem/api/storage/VolumeInfo.java       |  2 ++
 .../src/com/cloud/storage/DiskOfferingVO.java   | 31 ++++++++++++++++++++
 .../cloudstack/storage/volume/VolumeObject.java |  9 ++++++
 .../kvm/resource/LibvirtComputingResource.java  | 13 ++++++--
 .../kvm/resource/LibvirtDomainXMLParser.java    |  8 ++++-
 .../hypervisor/kvm/resource/LibvirtVMDef.java   | 24 ++++++++++++++-
 .../api/query/dao/DiskOfferingJoinDaoImpl.java  |  1 +
 .../cloud/api/query/vo/DiskOfferingJoinVO.java  | 11 +++++++
 setup/db/db/schema-420to430.sql                 |  2 ++
 15 files changed, 149 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/api/src/com/cloud/agent/api/to/VolumeTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/VolumeTO.java b/api/src/com/cloud/agent/api/to/VolumeTO.java
index a5681a0..ba792b5 100644
--- a/api/src/com/cloud/agent/api/to/VolumeTO.java
+++ b/api/src/com/cloud/agent/api/to/VolumeTO.java
@@ -41,6 +41,7 @@ public class VolumeTO implements InternalIdentity {
     private Long bytesWriteRate;
     private Long iopsReadRate;
     private Long iopsWriteRate;
+    private String cacheMode;
     private Long chainSize;
 
     public VolumeTO(long id, Volume.Type type, StoragePoolType poolType, String poolUuid,
String name, String mountPoint, String path, long size, String chainInfo) {
@@ -172,6 +173,14 @@ public class VolumeTO implements InternalIdentity {
         return iopsWriteRate;
     }
 
+    public void setCacheMode(String cacheMode) {
+        this.cacheMode = cacheMode;
+    }
+
+    public String getCacheMode() {
+        return cacheMode;
+    }
+
     public Long getChainSize() {
         return chainSize;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/api/src/com/cloud/offering/DiskOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/DiskOffering.java b/api/src/com/cloud/offering/DiskOffering.java
index 9c196e0..2bdefb6 100644
--- a/api/src/com/cloud/offering/DiskOffering.java
+++ b/api/src/com/cloud/offering/DiskOffering.java
@@ -80,4 +80,8 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
     void setIopsWriteRate(Long iopsWriteRate);
 
     Long getIopsWriteRate();
+
+    String getCacheMode();
+
+    void setCacheMode(String cacheMode);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/api/src/com/cloud/vm/DiskProfile.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/DiskProfile.java b/api/src/com/cloud/vm/DiskProfile.java
index 3d4c9e7..4412e3f 100644
--- a/api/src/com/cloud/vm/DiskProfile.java
+++ b/api/src/com/cloud/vm/DiskProfile.java
@@ -39,6 +39,7 @@ public class DiskProfile {
     private Long bytesWriteRate;
     private Long iopsReadRate;
     private Long iopsWriteRate;
+    private String cacheMode;
 
     private HypervisorType hyperType;
 
@@ -190,4 +191,12 @@ public class DiskProfile {
     public Long getIopsWriteRate() {
         return iopsWriteRate;
     }
+
+    public void setCacheMode(String cacheMode) {
+        this.cacheMode = cacheMode;
+    }
+
+    public String getCacheMode() {
+        return cacheMode;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
index 4291d85..8649890 100644
--- a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
@@ -79,6 +79,9 @@ public class DiskOfferingResponse extends BaseResponse {
     @SerializedName("diskIopsWriteRate") @Param(description="io requests write rate of the
disk offering")
     private Long iopsWriteRate;
 
+    @SerializedName("cacheMode") @Param(description="the cache mode to use for this disk
offering. none, writeback or writethrough")
+    private String cacheMode;
+
     @SerializedName("displayoffering") @Param(description="whether to display the offering
to the end user or not.")
     private Boolean displayOffering;
 
@@ -187,6 +190,14 @@ public class DiskOfferingResponse extends BaseResponse {
         this.maxIops = maxIops;
     }
 
+    public String getCacheMode() {
+        return this.cacheMode;
+    }
+
+    public void setCacheMode(String cacheMode) {
+        this.cacheMode = cacheMode;
+    }
+
     public String getStorageType() {
         return storageType;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/core/src/com/cloud/agent/api/AttachVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/AttachVolumeCommand.java b/core/src/com/cloud/agent/api/AttachVolumeCommand.java
index 49b2a70..c5d3ab0 100644
--- a/core/src/com/cloud/agent/api/AttachVolumeCommand.java
+++ b/core/src/com/cloud/agent/api/AttachVolumeCommand.java
@@ -39,6 +39,7 @@ public class AttachVolumeCommand extends Command {
     private Long bytesWriteRate;
     private Long iopsReadRate;
     private Long iopsWriteRate;
+    private String cacheMode;
 
     protected AttachVolumeCommand() {
     }
@@ -196,4 +197,12 @@ public class AttachVolumeCommand extends Command {
     public Long getIopsWriteRate() {
         return iopsWriteRate;
     }
+
+    public void setCacheMode(String cacheMode) {
+        this.cacheMode = cacheMode;
+    }
+
+    public String getCacheMode() {
+        return cacheMode;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java b/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
index 9f466ae..5009f66 100644
--- a/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
+++ b/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
@@ -42,6 +42,7 @@ public class VolumeObjectTO implements DataTO {
     private Long bytesWriteRate;
     private Long iopsReadRate;
     private Long iopsWriteRate;
+    private String cacheMode;
     private Hypervisor.HypervisorType hypervisorType;
 
     public VolumeObjectTO() {
@@ -69,6 +70,7 @@ public class VolumeObjectTO implements DataTO {
         this.bytesWriteRate = volume.getBytesWriteRate();
         this.iopsReadRate = volume.getIopsReadRate();
         this.iopsWriteRate = volume.getIopsWriteRate();
+        this.cacheMode = volume.getCacheMode();
         this.hypervisorType = volume.getHypervisorType();
     }
 
@@ -220,4 +222,12 @@ public class VolumeObjectTO implements DataTO {
         return iopsWriteRate;
     }
 
+    public void setCacheMode(String cacheMode) {
+        this.cacheMode = cacheMode;
+    }
+
+    public String getCacheMode() {
+        return cacheMode;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
index 3b4aba9..d9b6d25 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
@@ -45,4 +45,6 @@ public interface VolumeInfo extends DataObject, Volume {
     Long getBytesWriteRate();
     Long getIopsReadRate();
     Long getIopsWriteRate();
+
+    String getCacheMode();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
index 975619f..87715c5 100755
--- a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
+++ b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
@@ -118,6 +118,9 @@ public class DiskOfferingVO implements DiskOffering {
     @Column(name="iops_write_rate")
     Long iopsWriteRate;
 
+    @Column(name="cache_mode")
+    private String cacheMode;
+
     @Column(name="display_offering")
     boolean displayOffering = true;
 
@@ -126,6 +129,24 @@ public class DiskOfferingVO implements DiskOffering {
     }
 
     public DiskOfferingVO(Long domainId, String name, String displayText, long diskSize,
String tags, boolean isCustomized,
+            Boolean isCustomizedIops, Long minIops, Long maxIops, String cacheMode) {
+        this.domainId = domainId;
+        this.name = name;
+        this.displayText = displayText;
+        this.diskSize = diskSize;
+        this.tags = tags;
+        this.recreatable = false;
+        this.type = Type.Disk;
+        this.useLocalStorage = false;
+        this.customized = isCustomized;
+        this.uuid = UUID.randomUUID().toString();
+        this.customizedIops = isCustomizedIops;
+        this.minIops = minIops;
+        this.maxIops = maxIops;
+        this.cacheMode = cacheMode;
+    }
+
+    public DiskOfferingVO(Long domainId, String name, String displayText, long diskSize,
String tags, boolean isCustomized,
     		Boolean isCustomizedIops, Long minIops, Long maxIops) {
         this.domainId = domainId;
         this.name = name;
@@ -216,6 +237,16 @@ public class DiskOfferingVO implements DiskOffering {
         this.maxIops = maxIops;
     }
 
+    @Override
+    public String getCacheMode() {
+        return cacheMode;
+    }
+
+    @Override
+    public void setCacheMode(String cacheMode) {
+        this.cacheMode = cacheMode;
+    }
+
 	@Override
     public String getUniqueName() {
         return uniqueName;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
index b5968b6..2724be3 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
@@ -204,6 +204,15 @@ public class VolumeObject implements VolumeInfo {
         return null;
     }
 
+    @Override
+    public String getCacheMode() {
+        DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
+        if (diskOfferingVO != null) {
+            return diskOfferingVO.getCacheMode();
+        }
+        return null;
+    }
+
     public void update() {
         volumeDao.update(volumeVO.getId(), volumeVO);
         volumeVO = volumeDao.findById(volumeVO.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index d5a213f..b8b7970 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -195,6 +195,7 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.CpuTuneDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DevicesDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskProtocol;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskCacheMode;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.FeaturesDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.FilesystemDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GraphicDef;
@@ -1435,6 +1436,7 @@ ServerResource {
             volume.setBytesWriteRate(dskch.getBytesWriteRate());
             volume.setIopsReadRate(dskch.getIopsReadRate());
             volume.setIopsWriteRate(dskch.getIopsWriteRate());
+            volume.setCacheMode(dskch.getCacheMode());
             return new CreateAnswer(cmd, volume);
         } catch (CloudRuntimeException e) {
             s_logger.debug("Failed to create volume: " + e.toString());
@@ -2672,7 +2674,8 @@ ServerResource {
                     cmd.getPoolUuid());
             KVMPhysicalDisk disk = primary.getPhysicalDisk(cmd.getVolumePath());
             attachOrDetachDisk(conn, cmd.getAttach(), cmd.getVmName(), disk,
-                    cmd.getDeviceId().intValue(), cmd.getBytesReadRate(), cmd.getBytesWriteRate(),
cmd.getIopsReadRate(), cmd.getIopsWriteRate());
+                    cmd.getDeviceId().intValue(), cmd.getBytesReadRate(), cmd.getBytesWriteRate(),
cmd.getIopsReadRate(), cmd.getIopsWriteRate(),
+                    cmd.getCacheMode());
         } catch (LibvirtException e) {
             return new AttachVolumeAnswer(cmd, e.toString());
         } catch (InternalErrorException e) {
@@ -3566,6 +3569,8 @@ ServerResource {
                     disk.setIopsReadRate(volumeObjectTO.getIopsReadRate());
                 if ((volumeObjectTO.getIopsWriteRate() != null) && (volumeObjectTO.getIopsWriteRate()
> 0))
                     disk.setIopsWriteRate(volumeObjectTO.getIopsWriteRate());
+                if (volumeObjectTO.getCacheMode() != null)
+                    disk.setCacheMode(DiskDef.diskCacheMode.valueOf(volumeObjectTO.getCacheMode()));
             }
             vm.getDevices().addDevice(disk);
         }
@@ -3692,7 +3697,7 @@ ServerResource {
 
     protected synchronized String attachOrDetachDisk(Connect conn,
             boolean attach, String vmName, KVMPhysicalDisk attachingDisk,
-            int devId, Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate)
throws LibvirtException, InternalErrorException {
+            int devId, Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate,
String cacheMode) throws LibvirtException, InternalErrorException {
         List<DiskDef> disks = null;
         Domain dm = null;
         DiskDef diskdef = null;
@@ -3740,6 +3745,10 @@ ServerResource {
                     diskdef.setIopsReadRate(iopsReadRate);
                 if ((iopsWriteRate != null) && (iopsWriteRate > 0))
                     diskdef.setIopsWriteRate(iopsWriteRate);
+
+                if (cacheMode != null) {
+                    diskdef.setCacheMode(DiskDef.diskCacheMode.valueOf(cacheMode));
+                }
             }
 
             String xml = diskdef.toString();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
index a283768..d0b0b61 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
@@ -36,6 +36,7 @@ import org.xml.sax.SAXException;
 
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskProtocol;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskCacheMode;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.nicModel;
 
@@ -69,6 +70,7 @@ public class LibvirtDomainXMLParser {
                 DiskDef def = new DiskDef();
                 if (type.equalsIgnoreCase("network")) {
                     String diskFmtType = getAttrValue("driver", "type", disk);
+                    String diskCacheMode = getAttrValue("driver", "cache", disk);
                     String diskPath = getAttrValue("source", "name", disk);
                     String protocol = getAttrValue("source", "protocol", disk);
                     String authUserName = getAttrValue("auth", "username", disk);
@@ -78,9 +80,12 @@ public class LibvirtDomainXMLParser {
                     String diskLabel = getAttrValue("target", "dev", disk);
                     String bus = getAttrValue("target", "bus", disk);
                     def.defNetworkBasedDisk(diskPath, host, port, authUserName, poolUuid,
diskLabel,
-                                            DiskDef.diskBus.valueOf(bus.toUpperCase()), DiskDef.diskProtocol.valueOf(protocol.toUpperCase()));
+                                            DiskDef.diskBus.valueOf(bus.toUpperCase()),
+                                            DiskDef.diskProtocol.valueOf(protocol.toUpperCase()));
+                    def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode));
                 } else {
                     String diskFmtType = getAttrValue("driver", "type", disk);
+                    String diskCacheMode = getAttrValue("driver", "cache", disk);
                     String diskFile = getAttrValue("source", "file", disk);
                     String diskDev = getAttrValue("source", "dev", disk);
 
@@ -103,6 +108,7 @@ public class LibvirtDomainXMLParser {
                     } else if (type.equalsIgnoreCase("block")) {
                         def.defBlockBasedDisk(diskDev, diskLabel,
                                 DiskDef.diskBus.valueOf(bus.toUpperCase()));
+                        def.setCacheMode(DiskDef.diskCacheMode.valueOf(diskCacheMode));
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 5120870..b0e8bba 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -427,6 +427,23 @@ public class LibvirtVMDef {
             }
         }
 
+        public enum diskCacheMode {
+            NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough");
+            String _diskCacheMode;
+
+            diskCacheMode(String cacheMode) {
+                _diskCacheMode = cacheMode;
+            }
+
+            @Override
+            public String toString() {
+                if (_diskCacheMode == null) {
+                    return "none";
+                }
+                return _diskCacheMode;
+            }
+        }
+
         private deviceType _deviceType; /* floppy, disk, cdrom */
         private diskType _diskType;
         private diskProtocol _diskProtocol;
@@ -445,6 +462,7 @@ public class LibvirtVMDef {
         private Long _bytesWriteRate;
         private Long _iopsReadRate;
         private Long _iopsWriteRate;
+        private diskCacheMode _diskCacheMode;
 
         public void setDeviceType(deviceType deviceType) {
             _deviceType = deviceType;
@@ -606,6 +624,10 @@ public class LibvirtVMDef {
             _iopsWriteRate = iopsWriteRate;
         }
 
+        public void setCacheMode(diskCacheMode cacheMode) {
+            _diskCacheMode = cacheMode;
+        }
+
         @Override
         public String toString() {
             StringBuilder diskBuilder = new StringBuilder();
@@ -616,7 +638,7 @@ public class LibvirtVMDef {
             diskBuilder.append(" type='" + _diskType + "'");
             diskBuilder.append(">\n");
             diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType
-                    + "' cache='none' " + "/>\n");
+                    + "' cache='" + _diskCacheMode + "' " + "/>\n");
             if (_diskType == diskType.FILE) {
                 diskBuilder.append("<source ");
                 if (_sourcePath != null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
index 385ca36..15d03a2 100644
--- a/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
@@ -82,6 +82,7 @@ public class DiskOfferingJoinDaoImpl extends GenericDaoBase<DiskOfferingJoinVO,
         diskOfferingResponse.setBytesWriteRate(offering.getBytesWriteRate());
         diskOfferingResponse.setIopsReadRate(offering.getIopsReadRate());
         diskOfferingResponse.setIopsWriteRate(offering.getIopsWriteRate());
+        diskOfferingResponse.setCacheMode(offering.getCacheMode());
         diskOfferingResponse.setObjectName("diskoffering");
 
         return diskOfferingResponse;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
index 58e8370..a1bd16c 100644
--- a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
@@ -85,6 +85,9 @@ public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity,
     @Column(name="iops_write_rate")
     Long iopsWriteRate;
 
+    @Column(name="cache_mode")
+    String cacheMode;
+
     @Column(name="type")
     Type type;
 
@@ -212,6 +215,14 @@ public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity,
         this.maxIops = maxIops;
     }
 
+    public String getCacheMode() {
+        return cacheMode;
+    }
+
+    public void setCacheMode(String cacheMode) {
+        this.cacheMode = cacheMode;
+    }
+
     public boolean isDisplayOffering() {
         return displayOffering;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26f8443a/setup/db/db/schema-420to430.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-420to430.sql b/setup/db/db/schema-420to430.sql
index 3f7ef09..9ae0326 100644
--- a/setup/db/db/schema-420to430.sql
+++ b/setup/db/db/schema-420to430.sql
@@ -21,3 +21,5 @@
 
 -- Disable foreign key checking
 SET foreign_key_checks = 0;
+
+ALTER TABLE `disk_offering` ADD `cache_mode` VARCHAR( 16 ) NOT NULL DEFAULT 'none' COMMENT
'The disk cache mode to use for disks created with this offering';
\ No newline at end of file


Mime
View raw message