Revision 098c0958 lib/backend.py
b/lib/backend.py | ||
---|---|---|
85 | 85 |
- adds the ssh-key |
86 | 86 |
- sets the node id |
87 | 87 |
- sets the node status to installed |
88 |
""" |
|
89 | 88 |
|
89 |
""" |
|
90 | 90 |
f = open("/etc/ssh/ssh_host_rsa_key", 'w') |
91 | 91 |
f.write(rsa) |
92 | 92 |
f.close() |
... | ... | |
159 | 159 |
memory_dom0 is the memory allocated for domain0 in MiB |
160 | 160 |
memory_free is the currently available (free) ram in MiB |
161 | 161 |
memory_total is the total number of ram in MiB |
162 |
""" |
|
163 | 162 |
|
163 |
""" |
|
164 | 164 |
outputarray = {} |
165 | 165 |
vginfo = _GetVGInfo(vgname) |
166 | 166 |
outputarray['vg_size'] = vginfo['vg_size'] |
... | ... | |
192 | 192 |
by ssh-execution of 'hostname', result compared against name in list. |
193 | 193 |
|
194 | 194 |
""" |
195 |
|
|
196 | 195 |
result = {} |
197 | 196 |
|
198 | 197 |
if 'hypervisor' in what: |
... | ... | |
289 | 288 |
A list of all running instances on the current node |
290 | 289 |
- instance1.example.com |
291 | 290 |
- instance2.example.com |
292 |
""" |
|
293 | 291 |
|
292 |
""" |
|
294 | 293 |
try: |
295 | 294 |
names = hypervisor.GetHypervisor().ListInstances() |
296 | 295 |
except errors.HypervisorError, err: |
... | ... | |
313 | 312 |
memory: memory size of instance (int) |
314 | 313 |
state: xen state of instance (string) |
315 | 314 |
time: cpu time of instance (float) |
316 |
""" |
|
317 | 315 |
|
316 |
""" |
|
318 | 317 |
output = {} |
319 | 318 |
|
320 | 319 |
iinfo = hypervisor.GetHypervisor().GetInstanceInfo(instance) |
... | ... | |
341 | 340 |
state: xen state of instance (string) |
342 | 341 |
time: cpu time of instance (float) |
343 | 342 |
vcpus: the number of cpus |
344 |
""" |
|
345 | 343 |
|
344 |
""" |
|
346 | 345 |
output = {} |
347 | 346 |
|
348 | 347 |
iinfo = hypervisor.GetHypervisor().GetAllInstancesInfo() |
... | ... | |
471 | 470 |
|
472 | 471 |
Args: |
473 | 472 |
instance - name of instance to start. |
474 |
""" |
|
475 | 473 |
|
474 |
""" |
|
476 | 475 |
running_instances = GetInstanceList() |
477 | 476 |
|
478 | 477 |
if instance.name in running_instances: |
... | ... | |
495 | 494 |
|
496 | 495 |
Args: |
497 | 496 |
instance - name of instance to shutdown. |
498 |
""" |
|
499 | 497 |
|
498 |
""" |
|
500 | 499 |
running_instances = GetInstanceList() |
501 | 500 |
|
502 | 501 |
if instance.name not in running_instances: |
... | ... | |
958 | 957 |
|
959 | 958 |
Returns: |
960 | 959 |
a config entry for the actual lvm device snapshotted. |
961 |
""" |
|
962 | 960 |
|
961 |
""" |
|
963 | 962 |
if disk.children: |
964 | 963 |
if len(disk.children) == 1: |
965 | 964 |
# only one child, let's recurse on it |
... | ... | |
993 | 992 |
|
994 | 993 |
Returns: |
995 | 994 |
True if successful, False otherwise. |
996 |
""" |
|
997 | 995 |
|
996 |
""" |
|
998 | 997 |
inst_os = OSFromDisk(instance.os) |
999 | 998 |
export_script = inst_os.export_script |
1000 | 999 |
|
... | ... | |
1050 | 1049 |
|
1051 | 1050 |
Returns: |
1052 | 1051 |
False in case of error, True otherwise. |
1053 |
""" |
|
1054 | 1052 |
|
1053 |
""" |
|
1055 | 1054 |
destdir = os.path.join(constants.EXPORT_DIR, instance.name + ".new") |
1056 | 1055 |
finaldestdir = os.path.join(constants.EXPORT_DIR, instance.name) |
1057 | 1056 |
|
... | ... | |
1108 | 1107 |
A serializable config file containing the export info. |
1109 | 1108 |
|
1110 | 1109 |
""" |
1111 |
|
|
1112 | 1110 |
cff = os.path.join(dest, constants.EXPORT_CONF_FILE) |
1113 | 1111 |
|
1114 | 1112 |
config = objects.SerializableConfigParser() |
... | ... | |
1135 | 1133 |
False in case of error, True otherwise. |
1136 | 1134 |
|
1137 | 1135 |
""" |
1138 |
|
|
1139 | 1136 |
inst_os = OSFromDisk(instance.os) |
1140 | 1137 |
import_script = inst_os.import_script |
1141 | 1138 |
|
... | ... | |
1195 | 1192 |
|
1196 | 1193 |
def ListExports(): |
1197 | 1194 |
"""Return a list of exports currently available on this machine. |
1195 |
|
|
1198 | 1196 |
""" |
1199 | 1197 |
if os.path.isdir(constants.EXPORT_DIR): |
1200 | 1198 |
return os.listdir(constants.EXPORT_DIR) |
... | ... | |
1210 | 1208 |
|
1211 | 1209 |
Returns: |
1212 | 1210 |
False in case of error, True otherwise. |
1213 |
""" |
|
1214 | 1211 |
|
1212 |
""" |
|
1215 | 1213 |
target = os.path.join(constants.EXPORT_DIR, export) |
1216 | 1214 |
|
1217 | 1215 |
shutil.rmtree(target) |
Also available in: Unified diff