Change in vdsm[ovirt-3.5]: WIP profiling: memory: profile snapshots in vdsClient

fromani at redhat.com fromani at redhat.com
Tue Feb 16 10:41:07 UTC 2016


Francesco Romani has uploaded a new change for review.

Change subject: WIP profiling: memory: profile snapshots in vdsClient
......................................................................

WIP profiling: memory: profile snapshots in vdsClient

** WORK IN PROGRESS **
Add the ability to take memory snapshots in vdsClient.

Change-Id: I8c7c5a074953bd54a8c2704d8aa2b074e277fdde
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M client/vdsClient.py
M vdsm/API.py
M vdsm/rpc/BindingXMLRPC.py
3 files changed, 23 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/96/47596/2

diff --git a/client/vdsClient.py b/client/vdsClient.py
index e06137d..4379f3e 100644
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -1493,6 +1493,13 @@
             return stats['status']['code'], stats['status']['message']
         return 0, ''
 
+    def do_memoryProfileSnapshot(self, args):
+        stats = self.s.memoryProfileSnapshot()
+        if stats['status']['code']:
+            return stats['status']['code'], stats['status']['message']
+        print 'snapshot saved on host on %s' % stats['snapshot']
+        return 0, ''
+
     def do_setMOMPolicy(self, policyFile):
         stats = self.s.setMOMPolicy(policyFile)
         if stats['status']['code']:
@@ -2425,6 +2432,11 @@
                         ('<level> [logName][,logName]...', 'set log verbosity'
                          ' level (10=DEBUG, 50=CRITICAL'
                          )),
+        'memoryProfileSnapshot': (serv.do_memoryProfileSnapshot,
+                        ('',
+                         'save memory profile snapshot for later '
+                         'inspection')),
+
         'setMOMPolicy': (serv.do_setMOMPolicy,
                          ('<policyfile>', 'set MOM policy')),
         'setMOMPolicyParameters': (serv.do_setMOMPolicyParameters,
diff --git a/vdsm/API.py b/vdsm/API.py
index e5a224f..60c509f 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -46,6 +46,7 @@
 from virt import vmstatus
 from vdsm.compat import pickle
 from vdsm.define import doneCode, errCode, Kbytes, Mbytes
+from vdsm.profiling import memory
 import caps
 from vdsm.config import config
 import ksm
@@ -1362,6 +1363,11 @@
 
         return dict(status=doneCode)
 
+    def memoryProfileSnapshot(self):
+        name = memory.snapshot()
+        logging.debug('saved memory profiling snapshot on %s', name)
+        return {'status': doneCode, 'snapshot': name}
+
     # VM-related functions
     def getVMList(self, fullStatus=False, vmList=(), onlyUUID=False):
         """ return a list of known VMs with full (or partial) config each """
diff --git a/vdsm/rpc/BindingXMLRPC.py b/vdsm/rpc/BindingXMLRPC.py
index 2f12eb8..1367e31 100644
--- a/vdsm/rpc/BindingXMLRPC.py
+++ b/vdsm/rpc/BindingXMLRPC.py
@@ -571,6 +571,10 @@
         api = API.Global()
         return api.setLogLevel(level)
 
+    def memoryProfileSnapshot(self):
+        api = API.Global()
+        return api.memoryProfileSnapshot()
+
     def setMOMPolicy(self, policy):
         api = API.Global()
         return api.setMOMPolicy(policy)
@@ -997,6 +1001,7 @@
                 (self.addNetwork, 'addNetwork'),
                 (self.delNetwork, 'delNetwork'),
                 (self.editNetwork, 'editNetwork'),
+                (self.memoryProfileSnapshot, 'memoryProfileSnapshot'),
                 (self.setupNetworks, 'setupNetworks'),
                 (self.ping, 'ping'),
                 (self.setSafeNetworkConfig, 'setSafeNetworkConfig'),


-- 
To view, visit https://gerrit.ovirt.org/47596
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8c7c5a074953bd54a8c2704d8aa2b074e277fdde
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the vdsm-patches mailing list