cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject git commit: updated refs/heads/disk_io_stat to 385ca81
Date Fri, 31 May 2013 08:49:46 GMT
Updated Branches:
  refs/heads/disk_io_stat c30057635 -> 385ca81e0


CLOUDSTACK-1192: add RBD support


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

Branch: refs/heads/disk_io_stat
Commit: 385ca81e01754f0f65c18d32f0d35b41616498ac
Parents: c300576
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Fri May 31 10:49:35 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Fri May 31 10:49:35 2013 +0200

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java     |   23 +++++++++------
 1 files changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/385ca81e/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 46fce24..d402c61 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
@@ -189,6 +189,7 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ConsoleDef;
 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.deviceType;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskProtocol;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.FeaturesDef;
 import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.FilesystemDef;
@@ -4549,15 +4550,19 @@ ServerResource {
             List<DiskDef> disks = getDisks(conn, vmName);
 
             for (DiskDef disk : disks) {
-                DomainBlockStats blockStats = dm.blockStats(disk.getDiskLabel());
-                String path = disk.getDiskPath(); // for example, path = /mnt/pool_uuid/disk_path/
-                String diskPath = null;
-                if (path != null) {
-                    String[] token = path.split("/");
-                    if (token.length > 3) {
-                        diskPath = token[3];
-                        VmDiskStatsEntry stat = new VmDiskStatsEntry(vmName, diskPath, blockStats.wr_req,
blockStats.rd_req, blockStats.wr_bytes, blockStats.rd_bytes);
-                        stats.add(stat);
+                if (disk.getDeviceType().equals(deviceType.DISK)) {
+                    DomainBlockStats blockStats = dm.blockStats(disk.getDiskLabel());
+                    String path = disk.getDiskPath();
+                    String diskPath = null;
+                    if (path != null) {
+                        if (path.startsWith("rbd:"))    // path = rbd:/mnt/pool_uuid/disk_path/
+                            path = path.replace("rbd:", "");
+                        String[] token = path.split("/"); // path = /mnt/pool_uuid/disk_path/
+                        if (token.length > 3) {
+                            diskPath = token[3];
+                            VmDiskStatsEntry stat = new VmDiskStatsEntry(vmName, diskPath,
blockStats.wr_req, blockStats.rd_req, blockStats.wr_bytes, blockStats.rd_bytes);
+                            stats.add(stat);
+                        }
                     }
                 }
             }


Mime
View raw message