Change:
Resizing a persistent volume is partially broken on openstack (cinder) with k8s v1.11.1. Partially in the sense that static resizing (requiring a pod restart) works, but the newly introduced online resizing (not requiring a pod restart) fails. Upon resizing a pvc it remains in the Resizing condition forever (see the warning event) until I delete the pod that has this pvc mounted: After pod deletion it notifies me (correctly) that it's now waiting for the pod to come up to finish resizing: So far the warning event does not break the ExpandPersistentVolumes feature, as this one anyhow requires a pod restart. However it breaks the newly introduced ExpandInUsePersistentVolumes feature (alpha with k8s v1.11; doesn't require a pod restart for resizing to finish), as the pvc will remain in "Resizing" condition forever (or until the pod is restarted but this defeats the purpose of ExpandInUsePersistentVolumes). I'm not sure whether this is fully related but upon digging around I found and a consecutive fix with which was merged on Jan 23. However a few days later this fix seems to be (probably accidentally) overwritten with this commit: /kind bug /sig storage /sig openstack
/assign
Issues go stale after 90d of inactivity. Mark the issue as fresh with . Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with . Send feedback to sig-testing, kubernetes/test-infra and/or . /lifecycle stale
It is already fixed. So I will close it.
/close
Closing this issue. <detailsIn response to : /close Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
I am trying cinder online pvc resizing on kubernetes1.12.2. I noticed this kubernetes version has include your fix, but I still failed to resize pvc online. The error log has no change: Warning VolumeResizeFailed 45s (x2 over 66s) volumeexpand Error expanding volume "default/myclaim-expend" of plugin : volume status is not available The error log is reported below code line "volume.Status != volumeAvailableStatus" // ExpandVolume expands the size of specific cinder volume (in GiB) func (os *OpenStack) ExpandVolume(volumeID string, oldSize resource.Quantity, newSize resource.Quantity) (resource.Quantity, error) { volume, err := os.getVolume(volumeID) if err != nil { return oldSize, err } if volume.Status != volumeAvailableStatus { // cinder volume can not be expanded if its status is not available return oldSize, fmt.Errorf("volume status is not available") } One point confused me, once cinder volume is used by pod, it's status is "in-use", how the online pvc resizing pass the code check "volume.Status != volumeAvailableStatus"? There's where the online pvc resizing fails.
It looks like Cinder can not support online volume expansion - which is what is happening here. Even if online expansion is enabled, I think to actually perform resizing of Cinder volumes - you must bring the pod down.

Discussion:
"//pkg/apis/core/v1/helper:go_default_library", "//pkg/cloudprovider:go_default_library", "//pkg/controller:go_default_library", <ins> "//pkg/kubelet/apis:go_default_library", </ins> "//pkg/util/mount:go_default_library", "//pkg/volume:go_default_library", "//pkg/volume/util:go_default_library",

"strings" "time" <ins> "k8s.io/api/core/v1" </ins> "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/types" <ins> "k8s.io/kubernetes/pkg/cloudprovider" kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" </ins> k8s_volume "k8s.io/kubernetes/pkg/volume" volumeutil "k8s.io/kubernetes/pkg/volume/util"

AttachedServerId string // Device file path AttachedDevice string <ins> // AvailabilityZone is which availability zone the volume is in AvailabilityZone string </ins> // Unique identifier for the volume. ID string // Human-readable display name for the volume.

Metadata     map[string]string } <ins> // implements PVLabeler. var _ cloudprovider.PVLabeler = (*OpenStack)(nil) </ins> const ( VolumeAvailableStatus = "available" VolumeInUseStatus     = "in-use"

} volume := Volume{ <del> ID:     volumeV1.ID, Name:   volumeV1.Name, Status: volumeV1.Status, Size:   volumeV1.Size, </del> <ins> AvailabilityZone: volumeV1.AvailabilityZone, ID:               volumeV1.ID, Name:             volumeV1.Name, Status:           volumeV1.Status, Size:             volumeV1.Size, </ins> } if len(volumeV1.Attachments) > 0 && volumeV1.Attachments[0]["server_id"] != nil {

} volume := Volume{ <del> ID:     volumeV2.ID, Name:   volumeV2.Name, Status: volumeV2.Status, Size:   volumeV2.Size, </del> <ins> AvailabilityZone: volumeV2.AvailabilityZone, ID:               volumeV2.ID, Name:             volumeV2.Name, Status:           volumeV2.Status, Size:             volumeV2.Size, </ins> } if len(volumeV2.Attachments) > 0 {

} volume := Volume{ <del> ID:     volumeV3.ID, Name:   volumeV3.Name, Status: volumeV3.Status, Size:   volumeV3.Size, </del> <ins> AvailabilityZone: volumeV3.AvailabilityZone, ID:               volumeV3.ID, Name:             volumeV3.Name, Status:           volumeV3.Status, </ins> } if len(volumeV3.Attachments) > 0 {

return os.bsOpts.TrustDevicePath } <ins> // GetLabelsForVolume implements PVLabeler.GetLabelsForVolume func (os *OpenStack) GetLabelsForVolume(pv *v1.PersistentVolume) (map[string]string, error) { // Ignore any volumes that are being provisioned if pv.Spec.Cinder.VolumeID == k8s_volume.ProvisionedVolumeName { return nil, nil } // Get Volume volume, err := os.getVolume(pv.Spec.Cinder.VolumeID) if err != nil { return nil, err } // Contruct Volume Labels labels := make(map[string]string) labels[kubeletapis.LabelZoneFailureDomain] = volume.AvailabilityZone labels[kubeletapis.LabelZoneRegion] = os.region glog.V(4).Infof("The Volume %s has labels %v", pv.Spec.Cinder.VolumeID, labels) return labels, nil } </ins> // recordOpenstackOperationMetric records openstack operation metrics func recordOpenstackOperationMetric(operation string, timeTaken float64, err error) { if err != nil {