Revision d0c8c01d lib/hypervisor/hv_xen.py
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
46 | 46 |
REBOOT_RETRY_INTERVAL = 10 |
47 | 47 |
|
48 | 48 |
ANCILLARY_FILES = [ |
49 |
'/etc/xen/xend-config.sxp',
|
|
50 |
'/etc/xen/scripts/vif-bridge',
|
|
49 |
"/etc/xen/xend-config.sxp",
|
|
50 |
"/etc/xen/scripts/vif-bridge",
|
|
51 | 51 |
] |
52 | 52 |
|
53 | 53 |
@classmethod |
... | ... | |
142 | 142 |
" line: %s, error: %s" % (line, err)) |
143 | 143 |
|
144 | 144 |
# skip the Domain-0 (optional) |
145 |
if include_node or data[0] != 'Domain-0':
|
|
145 |
if include_node or data[0] != "Domain-0":
|
|
146 | 146 |
result.append(data) |
147 | 147 |
|
148 | 148 |
return result |
... | ... | |
275 | 275 |
if len(splitfields) > 1: |
276 | 276 |
key = splitfields[0].strip() |
277 | 277 |
val = splitfields[1].strip() |
278 |
if key == 'memory' or key == 'total_memory':
|
|
279 |
result['memory_total'] = int(val)
|
|
280 |
elif key == 'free_memory':
|
|
281 |
result['memory_free'] = int(val)
|
|
282 |
elif key == 'nr_cpus':
|
|
283 |
nr_cpus = result['cpu_total'] = int(val)
|
|
284 |
elif key == 'nr_nodes':
|
|
285 |
result['cpu_nodes'] = int(val)
|
|
286 |
elif key == 'cores_per_socket':
|
|
278 |
if key == "memory" or key == "total_memory":
|
|
279 |
result["memory_total"] = int(val)
|
|
280 |
elif key == "free_memory":
|
|
281 |
result["memory_free"] = int(val)
|
|
282 |
elif key == "nr_cpus":
|
|
283 |
nr_cpus = result["cpu_total"] = int(val)
|
|
284 |
elif key == "nr_nodes":
|
|
285 |
result["cpu_nodes"] = int(val)
|
|
286 |
elif key == "cores_per_socket":
|
|
287 | 287 |
cores_per_socket = int(val) |
288 |
elif key == 'threads_per_core':
|
|
288 |
elif key == "threads_per_core":
|
|
289 | 289 |
threads_per_core = int(val) |
290 | 290 |
|
291 | 291 |
if (cores_per_socket is not None and |
292 | 292 |
threads_per_core is not None and nr_cpus is not None): |
293 |
result['cpu_sockets'] = nr_cpus / (cores_per_socket * threads_per_core)
|
|
293 |
result["cpu_sockets"] = nr_cpus / (cores_per_socket * threads_per_core)
|
|
294 | 294 |
|
295 | 295 |
dom0_info = self.GetInstanceInfo("Domain-0") |
296 | 296 |
if dom0_info is not None: |
297 |
result['memory_dom0'] = dom0_info[2]
|
|
297 |
result["memory_dom0"] = dom0_info[2]
|
|
298 | 298 |
|
299 | 299 |
return result |
300 | 300 |
|
... | ... | |
344 | 344 |
if len(block_devices) > 24: |
345 | 345 |
# 'z' - 'a' = 24 |
346 | 346 |
raise errors.HypervisorError("Too many disks") |
347 |
namespace = [blockdev_prefix + chr(i + ord('a')) for i in range(24)]
|
|
347 |
namespace = [blockdev_prefix + chr(i + ord("a")) for i in range(24)]
|
|
348 | 348 |
for sd_name, (cfdev, dev_path) in zip(namespace, block_devices): |
349 | 349 |
if cfdev.mode == constants.DISK_RDWR: |
350 | 350 |
mode = "w" |
Also available in: Unified diff