Francesco Romani has uploaded a new change for review.
Change subject: profiling: memory: profile snapshots in vdsClient
......................................................................
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(a)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/25/47625/1
diff --git a/client/vdsClient.py b/client/vdsClient.py
index fe263f2..739374b 100755
--- a/client/vdsClient.py
+++ b/client/vdsClient.py
@@ -1596,6 +1596,13 @@
return stats['status']['code'],
stats['status']['message']
return 0, ''
+ def do_memoryProfileSnapshot(self):
+ stats = self.s.memoryProfileSnapshot()
+ if stats['status']['code']:
+ return stats['status']['code'],
stats['status']['message']
+ print 'snapshot saved on host on %s' % stats['name']
+ return 0, ''
+
def do_setMOMPolicy(self, policyFile):
stats = self.s.setMOMPolicy(policyFile)
if stats['status']['code']:
@@ -2635,6 +2642,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 0b5c8f7..1345dd8 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -51,6 +51,7 @@
from virt.vmdevices import hwclass
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 hooks
@@ -1409,6 +1410,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 c521cd8..c0212df 100644
--- a/vdsm/rpc/bindingxmlrpc.py
+++ b/vdsm/rpc/bindingxmlrpc.py
@@ -649,6 +649,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)
@@ -1088,6 +1092,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/47625
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8c7c5a074953bd54a8c2704d8aa2b074e277fdde
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>