Skip to content

Conversation

@paikend
Copy link
Collaborator

@paikend paikend commented Aug 15, 2025

OpenStack Connection Manager 개선

Overview (한글)

OpenStack Connection Manager를 모듈 레벨 싱글턴으로 변경하여 연결 관리를 개선하고, 불필요한 TODO 주석을 제거했습니다.

Key Changes (주요 변경사항)

  • 모듈 레벨 싱글턴 구현: OpenStackConnectionManager 인스턴스를 모듈 레벨에서 생성하여 싱글턴 패턴 적용
  • 연결 관리 개선: get_openstack_conn() 함수에서 모듈 레벨 싱글턴 인스턴스 사용
  • 불필요한 TODO 주석 제거: 토큰 만료 관련 TODO 주석 삭제 (OpenStack SDK에서 자동 재인증 지원)
  • 코드 주석 개선: 메서드 독스트링 오타 수정

Technical Details (기술적 세부사항)

Before

def get_openstack_conn():
    """Get OpenStack Connection"""
    return OpenStackConnectionManager.get_connection()

After

_openstack_connection_manager = OpenStackConnectionManager()

def get_openstack_conn():
    """Get OpenStack Connection"""
    return _openstack_connection_manager.get_connection()

Related Issues (관련 이슈)

  • 모듈 레벨에서 안전한 싱글턴 패턴 적용
  • OpenStack SDK의 자동 토큰 재인증 기능 활용

Additional Context (추가 정보)

OpenStack SDK는 keystoneauth1을 사용하여 토큰 만료 시 자동 재인증을 지원합니다 (allow_reauth=True가 기본값). 따라서 토큰 만료 관련 예외 처리는 SDK에서 자동으로 처리되므로 별도 구현이 불필요합니다.


Overview

Improved OpenStack Connection Manager by implementing module-level singleton pattern and removed unnecessary TODO comments.

Key Changes

  • Module-level singleton implementation: Created OpenStackConnectionManager instance at module level for singleton pattern
  • Improved connection management: Updated get_openstack_conn() function to use module-level singleton instance
  • Removed unnecessary TODO comments: Deleted token expiration related TODO comment (OpenStack SDK supports automatic re-authentication)
  • Improved code comments: Fixed typo in method docstring

Related Issues

  • Applied safe singleton pattern at module level
  • Leveraged OpenStack SDK's automatic token re-authentication feature

Additional Context

OpenStack SDK supports automatic re-authentication on token expiration using keystoneauth1 with allow_reauth=True as default. Therefore, manual token expiration handling is unnecessary as the SDK handles it automatically.

@halucinor halucinor added the fix Minor fixes, tweaks, and code improvements label Aug 17, 2025
Copy link
Collaborator Author

@paikend paikend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

내부 로직을 완전히 파악 못하고 PR 올렸네요
atexit.unregister(self.close) 작업할 떄 이 부분을 놓쳤어요

Copy link
Collaborator

@choieastsea choieastsea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@paikend paikend merged commit 1260b40 into develop Aug 18, 2025
6 checks passed
@paikend paikend deleted the fix/connection-enforce branch August 18, 2025 15:49
platanus-kr pushed a commit that referenced this pull request Aug 19, 2025
* Fix: enforce singleton patten openstack connection

* Remove: connection cleanup(Already support in opsntack SDK)
halucinor pushed a commit that referenced this pull request Aug 24, 2025
* Fix: enforce singleton patten openstack connection

* Remove: connection cleanup(Already support in opsntack SDK)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Minor fixes, tweaks, and code improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants