diff --git a/README.md b/README.md index bc56d8f..72e5dfa 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,9 @@ Configuration for this plugin is given via global config. Global configuration f - `"openstack_pass"`- password used to authenticate (ex. `"admin"`), - `"openstack_tenant"` - tenant name used to authenticate (ex. `"admin"`), - `"openstack_auth_url"` - keystone url (ex. `"http://172.16.0.5:5000/v2.0/"`). +If you're using authentication API in v3 you need to set one of those two configuration options (Note that both keys should be present in config, but only one of them is allowed to be set): +- `"openstack_domain_name"` - domain name +- `"openstack_domain_id"` - domain name These values should correspond to values given in `nova.conf`: - `"allocation_ratio_cores"` - oversubscription ratio for vcpus, used to derive some metrics for hypervisors (ex. 1.5), diff --git a/examples/cfg/cfg.json b/examples/cfg/cfg.json index 8a7190f..a275093 100644 --- a/examples/cfg/cfg.json +++ b/examples/cfg/cfg.json @@ -8,6 +8,8 @@ "openstack_user": "admin", "openstack_pass": "admin", "openstack_tenant": "admin", + "openstack_domain_id": "", + "openstack_domain_name": "", "allocation_ratio_cores" : 1.5, "allocation_ratio_ram": 3, "reserved_node_cores" : 2, diff --git a/novaplugin/collector.go b/novaplugin/collector.go index d72a192..d9b035d 100644 --- a/novaplugin/collector.go +++ b/novaplugin/collector.go @@ -97,6 +97,8 @@ func newCollector(config Config) (collectorInterface, error) { Username: config.User, Password: config.Pass, TenantName: config.Tenant, + DomainID: config.DomaninID, + DomainName: config.DomainName, AllowReauth: true, } diff --git a/novaplugin/plugin.go b/novaplugin/plugin.go index 5e8871b..3f5f970 100644 --- a/novaplugin/plugin.go +++ b/novaplugin/plugin.go @@ -44,10 +44,12 @@ const ( ) type Config struct { - User string `c:"openstack_user"` - Pass string `c:"openstack_pass"` - Tenant string `c:"openstack_tenant"` - Url string `c:"openstack_auth_url"` + User string `c:"openstack_user"` + Pass string `c:"openstack_pass"` + Tenant string `c:"openstack_tenant"` + Url string `c:"openstack_auth_url"` + DomainName string `c:"openstack_domain_name"` + DomaninID string `c:"openstack_domain_id"` RatioCores float64 `c:"allocation_ratio_cores"` RatioRam float64 `c:"allocation_ratio_ram"` diff --git a/novaplugin/plugin_test.go b/novaplugin/plugin_test.go index 21c633e..b7452bd 100644 --- a/novaplugin/plugin_test.go +++ b/novaplugin/plugin_test.go @@ -47,11 +47,15 @@ func testingConfig() (cfg1 plugin.ConfigType, cfg2 *cdata.ConfigDataNode) { cfg1.AddItem("openstack_pass", ctypes.ConfigValueStr{Value: "x"}) cfg1.AddItem("openstack_tenant", ctypes.ConfigValueStr{Value: "asdf"}) cfg1.AddItem("openstack_auth_url", ctypes.ConfigValueStr{Value: "x"}) + cfg1.AddItem("openstack_domain_id", ctypes.ConfigValueStr{Value: ""}) + cfg1.AddItem("openstack_domain_name", ctypes.ConfigValueStr{Value: ""}) cfg2.AddItem("openstack_user", ctypes.ConfigValueStr{Value: "x"}) cfg2.AddItem("openstack_pass", ctypes.ConfigValueStr{Value: "x"}) cfg2.AddItem("openstack_tenant", ctypes.ConfigValueStr{Value: "asdf"}) cfg2.AddItem("openstack_auth_url", ctypes.ConfigValueStr{Value: "x"}) + cfg2.AddItem("openstack_domain_id", ctypes.ConfigValueStr{Value: ""}) + cfg2.AddItem("openstack_domain_name", ctypes.ConfigValueStr{Value: ""}) cfg1.AddItem("allocation_ratio_cores", ctypes.ConfigValueFloat{Value: 3}) cfg1.AddItem("allocation_ratio_ram", ctypes.ConfigValueFloat{Value: 4})