Revision d15a9ad3
b/daemons/ganeti-noded | ||
---|---|---|
321 | 321 |
"""Install an OS on a given instance. |
322 | 322 |
|
323 | 323 |
""" |
324 |
inst_s, os_disk, swap_disk = params
|
|
324 |
inst_s = params[0]
|
|
325 | 325 |
inst = objects.Instance.FromDict(inst_s) |
326 |
return backend.AddOSToInstance(inst, os_disk, swap_disk)
|
|
326 |
return backend.AddOSToInstance(inst) |
|
327 | 327 |
|
328 | 328 |
@staticmethod |
329 | 329 |
def perspective_instance_run_rename(params): |
330 | 330 |
"""Runs the OS rename script for an instance. |
331 | 331 |
|
332 | 332 |
""" |
333 |
inst_s, old_name, os_disk, swap_disk = params
|
|
333 |
inst_s, old_name = params |
|
334 | 334 |
inst = objects.Instance.FromDict(inst_s) |
335 |
return backend.RunRenameInstance(inst, old_name, os_disk, swap_disk)
|
|
335 |
return backend.RunRenameInstance(inst, old_name) |
|
336 | 336 |
|
337 | 337 |
@staticmethod |
338 | 338 |
def perspective_instance_os_import(params): |
b/lib/backend.py | ||
---|---|---|
516 | 516 |
return output |
517 | 517 |
|
518 | 518 |
|
519 |
def AddOSToInstance(instance, os_disk, swap_disk):
|
|
519 |
def AddOSToInstance(instance): |
|
520 | 520 |
"""Add an OS to an instance. |
521 | 521 |
|
522 |
Args: |
|
523 |
instance: the instance object |
|
524 |
os_disk: the instance-visible name of the os device |
|
525 |
swap_disk: the instance-visible name of the swap device |
|
522 |
@type instance: L{objects.Instance} |
|
523 |
@param instance: Instance whose OS is to be installed |
|
526 | 524 |
|
527 | 525 |
""" |
528 | 526 |
inst_os = OSFromDisk(instance.os) |
... | ... | |
548 | 546 |
return True |
549 | 547 |
|
550 | 548 |
|
551 |
def RunRenameInstance(instance, old_name, os_disk, swap_disk):
|
|
549 |
def RunRenameInstance(instance, old_name): |
|
552 | 550 |
"""Run the OS rename script for an instance. |
553 | 551 |
|
554 |
Args: |
|
555 |
instance: the instance object |
|
556 |
old_name: the old name of the instance |
|
557 |
os_disk: the instance-visible name of the os device |
|
558 |
swap_disk: the instance-visible name of the swap device |
|
552 |
@type instance: objects.Instance |
|
553 |
@param instance: Instance whose OS is to be installed |
|
554 |
@type old_name: string |
|
555 |
@param old_name: previous instance name |
|
559 | 556 |
|
560 | 557 |
""" |
561 | 558 |
inst_os = OSFromDisk(instance.os) |
b/lib/cmdlib.py | ||
---|---|---|
2583 | 2583 |
_StartInstanceDisks(self, inst, None) |
2584 | 2584 |
try: |
2585 | 2585 |
if not self.rpc.call_instance_run_rename(inst.primary_node, inst, |
2586 |
old_name, |
|
2587 |
"sda", "sdb"): |
|
2586 |
old_name): |
|
2588 | 2587 |
msg = ("Could not run OS rename script for instance %s on node %s" |
2589 | 2588 |
" (but the instance has been renamed in Ganeti)" % |
2590 | 2589 |
(inst.name, inst.primary_node)) |
... | ... | |
3682 | 3681 |
if iobj.disk_template != constants.DT_DISKLESS: |
3683 | 3682 |
if self.op.mode == constants.INSTANCE_CREATE: |
3684 | 3683 |
feedback_fn("* running the instance OS create scripts...") |
3685 |
if not self.rpc.call_instance_os_add(pnode_name, iobj, "sda", "sdb"):
|
|
3684 |
if not self.rpc.call_instance_os_add(pnode_name, iobj): |
|
3686 | 3685 |
raise errors.OpExecError("could not add os for instance %s" |
3687 | 3686 |
" on node %s" % |
3688 | 3687 |
(instance, pnode_name)) |
b/lib/rpc.py | ||
---|---|---|
269 | 269 |
c.run() |
270 | 270 |
return c.getresult().get(node, False) |
271 | 271 |
|
272 |
def call_instance_os_add(self, node, inst, osdev, swapdev):
|
|
272 |
def call_instance_os_add(self, node, inst): |
|
273 | 273 |
"""Installs an OS on the given instance. |
274 | 274 |
|
275 | 275 |
This is a single-node call. |
276 | 276 |
|
277 | 277 |
""" |
278 |
params = [self._InstDict(inst), osdev, swapdev]
|
|
278 |
params = [self._InstDict(inst)] |
|
279 | 279 |
c = Client("instance_os_add", params) |
280 | 280 |
c.connect(node) |
281 | 281 |
c.run() |
282 | 282 |
return c.getresult().get(node, False) |
283 | 283 |
|
284 |
def call_instance_run_rename(self, node, inst, old_name, osdev, swapdev):
|
|
284 |
def call_instance_run_rename(self, node, inst, old_name): |
|
285 | 285 |
"""Run the OS rename script for an instance. |
286 | 286 |
|
287 | 287 |
This is a single-node call. |
288 | 288 |
|
289 | 289 |
""" |
290 |
params = [self._InstDict(inst), old_name, osdev, swapdev]
|
|
290 |
params = [self._InstDict(inst), old_name] |
|
291 | 291 |
c = Client("instance_run_rename", params) |
292 | 292 |
c.connect(node) |
293 | 293 |
c.run() |
Also available in: Unified diff