// addStorageTenant remembers a storage tenant we have used
166174
func (a *HostAgent) addStorageTenant(tenantID string) {
	for _, tid := range a.storageTenants {
		if tid == tenantID {
			return
		}
	}
	a.storageTenants = append(a.storageTenants, tenantID)
}
1370397
func (s *OrderableDBInstanceOption) SetStorageType(v string) *OrderableDBInstanceOption {
	s.StorageType = &v
	return s
}
1091521
func (u *Unit) AddStorage(constraints map[string][]params.StorageConstraints) error {
	if u.st.facade.BestAPIVersion() < 2 {
		return errors.NotImplementedf("AddStorage() (need V2+)")
	}

	all := make([]params.StorageAddParams, 0, len(constraints))
	for storage, cons := range constraints {
		for _, one := range cons {
			all = append(all, params.StorageAddParams{
				UnitTag:     u.Tag().String(),
				StorageName: storage,
				Constraints: one,
			})
		}
	}

	args := params.StoragesAddParams{Storages: all}
	var results params.ErrorResults
	err := u.st.facade.FacadeCall("AddUnitStorage", args, &results)
	if err != nil {
		return err
	}

	return results.Combine()
}
17745
func (s *Destination) SetStorageClass(v string) *Destination {
	s.StorageClass = &v
	return s
}
988211
func (env *azureEnviron) StorageProvider(t storage.ProviderType) (storage.Provider, error) {
	if t == azureStorageProviderType {
		return &azureStorageProvider{env}, nil
	}
	return nil, errors.NotFoundf("storage provider %q", t)
}
407394
func (f *Facade) lockTenant(ctx datastore.Context, tenantID string) (err error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.lockTenant"))

	mutex := getTenantLock(tenantID)
	mutex.Lock()
	defer func() {
		if err != nil {
			mutex.Unlock()
		}
	}()

	// Wait for current processing by the service state manager to complete
	//  The lock above will prevent any new requests to the service state manager
	f.ssm.Wait(tenantID)

	var svcs []service.ServiceDetails
	if svcs, err = f.GetServiceDetailsByTenantID(ctx, tenantID); err != nil {
		glog.Errorf("Could not get services for tenant %s: %s", tenantID, err)
		return
	}
	if err = f.zzk.LockServices(ctx, svcs); err != nil {
		glog.Errorf("Could not lock services for tenant %s: %s", tenantID, err)
		return
	}
	return
}
700900
func WithStorageService(
	parent context.Context, service types.StorageService) types.Context {

	var (
		serviceName = strings.ToLower(service.Name())
		driver      = service.Driver()
		driverName  = strings.ToLower(driver.Name())
	)

	parent = newContext(parent, DriverKey, driver, nil, nil)

	// set the service's InstanceID if present
	if iidm, ok := parent.Value(AllInstanceIDsKey).(types.InstanceIDMap); ok {
		if iid, ok := iidm[serviceName]; ok {
			parent = newContext(parent, InstanceIDKey, iid, nil, nil)
		}
	}

	// set the service's LocalDevices if present
	if ldm, ok := parent.Value(AllLocalDevicesKey).(types.LocalDevicesMap); ok {
		if ld, ok := ldm[driverName]; ok {
			parent = newContext(parent, LocalDevicesKey, ld, nil, nil)
		}
	}

	return newContext(parent, ServiceKey, service, nil, nil)
}
1356746
func (s *RequestUploadCredentialsOutput) SetStorageLocation(v *S3Location) *RequestUploadCredentialsOutput {
	s.StorageLocation = v
	return s
}
201859
func (m *MockAgentClient) AddPersistentDisk(arg0 string, arg1 interface{}) error {
	ret := m.ctrl.Call(m, "AddPersistentDisk", arg0, arg1)
	ret0, _ := ret[0].(error)
	return ret0
}
1221090
func (c *Client) AddToUnit(storages []params.StorageAddParams) ([]params.AddStorageResult, error) {
	out := params.AddStorageResults{}
	in := params.StoragesAddParams{Storages: storages}
	err := c.facade.FacadeCall("AddToUnit", in, &out)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return out.Results, nil
}
786314
func addStorages(ctx context.Context, storages []*pb.Storage, s *sandbox) ([]string, error) {
	span, ctx := trace(ctx, "mount", "addStorages")
	span.SetTag("sandbox", s.id)
	defer span.Finish()

	var mountList []string

	for _, storage := range storages {
		if storage == nil {
			continue
		}

		devHandler, ok := storageHandlerList[storage.Driver]
		if !ok {
			return nil, grpcStatus.Errorf(codes.InvalidArgument,
				"Unknown storage driver %q", storage.Driver)
		}

		// Wrap the span around the handler call to avoid modifying
		// the handler interface but also to avoid having to add trace
		// code to each driver.
		handlerSpan, _ := trace(ctx, "mount", storage.Driver)
		mountPoint, err := devHandler(*storage, s)
		handlerSpan.Finish()

		if err != nil {
			return nil, err
		}

		if mountPoint != "" {
			// Prepend mount point to mount list.
			mountList = append([]string{mountPoint}, mountList...)
		}
	}

	return mountList, nil
}
94266
func (s *Transition) SetStorageClass(v string) *Transition {
	s.StorageClass = &v
	return s
}
716798
func (*maasEnviron) StorageProvider(t storage.ProviderType) (storage.Provider, error) {
	if t == maasStorageProviderType {
		return maasStorageProvider{}, nil
	}
	return nil, errors.NotFoundf("storage provider %q", t)
}
208300
func (s *DBInstanceAutomatedBackup) SetStorageType(v string) *DBInstanceAutomatedBackup {
	s.StorageType = &v
	return s
}
1068287
func (s *StorageRuleType) SetStorageType(v string) *StorageRuleType {
	s.StorageType = &v
	return s
}
154769
func (s *OrderableReplicationInstance) SetStorageType(v string) *OrderableReplicationInstance {
	s.StorageType = &v
	return s
}
686886
func setupContainersStorage(pod *corev1.Pod, container *corev1.Container) {
	exists := false
	for _, v := range pod.Spec.Volumes {
		if v.Name == "container-storage-root" {
			exists = true
			break
		}
	}
	if !exists {
		pod.Spec.Volumes = append(pod.Spec.Volumes,
			corev1.Volume{
				Name: "container-storage-root",
				VolumeSource: corev1.VolumeSource{
					EmptyDir: &corev1.EmptyDirVolumeSource{},
				},
			},
		)
	}
	container.VolumeMounts = append(container.VolumeMounts,
		corev1.VolumeMount{
			Name:      "container-storage-root",
			MountPath: "/var/lib/containers/storage",
		},
	)
	container.Env = append(container.Env, corev1.EnvVar{Name: "BUILD_STORAGE_DRIVER", Value: "overlay"})
	container.Env = append(container.Env, corev1.EnvVar{Name: "BUILD_ISOLATION", Value: "chroot"})
}