def __init__(self, config, configuration_ini, cloud_prefix='SRC', results_path='.'): self.configuration_ini = configuration_ini self.results_path = results_path logging_config.dictConfig(conf.logging_configuration) self.log = logging.getLogger(__name__) self.filtering_utils = utils.FilteringUtils( self.configuration_ini['migrate']['filter_path']) self.migration_utils = utils.MigrationUtils(config) self.src_vms_from_config = \ self.migration_utils.get_all_vms_from_config() self.config = config self.cloud_prefix = cloud_prefix.lower() self.username = self.configuration_ini[self.cloud_prefix]['user'] self.password = self.configuration_ini[self.cloud_prefix]['password'] self.tenant = self.configuration_ini[self.cloud_prefix]['tenant'] self.auth_url = self.configuration_ini[self.cloud_prefix]['auth_url'] self.keystoneclient = keystone.Client(auth_url=self.auth_url, username=self.username, password=self.password, tenant_name=self.tenant) self.keystoneclient.authenticate() self.novaclient = nova.Client(username=self.username, api_key=self.password, project_id=self.tenant, auth_url=self.auth_url) self.token = self.keystoneclient.auth_token self.image_endpoint = \ self.keystoneclient.service_catalog.get_endpoints( service_type='image', endpoint_type='publicURL')['image'][0]['publicURL'] self.glanceclient = glance(endpoint=self.image_endpoint, token=self.token) self.neutronclient = neutron.Client(username=self.username, password=self.password, tenant_name=self.tenant, auth_url=self.auth_url) self.cinderclient = cinder.Client(self.username, self.password, self.tenant, self.auth_url) self.openstack_release = self._get_openstack_release() self.server_groups_supported = self.openstack_release in [ 'icehouse', 'juno' ] self.swift_connection = SwiftConnection(self.auth_url, self.username, self.password, self.tenant)
def __init__(self, config, configuration_ini, cloud_prefix='SRC', results_path='.'): self.configuration_ini = configuration_ini self.results_path = results_path logging_config.dictConfig(conf.logging_configuration) self.log = logging.getLogger(__name__) self.filtering_utils = utils.FilteringUtils( self.configuration_ini['migrate']['filter_path']) self.migration_utils = utils.MigrationUtils(config) self.src_vms_from_config = \ self.migration_utils.get_all_vms_from_config() self.config = config self.cloud_prefix = cloud_prefix.lower() self.username = self.configuration_ini[self.cloud_prefix]['user'] self.password = self.configuration_ini[self.cloud_prefix]['password'] self.tenant = self.configuration_ini[self.cloud_prefix]['tenant'] self.auth_url = self.configuration_ini[self.cloud_prefix]['auth_url'] self.keystoneclient = keystone.Client(auth_url=self.auth_url, username=self.username, password=self.password, tenant_name=self.tenant) self.keystoneclient.authenticate() self.novaclient = nova.Client(username=self.username, api_key=self.password, project_id=self.tenant, auth_url=self.auth_url) self.token = self.keystoneclient.auth_token self.image_endpoint = \ self.keystoneclient.service_catalog.get_endpoints( service_type='image', endpoint_type='publicURL')['image'][0]['publicURL'] self.glanceclient = glance(endpoint=self.image_endpoint, token=self.token) self.neutronclient = neutron.Client(username=self.username, password=self.password, tenant_name=self.tenant, auth_url=self.auth_url) self.cinderclient = cinder.Client(self.username, self.password, self.tenant, self.auth_url) self.openstack_release = self._get_openstack_release() self.server_groups_supported = self.openstack_release in ['icehouse', 'juno'] self.swift_connection = SwiftConnection(self.auth_url, self.username, self.password, self.tenant)
def switch_user(self, user, password, tenant): self.keystoneclient = keystone.Client(auth_url=self.auth_url, username=user, password=password, tenant_name=tenant) self.keystoneclient.authenticate() self.token = self.keystoneclient.auth_token self.novaclient = nova.Client(username=user, api_key=password, project_id=tenant, auth_url=self.auth_url) self.glanceclient = glance(endpoint=self.image_endpoint, token=self.token) self.neutronclient = neutron.Client(username=user, password=password, tenant_name=tenant, auth_url=self.auth_url) self.cinderclient = cinder.Client(user, password, tenant, self.auth_url)