Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

API access from v2 to v3, migration from centralci to upshift #56

Merged
merged 2 commits into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If you have installed 5minute using `pip install vminute`, they have been instal
### Get config file

1. Login into your OpenStack instance WebUI
2. Navigate to Access & Security -> API Access
2. Navigate to Project -> API Access
3. Save file from "Download OpenStack RC File" to ~/.5minute/config

## Get started
Expand Down
15 changes: 9 additions & 6 deletions vminute/vminute.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __exit__(self, type, value, traceback):
def get_FQDN_from_IP(ip):
# If we want to support old version of OpenStack, we have to update this function and
# solve it via serviceman
return "host-{1}-{2}-{3}.host.centralci.eng.rdu2.redhat.com".format(*ip.split("."))
return "ci-vm-{0}-{1}-{2}-{3}.hosted.upshift.rdu2.redhat.com".format(*ip.split("."))
ogajduse marked this conversation as resolved.
Show resolved Hide resolved


# -----------------------------------------------------------
Expand Down Expand Up @@ -241,7 +241,7 @@ def __checkenv(self):
if self.__check_env_done:
return
if not os.environ.get('OS_AUTH_URL') or \
not os.environ.get('OS_TENANT_NAME') or \
not os.environ.get('OS_PROJECT_NAME') or \
not os.environ.get('OS_USERNAME') or \
not os.environ.get('OS_PASSWORD'):
if not self.__first_check:
Expand Down Expand Up @@ -302,7 +302,7 @@ def __get_nova(self):
self.__nova = nova_client.Client(2,
username=os.environ.get('OS_USERNAME'),
password=os.environ.get('OS_PASSWORD'),
project_id=os.environ.get('OS_TENANT_NAME'),
project_id=os.environ.get('OS_PROJECT_NAME'),
app_version=os.environ.get('OS_IDENTITY_API_VERSION'),
auth_url=os.environ.get('OS_AUTH_URL'))
else:
Expand All @@ -315,7 +315,9 @@ def __get_session(self):
loader = keystoneLoading.get_plugin_loader('password')
auth = loader.load_from_options(username=os.environ.get('OS_USERNAME'),
password=os.environ.get('OS_PASSWORD'),
project_id=os.environ.get('OS_TENANT_ID'),
project_id=os.environ.get('OS_PROJECT_ID'),
user_domain_name=os.environ.get('OS_USER_DOMAIN_NAME'),
project_domain_id=os.environ.get('OS_PROJECT_DOMAIN_ID'),
auth_url=os.environ.get('OS_AUTH_URL'))
self.__session = keystoneSession.Session(auth=auth)
return self.__session
Expand Down Expand Up @@ -434,7 +436,7 @@ def __images(self):
if self.__filter == self.__default_filter:
# Call simple method for create session object
self.nova.api_version.is_null()
ff = {'filters': {'owner': os.environ.get('OS_TENANT_ID')}}
ff = {'filters': {'owner': os.environ.get('OS_PROJECT_ID')}}

# Somewhere between novaclient version 6 and
# version 9, images was deprecated and replaced
Expand Down Expand Up @@ -606,7 +608,8 @@ def __get_external_for_private_network(self, pnet):
This function returns public network for private network,
if the router is present between these nets.
"""
ports = self.neutron.list_ports(network_id=pnet['id'], device_owner="network:router_interface").get('ports')
ports = self.neutron.list_ports(network_id=pnet['id'],
device_owner='network:router_interface_distributed').get('ports')
if len(ports) == 0:
return None
router = self.neutron.show_router(ports.pop(0)['device_id'])
Expand Down