func (s *providerRegistrySuite) TestSupportedEnvironCommonProviders(c *gc.C) {
	for _, envProvider := range environs.RegisteredProviders() {
		for storageProvider := range provider.CommonProviders() {
			c.Logf("Checking storage provider %v is registered for env provider %v", storageProvider, envProvider)
			c.Assert(registry.IsProviderSupported(envProvider, storageProvider), jc.IsTrue)
		}
	}
}
Exemple #2
0
func (s *providerCommonSuite) TestCommonProvidersExported(c *gc.C) {
	var common []storage.ProviderType
	for pType, p := range provider.CommonProviders() {
		common = append(common, pType)
		_, ok := p.(storage.Provider)
		c.Check(ok, jc.IsTrue)
	}
	c.Assert(common, jc.SameContents, []storage.ProviderType{
		provider.LoopProviderType,
		provider.RootfsProviderType,
		provider.TmpfsProviderType,
	})
}
Exemple #3
0
// RegisterEnvironStorageProviders records which storage provider types
// are valid for an environment.
// This is to be called from the environ provider's init().
// Also registered will be provider types common to all environments.
func RegisterEnvironStorageProviders(envType string, providers ...storage.ProviderType) {
	existing := supportedEnvironProviders[envType]
	for _, p := range providers {
		if IsProviderSupported(envType, p) {
			continue
		}
		existing = append(existing, p)
	}

	// Add the common providers.
	for p := range provider.CommonProviders() {
		if IsProviderSupported(envType, p) {
			continue
		}
		existing = append(existing, p)
	}
	supportedEnvironProviders[envType] = existing
}
Exemple #4
0
func init() {
	// Register the providers common to all environments, eg loop, tmpfs etc
	for providerType, p := range provider.CommonProviders() {
		RegisterProvider(providerType, p)
	}
}