openstack

openstack - cinder iscsi volume disk 컨피그 및 instance 할당

sysman 2021. 2. 2. 15:51

 

##################################

##### network node 설정(storage) #######

##################################

 

lvm 관련 데몬 다운로드

# yum install lvm2 mesa-private-llvm* -y

# rpm -qa | grep lvm

 

lvm 데몬 실행

# systemctl enable lvm2-lvmetad

# systemctl start lvm2-lvmetad

# systemctl status lvm2-lvmetad

 

디스크 확인

# fdisk -l

...

Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

..

 

볼륨 생성

# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created.
# vgcreate cinder-volumes /dev/sdb
  Volume group "cinder-volumes" successfully created
# vgdisplay cinder-volumes

 

# vi /etc/cinder/cinder.conf

[DEFAULT]
my_ip = 192.168.100.112
log_dir = /var/log/cinder
state_path = /var/lib/cinder
enable_v1_api = True
enable_v2_api = True
enable_v3_api = True
auth_strategy = keystone
transport_url = rabbit://openstack:password@192.168.100.110
glance_api_servers = http://192.168.100.110:9292
enabled_backends = lvm

 

맨 아래쪽으로 내려가서 새로 작성함

[lvm]

target_helper = lioadm

 

volume_group = cinder-volumes

target_ip_address = 192.168.100.112

volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver

volumes_dir = $state_path/volumes

target_protocol = iscsi

 

 

#mkdir -p /var/lib/cinder/volumes

#chown -R cinder.cinder /var/lib/cinder/volumes

 

# systemctl restart openstack-cinder-volume target

# systemctl enable openstack-cinder-volume target

 

# openstack volume service list

 

##################################

#####       compute node 설정      #######

##################################

 

# vi /etc/nova/nova.conf

컴퓨트가 속한 리젼 지정 (카탈로그 서비스에서 제공한 url에서 nova 서비스와 동일한 리전 이름을 사용)

[cinder]
os_region_name = RegionOne

 

# systemctl restart openstack-nova-compute

 

##################################

#####       controller node 설정      #######

##################################

 

# echo "export OS_VOLUME_API_VERSION=2" >> ~/keystonerc

# source ~/keystonerc

1기가 볼륨 생성

# openstack volume create --size 1 disk1

# openstack volume list

 

인스턴스 생성

# openstack server create --flavor m1.tiny --image cirros --security-group default cirros

인스턴스에 volume 추가

# openstack server add volume cirros disk1

# openstack volume list

볼륨 연결 해제

# openstack server remove volume cirros disk1

볼륨 삭제

#openstack volume delete disk1 

 

 

인스턴스 cirros에서 확인 (/dev/vdb 확인)

인스턴스에서 vdb 파티션 생성

인스턴스에서 vdb 마운팅

 

참고 : itguava.tistory.com/109?category=846530