Skip to content

Commit ced0932

Browse files
authored
Merge pull request #2029 from k8s-infra-cherrypick-robot/cherry-pick-2028-to-release-1.17
[release-1.17] fix outdated metadata error in watcher
2 parents abf18aa + 9865a8b commit ced0932

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/gce-pd-csi-driver/cache.go

+8
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,14 @@ func watchDiskDetaches(watcher *fsnotify.Watcher, nodeName string, errorCh chan
641641
case event := <-watcher.Events:
642642
// In case of an event i.e. creation or deletion of any new PV, we update the VG metadata.
643643
// This might include some non-LVM changes, no harm in updating metadata multiple times.
644+
args := []string{
645+
"--updatemetadata",
646+
getVolumeGroupName(nodeName),
647+
}
648+
_, err := common.RunCommand("" /* pipedCmd */, nil /* pipedCmdArg */, "vgck", args...)
649+
if err != nil {
650+
klog.Errorf("Error updating volume group's metadata: %v", err)
651+
}
644652
reduceVolumeGroup(getVolumeGroupName(nodeName), true)
645653
klog.V(2).Infof("disk attach/detach event %#v\n", event)
646654
}

0 commit comments

Comments
 (0)