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/4.2 to cfc85eb
Date Mon, 22 Jul 2013 14:10:23 GMT
Updated Branches:
  refs/heads/4.2 c09d76077 -> cfc85eb68


ui change: Disk I/O polling statistics


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

Branch: refs/heads/4.2
Commit: cfc85eb68f24817dc604aa36fb6944ffb210c9f3
Parents: c09d760
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Mon Jul 22 16:06:10 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Mon Jul 22 16:09:50 2013 +0200

----------------------------------------------------------------------
 .../xen/resource/CitrixResourceBase.java        | 79 --------------------
 ui/scripts/instances.js                         |  8 +-
 2 files changed, 4 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cfc85eb6/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 2bd1c0a..2399220 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -139,8 +139,6 @@ import com.cloud.agent.api.GetHostStatsAnswer;
 import com.cloud.agent.api.GetHostStatsCommand;
 import com.cloud.agent.api.GetStorageStatsAnswer;
 import com.cloud.agent.api.GetStorageStatsCommand;
-import com.cloud.agent.api.GetVmDiskStatsAnswer;
-import com.cloud.agent.api.GetVmDiskStatsCommand;
 import com.cloud.agent.api.GetVmStatsAnswer;
 import com.cloud.agent.api.GetVmStatsCommand;
 import com.cloud.agent.api.GetVncPortAnswer;
@@ -195,7 +193,6 @@ import com.cloud.agent.api.UnPlugNicAnswer;
 import com.cloud.agent.api.UnPlugNicCommand;
 import com.cloud.agent.api.UpdateHostPasswordCommand;
 import com.cloud.agent.api.UpgradeSnapshotCommand;
-import com.cloud.agent.api.VmDiskStatsEntry;
 import com.cloud.agent.api.VmStatsEntry;
 import com.cloud.agent.api.check.CheckSshAnswer;
 import com.cloud.agent.api.check.CheckSshCommand;
@@ -498,8 +495,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             return execute((GetHostStatsCommand) cmd);
         } else if (clazz == GetVmStatsCommand.class) {
             return execute((GetVmStatsCommand) cmd);
-        } else if (cmd instanceof GetVmDiskStatsCommand) {
-            return execute((GetVmDiskStatsCommand) cmd);
         } else if (clazz == CheckHealthCommand.class) {
             return execute((CheckHealthCommand) cmd);
         } else if (clazz == StopCommand.class) {
@@ -2636,80 +2631,6 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         return hostStats;
     }
 
-    protected GetVmDiskStatsAnswer execute( GetVmDiskStatsCommand cmd) {
-        Connection conn = getConnection();
-        List<String> vmNames = cmd.getVmNames();
-        HashMap<String, List<VmDiskStatsEntry>> vmDiskStatsNameMap = new HashMap<String,
List<VmDiskStatsEntry>>();
-        if( vmNames.size() == 0 ) {
-            return new GetVmDiskStatsAnswer(cmd, "", cmd.getHostName(),vmDiskStatsNameMap);
-        }
-        try {
-
-            // Determine the UUIDs of the requested VMs
-            List<String> vmUUIDs = new ArrayList<String>();
-
-            for (String vmName : vmNames) {
-                VM vm = getVM(conn, vmName);
-                vmUUIDs.add(vm.getUuid(conn));
-            }
-
-            HashMap<String, List<VmDiskStatsEntry>> vmDiskStatsUUIDMap = getVmDiskStats(conn,
cmd, vmUUIDs, cmd.getHostGuid());
-            if( vmDiskStatsUUIDMap == null ) {
-                return new GetVmDiskStatsAnswer(cmd, "", cmd.getHostName(), vmDiskStatsNameMap);
-            }
-
-            for (String vmUUID : vmDiskStatsUUIDMap.keySet()) {
-                List<VmDiskStatsEntry> vmDiskStatsUUID = vmDiskStatsUUIDMap.get(vmUUID);
-                String vmName = vmNames.get(vmUUIDs.indexOf(vmUUID));
-                for (VmDiskStatsEntry vmDiskStat : vmDiskStatsUUID) {
-                    vmDiskStat.setVmName(vmName);
-                }
-                vmDiskStatsNameMap.put(vmName, vmDiskStatsUUID);
-            }
-
-            return new GetVmDiskStatsAnswer(cmd, "", cmd.getHostName(),vmDiskStatsNameMap);
-        } catch (XenAPIException e) {
-            String msg = "Unable to get VM disk stats" + e.toString();
-            s_logger.warn(msg, e);
-            return new GetVmDiskStatsAnswer(cmd, "", cmd.getHostName(),vmDiskStatsNameMap);
-        } catch (XmlRpcException e) {
-            String msg = "Unable to get VM disk stats" + e.getMessage();
-            s_logger.warn(msg, e);
-            return new GetVmDiskStatsAnswer(cmd, "", cmd.getHostName(),vmDiskStatsNameMap);
-        }
-    }
-    
-    private HashMap<String, List<VmDiskStatsEntry>> getVmDiskStats(Connection
conn, GetVmDiskStatsCommand cmd, List<String> vmUUIDs, String hostGuid) {
-        HashMap<String, List<VmDiskStatsEntry>> vmResponseMap = new HashMap<String,
List<VmDiskStatsEntry>>();
-
-        for (String vmUUID : vmUUIDs) {
-            vmResponseMap.put(vmUUID, new ArrayList<VmDiskStatsEntry>());
-        }
-        
-        try {
-            for (String vmUUID : vmUUIDs) {
-                VM vm = VM.getByUuid(conn, vmUUID);
-                List<VmDiskStatsEntry> vmDiskStats = new ArrayList<VmDiskStatsEntry>();
-                for (VBD vbd : vm.getVBDs(conn)) {
-                    if (!vbd.getType(conn).equals(Types.VbdType.CD)) {
-                        VmDiskStatsEntry stats = new VmDiskStatsEntry();
-                        VBDMetrics record = vbd.getMetrics(conn);
-                        stats.setPath(vbd.getVDI(conn).getUuid(conn));
-                        stats.setBytesRead((long)(record.getIoReadKbs(conn) * 1024));
-                        stats.setBytesWrite((long)(record.getIoWriteKbs(conn) * 1024));
-                        vmDiskStats.add(stats);
-                    }
-                }
-                vmResponseMap.put(vmUUID, vmDiskStats);
-            }
-        } catch (Exception e) {
-            s_logger.warn("Error while collecting disk stats from : ", e);
-            return null;
-        }
-        
-        return vmResponseMap;
-    }
-
     protected GetVmStatsAnswer execute( GetVmStatsCommand cmd) {
         Connection conn = getConnection();
         List<String> vmNames = cmd.getVmNames();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cfc85eb6/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index c53223c..12adfbb 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -1831,10 +1831,10 @@
                                             cpuused: jsonObj.cpuused,
                                             networkkbsread: (jsonObj.networkkbsread == null)
? "N/A" : cloudStack.converters.convertBytes(jsonObj.networkkbsread * 1024),
                                             networkkbswrite: (jsonObj.networkkbswrite ==
null) ? "N/A" : cloudStack.converters.convertBytes(jsonObj.networkkbswrite * 1024),
-                                            diskkbsread: (jsonObj.diskkbsread == null) ?
"N/A" : cloudStack.converters.convertBytes(jsonObj.diskkbsread * 1024),
-                                            diskkbswrite: (jsonObj.diskkbswrite == null)
? "N/A" : cloudStack.converters.convertBytes(jsonObj.diskkbswrite * 1024),
-                                            diskioread: (jsonObj.diskioread == null) ? "N/A"
: jsonObj.diskioread,
-                                            diskiowrite: (jsonObj.diskiowrite == null) ?
"N/A" : jsonObj.diskiowrite
+                                            diskkbsread: (jsonObj.diskkbsread == null) ?
"N/A" : ((jsonObj.hypervisor == "KVM") ? cloudStack.converters.convertBytes(jsonObj.diskkbsread
* 1024) : ((jsonObj.hypervisor == "XenServer") ? cloudStack.converters.convertBytes(jsonObj.diskkbsread
* 1024) + "/s" : "N/A")),
+                                            diskkbswrite: (jsonObj.diskkbswrite == null)
? "N/A" : ((jsonObj.hypervisor == "KVM") ? cloudStack.converters.convertBytes(jsonObj.diskkbswrite
* 1024) : ((jsonObj.hypervisor == "XenServer") ? cloudStack.converters.convertBytes(jsonObj.diskkbswrite
* 1024) + "/s" : "N/A")),
+                                            diskioread: (jsonObj.diskioread == null) ? "N/A"
: ((jsonObj.hypervisor == "KVM") ? jsonObj.diskioread : "N/A"),
+                                            diskiowrite: (jsonObj.diskiowrite == null) ?
"N/A" : ((jsonObj.hypervisor == "KVM") ? jsonObj.diskiowrite : "N/A")
                                         }
                                     });
                                 }


Mime
View raw message