Revision e4157912 lib/hypervisor/hv_lxc.py
b/lib/hypervisor/hv_lxc.py | ||
---|---|---|
149 | 149 |
cgroup = cls._GetCgroupMountPoint() |
150 | 150 |
try: |
151 | 151 |
memory = int(utils.ReadFile(utils.PathJoin(cgroup, 'lxc', |
152 |
instance_name, |
|
153 |
"memory.limit_in_bytes"))) |
|
152 |
instance_name,
|
|
153 |
"memory.limit_in_bytes")))
|
|
154 | 154 |
except EnvironmentError: |
155 | 155 |
# memory resource controller may be disabled, ignore |
156 | 156 |
memory = 0 |
... | ... | |
161 | 161 |
"""Get the list of running instances. |
162 | 162 |
|
163 | 163 |
""" |
164 |
return [ iinfo[0] for iinfo in self.GetAllInstancesInfo() ]
|
|
164 |
return [iinfo[0] for iinfo in self.GetAllInstancesInfo()]
|
|
165 | 165 |
|
166 | 166 |
def GetInstanceInfo(self, instance_name): |
167 | 167 |
"""Get instance properties. |
... | ... | |
249 | 249 |
# Conditionally enable, memory resource controller might be disabled |
250 | 250 |
cgroup = self._GetCgroupMountPoint() |
251 | 251 |
if os.path.exists(utils.PathJoin(cgroup, 'memory.limit_in_bytes')): |
252 |
out.append("lxc.cgroup.memory.limit_in_bytes = %dM" %
|
|
253 |
instance.beparams[constants.BE_MAXMEM])
|
|
252 |
out.append("lxc.cgroup.memory.limit_in_bytes = %dM" % |
|
253 |
instance.beparams[constants.BE_MAXMEM]) |
|
254 | 254 |
|
255 | 255 |
if os.path.exists(utils.PathJoin(cgroup, 'memory.memsw.limit_in_bytes')): |
256 |
out.append("lxc.cgroup.memory.memsw.limit_in_bytes = %dM" %
|
|
257 |
instance.beparams[constants.BE_MAXMEM])
|
|
256 |
out.append("lxc.cgroup.memory.memsw.limit_in_bytes = %dM" % |
|
257 |
instance.beparams[constants.BE_MAXMEM]) |
|
258 | 258 |
|
259 | 259 |
# Device control |
260 | 260 |
# deny direct device access |
... | ... | |
355 | 355 |
result.output) |
356 | 356 |
|
357 | 357 |
if not os.path.ismount(root_dir): |
358 |
return
|
|
358 |
return |
|
359 | 359 |
|
360 | 360 |
for mpath in self._GetMountSubdirs(root_dir): |
361 | 361 |
result = utils.RunCmd(["umount", mpath]) |
Also available in: Unified diff