본문 바로가기
Infra/프라이빗 클라우드 인프라

Image 생성 (Snapshot)

by shinebee* 2020. 7. 7.
  1. 1. Instance 생성

  2. 2. 원격 접속을 위해 floating ip 설정

  3. 3. sealing

    • 참고  linux vm sealing 검색.

rm -rf /etc/ssh/ssh_host_*
  • ssh key 모두 삭제 
hostname=localhost.localdomain
  • hostname 초기화
rm -rf /etc/udev/rules.d/70-*
  • 장치 정보를 제거 ( 머신을 사용하면서 여러가지 추가된 장치 (ex. usb...))

 

  • HWADDR (MAC 주소 세팅), UUID (network card ID) 있다면 제거  ->  /etc/sysconfig/network-scripts/ifcfg-eth*
  • 경우에 따라 DNS도 제거
system power off
  • 오류가 발생 할 수 있으므로 snapshot항상 멈춤 상태에서 찍는다.

 

 

 

  4. virt-sysprep 사용 - sealing

 

     [contorller]

1. openstack image save --file web-image.qcow2 test-i 
  •  controller에 이미지 복사.

 

      [compute]

1. yum install -y libguestfs libguestfs-tools
  • package 설치
2. scp root@192.168.122.10:~/web-image.qcow2 . 
  • 현재 위치에(.) controller에 저장되어있는 이미지를 불러온다.
3. export LIBGUESTFS_BACKEND=direct
  • 환경변수 지정. conf
4. virt-sysprep --list-operations
  • 어떤 작업을 하는지 리스트 목록으로 보여짐
5. virt-sysprep -a web-image.qcow2

 

 

     [controller]

1. rm -rf ~/web-image.qcow2 
  • 원래 있던 이미지 삭제 (sealing 하기전)
2. scp root@192.168.122.11:~/web-image.qcow2 . 
  • sealing이 완료된 이미지를 불러옴
3. openstack image create --file ~/web-image.qcow2 --disk-format qcow2 --private web-image-sealed 
  • 이미지 생성
  • image name = web-image-sealed.qcow2
4. openstack image list 
  • 확인

 

 

 

※ Window는?

  • 윈도우는 sysprep이라는 시스템을 초기화 할 수 있는 시스템 준비 도구가 있다.
  • SID → 시스템 고유의 ID + 사용자마다의 고유의 ID (Linux의 UID)

'Infra > 프라이빗 클라우드 인프라' 카테고리의 다른 글

[ Glance with Swift backend ]  (0) 2020.07.07
Image 생성 (diskimage-builder)  (0) 2020.07.07
Open Stack - Heat (wordpress)  (0) 2020.07.02
Open Stack - Cloud-init (wordpress)  (0) 2020.07.02
Open Stack 운영.3 (user)  (0) 2020.07.02

댓글