Revision cad0723b lib/bdev.py
b/lib/bdev.py | ||
---|---|---|
338 | 338 |
for child in self._children: |
339 | 339 |
child.SetInfo(text) |
340 | 340 |
|
341 |
def Grow(self, amount, dryrun): |
|
341 |
def Grow(self, amount, dryrun, backingstore):
|
|
342 | 342 |
"""Grow the block device. |
343 | 343 |
|
344 | 344 |
@type amount: integer |
... | ... | |
346 | 346 |
@type dryrun: boolean |
347 | 347 |
@param dryrun: whether to execute the operation in simulation mode |
348 | 348 |
only, without actually increasing the size |
349 |
@param backingstore: whether to execute the operation on backing storage |
|
350 |
only, or on "logical" storage only; e.g. DRBD is logical storage, |
|
351 |
whereas LVM, file, RBD are backing storage |
|
349 | 352 |
|
350 | 353 |
""" |
351 | 354 |
raise NotImplementedError |
... | ... | |
768 | 771 |
_ThrowError("Command: %s error: %s - %s", result.cmd, result.fail_reason, |
769 | 772 |
result.output) |
770 | 773 |
|
771 |
def Grow(self, amount, dryrun): |
|
774 |
def Grow(self, amount, dryrun, backingstore):
|
|
772 | 775 |
"""Grow the logical volume. |
773 | 776 |
|
774 | 777 |
""" |
778 |
if not backingstore: |
|
779 |
return |
|
775 | 780 |
if self.pe_size is None or self.stripe_count is None: |
776 | 781 |
if not self.Attach(): |
777 | 782 |
_ThrowError("Can't attach to LV during Grow()") |
... | ... | |
2070 | 2075 |
cls._InitMeta(aminor, meta.dev_path) |
2071 | 2076 |
return cls(unique_id, children, size, params) |
2072 | 2077 |
|
2073 |
def Grow(self, amount, dryrun): |
|
2078 |
def Grow(self, amount, dryrun, backingstore):
|
|
2074 | 2079 |
"""Resize the DRBD device and its backing storage. |
2075 | 2080 |
|
2076 | 2081 |
""" |
... | ... | |
2078 | 2083 |
_ThrowError("drbd%d: Grow called while not attached", self._aminor) |
2079 | 2084 |
if len(self._children) != 2 or None in self._children: |
2080 | 2085 |
_ThrowError("drbd%d: cannot grow diskless device", self.minor) |
2081 |
self._children[0].Grow(amount, dryrun) |
|
2082 |
if dryrun: |
|
2083 |
# DRBD does not support dry-run mode, so we'll return here |
|
2086 |
self._children[0].Grow(amount, dryrun, backingstore) |
|
2087 |
if dryrun or backingstore: |
|
2088 |
# DRBD does not support dry-run mode and is not backing storage, |
|
2089 |
# so we'll return here |
|
2084 | 2090 |
return |
2085 | 2091 |
result = utils.RunCmd(["drbdsetup", self.dev_path, "resize", "-s", |
2086 | 2092 |
"%dm" % (self.size + amount)]) |
... | ... | |
2163 | 2169 |
# TODO: implement rename for file-based storage |
2164 | 2170 |
_ThrowError("Rename is not supported for file-based storage") |
2165 | 2171 |
|
2166 |
def Grow(self, amount, dryrun): |
|
2172 |
def Grow(self, amount, dryrun, backingstore):
|
|
2167 | 2173 |
"""Grow the file |
2168 | 2174 |
|
2169 | 2175 |
@param amount: the amount (in mebibytes) to grow with |
2170 | 2176 |
|
2171 | 2177 |
""" |
2178 |
if not backingstore: |
|
2179 |
return |
|
2172 | 2180 |
# Check that the file exists |
2173 | 2181 |
self.Assemble() |
2174 | 2182 |
current_size = self.GetActualSize() |
... | ... | |
2339 | 2347 |
""" |
2340 | 2348 |
pass |
2341 | 2349 |
|
2342 |
def Grow(self, amount, dryrun): |
|
2350 |
def Grow(self, amount, dryrun, backingstore):
|
|
2343 | 2351 |
"""Grow the logical volume. |
2344 | 2352 |
|
2345 | 2353 |
""" |
... | ... | |
2605 | 2613 |
""" |
2606 | 2614 |
pass |
2607 | 2615 |
|
2608 |
def Grow(self, amount, dryrun): |
|
2616 |
def Grow(self, amount, dryrun, backingstore):
|
|
2609 | 2617 |
"""Grow the Volume. |
2610 | 2618 |
|
2611 | 2619 |
@type amount: integer |
... | ... | |
2615 | 2623 |
only, without actually increasing the size |
2616 | 2624 |
|
2617 | 2625 |
""" |
2626 |
if not backingstore: |
|
2627 |
return |
|
2618 | 2628 |
if not self.Attach(): |
2619 | 2629 |
_ThrowError("Can't attach to rbd device during Grow()") |
2620 | 2630 |
|
Also available in: Unified diff