2016-12-28 1 views
1

"런던"지역에 포함 된 대시 보드를 만들었습니다. 하지만 내가 접근하려고 할 때, 프로그램은 심지어 here과 같이 기본 영역으로 확인합니다. 내 자격 증명의 영역이 "런던"이지만 지역 "달라스"만 명시합니다. 내 프로그램을 통해 컨테이너를 만들려고했는데 컨테이너가 "달라스"지역에서 만들어졌습니다.개체 저장소 - "런던"지역의 컨테이너에 액세스 할 수 없습니다.

프로그램을 "런던"지역의 컨테이너에 액세스하려면 어떻게합니까? 지역을 지정하는 방법에 대한 조언을 주시면 감사하겠습니다.

컨테이너를 나열하는 코드는 다음과 같습니다.

final private OSClient os; 

public ObjectStorageDAO(String url, String userId, String password, String project, String domainName) 
     throws Exception { 

    Identifier domainIdentifier = Identifier.byName(domainName); 
    Identifier projectIdentifier = Identifier.byName(project); 

    os = OSFactory.builderV3().endpoint(url).credentials(userId, password) 
      .scopeToProject(projectIdentifier, domainIdentifier).authenticate(); 
} 

/** 
* Returns the list of containers under the account 
*/ 
public List containers() { 
    return os.objectStorage().containers().list(); 
} 
+0

을'os' 객체를 초기화 한 후, 당신은이 지역을 강제로 시도 할 수 있습니다? 예 : 'os.useRegion ('london')'- http://www.openstack4j.com/learn/identity/identity-v3 –

+0

대단히 감사합니다. @SHC –

+0

훌륭한 것들 - 나는 이것을 답으로 추가했습니다. 이 대답을 수락 하시겠습니까? –

답변

2

운영 체제 개체를 초기화 한 후,이 지역을 강제로 시도 할 수 있습니다?

final private OSClient os; 

public ObjectStorageDAO(String url, String userId, String password, String project, String domainName) 
     throws Exception { 

    Identifier domainIdentifier = Identifier.byName(domainName); 
    Identifier projectIdentifier = Identifier.byName(project); 

    os = OSFactory.builderV3().endpoint(url).credentials(userId, password) 
      .scopeToProject(projectIdentifier, domainIdentifier).authenticate(); 

    ///////////////////////// 
    // force london region // 
    ///////////////////////// 

    os.useRegion('london') 
} 

/** 
* Returns the list of containers under the account 
*/ 
public List containers() { 
    return os.objectStorage().containers().list(); 
} 

자세한 내용은 여기를 참조 : http://www.openstack4j.com/learn/identity/identity-v3

관련 문제