Revision d61cbe76
b/daemons/ganeti-noded | ||
---|---|---|
220 | 220 |
amount = params[1] |
221 | 221 |
return backend.GrowBlockDevice(cfbd, amount) |
222 | 222 |
|
223 |
@staticmethod |
|
224 |
def perspective_blockdev_close(params): |
|
225 |
"""Closes the given block devices. |
|
226 |
|
|
227 |
""" |
|
228 |
disks = [objects.Disk.FromDict(cf) for cf in params] |
|
229 |
return backend.CloseBlockDevices(disks) |
|
230 |
|
|
223 | 231 |
# export/import -------------------------- |
224 | 232 |
|
225 | 233 |
@staticmethod |
b/lib/backend.py | ||
---|---|---|
1477 | 1477 |
|
1478 | 1478 |
Args: |
1479 | 1479 |
file_storage_dir: string with path |
1480 |
|
|
1480 |
|
|
1481 | 1481 |
Returns: |
1482 | 1482 |
normalized file_storage_dir (string) if valid, None otherwise |
1483 | 1483 |
|
... | ... | |
1592 | 1592 |
return result |
1593 | 1593 |
|
1594 | 1594 |
|
1595 |
def CloseBlockDevices(disks): |
|
1596 |
"""Closes the given block devices. |
|
1597 |
|
|
1598 |
This means they will be switched to secondary mode (in case of DRBD). |
|
1599 |
|
|
1600 |
""" |
|
1601 |
bdevs = [] |
|
1602 |
for cf in disks: |
|
1603 |
rd = _RecursiveFindBD(cf) |
|
1604 |
if rd is None: |
|
1605 |
return (False, "Can't find device %s" % cf) |
|
1606 |
bdevs.append(rd) |
|
1607 |
|
|
1608 |
msg = [] |
|
1609 |
for rd in bdevs: |
|
1610 |
try: |
|
1611 |
rd.Close() |
|
1612 |
except errors.BlockDeviceError, err: |
|
1613 |
msg.append(str(err)) |
|
1614 |
if msg: |
|
1615 |
return (False, "Can't make devices secondary: %s" % ",".join(msg)) |
|
1616 |
else: |
|
1617 |
return (True, "All devices secondary") |
|
1618 |
|
|
1619 |
|
|
1595 | 1620 |
class HooksRunner(object): |
1596 | 1621 |
"""Hook runner. |
1597 | 1622 |
|
b/lib/rpc.py | ||
---|---|---|
512 | 512 |
return c.getresult().get(node, False) |
513 | 513 |
|
514 | 514 |
|
515 |
def call_blockdev_close(node, disks): |
|
516 |
"""Closes the given block devices. |
|
517 |
|
|
518 |
This is a single-node call. |
|
519 |
|
|
520 |
""" |
|
521 |
params = [cf.ToDict() for cf in disks] |
|
522 |
c = Client("blockdev_close", params) |
|
523 |
c.connect(node) |
|
524 |
c.run() |
|
525 |
return c.getresult().get(node, False) |
|
526 |
|
|
527 |
|
|
515 | 528 |
def call_upload_file(node_list, file_name): |
516 | 529 |
"""Upload a file. |
517 | 530 |
|
Also available in: Unified diff