10495 |
10495 |
" from the first disk's node group will be"
|
10496 |
10496 |
" used")
|
10497 |
10497 |
|
|
10498 |
if not self.op.disk_template in constants.DTS_EXCL_STORAGE:
|
|
10499 |
nodes = [pnode]
|
|
10500 |
if self.op.disk_template in constants.DTS_INT_MIRROR:
|
|
10501 |
nodes.append(snode)
|
|
10502 |
has_es = lambda n: _IsExclusiveStorageEnabledNode(self.cfg, n)
|
|
10503 |
if compat.any(map(has_es, nodes)):
|
|
10504 |
raise errors.OpPrereqError("Disk template %s not supported with"
|
|
10505 |
" exclusive storage" % self.op.disk_template,
|
|
10506 |
errors.ECODE_STATE)
|
|
10507 |
|
10498 |
10508 |
nodenames = [pnode.name] + self.secondaries
|
10499 |
10509 |
|
10500 |
10510 |
# Verify instance specs
|
... | ... | |
12416 |
12426 |
utils.FormatUnit(self.delta, "h"),
|
12417 |
12427 |
errors.ECODE_INVAL)
|
12418 |
12428 |
|
12419 |
|
if instance.disk_template not in (constants.DT_FILE,
|
12420 |
|
constants.DT_SHARED_FILE,
|
12421 |
|
constants.DT_RBD,
|
12422 |
|
constants.DT_EXT):
|
|
12429 |
self._CheckDiskSpace(nodenames, self.disk.ComputeGrowth(self.delta))
|
|
12430 |
|
|
12431 |
def _CheckDiskSpace(self, nodenames, req_vgspace):
|
|
12432 |
template = self.instance.disk_template
|
|
12433 |
if template not in (constants.DTS_NO_FREE_SPACE_CHECK):
|
12423 |
12434 |
# TODO: check the free disk space for file, when that feature will be
|
12424 |
12435 |
# supported
|
12425 |
|
_CheckNodesFreeDiskPerVG(self, nodenames,
|
12426 |
|
self.disk.ComputeGrowth(self.delta))
|
|
12436 |
nodes = map(self.cfg.GetNodeInfo, nodenames)
|
|
12437 |
es_nodes = filter(lambda n: _IsExclusiveStorageEnabledNode(self.cfg, n),
|
|
12438 |
nodes)
|
|
12439 |
if es_nodes:
|
|
12440 |
# With exclusive storage we need to something smarter than just looking
|
|
12441 |
# at free space; for now, let's simply abort the operation.
|
|
12442 |
raise errors.OpPrereqError("Cannot grow disks when exclusive_storage"
|
|
12443 |
" is enabled", errors.ECODE_STATE)
|
|
12444 |
_CheckNodesFreeDiskPerVG(self, nodenames, req_vgspace)
|
12427 |
12445 |
|
12428 |
12446 |
def Exec(self, feedback_fn):
|
12429 |
12447 |
"""Execute disk grow.
|
... | ... | |
13292 |
13310 |
" from the first disk's node group will be"
|
13293 |
13311 |
" used")
|
13294 |
13312 |
|
|
13313 |
if not self.op.disk_template in constants.DTS_EXCL_STORAGE:
|
|
13314 |
# Make sure none of the nodes require exclusive storage
|
|
13315 |
nodes = [pnode_info]
|
|
13316 |
if self.op.disk_template in constants.DTS_INT_MIRROR:
|
|
13317 |
assert snode_info
|
|
13318 |
nodes.append(snode_info)
|
|
13319 |
has_es = lambda n: _IsExclusiveStorageEnabledNode(self.cfg, n)
|
|
13320 |
if compat.any(map(has_es, nodes)):
|
|
13321 |
errmsg = ("Cannot convert disk template from %s to %s when exclusive"
|
|
13322 |
" storage is enabled" % (instance.disk_template,
|
|
13323 |
self.op.disk_template))
|
|
13324 |
raise errors.OpPrereqError(errmsg, errors.ECODE_STATE)
|
|
13325 |
|
13295 |
13326 |
def CheckPrereq(self):
|
13296 |
13327 |
"""Check prerequisites.
|
13297 |
13328 |
|