core-admin/dom0/qmemman/qmemman_client.py
2010-08-30 11:40:19 +02:00

17 lines
421 B
Python
Executable File

import socket
class QMemmanClient:
def request_memory(self, amount):
self.sock = socket.socket(socket.AF_UNIX)
self.sock.connect("/var/run/qubes/qmemman.sock")
self.sock.send(str(amount)+"\n")
self.received = self.sock.recv(1024).strip()
if self.received == 'OK':
return True
else:
return False
def close(self):
self.sock.close()