Skip to content

Commit

Permalink
Basic Strategy works
Browse files Browse the repository at this point in the history
Changes:
* replace [user|project]_domain_NAME with [user|project]_domain_ID (in keystone auth), and set thess params from watcher.conf file (not manually in code);
* specify values of Primitives.[LIVE|COLD]_MIGRATE and send PRIMITIVES.LIVE_MIGRATE param to Migrate()-class while build_primitive_from_action();
  • Loading branch information
Stavitsky committed Dec 25, 2015
1 parent 9dccb29 commit 0ead5de
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion watcher/applier/mapping/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def build_primitive_from_action(self, action):
action.src,
action.dst)
elif action.action_type == Primitives.LIVE_MIGRATE.value:
return Migrate(action.applies_to, Primitives.COLD_MIGRATE,
return Migrate(action.applies_to, Primitives.LIVE_MIGRATE,
action.src,
action.dst)
elif action.action_type == Primitives.HYPERVISOR_STATE.value:
Expand Down
13 changes: 7 additions & 6 deletions watcher/applier/primitives/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,17 @@ def migrate(self, destination):
'username': CONF.keystone_authtoken.admin_user,
'password': CONF.keystone_authtoken.admin_password,
'project_id': project_id,
'user_domain_name': "default",
'project_domain_name': "default"}
'user_domain_id': CONF.keystone_authtoken.user_domain_id,
'project_domain_id': CONF.keystone_authtoken.project_domain_id
}
auth2 = v3.Password(auth_url=creds2['auth_url'],
username=creds2['username'],
password=creds2['password'],
project_id=creds2['project_id'],
user_domain_name=creds2[
'user_domain_name'],
project_domain_name=creds2[
'project_domain_name'])
user_domain_id=creds2[
'user_domain_id'],
project_domain_id=creds2[
'project_domain_id'])
sess2 = session.Session(auth=auth2)
wrapper2 = NovaClient(creds2, session=sess2)

Expand Down
15 changes: 13 additions & 2 deletions watcher/common/keystone.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@
LOG = log.getLogger(__name__)
CONF = cfg.CONF

watcher_domain_opts = [
cfg.StrOpt('project_domain_id',
default='default',
help='Project domain ID'),
cfg.StrOpt('user_domain_id',
default='default',
help='User domain ID')
]

CONF.register_opts(watcher_domain_opts, 'keystone_authtoken')

CONF.import_opt('admin_user', 'keystonemiddleware.auth_token',
group='keystone_authtoken')
CONF.import_opt('admin_tenant_name', 'keystonemiddleware.auth_token',
Expand Down Expand Up @@ -105,8 +116,8 @@ def get_credentials(self):
'username': CONF.keystone_authtoken.admin_user,
'password': CONF.keystone_authtoken.admin_password,
'project_name': CONF.keystone_authtoken.admin_tenant_name,
'user_domain_name': "default",
'project_domain_name': "default"}
'user_domain_id': CONF.keystone_authtoken.user_domain_id,
'project_domain_id': CONF.keystone_authtoken.project_domain_id}
LOG.debug(creds)
return creds

Expand Down
4 changes: 2 additions & 2 deletions watcher/decision_engine/planner/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@


class Primitives(Enum):
LIVE_MIGRATE = 'MIGRATE'
COLD_MIGRATE = 'MIGRATE'
LIVE_MIGRATE = 'LIVE_MIGRATE'
COLD_MIGRATE = 'COLD_MIGRATE'
POWER_STATE = 'POWERSTATE'
HYPERVISOR_STATE = 'HYPERVISOR_STATE'
NOP = 'NOP'
Expand Down

0 comments on commit 0ead5de

Please sign in to comment.