Revision c41eea6e lib/hypervisor/hv_kvm.py
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
105 | 105 |
def ListInstances(self): |
106 | 106 |
"""Get the list of running instances. |
107 | 107 |
|
108 |
We can do this by listing our live instances directory and checking whether
|
|
109 |
the associated kvm process is still alive. |
|
108 |
We can do this by listing our live instances directory and |
|
109 |
checking whether the associated kvm process is still alive.
|
|
110 | 110 |
|
111 | 111 |
""" |
112 | 112 |
result = [] |
... | ... | |
119 | 119 |
def GetInstanceInfo(self, instance_name): |
120 | 120 |
"""Get instance properties. |
121 | 121 |
|
122 |
Args: |
|
123 |
instance_name: the instance name |
|
122 |
@param instance_name: the instance name |
|
123 |
|
|
124 |
@return: tuple (name, id, memory, vcpus, stat, times) |
|
124 | 125 |
|
125 |
Returns: |
|
126 |
(name, id, memory, vcpus, stat, times) |
|
127 | 126 |
""" |
128 | 127 |
pidfile = "%s/%s" % (self._PIDS_DIR, instance_name) |
129 | 128 |
pid = utils.ReadPidFile(pidfile) |
... | ... | |
159 | 158 |
def GetAllInstancesInfo(self): |
160 | 159 |
"""Get properties of all instances. |
161 | 160 |
|
162 |
Returns:
|
|
163 |
[(name, id, memory, vcpus, stat, times),...] |
|
161 |
@return: list of tuples (name, id, memory, vcpus, stat, times)
|
|
162 |
|
|
164 | 163 |
""" |
165 | 164 |
data = [] |
166 | 165 |
for name in os.listdir(self._PIDS_DIR): |
... | ... | |
288 | 287 |
def GetNodeInfo(self): |
289 | 288 |
"""Return information about the node. |
290 | 289 |
|
291 |
The return value is a dict, which has to have the following items: |
|
292 |
(all values in MiB) |
|
293 |
- memory_total: the total memory size on the node |
|
294 |
- memory_free: the available memory on the node for instances |
|
295 |
- memory_dom0: the memory used by the node itself, if available |
|
290 |
@return: a dict with the following keys (values in MiB): |
|
291 |
- memory_total: the total memory size on the node |
|
292 |
- memory_free: the available memory on the node for instances |
|
293 |
- memory_dom0: the memory used by the node itself, if available |
|
296 | 294 |
|
297 | 295 |
""" |
298 | 296 |
# global ram usage from the xm info command |
Also available in: Unified diff