// Get volume or snapshot name without config tag
13865
func (d *driver) getPrintableName(name string) string {
	return strings.TrimPrefix(name, d.tag()+azureud.TagDelimiter)
}
943972
func MakeSnapshotName(snapshot *crdv1.VolumeSnapshot) string {
	return snapshot.Metadata.Namespace + "/" + snapshot.Metadata.Name + "-" + string(snapshot.Metadata.UID)
}
743913
func (c *Client) GetSnapshot(id string, name string) (Snapshot, error) {
	initiator, err := c.api.GetSnapshot(id, name)
	if err != nil {
		return nil, err
	}
	return initiator.Content, nil
}
1077477
func (s *SnapshotService) GetSnapshotByName(name string, opts ...OptionFunc) (*Snapshot, int, error) {
	id, count, err := s.GetSnapshotID(name, opts...)
	if err != nil {
		return nil, count, err
	}

	r, count, err := s.GetSnapshotByID(id, opts...)
	if err != nil {
		return nil, count, err
	}
	return r, count, nil
}
418806
func (vm *volumeManager) getUnmountedVolumes(podName types.UniquePodName, expectedVolumes []string) []string {
	mountedVolumes := sets.NewString()
	for _, mountedVolume := range vm.actualStateOfWorld.GetMountedVolumesForPod(podName) {
		mountedVolumes.Insert(mountedVolume.OuterVolumeSpecName)
	}
	return filterUnmountedVolumes(mountedVolumes, expectedVolumes)
}
92479
func (a *awsEBSPlugin) FindSnapshot(tags *map[string]string) (*crdv1.VolumeSnapshotDataSource, *[]crdv1.VolumeSnapshotCondition, error) {
	glog.Infof("FindSnapshot by tags: %#v", *tags)

	// TODO: Implement FindSnapshot
	return nil, nil, fmt.Errorf("Snapshot not found")
}
932055
func (v *volume) StorageInstance() (names.StorageTag, error) {
	if v.doc.StorageId == "" {
		msg := fmt.Sprintf("volume %q is not assigned to any storage instance", v.Tag().Id())
		return names.StorageTag{}, errors.NewNotAssigned(nil, msg)
	}
	return names.NewStorageTag(v.doc.StorageId), nil
}
895695
func (plugin *gcePersistentDiskPlugin) FindSnapshot(tags *map[string]string) (*crdv1.VolumeSnapshotDataSource, *[]crdv1.VolumeSnapshotCondition, error) {
	glog.Infof("FindSnapshot by tags: %#v", *tags)

	// TODO: Implement FindSnapshot
	return nil, nil, fmt.Errorf("Snapshot not found")
}
953142
func (gce *Cloud) getDiskByName(diskName string, zone string) (*gceDisk, error) {
	disk, err := gce.findDiskByName(diskName, zone)
	if disk == nil && err == nil {
		return nil, fmt.Errorf("GCE persistent disk not found: diskName=%q zone=%q", diskName, zone)
	}
	return disk, err
}
185128
func (v *RsyncVolume) UntagSnapshot(tagName string) (string, error) {
	v.Lock()
	defer v.Unlock()
	// find the snapshot with the provided tag
	info, err := v.getSnapshotWithTag(tagName, false)
	if err != nil {
		glog.Errorf("Could not find snapshot with tag %s: %s", tagName, err)
		return "", err
	}
	// remove the tag and update the snapshot
	var tags []string
	for _, tag := range info.Tags {
		if tag != tagName {
			tags = append(tags, tag)
		}
	}
	info.Tags = tags
	if err := v.writeSnapshotInfo(info.Label, info); err != nil {
		glog.Errorf("Could not remove tag '%s' from snapshot %s: %s", tagName, info.Name, err)
		return "", err
	}
	return info.Label, err
}
1243331
func (s *ResourcemetadataService) NewGetVolumeSnapshotDetailsParams(snapshotid string) *GetVolumeSnapshotDetailsParams {
	p := &GetVolumeSnapshotDetailsParams{}
	p.p = make(map[string]interface{})
	p.p["snapshotid"] = snapshotid
	return p
}
536048
func (dfs *DistributedFilesystem) Tag(snapshotID string, tagName string) error {
	// Get the parent volume that owns the snapshot
	vol, err := dfs.disk.GetTenant(snapshotID)
	if err != nil {
		glog.Errorf("Could not get tenant of snapshot %s: %s", snapshotID, err)
		return err
	}
	// Add a tag to the snapshot
	if err := vol.TagSnapshot(snapshotID, tagName); err != nil {
		glog.Errorf("Could not add tag %s to snapshot %s: %s", tagName, snapshotID, err)
		return err
	}
	return nil
}
1372243
func (v *BtrfsVolume) SnapshotInfo(label string) (*volume.SnapshotInfo, error) {
	if v.isInvalidSnapshot(label) {
		return nil, volume.ErrInvalidSnapshot
	}

	reader, err := v.ReadMetadata(label, ".SNAPSHOTINFO")
	if err != nil {
		glog.Errorf("Could not get info for snapshot %s: %s", label, err)
		return nil, err
	}
	defer reader.Close()
	decoder := json.NewDecoder(reader)
	var info volume.SnapshotInfo
	if err := decoder.Decode(&info); err != nil {
		glog.Errorf("Could not decode snapshot info for %s: %s", label, err)
		return nil, err
	}
	return &info, err
}
1142987
func (sb *storageBackend) Volume(tag names.VolumeTag) (Volume, error) {
	v, err := getVolumeByTag(sb.mb, tag)
	return v, err
}
1139141
func (sb *storageBackend) RemoveVolumeAttachment(host names.Tag, volume names.VolumeTag) (err error) {
	defer errors.DeferredAnnotatef(&err, "removing attachment of volume %s from %s", volume.Id(), names.ReadableString(host))
	buildTxn := func(attempt int) ([]txn.Op, error) {
		attachment, err := sb.VolumeAttachment(host, volume)
		if errors.IsNotFound(err) && attempt > 0 {
			// We only ignore IsNotFound on attempts after the
			// first, since we expect the volume attachment to
			// be there initially.
			return nil, jujutxn.ErrNoOperations
		}
		if err != nil {
			return nil, errors.Trace(err)
		}
		if attachment.Life() != Dying {
			return nil, errors.New("volume attachment is not dying")
		}
		v, err := getVolumeByTag(sb.mb, volume)
		if err != nil {
			return nil, errors.Trace(err)
		}
		return removeVolumeAttachmentOps(host, v), nil
	}
	return sb.mb.db().Run(buildTxn)
}
1006921
func (h *hostPathPlugin) FindSnapshot(tags *map[string]string) (*crdv1.VolumeSnapshotDataSource, *[]crdv1.VolumeSnapshotCondition, error) {
	glog.Infof("FindSnapshot by tags: %#v", *tags)

	// TODO: Implement FindSnapshot
	return nil, nil, fmt.Errorf("Snapshot not found")
}
415109
func (vs *volumeSnapshotter) getPVFromName(pvName string) (*v1.PersistentVolume, error) {
	return vs.coreClient.CoreV1().PersistentVolumes().Get(pvName, metav1.GetOptions{})
}