Commit bd2cafa4 authored by Hrvoje Ribicic's avatar Hrvoje Ribicic

Restrict Ganeti's orphan volume checks to the single VG

Prior to patch eeda5882, Ganeti checked all the LVs on nodes under
its control, and dutifuly declared any stray volumes as orphans in
warnings emitted during cluster-verify. After the patch, the nodes
returned information related only to the LV set as *the* Ganeti VG,
bypassing this problem.

Unfortunately, this led Ganeti to report the disks of instances created
on a different VG as non-existent. This patch fixes things by reverting
patch eeda5882 and making Ganeti warn about orphan volumes only if
they belong to the Ganeti-administered VG.
Signed-off-by: default avatarHrvoje Ribicic <riba@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent c7c42554
......@@ -1094,7 +1094,7 @@ def VerifyNode(what, cluster_name, all_hvparams, node_groups, groups_cfg):
if constants.NV_LVLIST in what and vm_capable:
try:
val = GetVolumeList([what[constants.NV_LVLIST]])
val = GetVolumeList(utils.ListVolumeGroups().keys())
except RPCFail, err:
val = str(err)
result[constants.NV_LVLIST] = val
......
......@@ -2621,12 +2621,15 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
"instance lives on non-vm_capable node %s",
self.cfg.GetNodeName(node_uuid))
def _VerifyOrphanVolumes(self, node_vol_should, node_image, reserved):
def _VerifyOrphanVolumes(self, vg_name, node_vol_should, node_image,
reserved):
"""Verify if there are any unknown volumes in the cluster.
The .os, .swap and backup volumes are ignored. All other volumes are
reported as unknown.
@type vg_name: string
@param vg_name: the name of the Ganeti-administered volume group
@type reserved: L{ganeti.utils.FieldSet}
@param reserved: a FieldSet of reserved volume names
......@@ -2637,6 +2640,10 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
# skip non-healthy nodes
continue
for volume in n_img.volumes:
# skip volumes not belonging to the ganeti-administered volume group
if volume.split('/')[0] != vg_name:
continue
test = ((node_uuid not in node_vol_should or
volume not in node_vol_should[node_uuid]) and
not reserved.Matches(volume))
......@@ -3757,7 +3764,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
self.cfg.GetInstanceLVsByNode(instance.uuid, lvmap=node_vol_should)
break
self._VerifyOrphanVolumes(node_vol_should, node_image, reserved)
self._VerifyOrphanVolumes(vg_name, node_vol_should, node_image, reserved)
if constants.VERIFY_NPLUSONE_MEM not in self.op.skip_checks:
feedback_fn("* Verifying N+1 Memory redundancy")
......
......@@ -1700,7 +1700,7 @@ class TestLUClusterVerifyGroupVerifyOrphanVolumes(
self.master_uuid: ["mock_vg/disk_0"]
}
lu._VerifyOrphanVolumes(node_vol_should, node_imgs,
lu._VerifyOrphanVolumes("mock_vg", node_vol_should, node_imgs,
utils.FieldSet("mock_vg/disk_2"))
self.mcpu.assertLogContainsRegex("volume mock_vg/disk_1 is unknown")
self.mcpu.assertLogDoesNotContainRegex("volume mock_vg/disk_0 is unknown")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment