'2017/07/18'에 해당되는 글 2건

  1. 2017.07.18 처음 본 오픈 스택의 Cinder
  2. 2017.07.18 [python3] python3에서 자주 실수하는 부분

오픈 스택 스토리지는 3가지 스토리지 타입이 있다. Nova, Cinder, Swift가 있다. 

자세한 비교표는 아래와 같다. 이 중 Nova는 Computing 역할을 한다. 


Cinder는 아마존의 Elastic Block Service(EBS)와 비교된다. 더 정확히 말하면 추상화 api라고 보면 된다.


    




Cinder(https://github.com/openstack/cinder)는 인스턴스마다 붙일 수 있는 블록스토리지의 개념을 갖는 가상 하드 드라이브 개념이 있다. 

오픈스택의 cinder 문서(https://docs.openstack.org/cinder/latest/)에 따르면 표준의, HA 기능까지 제대로 있다. 

  • Component based architecture: Quickly add new behaviors
  • Highly available: Scale to very serious workloads
  • Fault-Tolerant: Isolated processes avoid cascading failures
  • Recoverable: Failures should be easy to diagnose, debug, and rectify
  • Open Standards: Be a reference implementation for a community-driven api

cinder는 볼륨,쿼터 기능을 API로 제공한다.
cinder 아키텍처는 다음과 같다. 





화면은 다음과 같다.


출처 : https://cloudarchitectmusings.com/2013/11/18/laying-cinder-block-volumes-in-openstack-part-1-the-basics/





Screen Shot 2013-11-18 at 11.00.24 AM

cinder의 각 컴포넌트 기능은 다음과 같다. 

  • cinder-api – API 서버
  • cinder-scheduler – 볼륨 요청을 적절한 볼륨 서비스로 스케쥴하고 보낸다. 기본 설정은 라운드 로빈이지만 Filter Scheduler를 복잡한 스케쥴을 할 수 있다.
  • cinder-volume – 블럭 스토리지 디바이스를 관리한다.
  • cinder-backup – 볼륨을 여러 백업 장치에 복사한다.



Nova와 어떻게 연동되는지 https://cloudarchitectmusings.com/2013/11/18/laying-cinder-block-volumes-in-openstack-part-1-the-basics/의 내용의 일부를 발번역했다. 



1. 볼륨은 cinder create 커맨드를 통해 생성된다. cinder create 커맨드는 논리 볼륨(LV)에 "cinder-volumes" 볼륨 그룹( VG)으로 생성한다.

2. 해당 볼륨은 nova volume-attach 커맨드를 통해 인스턴스에 붙는다. nova volumne-attach 커맨드는 컴퓨트 노드의 iSCSI IQN을 생성한다. 

3. 인스턴스를 실행하는 컴퓨터 노드는 이제 iSCSI 액티브 세션을 갖고 있고 새로운 로컬 스토리지를 얻는다.

4. Libvirt는 인스턴스에 대한 스토리지로 로컬 스토리를 사용한다. 인스턴스는 새로운 디스크를 얻었다. 보통 /dev/vdX디스크라 되어 있다.

Screen Shot 2013-11-18 at 11.06.14 AM




다음은 슬라이드 자료이다. 


OpenStack Cinder from Deepti Ramakrishna


'Cloud' 카테고리의 다른 글

처음 본 오픈 스택의 Nova  (0) 2017.07.20
[펌] 공개된 카카오 오픈 스택 관련 공개 및 강의 자료  (0) 2017.07.20
처음 본 Kolla  (0) 2017.07.17
처음 만난 ceph  (0) 2017.07.14
처음 만난 SDN/NFV  (0) 2017.07.14
Posted by '김용환'
,


python3 코드를 개발하다가 자주 실수하는 부분을 적어본다.


1. raw_input은 사라졌다.


raw_input  대신 input 함수로 바꿔 그대로 사용한다.




2. print "" 이 아닌 print("")이다.


print "log : ..."



3. sqlite



python2에서는 sqlite import하고 난 뒤 쿼리를 날리면 buffer()를 사용했었는데, python3에서는 ()만 사용한다.


cur.execute('SELECT count FROM Ages WHERE org = ? ', (org, ))

row = cur.fetchone()


()를 사용하지 않으면, 다음 에러가 발생한다.


sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 40 supplied.





두 개의 매개 변수를 쿼리에 전달할 때는 다음처럼 2개의 변수를 ()에 넣어서 전달한다. 


cur.execute('''INSERT INTO Ages (id, age) VALUES ( ?, ? )''', (i,a), )




4. urllib api의 모듈 이름


파이썬 2              => 파이썬 3

urllib.urlencode() =>  urllib.parse.urlencode()

urllib.urlopen() => urllib.request.urlopen()





5. urllib api의 바이너리 


python2의 urllib에서는 urlopen의 결과가 기본 문자열이었다면 python3의 urllib.request.urlopen의 결과는 bytes이다.


에러는 TypeError: a bytes-like object is required, not 'str'와 같다.


    uh = urllib.request.urlopen(url, context=scontext)

    data = uh.read().decode('utf-8')

    


로그로 찍어보면 아래와 같이 byte로 읽는 것을 확인할 수 있다. 

characters b'{\




    

    

    

'python' 카테고리의 다른 글

pyenv 설치 방법  (0) 2017.09.19
[python3] sorted 함수 예제  (0) 2017.07.20
[python3] dict()의 in의 의미  (0) 2017.07.11
[python3] 맥에서 spyder 설치/실행  (0) 2017.04.28
[python] python 2.4 -> python 2.7 업그레이드  (0) 2017.01.16
Posted by '김용환'
,