コード例 #1
0
ファイル: providerregistry_test.go プロジェクト: imoapps/juju
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)
		}
	}
}
コード例 #2
0
ファイル: common_test.go プロジェクト: Pankov404/juju
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,
	})
}
コード例 #3
0
ファイル: providerregistry.go プロジェクト: Pankov404/juju
// 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
}
コード例 #4
0
ファイル: init.go プロジェクト: imoapps/juju
func init() {
	// Register the providers common to all environments, eg loop, tmpfs etc
	for providerType, p := range provider.CommonProviders() {
		RegisterProvider(providerType, p)
	}
}