|
원본 : http://d.hatena.ne.jp/utera/20100416/1271430636
물리적 환경에서 가상 환경에 서버 마이그 레이션하는 것이 P2V (Physical to Virtual)라고 부르게됩니다.
P2V 도구의 하나로 Virt - P2V ( http://people.redhat.com/ ~ rjones/virt-p2v / )가 있는데,이 도구는 현재 바이너리 (iso 이미지)를 다운로드하지 못하고, 소스 코드만을 이용 준비 되었습니다.
오늘은 내가 확인한 Virt - P2V 빌드 단계를 소개합니다.
이번에는 ( KVM 의) 최소 구성으로 설치 i386적인 fedora12를 사용하여 빌드했습니다.
우선 소스 코드를 다운로드하여 압축을 풉니다.
$ wget http://people.redhat.com/ ~ rjones/virt-p2v/virt-p2v-0.9.9.tar.gz $ tar xzf virt - p2v - 0.9.9.tar.gz $ cd virt - p2v - 0.9.9
README에 나와있는 필수 패키지를 설치합니다.
그 외에도 mercurial과 createrepo 패키지가 필요하므로 미리 설치되어야합니다.
(종속 관계로 다양한 패키지가 동시에 설치됩니다.)
$ sudo yum - y install livecd - tools rpm - build $ sudo yum - y install ocaml ocaml - findlib ocaml - extlib ocaml - pcre ocaml - xml - light \ ocaml - newt ocaml - libvirt ocaml - fileutils ocaml - gettext ocaml - gettext - devel $ sudo yum - y install mercurial createrepo
패키지 설치가 끝나면 빌드를 시작합니다.
$ . / configure Checking for A BSD - compatible install ... / usr / bin / install - c checking for ocamlc ... ocamlc OCaml version is 3.11.1 + rc1 OCaml library path is / usr / lib / ocaml checking for ocamlopt ... ocamlopt checking for ocamlc.opt ... ocamlc.opt checking for ocamlopt.opt ... ocamlopt.opt checking for ocamldep ... ocamldep checking for ocamlmktop ... ocamlmktop checking for ocamlmklib ... ocamlmklib checking for ocamldoc .... / configure : line 2313 : WARNING : : command not found no checking for ocamlfind ... ocamlfind checking for module unix ... checking for module extlib ... + extlib checking for module xml - light ... + xml - light checking for module newt ... + newt checking for module pcre ... + pcre checking for module libvirt ... + libvirt checking for module gettext ... + gettext checking for livecd - creator ... livecd - creator checking for livecd - iso - to - pxeboot ... livecd - iso - to - pxeboot checking for perldoc ... perldoc checking for qemu ... no checking for qemu - kvm ... no checking for ocaml - gettext .. . ocaml - gettext ---------------------------------------------- -------------- Thanks for downloading virt - p2v 0.9.9 --------------------------- --------------------------------- configure : creating. / config.status config.status : creating Makefile config.status : creating po / Makefile config.status : creating p2v.ks config.status : creating virt - p2v.spec $ make RPM make dist make [1] : Entering directory`/ usr/local/src/virt-p2v-0.9.9 'make check - manifest make [2] : Entering directory`/ usr/local/src/virt-p2v-0.9.9'abort : There is no Mercurial repository here (. hg not found)! <이하 생략>
. hg가 없다한다. 아무래도 저장소 정보가 저장된 mercurial 설정 파일 같습니다.
. hg를 어떻게 작성할지 이래저래 고민했지만, 개발 레파지토리에서 소스 코드를 검색하면. hg가 들어있었습니다.
$ cd .. $ HG clone http://hg.et.redhat.com/virt/applications/virt-p2v--devel destination Directory : virt - p2v - devel requesting all changes adding changesets adding manifests adding file changes added 152 changesets with 345 changes to 75 files (+1 heads) updating to branch default 64 files updated, 0 files merged, 0 files removed, 0 files unresolved $ ls virt - p2v - 0.9.9 virt - p2v - 0.9.9.tar. gz virt - p2v - devel $ ls - a virt - p2v - devel . COPYING inittab Makefile.in README virt - p2v virt - p2v.1.txt .. extras install - sh MANIFEST README.developers virt - p2v.1 virt - p2v.pod aclocal.m4. hg iso - attach p2v.ks.in TODO virt - p2v.1.css virt - p2v.spec.in configure.ac. hgignore lvm.conf po tty1 virt - p2v.1.html virt - p2v - update - wrapper
걱정 되었기 때문에, make rpm에서 걸려있는 위치를 보고했습니다.
$ cd virt - p2v - 0.9.9 $ less Makefile check - manifest : @ hg manifest | sort>. check - manifest; \ sort MANIFEST>. orig - manifest; \ diff - u. orig - manifest. check - manifest; rv =$$?; \ rm - f. orig - manifest. check - manifest; \ exit $ $ rv
MANIFEST 내용도 확인 보았는데, 아무 래도 저장소에 들어있는 파일 목록을 확인하고있는 모습.
개발 버전. hg를 빌려 와서도 문제 없을 것이므로 복사하고 다시 시도.
$ cp - a ../virt-p2v--devel/.hg. $ make RPM make dist make [1] : Entering directory`/ usr/local/src/virt-p2v-0.9.9 'make check - manifest make [2] : Entering directory`/ usr/local/src/virt-p2v-0.9.9 '---. orig - manifest 2010-04-16 07:46:42.167689964 +0900 + + +. check - manifest 2010 - 04-16 07:46:42.162696352 +0900 @ @ -40,6 +40,8 @ @ MANIFEST p2v.ks.in po / de.po + po / es.po + po / it.po po / ja.po po / LINGUAS po / Makefile.in make [2] : *** [check - manifest] Error 1 make [2] : Leaving directory`/ usr/local/src/virt-p2v-0.9.9 'make [1] : *** [dist] Error 2 make [1] : Leaving directory`/ usr/local/src/virt-p2v-0.9.9 'make : *** [p2vrepo/virt-p2v-0.9.9-1. noarch.rpm] Error 2
개발 버전은 스페인과 이탈리아의 언어 파일이 추가되어있는 모양.
언어 파일도 개발 버전의 소스 트리에서 가져와, MANIFEST 파일을 편집합니다.
$ cp - a ../virt-p2v--devel/po/es.po ../virt-p2v--devel/po/it.po / po $ vi MANIFEST 파일 맨 끝에 다음 2 줄을 추가 . po / es.po po / it.po
이 상태에서 make rpm이 통과하게되었습니다.
$ make rpm
お次는 make build입니다. root 권한으로 실행하십시오.
$ sudo make build test - f p2vrepo/virt-p2v-0.9.9-1.noarch.rpm test - x virt - p2v ./virt-p2v - test rm - f virt - p2v - 0.9.9.iso livecd - creator - config = p2v.ks - fslabel = virt - p2v - 0.9.9 mke2fs 1.41.9 (22 - Aug - 2009) Filesystem label = virt - p2v - 0.9.9 OS type : Linux Block size = 4096 (log = 2) Fragment size = 4096 (log = 2) 262144 inodes, 1048576 blocks 10485 blocks (1.00 %) reserved for the super user First data block = 0 Maximum filesystem blocks = 1073741824 32 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks : 32768, 98304, 163840, 229376, 294912, 819200, 884736 Writing inode tables : done Creating journal (32768 blocks) : done Writing superblocks and filesystem accounting information : done This filesystem will be automatically checked every 27 mounts or 180 days, whichever comes first. Use tune2fs - c or - i to override. tune2fs 1.41.9 (22 - Aug - 2009) Setting maximal mount count to -1 Setting interval between checks to 0 seconds Retrieving file : / / / usr/local/src/virt-p2v-0.9.9/p2vrepo/repodata/repomd.xml ... OK Retrieving file : / / / usr/local/src/virt-p2v-0.9.9/p2vrepo/repodata / primary.xml.gz ... OK / usr/lib/python2.6/site-packages/imgcreate/errors.py : 45 : DeprecationWarning : BaseException.message has been deprecated as of Python 2.6 return unicode (self.message) Error creating Live CD : Unable to download from repo : Cannot retrieve repository metadata (repomd.xml) for repository : released. Please verify its path and try again <이하 생략>
LiveCD 이미지에수록하는 패키지를 저장소에서 다운로드하는 곳 이끼있는 것 같습니다.
p2v.ks 파일에 지정되어있는 저장소 URL을 현재 사용할 수있는 것으로 변경합니다.
$ cp - a p2v.ks p2v.ks.orig $ vi p2v.ks 다음 diff 결과를 참고 저장소 지정을 다시 $ diff - u p2v.ks.orig p2v.ks --- p2v.ks.orig 2010 - 04-16 22:40:15.712718787 +0900 + + + p2v.ks 2010-04-16 23:01:57.343700887 +0900 @ @ -30,8 +30,8 @ @ bootloader - append = "console = tty0 console = ttyS0, 9600n8 "# Basic Fedora repository and updates. - repo - name = released - baseurl = http://download.fedora.redhat.com/pub/fedora/linux/releases/10/Everything/i386/os / - repo - name = updates - baseurl = http://download.fedora.redhat.com/pub/fedora/linux/updates/10/i386/ + repo - name = released - mirrorlist = http:/ / mirrors.fedoraproject.org / mirrorlist? repo = fedora - 12 & arch = i386 + repo - name = updates - mirrorlist = http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-12&arch=i386 # repo - name = released - mirrorlist = http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-10&arch=i386 # A local repository if selected by. / configure - enable - localrepo =...
자 이번에야말로.
$ sudo make build
LiveCD 이미지를 만드는 데 시간이 걸리지만, 특히 오류없이 virt - p2v - 0.9.9.iso가 만들 어질 것입니다.
에서 소개하는 단계로 Virt - P2V 이미지를 만들 수 있지만, 소스가 제대로 빌드 할 수없는 상태로 배포되지 않거나 조금 불안한 부분이 있습니다.
(기회가 없기 때문에, 아직이 이미지의 P2V를 철저히 시험하지 않습니다)
덧붙여서, Virt - P2V의 공식 페이지에는 다음과 같은 단서가 들어 있습니다.
Please note this project is in the process of being rewritten.
at this time We recommend you try Alternate methods or follow The Manual Process Here .