Revision 2c7a0373 lib/hypervisor/hv_xen.py
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
302 | 302 |
" did not reboot in the expected interval" % |
303 | 303 |
(instance.name, )) |
304 | 304 |
|
305 |
def BalloonInstanceMemory(self, instance, mem): |
|
306 |
"""Balloon an instance memory to a certain value. |
|
307 |
|
|
308 |
@type instance: L{objects.Instance} |
|
309 |
@param instance: instance to be accepted |
|
310 |
@type mem: int |
|
311 |
@param mem: actual memory size to use for instance runtime |
|
312 |
|
|
313 |
""" |
|
314 |
cmd = [constants.XEN_CMD, "mem-set", instance.name, mem] |
|
315 |
result = utils.RunCmd(cmd) |
|
316 |
if result.failed: |
|
317 |
raise errors.HypervisorError("Failed to balloon instance %s: %s (%s)" % |
|
318 |
(instance.name, result.fail_reason, |
|
319 |
result.output)) |
|
320 |
cmd = ["sed", "-ie", "s/^memory.*$/memory = %s/" % mem] |
|
321 |
cmd.append(XenHypervisor._ConfigFileName(instance.name)) |
|
322 |
result = utils.RunCmd(cmd) |
|
323 |
if result.failed: |
|
324 |
raise errors.HypervisorError("Failed to update memory for %s: %s (%s)" % |
|
325 |
(instance.name, result.fail_reason, |
|
326 |
result.output)) |
|
327 |
|
|
305 | 328 |
def GetNodeInfo(self): |
306 | 329 |
"""Return information about the node. |
307 | 330 |
|
Also available in: Unified diff