Product SiteDocumentation Site

Red Hat Enterprise Linux 5

가상화 가이드

Virtualization Documentation

엮음 5.8

Red Hat Engineering Content Services

법적 공지

Copyright © 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
All other trademarks are the property of their respective owners.


1801 Varsity Drive
 RaleighNC 27606-2072 USA
 Phone: +1 919 754 3700
 Phone: 888 733 4281
 Fax: +1 919 754 3701

초록
The Red Hat Enterprise Linux Virtualization Guide contains information on installation, configuring, administering, and troubleshooting virtualization technologies included with Red Hat Enterprise Linux.

머리말
1. 문서 정보
2. 문서화 규정
2.1. 표기 규정
2.2. 인용문 규정
2.3. 알림 및 경고
3. We need your feedback
3.1. Technical review requests
4. What is Virtualization?
5. Types of Virtualization
5.1. Full Virtualization
5.2. Para-Virtualization
5.3. Para-virtualized drivers
6. How CIOs should think about virtualization
I. Red Hat Enterprise Linux의 가상화에 있어서 요구 사항 및 제한 사항
1. 시스템 요구 사항
2. Xen 제한 및 지원 사항
3. KVM 제한 및 지원 사항
4. Hyper-V restrictions and support
5. 가상화 기술 제한 사항
5.1. 가상화에서의 일반적인 제한 사항
5.2. Xen 제한 사항
5.3. Xen 기술 제한 사항
5.4. 어플리케이션 제한 사항
II. 설치
6. 가상화 패키지 설치
6.1. 새 Red Hat Enterprise Linux 설치를 사용하여 Xen 설치
6.2. 기존 Red Hat Enterprise Linux 시스템에 Xen 패키지 설치
6.3. 새 Red Hat Enterprise Linux 설치를 사용하여 KVM 설치
6.4. 기존 Red Hat Enterprise Linux 시스템에 KVM 패키지 설치
7. 가상화 게스트 설치 개요
7.1. virt-install로 게스트 생성
7.2. virt-manager로 게스트 생성
7.3. PXE로 게스트 설치
8. 게스트 운영 체제 설치 절차
8.1. 반가상화 게스트로서 Red Hat Enterprise Linux 5 설치
8.2. 완전 가상화 게스트로서 Red Hat Enterprise Linux 설치
8.3. 완전 가상화 게스트로 Windows XP 설치
8.4. 완전 가상화 게스트로 윈도우 서버 2003 설치
8.5. 완전 가상화 게스트로 Windows Server 2008 설치
III. 설정
9. Virtualized storage devices
9.1. 가상 플로피 디스크 제어기 생성
9.2. 게스트에 저장 장치 추가
9.3. Red Hat Enterprise Linux 5에서 영구적 저장 장치 설정
9.4. 게스트에 가상화 CD-ROM 또는 DVD 장치 추가
10. 네트워크 설정
10.1. libvirt를 사용한 NAT (Network address translation)
10.2. libvirt를 사용하여 브리지된 네트워킹
11. 사전 Red Hat Enterprise Linux 5.4 Xen 네트워킹
11.1. 여러 이더넷 카드를 사용하기 위해 다수의 게스트 네트워크 브리지 설정
11.2. Red Hat Enterprise Linux 5.0 랩톱 네트워크 설정
12. Xen 반가상화 드라이버
12.1. 시스템 요구 사항
12.2. 반가상화 제한 및 지원 사항
12.3. 반가상화 드라이버 설치
12.3.1. 일반적인 설치 단계
12.3.2. Red Hat Enterprise Linux 3에서 반가상화 드라이버 설치 및 설정
12.3.3. Red Hat Enterprise Linux 4에서 반가상화 드라이버 설치 및 설정
12.3.4. Xen Para-virtualized Drivers on Red Hat Enterprise Linux 5
12.3.5. Xen Para-virtualized Drivers on Red Hat Enterprise Linux 6
12.4. 반가상화 네트워크 드라이버 설정
12.5. 반가상화 하드웨어 추가 설정
12.5.1. 가상 네트워크 인터페이스
12.5.2. 가상 저장 장치
13. KVM 반가상화 드라이버
13.1. KVM Windows 반가상화 드라이버 설치
13.2. Installing drivers with a virtualized floppy disk
13.3. 기존 장치에 대해 KVM 반가상화 드라이버 사용
13.4. 새 장치에 대해 KVM 반가상화 드라이버 사용
14. PCI passthrough
14.1. Adding a PCI device with virsh
14.2. Adding a PCI device with virt-manager
14.3. PCI passthrough with virt-install
14.4. PCI passthrough for para-virtualized Xen guests on Red Hat Enterprise Linux
15. SR-IOV
15.1. Introduction
15.2. Using SR-IOV
15.3. Troubleshooting SR-IOV
16. KVM 게스트 시간 관리
IV. 관리
17. 서버 모범 사례
18. 가상화 보안
18.1. Storage security issues
18.2. SELinux 및 가상화
18.3. SELinux
18.4. Virtualization firewall information
19. xend를 사용한 게스트 관리
20. Xen 실시간 이전
20.1. 실시간 이전의 예
20.2. 실시간 게스트 이전 설정
21. KVM 실시간 이전
21.1. 실시간 이전 요구 사항
21.2. 공유 저장 장치 예제: 단일 이전을 위한 NFS
21.3. virsh로 실시간 KVM 이전
21.4. virt-manager를 사용하여 이전
22. 가상화 게스트의 원격 관리
22.1. SSH를 통한 원격 관리
22.2. TLS 및 SSL을 통한 원격 관리
22.3. 전송 모드
V. Virtualization Storage Topics
23. Using shared storage with virtual disk images
23.1. Using iSCSI for storing virtual disk images
23.1.1. How to set up an iSCSI target on Red Hat Enterprise Linux
23.1.2. How to configure iSCSI on a libvirt KVM host and provision a guest using virt-install
VI. 가상화 참조 가이드
24. 가상화 도구
25. virsh를 사용한 게스트 관리
26. 가상 장치 관리자(virt-manager)를 사용한 게스트 관리
26.1. The Add Connection window
26.2. 가상 장치 관리자 메인 창
26.3. The guest Overview tab
26.4. 가상 장치 그래픽형식 콘솔
26.5. virt-manager 시작
26.6. 저장된 장치 복구
26.7. 게스트 정보 표시
26.8. 상태 모니터링
26.9. 게스트 식별자 표시
26.10. Displaying a guest's status
26.11. 가상 CPU 보기
26.12. CPU 사용량 보기
26.13. 메모리 사용량 보기
26.14. 가상 네트워크 관리
26.15. 가상 네트워크 생성
27. xm 명령 빠른 참조
28. Xen 커널 부트 파라미터 설정
29. ELILO 설정
30. libvirt configuration reference
31. Xen 설정 파일
VII. 힌트 및 도움말
32. 힌트 및 도움말
32.1. 자동으로 게스트 시작
32.2. KVM과 Xen 하이퍼바이저 사이에서 변경
32.2.1. Xen에서 KVM으로
32.2.2. KVM에서 Xen으로
32.3. qemu-img 사용
32.4. Overcommitting Resources
32.5. /etc/grub.conf 수정
32.6. 가상화 확장자 확인
32.7. Accessing data from a guest disk image
32.8. Setting KVM processor affinities
32.9. 고유한 새 MAC 주소 생성
32.10. Xen 게스트 용 네트워크 대역폭 제한
32.11. Xen 프로세서 친화력 설정
32.12. Xen 하이퍼바이저 수정
32.13. 보안 ftpd
32.14. LUN 지속성 구현
32.15. 게스트 용 SMART 디스크 모니터링 비활성화
32.16. 이전 Xen 설정 파일 삭제
32.17. VNC 서버 설정
32.18. 게스트 설정 파일 복제
32.19. 기존 게스트 및 게스트 설정 파일 중복
33. 사용자 설정 libvirt 스크립트 생성
33.1. virsh로 XML 설정 파일 사용
VIII. 문제 해결
34. Xen 문제 해결
34.1. Xen 디버깅 및 문제해결
34.2. 로그 파일 개요
34.3. 로그 파일 설명
34.4. 주요 디렉토리 위치
34.5. 로그를 사용한 문제해결
34.6. 직렬 콘솔을 사용한 문제해결
34.7. 반가상화 게스트 콘솔 액세스
34.8. 완전 가상화 게스트 콘솔 액세스
34.9. 일반적인 Xen 문제
34.10. 게스트 생성 오류
34.11. 직렬 콘솔을 사용한 문제해결
34.11.1. Xen에 대한 직렬 콘솔 출력 결과
34.11.2. 반가상화 게스트에서 Xen 직렬 콘솔 출력 결과
34.11.3. 완전 가상화 게스트에서 직렬 콘솔 출력 결과
34.12. Xen 설정 파일
34.13. Xen 오류 메세지 해석
34.14. 로그 디렉토리의 레이아웃
35. 문제 해결
35.1. 사용 가능한 저장 장치 및 파티션 확인
35.2. Xen 기반 게스트를 다시 시작한 후 콘솔 정지
35.3. 네트워크 도구로 찾을 수 없는 가상 이더넷 장치
35.4. Loop 장치 오류
35.5. 메모리 부족으로 인한 도메인 생성 실패
35.6. 잘못된 커널 이미지 오류
35.7. 잘못된 커널 이미지 오류 - PAE 플랫폼 상의 비-PAE 커널
35.8. 완전 가상화 64 비트 게스트 부팅 실패
35.9. 로컬 호스트 항목 부재로 virt-manager 실패 초래
35.10. 게스트 부팅 도중 마이크로코드 오류
35.11. 가상 장치 시작 시 Python depreciation 경고 메세지
35.12. BIOS에 있는 Intel VT 및 AMD-V 가상화 하드웨어 확장자 활성화
35.13. KVM 네트워킹 실행
36. Xen 반가상화 드라이버 문제 해결
36.1. Red Hat Enterprise Linux 5 Virtualization 로그 파일 및 디렉토리
36.2. Red Hat Enterprise Linux 3 게스트 운영 체제에서 반가상화 게스트 불러오기 실패
36.3. Red Hat Enterprise Linux 3에서 반가상화 드라이버를 설치하는 동안 나타나는 경고 메세지
36.4. 반가상화 드라이버를 수동으로 불러오기
36.5. 반가상화 드라이버가 성공적으로 불려졌는지 확인
36.6. 반가상화 드라이버 사용에서 시스템 처리량 제한
Glossary
A. 추가 자료
A.1. 온라인 자료
A.2. 설치된 문서 자료
B. 판권 페이지

머리말

The Red Hat Enterprise Linux Virtualization Guide covers all aspects of using and managing virtualization products included with Red Hat Enterprise Linux.

1. 문서 정보

This book is divided into 8 parts:
  • 시스템 요구 사항
  • 설치
  • 설정
  • 관리
  • Storage
  • 참고 자료
  • 힌트 및 도움말
  • 문제 해결
Key terms and concepts used throughout this book are covered in the Glossary.
This book covers virtualization topics for Red Hat Enterprise Linux 5. The KVM and Xen hypervisors are provided with Red Hat Enterprise Linux 5. Both the KVM and Xen hypervisors support Full virtualization. The Xen hypervisor also supports Para-virtualization. Refer to 4절. “What is Virtualization?” and the Glossary for more details on these terms.

2. 문서화 규정

이 메뉴얼에서는 특정 단어 및 구문을 강조 표시하여 특정 정보 부분에 주의를 집중시키기 위해 문서화 규정을 사용하고 있습니다.
PDF 및 문서 편집에서 이 메뉴얼은 Liberation 글꼴 모음에 있는 서체를 사용합니다. 시스템에 Liberation 글꼴 모음이 설치되어 있을 경우 이는 HTML 편집에서도 사용되지만 설치되어 있지 않을 경우, 다른 동일한 서체로 나타나게 됩니다. 알림: Red Hat Enterprise Linux 5 및 이후 버전에는 기본값으로 Liberation 글꼴 모음이 들어 있습니다.

2.1. 표기 규정

네 가지 표기 규정을 사용하여 특정 단어 및 구문에 주의를 집중시킵니다. 이러한 규정 및 적용 방식은 다음과 같습니다.
고정폭 굵은체
쉘 명령, 파일 이름 및 경로를 포함한 시스템 입력을 강조하기 위해 사용됩니다. 키 캡 및 키 조합을 강조하기 위해 사용되기도 합니다. 예:
현재 작업 중인 디렉토리에 있는 my_next_bestselling_novel 파일 내용을 확인하려면, 쉘 프롬프트에서 cat my_next_bestselling_novel 명령을 입력하고 Enter 키를 눌러 명령을 실행합니다.
위에서 파일 이름, 쉘 명령, 키 캡 모두는 고정폭 굵은체로 나타나 있어 내용과 구별될 수 있습니다.
키 조합은 키 조합의 각 부분을 하이픈으로 연결하여 키 캡과 구별되게 할 수 있습니다. 예:
Enter 키를 눌러 명령을 실행합니다.
Ctrl+Alt+F2을 눌러 첫번째 가상 터미널로 전환합니다. Ctrl+Alt+F1을 눌러 X-윈도우 세션으로 돌아갑니다.
첫 번째 문장에서는 눌러야 하는 특정 키 캡을 강조하고 있습니다. 두 번째 문장에서는 동시에 눌러야 하는 세 개의 키 캡 두 묶음을 강조하고 있습니다.
소스 코드를 설명해야 할 경우, 문장에서 언급된 클래스 이름, 방식, 기능, 변수 이름 및 반환값은 위와 같이 고정폭 굵은체로 나타나게 됩니다. 예:
파일 관련 클래스에는 파일 시스템의 경우 filesystem, 파일의 경우 file, 디렉토리의 경우 dir가 포함됩니다. 각각의 클래스에는 자체의 권한 설정이 있습니다.
가변폭 굵은체
이는 프로그램 이름; 대화 상자 텍스트; 레이블된 버튼; 체크 박스 및 라디오 버튼 레이블; 메뉴 제목; 하부 메뉴 제목을 포함하여 시스템에 있는 단어 또는 구문을 나타냅니다. 예:
주 메뉴 바에서 시스템기본설정마우스를 선택하여 마우스 기본 설정을 시작합니다. 버튼 탭에서, 왼손 잡이 마우스 체크 상자를 선택하고 닫기를 클릭하여 주요 마우스 버튼을 왼쪽에서 오른쪽으로 전환합니다 (왼손 잡이일 경우 보다 적절하게 마우스 사용을 할 수 있게 함).
gedit 파일에 특수 문자를 삽입하려면, 주 메뉴 바에서 프로그램보조 프로그램글자 표를 선택합니다. 다음으로 글자 표에서 검색찾기…를 선택하고, 검색란에 글자 이름을 입력한 후 다음 버튼을 클릭합니다. 찾으려는 글자가 글자 표에 표시되면, 이를 더블 클릭하여 복사할 글자란에 위치하게 한 후, 복사 버튼을 클릭합니다. 그 후 문서로 다시 돌아와서 gedit 메뉴 바에서 편집붙이기를 선택합니다.
위의 내용에는 프로그램 이름, 다양한 시스템 메뉴 이름 및 항목; 특정 프로그램 메뉴 이름; GUI 인터페이스에 있는 버튼 및 텍스트가 포함되어 있으며, 텍스트와 구별 가능하도록 모두 가변폭 굵은체로 되어 있습니다.
고정폭 굵은 이텔릭체 또는 가변폭 굵은 이텔릭체
고정폭 굵은체이던 가변폭 굵은체이던지 간에 이텔릭체가 추가될 경우 이는 교체 또는 변경 가능한 텍스트를 나타내는 것입니다. 글자 그대로 입력하지 말아야 할 텍스트나 또는 상황에 따라 변경해야 하는 텍스트의 경우 이텔릭체로 나타냅니다. 예:
ssh를 사용하여 원격 컴퓨터에 연결하려면, 쉘 프롬프트에 ssh username@domain.name을 입력합니다. 원격 컴퓨터가 example.com이고 사용자 이름이 john일 경우, ssh john@example.com을 입력합니다.
mount -o remount file-system 명령은 지정한 파일 시스템을 다시 마운트합니다. 예를 들어, /home 파일 시스템을 다시 마운트하려면 mount -o remount /home 명령을 사용합니다.
현재 설치된 패키지 버전을 보려면, rpm -q package 명령을 사용합니다. 그러면 다음과 같은 값이 출력됩니다: package-version-release.
위에서 굵은 이텔릭체로 나타나는 단어 — username, domain.name, file-system, package, version 및 release에 유의합니다. 각 단어는 임의의 단어로, 명령을 실행할 때 입력해야 할 텍스트이거나 또는 시스템에 의해 나타나는 텍스트입니다.
작업 제목을 표시하기 위한 기본적인 사용을 제외하고 중요한 새로운 용어를 처음 사용할 때 이텔릭체로 표시합니다. 예:
Publican은 DocBook 발행 시스템입니다.

2.2. 인용문 규정

터미널 출력 결과 및 소스 코드 목록은 주위의 문장에서 잘 보이는 위치에 설정됩니다.
터미널로 보내진 출력 결과는mono-spaced roman에 설정되어 다음과 같이 나타납니다:
books        Desktop   documentation  drafts  mss    photos   stuff  svn
books_tests  Desktop1  downloads      images  notes  scripts  svgs
소스 코드 목록도 mono-spaced roman에 설정되지만, 다음과 같이 구문 강조가 추가되어 있습니다:
package org.jboss.book.jca.ex1;

import javax.naming.InitialContext;

public class ExClient
{
   public static void main(String args[]) 
       throws Exception
   {
      InitialContext iniCtx = new InitialContext();
      Object         ref    = iniCtx.lookup("EchoBean");
      EchoHome       home   = (EchoHome) ref;
      Echo           echo   = home.create();

      System.out.println("Created Echo");

      System.out.println("Echo.echo('Hello') = " + echo.echo("Hello"));
   }
}

2.3. 알림 및 경고

마지막으로, 3 종류의 시각적 스타일을 사용하여 간과될 수 있는 정보에 주의를 집중시킵니다.

알림

알림에서는 현재 작업에 대한 도움말, 지름길 또는 대안적 방법을 제공합니다. 알림 내용을 무시해도 상관없지만 효율적으로 작업할 수 있는 방법을 놓칠 수 있습니다.

중요

중요 상자에서는 현재 세션에만 적용되는 설정을 변경하거나 업데이트를 적용하기 전 다시 시작해야 하는 서비스와 같이 간과하기 쉬운 세부 사항을 제공합니다. 중요 상자를 무시해도 데이터를 손실하게 되지 않지만 문제를 일으킬 수 있습니다.

경고

경고는 무시해서는 안됩니다. 경고를 무시할 경우 대부분 데이터가 손실될 수 있습니다.

3. We need your feedback

If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you. Submit a report in Bugzilla: http://bugzilla.redhat.com/ against Red Hat Enterprise Linux with the Virtualization_Guide component.
When submitting a bug report, be sure to mention the manual's identifier: Virtualization_Guide and version number: 5.
If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, include the section number and some of the surrounding text so we can find it easily.

3.1. Technical review requests

All review requests are classified into one of the following five categories:
New content
content documented for the first time — an entirely new feature, procedure, or concept. For example: "Section now describes the new procedure for creating bootable USB devices."
Correction
a factual error previously present in the text has been corrected. For example: "Section previously stated (incorrectly) that IPv4 and IPv6 were both supported; section now states that IPv6 has never been supported."
Clarification
material that was already factually correct but is now better explained. Clarifications are usually in response to reader feedback that the previous content was confusing or misleading in some way. For example: "Paths described in Example 1.2.3 now better reflect the directory structure of an actual installed system."
Obsoletion
a description of a feature or a procedure has been dropped. Material might be obsolete because of a feature that is no longer supported, a known issue that has been corrected, or hardware that is now obsolete. For example, "Section no longer describes how to update kernel modules using a floppy disk."
Verification
a request to check a fact, procedure, or whether material should be obsoleted. For example, "Section describes how to connect to a generic iSCSI storage device. Please verify this on your hardware" or "Section still describes how to update kernel modules using a LS-120 SuperDisk; please verify that we still need to tell readers about this obsolete hardware."

4. What is Virtualization?

Virtualization is a broad computing term for running software, usually operating systems, concurrently and isolated from other programs on one system. Most existing implementations of virtualization use a hypervisor, a software layer that controls hardware and provides guest operating systems with access to underlying hardware devices. The hypervisor allows multiple operating systems to run on the same physical system by offering virtualized hardware to the guest operating system.

5. Types of Virtualization

5.1. Full Virtualization

Red Hat Enterprise Linux contains virtualization packages and tools which provide system administrators with the means to run fully virtualized, unmodified, operating system guests on Red Hat Enterprise Linux. This provides companies with the ability to consolidate older systems onto newer, more efficient hardware. This reduces physical space and operating costs involved with powering and cooling older, less efficient systems. Full virtualization incurs worse I/O performance than native, also known as bare-metal, installations of operating systems.

5.2. Para-Virtualization

Para-virtualization is a virtualization technique which involves running modified versions of operating systems. The para-virtualized operating system is modified to be aware that it is being virtualized, offering an increased ability for optimization as the guest is more aware of its environment. Performance is generally very close to running bare-metal, non-virtualized operating systems.

5.3. Para-virtualized drivers

These two techniques, para-virtualization and full virtualization, can be combined to allow unmodified operating systems to receive near native I/O performance by using para-virtualized drivers on fully virtualized operating systems. This guide covers installation and configuration of the Red Hat Enterprise Linux para-virtualized drivers package for fully virtualized Microsoft Windows® guests.
The para-virtualized drivers package contains storage and network device drivers for fully virtualized Microsoft Windows® guests. The drivers provide Microsoft Windows® guests running on Red Hat Enterprise Linux with enhanced disk and network I/O performance.

6. How CIOs should think about virtualization

by Lee Congdon, Chief Information Officer, Red Hat, Inc.
빠르게 변화하는 가상화 기술에 이미 많은 투자를 하셨다면, 이를 보다 더 활용하기 위해 아래의 내용을 고찰하시기 바랍니다. 만약 그렇지 않으시다면, 바로 지금이 가상화 기술을 시작하셔야 할 때 입니다.
가상화 기술은 유연성 확대, 비용 절감, 모든 엔터프라이즈 및 정보 기술 기업에 있어서 중요한 기술 도구 모음을 제공합니다. 향후 가상화 기술 솔루션은 점진적으로 확대 사용될 것입니다.
가상화 기술은 기업의 여러 방면에 걸쳐 중요한 이점을 제공할 수 있으므로 파일럿 프로그램을 구축하고 전문 지식을 개발하여 가상화 기술을 사용하셔야 합니다.
가상화 기술 혁신
본질적으로 가상화 기술은 특정 물리적 하드웨어 플랫폼에서 시스템에 의해 지원되는 운영 체제, 서비스, 어플리케이션을 분리시켜 유연성을 증가시킵니다. 이는 공유된 하드웨어 플랫폼에서 다수의 가상 환경을 구축할 수 있게 합니다.
혁신을 추구하는 기업에서는 추가 하드웨어를 설치하지 않고 새 시스템 및 서비스를 생성하기 위한 (혹은 이러한 시스템 및 서비스가 더이상 필요하지 않을 경우 신속하게 시스템을 제거할 수 있는) 기능이 기술혁신 증진에 있어서 중요한 요소가 될 수 있습니다.
이러한 요소에는 사용자 설정 소프트웨어 생성을 위한 신속한 개발 시스템 구축, 신속한 테스트 환경 구축, 대안적 소프트웨어 솔류션 제공, 대규모의 하드웨어 투자 없이 이를 비교, 신속한 프로토타이핑 및 개발 환경 지원, 필요에 따른 신속한 새 제품 서비스 구축 등이 있습니다.
이러한 환경은 Amazon의 EC2 서비스와 같이 기업내에서나 또는 외부에 구축될 수 있습니다. 새 가상 환경 구축 비용이 매우 저렴하고 기존 하드웨어의 장점을 취할 수 있어 최소 투자로 이러한 기술 혁신을 구축 및 가속화할 수 있습니다.
가상화 기술은 기술 혁신 지원을 능가하여 교육용으로 가상 환경을 사용할 수 있습니다. 이러한 서비스는 가상화 기술의 이상적인 프로그램으로 학습자는 자신이 잘 알고 있는 표준 시스템 환경으로 코스를 시작할 수 있으며, 학습 환경은 생산 네트워크와 분리될 수 있습니다. 학습자는 하드웨어 리소스를 단독 사용할 필요 없이 고유한 소프트웨어 환경을 구축할 수 있습니다.
지속적인 가상 환경 기능 확대로, 특정 사용자의 필요에 따라 이동 가능한 환경을 구축하기 위한 가상화 기술 사용이 증가되고 있음을 알 수 있습니다. 이러한 환경은 사용자 위치와 상관 없이 액세스 가능한 로컬 프로세싱 환경으로 이동할 수 있습니다. 사용자의 가상 환경은 네트워크에 저장되거나 또는 이동 가능한 메모리 장치에 보관될 수 있습니다.
이와 연관된 개념으로 Appliance Operating System이 있으며, 이는 가상 환경에서 실행하기 위해 고안된 운영 체제 기반 어플리케이션 패키지입니다. 패키지를 사용하면 보안된 환경에서 어플리케이션을 실행할 수 있음은 물론 개발 및 기술 지원 비용이 보다 저렴하게 됩니다. Appliance Operating System 솔루션은 어플리케이션 개발자 및 사용자 모두에게 여러가지 이점을 제공합니다.
가상화 기술 어플리케이션을 사용자 엔터프라이즈에 적용시키는 방법은 다양합니다. 하나 이상의 영역에서 이미 이러한 이술을 사용하고 계실 경우 위의 내용을 주지하시어 신속한 개발에 필요한 솔루션에 추가 투자를 고려해 보시기 바랍니다. 가상화 기술을 시작하지 않으신 경우 기술 개발을 위한 교육을 실행하시고 어플리케이션 개발 및 테스트하시기 바랍니다. 가상화에 있어서 보다 풍부한 경험이 있는 기업의 경우 이동 가능한 가상 환경이나 또는 어플리케이션 어플라이언스 운용을 고려해 보시기 바랍니다.
가상화 기술로 인한 비용 절감 효과
저렴한 비용으로 가상화 기술을 사용할 수 있습니다. 중요한 장점 중 하나는 가상 환경을 실행하는 보다 적은 수의 강력한 하드웨어 플랫폼 모음으로의 서버 통합입니다. 하드웨어 수를 감소하고 사용되지 않은 용량을 감소하여 비용을 절약할 수 있을 뿐 아니라 가상 게스트를 보다 강력한 하드웨어에서 운용함으로서 어플리케이션 실행을 향상시킬 수 있습니다.
기타 다른 이점에는 비파괴적 방식으로 하드웨어 용량을 추가하고 사용 가능한 리소스로 작업량을 이전할 수 있는 기능이 있습니다.
기업의 필요에 따라, 장애 복구 용 가상 환경을 구축할 수 도 있습니다. 가상화 기술 사용으로 중복된 동일한 하드웨어 환경의 필요성이 감소되었으며 저렴한 비용으로 장애 시나리오를 테스트할 수 있게 되었습니다.
가상화 기술은 최대치 작업 부하량 문제에 대해 최상의 솔루션을 제공합니다. 기업에 보완적인 작업부하량이 있을 경우, 현재 최대 수요량이 있는 어플리케이션으로 리소스를 할당할 수 있습니다. 현재 기업내에 최대치 작업 부하량이 있을 경우, 외부에서 필요한 용량을 구입하고 가상화 기술을 사용하여 이를 효과적으로 운용할 수 있습니다.
서버 통합을 통해 비용을 절감할 수 있습니다. 이러한 목적을 위해 가상화 기술을 사용하지 않을 경우, 지금 프로그램을 시작하시기 바랍니다. 가상화 기술을 사용함으로서 작업부하량 균형 및 가상화 장애 복구 환경에 대한 이점을 확인하실 수 있습니다.
표준 솔루션으로서의 가상화 기술
기업의 특정 목적에 관계없이, 가상화 기술이 활성화됨에 따라 시스템 및 어플리케이션 부분으로 이를 살펴보셔야 합니다. 운영 체제 벤더는 표준 구성요소로서 가상화 기술을 포함시키고, 하드웨어 벤더는 플랫폼에 가상 기능을 구축하며, 가상화 기술 벤더는 기술 공급의 범위를 확장시키게 될 것입니다.
솔루션 구조에 가상화 기술 통합을 계획하지 않고 계실 경우, 바로 지금이 파일럿 프로젝트를 구성하고, 충분히 활용되지 않는 하드웨어 플랫폼을 할당하여, 이러한 유연하고 비용 절감 효과를 갖는 기술에 대한 전문지식을 개발해야 할 때 입니다. 그 후, 가상 솔루션을 통합하기 위해 대상 구조를 확장합니다. 기존 서비스를 가상화하여 실질적인 혜택이 사용 가능할 지라도, 통합된 가상화 전략으로 새 어플리케이션을 구축하여 관리 및 사용 면에 있어서 보다 많을 장점을 얻을 수 있습니다.
Red Hat의 가상화 기술 솔루션에 대한 보다 자세한 내용은 http://www.redhat.com/products/에서 확인하시기 바랍니다.

부 I. Red Hat Enterprise Linux의 가상화에 있어서 요구 사항 및 제한 사항

시스템 요구 사항, 지원 제한 사항

다음 부분에서는 Red Hat Enterprise Linux의 가상화에 있어서 시스템 요구 사항 및 제한 사항에 대한 개요를 설명합니다.

1장. 시스템 요구 사항

This chapter lists system requirements for successfully running virtualization with Red Hat Enterprise Linux. Virtualization is available for Red Hat Enterprise Linux 5 Server.
The requirements for virtualization vary depending on the type of hypervisor. The Kernel-based Virtual Machine (KVM) and Xen hypervisors are provided with Red Hat Enterprise Linux 5. Both the KVM and Xen hypervisors support Full virtualization. The Xen hypervisor also supports Para-virtualization.
For information on installing the virtualization packages, read 6장. 가상화 패키지 설치 .
최소 시스템 요구 사항
  • 6GB 여유 디스크 공간
  • 2GB의 RAM.

KVM 오버커밋

KVM can overcommit physical resources for virtualized guests. Overcommiting resources means the total virtualized RAM and processor cores used by the guests can exceed the physical RAM and processor cores on the host. For information on safely overcommitting resources with KVM refer to 32.4절. “Overcommitting Resources”.
Xen 반가상화 요구 사항
반가상화 게스트에는 NFS, FTP 또는 HTTP 프로토콜을 사용하는 네트워크를 통해 사용 가능한 Red Hat Enterprise Linux 5 설치 트리가 필요합니다.
Xen 완전 가상화 요구 사항
Xen 하이퍼바이저를 사용하는 완전 가상화에는 다음이 필요합니다:
  • an Intel processor with the Intel VT extensions, or
  • AMD-V 확장자를 사용하는 AMD 프로세서
  • Intel Itanium 프로세서
Refer to 32.6절. “가상화 확장자 확인 ” to determine if your processor has the virtualization extensions.
KVM 요구 사항
KVM 하이퍼바이저에는 다음이 필요합니다:
  • Intel VT 및 Intel 64 확장자를 사용하는 Intel 프로세서
  • AMD-V 및 AMD64 확장자를 사용하는 AMD 프로세서
Refer to 32.6절. “가상화 확장자 확인 ” to determine if your processor has the virtualization extensions.
저장 장치 지원
지원되는 게스트 저장 방식은 다음과 같습니다:
  • Files on local storage
  • Physical disk partitions
  • Locally connected physical LUNs
  • LVM partitions
  • iSCSI and Fibre Channel based LUNs

파일 기반 게스트 저장 장치

File-based guest images are stored in the /var/lib/libvirt/images/ directory by default. If you use a different directory you must label the new directory according to SELinux policy. Refer to 18.2절. “SELinux 및 가상화 ” for details.

2장. Xen 제한 및 지원 사항

Red Hat Enterprise Linux 5 supports various architecture combinations for hosts and virtualized guests. All architectures have processor and memory limitations. Refer to the following URLs for the processor and memory amount limitations for Red Hat Enterprise Linux:
The following URL shows a complete chart of supported operating systems and host and guest combinations:

참고

To utilize para-virtualization on Red Hat Enterprise Linux 5, your processor must have the Physical Address Extension (PAE) instruction set.

Itanium® 지원

Virtualization with the Xen hypervisor on the Intel Itanium architecture requires the guest firmware image package, refer to yum으로 Xen 하이퍼바이저 설치 for more information.

3장. KVM 제한 및 지원 사항

The KVM hypervisor requires a processor with the Intel-VT or AMD-V virtualization extensions.
To verify whether your processor supports the virtualization extensions and for information on enabling the virtualization extensions if they are disabled, refer to 32.6절. “가상화 확장자 확인 ”.
The following URLs explain the processor and memory amount limitations for Red Hat Enterprise Linux:
The following URL shows a complete chart of supported operating systems and host and guest combinations:

4장. Hyper-V restrictions and support

Certification of guests running under the Microsoft Hyper-V server is conducted by Microsoft. Red Hat Enterprise Linux 5 is fully certified to run under the Microsoft Hyper-V server.

참고

To avoid timing errors when running Red Hat Enterprise Linux 5 under the Microsoft Hyper-V server, use the divider=10 option in the grub.conf file.

5장. 가상화 기술 제한 사항

다음 부분에서는 Red Hat Enterprise Linux에 있는 가상화 패키지의 추가적 제한 사항에 대해 설명합니다.

5.1. 가상화에서의 일반적인 제한 사항

Converting between hypervisors
Presently, there is no support for converting Xen-based guests to KVM or KVM-based guests to Xen. Guests can only be supported on the hypervisor type on which they were created. However, at the time of writing, a tool is in development which may be released with future versions of Red Hat Enterprise Linux.
기타 다른 제한 사항
For other details affecting virtualization, refer to the Red Hat Enterprise Linux Release Notes at http://docs.redhat.com for your version. The Release Notes cover the present new features, known issues and limitations as they are updated or discovered.
배포 전 테스트
You should test for the maximum anticipated system and virtualized network load before deploying heavy I/O applications. Load testing and planning are important as virtualization performance can suffer due to high I/O usage.

5.2. Xen 제한 사항

다음과 같은 제한 사항은 KVM 하이퍼바이저에 적용됩니다:
Constant TSC 비트
Systems without a Constant Time Stamp Counter require additional configuration. Refer to 16장. KVM 게스트 시간 관리 for details on determining whether you have a Constant Time Stamp Counter and configuration steps for fixing any related issues.
메모리 오버커밋
KVM supports memory overcommit and can store the memory of guests in swap. A guest will run slower if it is swapped frequently. When Kernel SamePage Merging (KSM) is used, make sure that the swap size is equivalent to the size of the overcommit ratio.
CPU 오버커밋
물리적 프로세서 코어 당 10 개 이상의 가상 CPU를 지원하지 않습니다. 물리적 프로세서 코어 수 이상의 오버커밋된 가상 CPU 수는 특정 가상 게스트에 문제를 일으킬 수 있습니다.
Overcommitting CPUs has some risk and can lead to instability. Refer to 32.4절. “Overcommitting Resources” for tips and recommendations on overcommitting CPUs.
가상 SCSI 장치
SCSI emulation is presently not supported. Virtualized SCSI devices are disabled in KVM.
가상 IDE 장치
KVM은 게스트 당 최대 4 개의 가상 (에뮬레이트) IDE 장치로 제한되어 있습니다.
반가상화 장치
virtio 드라이버를 사용하는 반가상화 장치는 PCI 장치입니다. 현재 게스트는 최대 32 개의 PCI 장치로 제한되어 있습니다. 일부 PCI 장치는 게스트 실행을 위해 중요하며 이러한 장치는 제거될 수 없습니다. 기본값으로 필요한 장치는 다음과 같습니다:
  • 호스트 브리지
  • ISA 브리지 및 usb 브리지 (usb 및 isa 브리지는 동일한 장치임)
  • 그래픽 카드 (Cirrus 또는 qxl 드라이버 사용)
  • 메모리 부울 장치
게스트에 대해 32 개의 사용 가능한 PCI 장치 중 4 개만 제거할 수 없습니다. 이는 게스트 당 추가 장치에 대해 28 개의 PCI 슬롯을 사용할 수 있음을 의미합니다. 모든 반가상화 네트워크 또는 블럭 장치는 하나의 슬롯을 사용합니다. 각 게스트는 반가상화 네트워크, 반가상화 디스크 장치, VT-d를 사용하는 기타 다른 PCI 장치 조합으로 구성된 추가 장치를 최대 28개 까지 사용할 수 있습니다.
이전 제한 사항
실시간 이전은 동일한 공급 업체에서의 CPU와만 가능합니다 (즉, Intel에서 Intel로 또는 AMD에서 AMD로만 가능)
NX (No eXecution) 비트는 CPU 및 실시간 이전에 대해 설정 또는 설정 해제되어 있어야 합니다.
Storage limitations
The host should not use disk labels to identify file systems in the fstab file, the initrd file or used by the kernel command line. If less privileged users, especially virtualized guests, have write access to whole partitions or LVM volumes the host system could be compromised.
Guests should not be given write access to whole disks or block devices (for example, /dev/sdb). Virtualized guests with access to block devices may be able to access other block devices on the system or modify volume labels which can be used to compromise the host system. Use partitions (for example, /dev/sdb1) or LVM volumes to prevent this issue.

5.3. Xen 기술 제한 사항

주의

All limitations in this chapter are limitations for Red Hat Enterprise Linux 5.8 except where noted. Older versions may have fewer limitations.
Xen 호스트 (dom0) 제한 사항
  • A limit of 254 para-virtualized block devices per host. The total number of block devices (using the tap:aio driver) attached to virtualized guests cannot exceed 254 devices.

반가상화 장치 제한 문제 해결

There are two methods for working around the para-virtualized device limit: using phy devices (devices using the physical access mode) or using LVM on the guest.
리소스가 충분할 경우 호스트는 phy 장치 수에 제한을 갖지 않습니다.
LVM 또는 비슷한 논리 파티션 도구는 블럭 장치에서 생성되어 단일 반가상화 블럭 장치에 추가 논리 파티션을 생성할 수 있습니다.
Xen 반가상화 기술 제한 사항
  • For x86 guests, a maximum of 16GB memory per guest.
  • For x86_64 guests, a maximum of 168GB memory per guest.
  • A maximum of 254 devices per virtualized guest.
  • 가상 게스트 당 최대 15 개의 네트워크 장치
Xen 완전 가상화 기술 제한 사항
  • For x86 guests, a maximum of 16GB memory per guest.
  • 게스트 당 최대 4 개의 가상 (에뮬레이트) IDE 장치
    완전 가상화 게스트 용 반가상화 드라이버를 사용하는 장치는 이러한 제한 사항을 갖지 않습니다.
  • Virtualized (emulated) IDE devices are limited by the total number of loopback devices supported by the system. The default number of available loopback devices on Red Hat Enterprise Linux 5.8 is 8. That is, by default, all virtualized guests on the system can each have no more than 8 virtualized (emulated) IDE devices.
    For more information on loopback devices, refer to the Red Hat KnowledgeBase, article DOC-1722.

    8개 이상의 루프백 장치 사용

    기본값으로 Red Hat Enterprise Linux는 사용 가능한 루프백 장치 수에 제한이 있습니다. 이는 커널 제한을 수정하여 증가시킬 수 있습니다.
    /etc/modprobe.conf에서 다음 행을 추가합니다: /etc/rc.local 파일을 편집하고 다음의 행을 추가합니다:
    options loop max_loop=64
    
    Reboot the machine or run the following commands to update the kernel with this new limit:
    # rmmod loop
    # modprobe loop
    
  • A limit of 254 para-virtualized block devices per host. The total number of block devices (using the tap:aio driver) attached to virtualized guests cannot exceed 254 devices.
  • A maximum of 254 block devices using the para-virtualized drivers per virtualized guest.
  • 가상 게스트 당 최대 15 개의 네트워크 장치
  • 가상 게스트 당 최대 15 개의 가상 SCSI 장치
PCI passthrough limitations
  • PCI passthrough (attaching PCI devices to guests) is presently only supported on the following architectures:
    • 32 bit (x86) systems.
    • Intel 64 systems.
    • Intel Itanium 2 systems.

5.4. 어플리케이션 제한 사항

특정 어플리케이션 유형에 적합하지 않은 가상화 기술의 여러 측면에 대해 설명합니다.
대량의 I/O 처리량 요구 사항을 갖는 어플리케이션은 완전 가상화 게스트에 대해 반가상화 드라이버를 사용해야 합니다. 반가상화 드라이버가 없이 특정 어플리케이션의 경우 대량의 I/O 작업 부하 상태에서 안정적이지 않을 수 있습니다.
다음의 어플리케이션은 대량의 I/O 요청을 피해야 합니다:
  • kdump 서버
  • netdump 서버
You should carefully evaluate database applications before running them on a virtualized guest. Databases generally use network and storage I/O devices intensively. These applications may not be suitable for a fully virtualized environment. Consider para-virtualization or para-virtualized drivers in these cases for increased I/O performance.
Other applications and tools which heavily utilize I/O or require real-time performance should be evaluated carefully. Using full virtualization with the para-virtualized drivers or para-virtualization results in better performance with I/O intensive applications. Applications still suffer a small performance loss from running in virtualized environments. The performance benefits of virtualization through consolidating to newer and faster hardware should be evaluated against the potential application performance issues associated with using fully virtualized hardware.

부 II. 설치

6장. 가상화 패키지 설치

가상화를 사용하기 전 Red Hat Enterprise Linux에 가상화 패키지를 설치해야 합니다. 가상화 패키지는 설치 도중이나 설치 후 yum 명령 및 Red Hat Network (RHN)를 사용하여 설치할 수 있습니다.
단일 시스템에 KVM 및 Xen 하이퍼바이저 모두를 설치할 수 있습니다. Xen 하이퍼바이저는 kernel-xen 패키지를 사용하고 KVM 하이퍼바이저는 kvm 커널 모듈과 함께 Red Hat Enterprise Linux 기본값 커널을 사용합니다. Xen 및 KVM은 각각 다른 커널을 사용하므로 주어진 시간에 하나의 하이퍼바이저만이 활성화될 수 있습니다. Red Hat은 가상화에 사용하고자 하는 하이퍼바이저 하나만을 설치할 것을 권장합니다.
To change hypervisor from Xen to KVM or KVM to Xen refer to 32.2절. “KVM과 Xen 하이퍼바이저 사이에서 변경 ”.

6.1. 새 Red Hat Enterprise Linux 설치를 사용하여 Xen 설치

다음 부분에서는 새 Red Hat Enterprise Linux 설치 부분으로 가상화 도구 및 Xen 패키지 설치에 대해 설명합니다.

설치에 도움이 필요하십니까?

The Installation Guide (available from redhat.com) covers installing Red Hat Enterprise Linux in detail.
  1. Red Hat Enterprise Linux 설치 CD-ROM, DVD 또는 PXE에서 상호 대화식 Red Hat Enterprise Linux 설치를 시작합니다.
  2. You must enter a valid installation number when prompted to receive access to the virtualization and other Advanced Platform packages. Installation numbers can be obtained from Red Hat Customer Service.
  3. Complete all steps until you see the package selection step.
    가상화 패키지 그룹과 지금 사용자 정의 라디오 버튼을 선택합니다.
  4. 가상화 패키지 그룹을 선택합니다. 가상화 패키지 그룹은 Xen 하이퍼바이저, virt-manager, libvirt, virt-viewer 및 설치를 위한 모든 종속 패키지를 선택합니다.
  5. 패키지 사용자 정의 (필요 시)

    기타 다른 가상화 패키지가 필요할 경우 가상화 그룹을 사용자 정의합니다.
    Press the Close button then the Forward button to continue the installation.

주의

가상화 패키지에 대한 업데이트를 받기 위해 유효한 RHN 가상화 인타이틀먼트가 필요합니다.
킥스타트 파일로 Xen 패키지 설치
다음 부분에서는 Xen 하이퍼바이저 패키지로 Red Hat Enterprise Linux를 설치하기 위해 킥스타트 파일을 사용하는 방법에 대해 설명합니다. 킥스타트 파일은 사용자 없이 대량의 자동 설치 프로그램을 각각의 개별 시스템에 수동 설치하게 합니다. 이는 가상화 패키지로 Red Hat Enterprise Linux를 설치하기 위해 킥스타트 파일을 생성 및 사용하는 방법에 대해 도움을 드립니다.
킥스타트 파일의 %packages 부분에 다음의 패키지 그룹을 추가합니다:
%packages
@xen

Intel Itanium 시스템의 경우

Fully virtualized guests on the Itanium® architecture require the guest firmware image package (xen-ia64-guest-firmware). Append the following package to your kickstart file:
xen-ia64-guest-firmware
More information on Kickstart files can be found on Red Hat's website, redhat.com, in the Installation Guide.

6.2. 기존 Red Hat Enterprise Linux 시스템에 Xen 패키지 설치

다음 부분에서는 작동 중인 Red Hat Enterprise Linux 시스템에 가상화 패키지를 설치하기 위해 필요한 절차에 대해 설명합니다.
Red Hat Network 인타이틀먼트 목록에 패키지 추가
다음 부분에서는 가상화 패키지에 대해 Red Hat Network (RHN) 인타이틀먼트를 활성화하는 방법에 대해 설명합니다. Red Hat Enterprise Linux에서 가상화 패키지를 설치 및 업데이트하려면 이러한 인타이틀먼트를 활성화해야 합니다. Red Hat Enterprise Linux에 가상화 패키지를 설치하려면 유효한 Red Hat Network 계정이 필요합니다.
또한, 시스템이 RHN에 등록되어 있어야 합니다. Red Hat Enterprise Linux의 등록되지 않은 설치를 등록하려면 rhn_register 명령을 실행하고 프롬프트를 따릅니다.
유효한 Red Hat 서브스크립션이 없을 경우 Red Hat 온라인 스토어로 가보시기 바랍니다.
절차 6.1. RHN으로 가상화 인타이틀먼트 추가
  1. RHN 사용자명 및 암호를 사용하여 RHN에 로그인합니다.
  2. 가상화에 설치할 시스템을 선택합니다.
  3. 시스템 등록정보 부분에서 현재 시스템 인타이틀먼트가 인타이틀먼트 헤더 옆에 나열됩니다. (등록정보 편집) 링크를 사용하여 인타이틀먼트를 변경합니다.
  4. 가상화 체크 박스를 선택합니다.
이제 가상화 패키지를 받을 수 있도록 시스템에 인타이틀먼트가 부여되었습니다. 다음 부분에서는 이러한 패키지를 설치하는 방법에 대해 설명합니다.
yum으로 Xen 하이퍼바이저 설치
Red Hat Enterprise Linux에서 가상화를 사용하려면 xenkernel-xen 패키지가 필요합니다. xen 패키지에는 하이퍼바이저 및 기본 가상화 도구가 들어 있습니다. kernel-xen 패키지에는 하이퍼바이저에서 가상 장치 게스트로서 실행되는 수정된 리눅스 커널이 들어 있습니다.
xenkernel-xen 패키지를 설치하려면 다음을 실행합니다:
# yum install xen kernel-xen
Itanium® 아키텍처 상의 완전 가상화 게스트는 추가 설치 DVD로 부터 게스트 펌웨어 이미지 패키지 (xen-ia64-guest-firmware)를 필요로 합니다. 이러한 패키지는 yum 명령을 사용하여 RHN에서 설치될 수 있습니다:
# yum install xen-ia64-guest-firmware
It is advised to install additional virtualization packages for management and configuration. 권장되는 가상화 패키지: lists the recommended packages.
기타 권장 가상화 패키지를 설치합니다:
# yum install virt-manager libvirt libvirt-python python-virtinst

6.3. 새 Red Hat Enterprise Linux 설치를 사용하여 KVM 설치

다음 부분에서는 새 Red Hat Enterprise Linux 설치 부분으로 가상화 도구 및 KVM 패키지를 설치하는 방법에 대해 설명합니다.

설치에 도움이 필요하십니까?

The Installation Guide (available from redhat.com) covers installing Red Hat Enterprise Linux in detail.

유효한 설치 번호가 필요합니다

유효한 설치 번호 없이 설치 도중 가상화 패키지를 선택할 수 없습니다.
  1. Red Hat Enterprise Linux 설치 CD-ROM, DVD 또는 PXE에서 상호 대화식 Red Hat Enterprise Linux 설치를 시작합니다.
  2. 가상화 및 기타 다른 고급 플랫폼 패키지로 액세스하라는 메세지가 나타나면 유효한 설치 번호를 입력해야 합니다.
  3. Complete all steps up to the package selection step.
    가상화 패키지 그룹과 지금 사용자 정의 라디오 버튼을 선택합니다.
  4. KVM 패키지 그룹을 선택합니다. 가상화 패키지 그룹을 선택 해제합니다. 이는 설치를 위해 KVM 하이퍼바이저, virt-manager, libvirt, virt-viewer를 선택합니다.
  5. 패키지 사용자 정의 (필요 시)

    기타 다른 가상화 패키지가 필요할 경우 가상화 그룹을 사용자 정의합니다.
    Press the Close button then the Forward button to continue the installation.

주의

가상화 패키지에 대한 업데이트를 받기 위해 유효한 RHN 가상화 인타이틀먼트가 필요합니다.
킥스타트 파일로 KVM 패키지 설치
다음 부분에서는 KVM 하이퍼바이저 패키지로 Red Hat Enterprise Linux를 설치하기 위해 킥스타트 파일을 사용하는 방법에 대해 설명합니다. 킥스타트 파일은 사용자 없이 각각의 개별 시스템에 대량의 자동 설치 프로그램을 수동으로 설치하게 합니다. 다음 부분에서는 가상화 패키지로 Red Hat Enterprise Linux를 설치하기 위해 킥스타트 파일을 생성 및 사용하는 방법에 대해 설명합니다.
킥스타트 파일의 %packages 부분에 다음의 패키지 그룹을 추가합니다:
%packages
@kvm
More information on Kickstart files can be found on Red Hat's website, redhat.com, in the Installation Guide.

6.4. 기존 Red Hat Enterprise Linux 시스템에 KVM 패키지 설치

다음 부분에서는 작동 중인 Red Hat Enterprise Linux 5.4 또는 그 이상 버전에서 KVM 하이퍼바이저를 설치하는 절차를 설명합니다.
Red Hat Network 인타이틀먼트 목록에 패키지 추가
다음 부분에서는 가상화 패키지에 대해 Red Hat Network (RHN) 인타이틀먼트를 활성화하는 방법에 대해 설명합니다. Red Hat Enterprise Linux에서 가상화 패키지를 설치 및 업데이트하려면 이러한 인타이틀먼트를 활성화해야 합니다. Red Hat Enterprise Linux에 가상화 패키지를 설치하려면 유효한 Red Hat Network 계정이 필요합니다.
또한, 시스템이 RHN에 등록되어 있어야 합니다. Red Hat Enterprise Linux의 등록되지 않은 설치를 등록하려면 rhn_register 명령을 실행하고 프롬프트를 따릅니다.
유효한 Red Hat 서브스크립션이 없을 경우 Red Hat 온라인 스토어로 가보시기 바랍니다.
절차 6.2. RHN으로 가상화 인타이틀먼트 추가
  1. RHN 사용자명 및 암호를 사용하여 RHN에 로그인합니다.
  2. 가상화에 설치할 시스템을 선택합니다.
  3. 시스템 등록정보 부분에서 현재 시스템 인타이틀먼트가 인타이틀먼트 헤더 옆에 나열됩니다. (등록정보 편집) 링크를 사용하여 인타이틀먼트를 변경합니다.
  4. 가상화 체크 박스를 선택합니다.
이제 가상화 패키지를 받을 수 있도록 시스템에 인타이틀먼트가 부여되었습니다. 다음 부분에서는 이러한 패키지를 설치하는 방법에 대해 설명합니다.
yum으로 KVM 하이퍼바이저 설치
Red Hat Enterprise Linux에서 가상화를 사용하려면 kvm 패키지가 필요합니다. kvm 패키지에는 기본값 Red Hat Enterprise Linux 커널에서 KVM 하이퍼바이저를 제공하는 KVM 커널 모듈에 들어 있습니다.
kvm 패키지를 설치하려면 다음을 실행합니다:
# yum install kvm
이제 추가 가상화 관리 패키지를 설치합니다.
기타 권장 가상화 패키지를 설치합니다:
# yum install virt-manager libvirt libvirt-python python-virtinst

7장. 가상화 게스트 설치 개요

호스트 시스템에 가상화 패키지를 설치한 후 게스트 운영 체제를 생성할 수 있습니다. 다음 부분에서는 가상 장치에 게스트 운영 체제를 설치하는 일반적인 절차에 대해 설명합니다. virt-manager에서 새 장치 버튼을 사용하거나 명령행 인터페이스 virt-install를 사용하여 게스트를 생성할 수 있습니다. 다음 부분에서는 두 가지 방식 모두를 설명합니다.
Detailed installation instructions are available for specific versions of Red Hat Enterprise Linux, other Linux distributions and Windows. Refer to 8장. 게스트 운영 체제 설치 절차 for those procedures.

7.1. virt-install로 게스트 생성

virt-install 명령을 사용하여 명령행에서 가상 게스트를 생성할 수 있습니다. virt-install은 가상 장치를 자동 생성하기 위해 상호 대화식이나 스크립트식으로 사용될 수 있습니다. 킥스타트 파일로 virt-install을 사용할 경우 가상 장치가 무인 설치될 수 있습니다.
virt-install 도구는 명령행에 전달할 수 있는 여러 옵션을 제공합니다. 옵션의 전체 목록을 보려면 다음을 실행합니다:
$ virt-install --help
virt-install 맨 페이지에는 각 명령 옵션 및 중요한 변수에 대해 설명되어 있습니다.
qemu-img는 저장 장치 옵션을 설정하기 위해 virt-install 전에 사용할 수 있는 관련 명령입니다.
An important option is the --vnc option which opens a graphical window for the guest's installation.
예 7.1. Red Hat Enterprise Linux 3 게스트 생성을 위해 KVM으로 virt-install 사용
다음 예에서는 CD-ROM에서 가상 네트워크 및 5 GB 파일 기반 블럭 장치 이미지를 사용하여 rhel3support라는 Red Hat Enterprise Linux 3 게스트를 생성합니다. 예에서는 KVM 하이퍼바이저를 사용합니다.
# virt-install --accelerate --hvm --connect qemu:///system \
   --network network:default \
   --name rhel3support --ram=756\
   --file=/var/lib/libvirt/images/rhel3support.img \
   --file-size=6 --vnc --cdrom=/dev/sr0

예 7.2. fedora 11 게스트 생성을 위해 virt-install 사용
# virt-install --name fedora11 --ram 512 --file=/var/lib/libvirt/images/fedora11.img \
	--file-size=3 --vnc --cdrom=/var/lib/libvirt/images/fedora11.iso

7.2. virt-manager로 게스트 생성

가상 장치 관리자인 virt-manager는 가상 게스트 생성 및 관리를 위한 그래픽 형식 도구입니다.
절차 7.1. virt-manager로 가상 게스트 생성
  1. Open virt-manager

    Start virt-manager. Launch the Virtual Machine Manager application from the Applications menu and System Tools submenu. Alternatively, run the virt-manager command as root.
  2. Optional: Open a remote hypervisor

    Open the File -> Add Connection. The dialog box below appears. Select a hypervisor and click the Connect button:
  3. Create a new guest

    virt-manager 화면에서는 새 가상 장치를 생성할 수 있습니다. 새로 생성 버튼을 클릭하여 새 게스트를 생성합니다. 이는 스크린샷에서 보여주는 마법사를 엽니다.
  4. New guest wizard

    The Create a new virtual machine window provides a summary of the information you must provide in order to create a virtual machine:
    설치를 위한 정보를 확인하고 다음 버튼을 클릭합니다.
  5. Name the virtual machine

    Provide a name for your virtualized guest. Punctuation and whitespace characters are not permitted in versions before Red Hat Enterprise Linux 5.5. Red Hat Enterprise Linux 5.5 adds support for '_', '.' and '-' characters.
    Press Forward to continue.
  6. Choose virtualization method

    가상화 방식 선택 화면이 나타납니다. 반가상화 또는 완전 가상화를 선택합니다.
    완전 가상화는 Intel® VT 또는 AMD-V 프로세서가 있는 시스템을 필요로 합니다. 가상화 확장자가 나타나지 않으면 완전 가상화 라디오 버튼이나 커널/하드웨어 가속 활성화를 선택할 수 없게 됩니다. kernel-xen이 현재 실행 중인 커널이 아닐 경우 반가상화 옵션은 회색으로 표시되게 됩니다.
    KVM 하이퍼바이저로 연결할 경우 완전 가상화만을 사용할 수 있습니다.
    Choose the virtualization type and click the Forward button.
  7. Select the installation method

    The Installation Method window asks for the type of installation you selected.
    Guests can be installed using one of the following methods:
    Local media installation
    This method uses a CD-ROM or DVD or an image of an installation CD-ROM or DVD (an .iso file).
    Network installation tree
    This method uses a mirrored Red Hat Enterprise Linux installation tree to install guests. The installation tree must be accessible using one of the following network protocols: HTTP, FTP or NFS.
    The network services and files can be hosted using network services on the host or another mirror.
    Network boot
    This method uses a Preboot eXecution Environment (PXE) server to install the guest. Setting up a PXE server is covered in the Red Hat Enterprise Linux Deployment Guide. Using this method requires a guest with a routable IP address or shared network device. Refer to 10장. 네트워크 설정 for information on the required networking configuration for PXE installation.
    Set the OS type and OS variant.
    Choose the installation method and click Forward to proceed.

    Para-virtualized guest installation

    Para-virtualized installation must be installed with a network installation tree. The installation tree must be accessible using one of the following network protocols: HTTP, FTP or NFS. The installation media URL must contain a Red Hat Enterprise Linux installation tree. This tree is hosted using NFS, FTP or HTTP.
  8. Installation media selection

    This window is dependent on what was selected in the previous step.
    1. ISO image or physical media installation

      If Local install media was selected in the previous step this screen is called Install Media.
      Select the location of an ISO image or select a DVD or CD-ROM from the dropdown list.
      Click the Forward button to proceed.
    2. Network install tree installation

      If Network install tree was selected in the previous step this screen is called Installation Source.
      Network installation requires the address of a mirror of a Linux installation tree using NFS, FTP or HTTP. Optionally, a kickstart file can be specified to automated the installation. Kernel parameters can also be specified if required.
      Click the Forward button to proceed.
    3. Network boot (PXE)

      PXE installation does not have an additional step.
  9. Storage setup

    The Storage window displays. Choose a disk partition, LUN or create a file-based image for the guest storage.
    All image files are stored in the /var/lib/libvirt/images/ directory by default. In the default configuration, other directory locations for file-based images are prohibited by SELinux. If you use a different directory you must label the new directory according to SELinux policy. Refer to 18.2절. “SELinux 및 가상화 ” for details.
    Your guest storage image should be larger than the size of the installation, any additional packages and applications, and the size of the guests swap file. The installation process will choose the size of the guest's swap based on size of the RAM allocated to the guest.
    게스트가 어플리케이션이나 기타 다른 데이터에 대한 추가 공간을 필요로할 경우 추가 공간을 할당합니다. 예를 들어, 웹 서버는 로그 파일에 대해 추가 공간을 필요로 합니다.
    선택한 저장 장치 유형에서 게스트에 적합한 크기를 선택하고 다음 버튼을 클릭합니다.

    참고

    It is recommend that you use the default directory for virtual machine images, /var/lib/libvirt/images/. If you are using a different location (such as /images/ in this example) make sure it is added to your SELinux policy and relabeled before you continue with the installation (later in the document you will find information on how to modify your SELinux policy).
  10. Network setup

    Select either Virtual network or Shared physical device.
    The virtual network option uses Network Address Translation (NAT) to share the default network device with the virtualized guest. Use the virtual network option for wireless networks.
    The shared physical device option uses a network bond to give the virtualized guest full access to a network device.
    Press Forward to continue.
  11. Memory and CPU allocation

    The Memory and CPU Allocation window displays. Choose appropriate values for the virtualized CPUs and RAM allocation. These values affect the host's and guest's performance.
    게스트는 효과적인 실행을 위해 충분한 물리적 메모리 (RAM)를 필요로 합니다. 게스트 운영 체제 및 프로그램 요구 사항에 맞는 메모리 값을 선택합니다. 대부분 운영 체제는 올바른 작동을 위해 최소 512MB RAM을 필요로 합니다. 게스트는 물리적 RAM을 사용함에 유의하십시오. 호스트 시스템에 대해 너무 많은 게스트를 실행하거나 메모리가 충분하지 않을 경우 가상 메모리를 현저하게 사용하게 됩니다. 가상 메모리 속도는 감소하여 시스템 성능 및 응답 저하 현상이 나타나게 됩니다. 보다 효과적으로 실행할 수 있도록 모든 게스트 및 호스트에 대해 충분한 메모리를 할당하였는지 확인합니다.
    가상 게스트에 대해 충분한 가상 CPU를 할당합니다. 게스트가 멀티 스레드 어플리케이션을 실행하고 있을 경우, 효과적으로 실행하기 위해 게스트가 필요로하는 가상 CPU 수를 할당합니다. 호스트 시스템에서 사용할 수 있는 실제 프로세서 (또는 하이퍼 스레드) 수량 이상의 가상 CPU를 할당하지 않습니다. 그 이상의 가상 프로세서를 할당할 수 있지만 과도한 할당은 프로세서 문맥 교환 오버헤드를 초래하게 되어 게스트 및 호스트 성능에 부정적인 영향을 미치게 됩니다.
    Press Forward to continue.
  12. Verify and start guest installation

    The Finish Virtual Machine Creation window presents a summary of all configuration information you entered. Review the information presented and use the Back button to make changes, if necessary. Once you are satisfied click the Finish button and to start the installation process.
    VNC 화면에서는 게스트 운영 체제 설치 프로세스의 시작을 보여줍니다.
This concludes the general process for creating guests with virt-manager. 8장. 게스트 운영 체제 설치 절차 contains step-by-step instructions to installing a variety of common operating systems.

7.3. PXE로 게스트 설치

다음 부분에서는 PXE를 사용하에 게스트를 설치하기 위해 필요한 절차에 대해 설명합니다. PXE 게스트 설치에는 네트워크 브리지라고 알려진 네트워크 장치 공유가 필요합니다. 아래에서는 브리지를 생성하고 PXE 설치를 위한 브리지 사용에 필요한 절차에 대해 설명합니다.
  1. 새 브리지 생성

    1. /etc/sysconfig/network-scripts/ 디렉토리에 새 네트워크 스크립트 파일을 생성합니다. 예에서는 installation라는 브리지를 만드는 ifcfg-installation 라는 파일을 생성합니다.
      # cd /etc/sysconfig/network-scripts/
      # vim ifcfg-installation
      DEVICE=installation
      TYPE=Bridge
      BOOTPROTO=dhcp
      ONBOOT=yes
      

      경고

      The line, TYPE=Bridge, is case-sensitive. It must have uppercase 'B' and lower case 'ridge'.
    2. Start the new bridge by restarting the network service. The ifup installation command can start the individual bridge but it is safer to test the entire network restarts properly.
      # service network restart
      
    3. 새 브리지에 추가된 인터페이스가 없습니다. brctl show 명령을 사용하여 시스템 상의 네트워크 브리지에 관한 상세 정보를 확인합니다.
      # brctl show
      bridge name     bridge id               STP enabled     interfaces
      installation    8000.000000000000       no
      virbr0          8000.000000000000       yes
      
      virbr0 브리지는 기본 이더넷 장치에 있는 NAT (Network Address Translation)에 대해 libvirt를 사용하는 기본값 브리지입니다.
  2. 새 브리지에 인터페이스 추가

    인터페이스에 해당하는 설정 파일을 편집합니다. 이전 단계에서 생성된 브리지 이름과 함께 BRIDGE 파라미터를 설정 파일에 추가합니다.
    # Intel Corporation Gigabit Network Connection
    DEVICE=eth1
    BRIDGE=installation
    BOOTPROTO=dhcp
    HWADDR=00:13:20:F7:6E:8E
    ONBOOT=yes
    
    설정 파일을 편집한 후, 네트워크를 재시작하거나 재부팅합니다.
    # service network restart
    
    brctl show 명령으로 인터페이스가 첨부되었는지 확인합니다.
    # brctl show
    bridge name     bridge id               STP enabled     interfaces
    installation    8000.001320f76e8e       no              eth1
    virbr0          8000.000000000000       yes
    
  3. 보안 설정

    iptables를 설정하여 모든 트래픽이 브리지를 통해 전송되게 합니다.
    # iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
    # service iptables save
    # service iptables restart
    

    브리지에서 iptables 비활성화

    다른 방법으로 브리지된 전송이 iptables 규칙에 의해 처리되지 않게 합니다. /etc/sysctl.conf에 다음 행을 추가합니다:
    net.bridge.bridge-nf-call-ip6tables = 0
    net.bridge.bridge-nf-call-iptables = 0
    net.bridge.bridge-nf-call-arptables = 0
    
    sysctl로 설정된 커널 파라미터를 다시 불러옵니다
    # sysctl -p /etc/sysctl.conf
    
  4. 설치 전 libvirt 재시작

    libvirt 데몬을 다시 시작합니다.
    # service libvirtd reload
    
브리지가 설정되었습니다. 이제 설치를 시작할 수 있습니다.
virt-install로 PXE 설치
virt-install의 경우 --network=bridge:installation 설치 파라미터를 첨부합니다. 여기서 installation은 브리지 이름입니다. PXE 설치의 경우 --pxe 파라미터를 사용합니다.
예 7.3. virt-install로 PXE 설치
# virt-install --accelerate --hvm --connect qemu:///system \
    --network=bridge:installation --pxe\
    --name EL10 --ram=756 \
    --vcpus=4
    --os-type=linux --os-variant=rhel5
    --file=/var/lib/libvirt/images/EL10.img \

virt-manager로 PXE 설치
The steps below are the steps that vary from the standard virt-manager installation procedures. For the standard installations refer to 8장. 게스트 운영 체제 설치 절차 .
  1. PXE 선택

    설치 방식으로 PXE를 선택합니다.
  2. 브리지 선택

    물리적 장치 공유를 선택하고 이전 단계에서 생성된 브리지를 선택합니다.
  3. 설치 시작

    설치 시작 준비가 완료되었습니다..
DHCP 요청이 전송되고 유효한 PXE 서버가 검색되면 게스트 설치 프로세스가 시작됩니다.

8장. 게스트 운영 체제 설치 절차

This chapter covers how to install various guest operating systems in a virtualized environment on Red Hat Enterprise Linux. To understand the basic processes, refer to 7장. 가상화 게스트 설치 개요 .

중요

When installing a Red Hat Enterprise Linux guest, the installer will ask to perform an integrity check on your installation source (CD/DVD media, or ISO file). If you select to perform the check, once the media is tested and the installation continues, you may encounter a message that states: The Red Hat Enterprise Linux Server CD was not found in any of your CDROM drives. Please insert the Red Hat Enterprise Linux Server CD and press OK to retry.
This behavior is intentional, provided as a convenience to make sure media is ejected in case a CD install (requiring multiple discs/images) is being performed as opposed to a DVD install.
To proceed past this message, make sure you either insert the next CD, or edit the guest's XML file specifying the next ISO file (or re-insert the DVD media). Next, run virsh update-device Guest1 ~/Guest1.xml (substituting your guest's name and XML file), and select OK to continue past this step.

8.1. 반가상화 게스트로서 Red Hat Enterprise Linux 5 설치

다음 부분에서는 반가상화 게스트로서 Red Hat Enterprise Linux 5를 설치하는 방법에 대해 설명합니다. 반가상화 게스트는 완전 가상화 게스트 보다 빠르며 완전 가상화의 모든 장점을 지원합니다. 반가상화에는 특정 지원되는 커널, kernel-xen 커널이 필요합니다.

반가상화에서 주요 사항

반가상화는 오직 Xen 하이퍼바이저와 함께 작동합니다. 반가상화는 KVM 하이퍼바이저와는 작동하지 않습니다.
설치를 시작하기 전 root 액세스를 갖고 있는지 확인합니다.
이 방식으로 원격 서버에서 Red Hat Enterprise Linux를 설치합니다. 다음 부분에서 설명하는 설치 절차는 최소 설치 라이브 CD-ROM에서 설치하는 것과 유사합니다.
Create para-virtualized Red Hat Enterprise Linux 5 guests using virt-manager or virt-install. For instructions on virt-manager, refer to the procedure in 7.2절. “virt-manager로 게스트 생성 ”.
명령행 기반 virt-install 도구로 반가상화 게스트를 생성합니다. --vnc 옵션은 그래픽 설치를 보여줍니다. 예에서 게스트 이름은 rhel5PV, 디스크 이미지 파일은 rhel5PV.dsk이며 Red Hat Enterprise Linux 5 설치 트리의 로컬 미러는 ftp://10.1.1.1/trees/RHEL5-B2-Server-i386/입니다. 이러한 값을 시스템 및 네트워크에 적합한 값으로 대체합니다.
# virt-install -n rhel5PV -r 500 \
-f /var/lib/libvirt/images/rhel5PV.dsk -s 3 --vnc -p \
-l ftp://10.1.1.1/trees/RHEL5-B2-Server-i386/

자동 설치

Red Hat Enterprise Linux는 그래픽 인터페이스 또는 수동으로 입력하지 않고 설치될 수 있습니다. 킥스타트 파일을 사용하여 설치 절차를 자동화합니다.
두 방식 모두 이 창을 열면 게스트의 처음 부팅 단계가 나타나게 됩니다:
게스트가 처음 부팅을 완료한 후, Red Hat Enterprise Linux 용 표준 설치 프로세스가 시작됩니다. 대부분 시스템의 경우 디폴트 입력값을 허용합니다.
절차 8.1. 반가상화 Red Hat Enterprise Linux 게스트 설치 절차
  1. 언어를 선택하고 OK를 클릭합니다.
  2. 키보드 레이아웃을 선택하고 OK를 클릭합니다.
  3. Assign the guest's network address. Choose to use DHCP (as shown below) or a static IP address:
  4. DHCP를 선택하셨을 경우, 설치 프로세스는 IP 주소를 요청하게 됩니다:
  5. If you chose a static IP address for your guest this prompt appears. Enter the details on the guest's networking configuration:
    1. 유효한 IP 주소를 입력하고, 입력하신 IP 주소가 설치 트리가 있는 설치 서버에 도달할 수 있는지를 확인합니다.
    2. 유효한 서브넷 마스크, 디폴트 케이트웨이, 네임 서버 주소를 입력합니다.
    언어를 선택하고 OK를 클릭합니다.
  6. 다음은 고정 IP 주소 설정의 예입니다:
  7. 설치 절차에서는 서버에서 필요한 파일을 검색합니다:
초기 절차를 완료하면 그래픽 설치 프로세스가 시작됩니다.
베타 버전이나 또는 초기 릴리즈 배포판을 설치할 경우 운영 체제 설치를 원하는 지를 확인하셔야 합니다. 어쨌든 설치를 클릭하고 OK를 클릭합니다:
절차 8.2. 그래픽 설치 프로세스
  1. 사용 가능한 등록 코드를 입력합니다. 사용 가능한 RHN 서브스크립션 키가 있으실 경우 Installation Number 란에 입력해 주십시오:

    주의

    등록 단계를 생략하셨을 경우 rhn_register 명령을 사용하여 설치 후 Red Hat Network 계정 정보를 확인하실 수 있습니다. rhn_register 명령에는 root 액세스가 필요합니다.
  2. 설치 프로그램은 설치를 위해 선택한 저장 장치에 있는 모든 데이터를 삭제하실 것인지를 확인하게 됩니다:
    버튼을 클릭하여 계속 진행합니다.
  3. Review the storage configuration and partition layout. You can chose to select the advanced storage configuration if you want to use iSCSI for the guest's storage.
    Make your selections then click Forward.
  4. 설치를 위해 선택한 저장 장치를 확인합니다.
    버튼을 클릭하여 계속 진행합니다.
  5. 네트워킹 및 호스트 이름을 설정합니다. 이러한 설정은 이전 설치 프로세스에서 입력된 데이터와 함께 전달됩니다. 필요 시 설정 사항을 변경합니다.
    OK를 클릭하여 계속 진행합니다.
  6. 해당하는 시간대를 선택합니다:
  7. 게스트 용 root 암호를 입력합니다.
    다음 버튼을 클릭하여 계속 진행합니다.
  8. 설치할 소프트웨어 패키지를 선택합니다. 사용자 설정 버튼을 선택합니다. System 디렉토리에 있는 kernel-xen 패키지를 설치하셔야 합니다. 반가상화의 경우 kernel-xen 패키지가 필요합니다.
    Click Forward.
  9. 패키지 설치 의존성 및 필요한 용량을 확인합니다.
  10. After the installation dependencies and space requirements have been verified click Forward to start the actual installation.
  11. 선택된 모든 소프트웨어 패키지는 자동으로 설치됩니다.
  12. 설치를 마친 후 게스트를 재부팅합니다:
  13. 새로 설치된 게스트는 재부팅되지 않는 대신 종료됩니다:
  14. Boot the guest. The guest's name was chosen when you used the virt-install in 8.1절. “반가상화 게스트로서 Red Hat Enterprise Linux 5 설치 ”. If you used the default example the name is rhel5PV.
    virsh를 사용하여 게스트를 재부팅합니다:
    # virsh reboot rhel5PV
    다른 방법으로 virt-manager를 열고 게스트 이름을 선택합니다. 열기를 클릭하고 실행을 클릭합니다.
    A VNC window displaying the guest's boot processes now opens.
  15. 게스트를 부팅하면 처음 부팅 설정 화면이 나타납니다. 이 화면을 통해 게스트의 기본 설정 사항을 선택합니다.
  16. 라이센스 계약을 읽고 동의합니다:
    라이센스 계약 화면에서 다음을 클릭합니다.
  17. 방화벽을 설정합니다.
    다음 버튼을 클릭하여 계속 진행합니다.
    1. 방화벽 설정을 사용하지 않음을 선택하셨을 경우 선택하신 사항을 한 번 더 확인하셔야 합니다. 를 클릭하여 확인하고 계속 진행합니다. 방화벽 설정을 사용하지 않는 것은 권장되지 않습니다.
  18. SELinux를 설정합니다. 강제 모드로 SELinux를 실행할 것을 강력히 권장합니다. 허용 모드에서 SELinux를 실행하거나 또는 이를 완전 비활성화로 실행 선택하실 수 있습니다.
    다음 버튼을 클릭하여 계속 진행합니다.
    1. SELinux를 비활성화로 선택하신 경우 경고 메세지가 나타납니다. 를 클릭하여 SELinux를 비활성화합니다.
  19. Disable kdump. The use of kdump is unsupported on para-virtualized guests.
    다음 버튼을 클릭하여 계속 진행합니다.
  20. Confirm time and date are set correctly for your guest. If you install a para-virtualized guest time and date should synchronize with the hypervisor.
    If the users sets the time or date during the installation it is ignored and the hypervisor's time is used.
    다음 버튼을 클릭하여 계속 진행합니다.
  21. 소프트웨어 업데이트를 설정합니다. Red Hat Network 서브스크립션을 갖고 계시거나 또는 이를 사용하시고자 할 경우 아래의 화면을 사용하여 RHN에 새로 설치된 게스트를 등록하실 수 있습니다.
    다음 버튼을 클릭하여 계속 진행합니다.
    1. RHN에 대한 선택 사항을 확인합니다.
    2. RHN 액세스를 설정하지 않은 경우 추가 화면이 나타나게 됩니다. RHN 액세스가 활성화되어 있지 않을 경우, 소프트웨어 업데이트를 받지 못하게 됩니다.
      다음 버튼을 클릭합니다.
  22. 비 root 사용자 계정을 생성합니다. 일반적인 사용을 위해 비 root 사용자를 생성하여 보안을 강화할 것을 권장합니다. 사용자 이름, 이름, 암호를 입력합니다.
    다음 버튼을 클릭합니다.
  23. 사운드 장치가 감지되어 사운드가 필요할 경우 이를 조정합니다. 프로세스를 완료하고 다음 버튼을 클릭합니다.
  24. You can install additional packages from a CD or another repository using this screen. It is often more efficient to not install any additional software at this point but add packages later using the yum command or RHN. Click Finish.
  25. 게스트는 변경 사항을 재설정하고 부팅 프로세스를 계속 진행하게 됩니다.
  26. Red Hat Enterprise Linux 5 로그인 화면이 나타나게 됩니다. 이전 단계에서 생성된 사용자 이름을 사용하여 로그인합니다.
  27. 이제 Red Hat Enterprise Linux 반가상화 게스트가 성공적으로 설치되었습니다.

8.2. 완전 가상화 게스트로서 Red Hat Enterprise Linux 설치

This section covers installing a fully virtualized Red Hat Enterprise Linux 5 guest. This procedure covers both the KVM and the Xen hypervisors; the steps are interchangeable and different steps are noted.
The KVM hypervisor requires Red Hat Enterprise Linux 5.4 or newer.
절차 8.3. virt-manager로 Red Hat Enterprise Linux 5 완전 가상화 게스트 생성
  1. virt-manager 열기

    virt-manager를 시작합니다. 프로그램 메뉴에서 시스템 도구로 가서 가상 장치 관리자 프로그램을 시작합니다. 다른 방법으로 root로 virt-manager 명령을 실행합니다.
  2. 하이퍼바이저 선택

    하이퍼바이저를 선택합니다. 설치되었을 경우, Xen 또는 KVM을 선택합니다. 예에서는 KVM을 선택하고 있습니다. 현재 KVM은 qemu로 되어 있음에 유의하십시오.
    Connect to a hypervisor if you have not already done so. Open the File menu and select the Add Connection... option. Refer to 26.1절. “The Add Connection window”.
    하이퍼바이저 연결을 선택하면 새 장치 버튼을 사용할 수 있게 됩니다. 새 장치 버튼을 누릅니다.
  3. 새 가상 장치 마법사 시작

    Pressing the New button starts the virtual machine creation wizard.
    Press Forward to continue.
  4. 가상 장치 이름 지정

    Provide a name for your virtualized guest. Punctuation and whitespace characters are not permitted in versions before Red Hat Enterprise Linux 5.5. Red Hat Enterprise Linux 5.5 adds support for '_', '.' and '-' characters.
    Press Forward to continue.
  5. 가상화 방식 선택

    Choose the virtualization method for the virtualized guest. Note you can only select an installed virtualization method. If you selected KVM or Xen earlier (단계 4) you must use the hypervisor you selected. This example uses the KVM hypervisor.
    Press Forward to continue.
  6. 설치 방식 선택

    다음 중 하나의 방식을 사용하여 Red Hat Enterprise Linux를 설치할 수 있습니다:
    • 로컬 설치 미디어, ISO 이미지, 물리 광학 미디어 장치.
    • HTTP, FTP, NFS를 통한 네트워크에 호스트된 Red Hat Enterprise Linux 용 설치 트리가 있을 경우 네트워크 설치 트리를 선택합니다.
    • Red Hat Enterprise Linux 설치 미디어를 부팅하기 위해 PXE 서버가 설정되어 있을 경우 PXE를 사용할 수 있습니다. Red Hat Enterprise Linux 설치를 PXE 부팅하기 위해 서버를 설정하는 방법은 여기서 설명하고 있지 않지만, 미디어 부팅 후 대부분의 설치 절차는 동일합니다.
    Set OS Type to Linux and OS Variant to Red Hat Enterprise Linux 5 as shown in the screenshot.
    Press Forward to continue.
  7. 설치 미디어 배치

    ISO 이미지 위치 또는 CD-ROM 또는 DVD 장치를 선택합니다. 예에서는 Red Hat Enterprise Linux 설치 DVD의 ISO 파일 이미지를 사용하고 있습니다.
    1. 검색 버튼을 누릅니다.
    2. ISO 파일의 위치를 검색하여 ISO 이미지를 선택합니다. 열기 버튼을 눌러 선택 사항을 확인합니다.
    3. The file is selected and ready to install.
      Press Forward to continue.

    이미지 파일 및 SELinux

    For ISO image files and guest storage images the recommended to use the /var/lib/libvirt/images/ directory. Any other location may require additional configuration for SELinux, refer to 18.2절. “SELinux 및 가상화 ” for details.
  8. 저장 장치 설정

    Assign a physical storage device (Block device) or a file-based image (File). File-based images must be stored in the /var/lib/libvirt/images/ directory. Assign sufficient space for your virtualized guest and any applications the guest requires.
    Press Forward to continue.

    이전

    Live and offline migrations require guests to be installed on shared network storage. For information on setting up shared storage for guests refer to V부. Virtualization Storage Topics.
  9. 네트워크 설정

    가상 네트워크 또는 물리적 장치 공유를 선택합니다.
    가상 네트워크 옵션에서는 가상 게스트와 함께 기본값 네트워크 장치를 공유하기 위해 NAT (Network Address Translation)를 사용합니다. 무선 네트워크 용 가상 네트워크 옵션을 사용합니다.
    The shared physical device option uses a network bond to give the virtualized guest full access to a network device.
    Press Forward to continue.
  10. 메모리 및 CPU 할당

    The Memory and CPU Allocation window displays. Choose appropriate values for the virtualized CPUs and RAM allocation. These values affect the host's and guest's performance.
    가상 게스트는 효과적인 실행을 위해 충분한 물리적 메모리 (RAM)를 필요로 합니다. 게스트 운영 체제 및 프로그램 요구 사항에 맞는 메모리 값을 선택합니다. 게스트는 물리적 RAM을 사용함에 유의하십시오. 호스트 시스템에 대해 너무 많은 게스트를 실행하거나 메모리가 충분하지 않을 경우 가상 메모리 및 스왑을 현저하게 사용하게 됩니다. 가상 메모리 속도는 감소하여 시스템 성능 및 응답 저하 현상이 나타나게 됩니다. 보다 효과적으로 실행할 수 있도록 모든 게스트 및 호스트에 대해 충분한 메모리를 할당하였는지 확인합니다.
    가상 게스트에 대해 충분한 가상 CPU를 할당합니다. 게스트가 다중 스레드 어플리케이션을 실행하고 있을 경우 가장 효율적으로 실행하기 위해 게스트에 필요한 가상 CPU 수를 지정합니다. 호스트 시스템에서 사용할 수 있는 실제 프로세서 (또는 하이퍼 스레드) 수량 이상의 가상 CPU를 할당하지 않습니다. 그 이상의 가상 프로세서를 할당할 수 있지만 과도한 할당은 프로세서 문맥 교환 오버헤드를 초래하게 되어 게스트 및 호스트 성능에 부정적인 영향을 미치게 됩니다.
    Press Forward to continue.
  11. 게스트 설치 확인 및 시작

    Verify the configuration.
    Press Finish to start the guest installation procedure.
  12. Red Hat Enterprise Linux 설치

    Red Hat Enterprise Linux 5 설치 절차를 완료합니다. 설치 순서는 설치 가이드에서 다루고 있습니다. Red Hat 문서에 있는 Red Hat Enterprise Linux 설치 가이드를 참조하십시오.
이제 Red Hat Enterprise Linux 5 완전 가상화 게스트가 설치되었습니다.

8.3. 완전 가상화 게스트로 Windows XP 설치

Windows XP는 완전 가상화 게스트로 설치할 수 있습니다. 다음 부분에서는 Red Hat Enterprise Linux에서 완전 가상화 게스트로 Windows XP를 설치하는 방법에 대해 설명합니다.
This procedure covers both the KVM and the Xen hypervisors; the steps are interchangeable and different steps are noted.
The KVM hypervisor requires Red Hat Enterprise Linux 5.4 or newer.
이 작업을 시작하기 전 root 액세스를 가지고 있는지를 확인합니다.

Itanium® 지원

현재 Red Hat Enterprise Linux는 Itanium® 아키텍처에서 호스트되며 완전 가상화 Windows XP 게스트를 지원하지 않습니다. Itanium 기반 시스템 용 Windows Server 2003만이 Itanium 시스템에 대해 지원됩니다.
  1. virt-manager 시작

    Open Applications > System Tools > Virtual Machine Manager. Open a connection to a host (click File > Add Connection). Click the New button to create a new virtual machine.
  2. 가상 시스템 이름 지정

    시스템 이름을 입력하고 다음 버튼을 클릭합니다.
  3. 가상화 방식 선택

    If you selected KVM or Xen earlier (step 단계 1 ) you must use the hypervisor you selected. This example uses the KVM hypervisor.
    Windows는 완전 가상화만을 사용하여 설치될 수 있습니다.
  4. 설치 방식 선택

    이 화면에서는 설치 방식 및 운영 체제 유형을 지정할 수 있습니다.
    OS 유형 목록에서 Windows를 선택하고 OS 변형 목록에서 Microsoft Windows XP를 선택합니다.
    PXE로 게스트를 설치하는 것은 Red Hat Enterprise Linux 5.2에서 지원됩니다. 그러나 PXE 설치는 이 장에서 다루지 않습니다.

    이미지 파일 및 SELinux

    For ISO image files and guest storage images the recommended to use the /var/lib/libvirt/images/ directory. Any other location may require additional configuration for SELinux, refer to 18.2절. “SELinux 및 가상화 ” for details.
    다음 버튼을 클릭하여 계속 진행합니다.
  5. Choose installation image

    Choose the installation image or CD-ROM. For CD-ROM or DVD installation select the device with the Windows installation disc in it. If you chose ISO Image Location enter the path to a Windows installation .iso image.
    다음 버튼을 클릭하여 계속 진행합니다.
  6. The Storage window displays. Choose a disk partition, LUN or create a file-based image for the guest's storage.
    All image files are stored in the /var/lib/libvirt/images/ directory by default. In the default configuration, other directory locations for file-based images are prohibited by SELinux. If you use a different directory you must label the new directory according to SELinux policy. Refer to 18.2절. “SELinux 및 가상화 ” for details.
    응용 프로그램이나 기타 다른 데이터에 대해 게스트에 추가 공간이 필요할 경우, 여분의 공간을 할당합니다. 예를 들어, 웹 서버에는 로그 파일을 위해 추가 공간을 필요로 합니다.
    선택한 저장 장치 유형에서 게스트에 알맞는 크기를 선택하고 다음 버튼을 클릭합니다.

    참고

    가상 장치 이미지에 대해 기본값 디렉토리 /var/lib/libvirt/images/를 사용할 것을 권장합니다. 다른 위치를 사용하고 계실 경우 (예: /images/) 설치를 계속 진행하시기 전 이를 SELinux 정책에 추가하여 다시 레이블했는지를 확인합니다. (차후 이 문서에서 SELinux 정책을 수정하는 방법을 설명합니다)
  7. 네트워크 설정

    가상 네트워크 또는 물리적 장치 공유를 선택합니다.
    가상 네트워크 옵션은 NAT (Network Address Translation)를 사용하여 가상 게스트와 함께 기본값 네트워크 장치를 공유합니다. 무선 네트워크의 경우 가상 네트워크 옵션을 사용합니다.
    The shared physical device option uses a network bond to give the virtualized guest full access to a network device.
    Press Forward to continue.
  8. The Memory and CPU Allocation window displays. Choose appropriate values for the virtualized CPUs and RAM allocation. These values affect the host's and guest's performance.
    가상 게스트는 보다 효율적으로 실행하기 위해 충분한 물리적 메모리 (RAM)가 필요합니다. 게스트 운영 체제 및 응용 프로그램 요건에 적합한 메모리 값을 선택합니다. 대부분의 운영 체제가 올바르게 작동하려면 최소 512MB의 RAM이 필요합니다. 게스트는 물리적 RAM을 사용함을 잊지 마십시오. 과도한 수의 게스트를 실행하고 있거나 호스트 시스템에 메모리가 부족할 경우 가상 메모리와 스왑을 사용하게 됩니다. 가상 메모리가 현저하게 느려지면 시스템 성능 및 응답 저하 현상이 나타납니다. 보다 효과적인 운영을 위해 모든 게스트 및 호스트에 충분한 메모리를 할당하였는지를 확인합니다.
    가상 게스트에 충분한 가상 CPU를 할당합니다. 게스트가 다중 스레드 응용 프로그램을 실행할 경우, 게스트를 효율적으로 실행하기 위해 필요한 가상 CPU 수를 지정합니다. 호스트 시스템에서 사용할 수 있는 실제 프로세서 (또는 하이퍼스레딩) 수량 이상의 가상 CPU를 할당하지 마십시오. 가상 프로세서를 초과하여 할당할 수 있지만 초과 할당은 프로세서 문맥이 오버헤드로 전환되어 게스트 및 호스트 성능에 심각하고 부정적인 영향을 줍니다.
  9. 설치를 계속 진행하기 전 요약 화면이 나타나게 됩니다. 완료 버튼을 눌러 게스트 설치를 실행합니다:
  10. You must make a hardware selection so open a console window quickly after the installation starts. Click Finish then switch to the virt-manager summary window and select your newly started Windows guest. Double click on the system name and the console window opens. Quickly and repeatedly press F5 to select a new HAL, once you get the dialog box in the Windows install select the 'Generic i486 Platform' tab. Scroll through selections with the Up and Down arrows.
  11. 다른 표준 Windows 설치와 함께 설치가 진행됩니다.
  12. 요청 시 하드 드라이브를 파티션합니다.
  13. 드라이버를 포맷한 후 Windows는 파일을 하드 드라이브에 복사하기 시작합니다.
  14. 파일은 저장 장치에 복사하고 Windows를 다시 시작합니다.
  15. Windows 게스트를 다시 시작합니다:
    # virsh start WindowsGuest
    여기서 WindowsGuest는 가상 장치의 이름입니다.
  16. 콘솔 창을 열면 Windows 설치 설정 단계가 나타납니다.
  17. 설정 단계에서 설치 프로그램이 정지될 경우 virsh reboot WindowsGuestName 명령을 사용하여 게스트를 재시작할 수 있습니다. 가상 장치를 재시작하면 Setup is being restarted 메세지가 나타나게 됩니다:
  18. 설정 완료후 윈도우 부팅 화면이 나타나게 됩니다:
  19. 이제 윈도우 설치의 표준 설정을 계속 진행하실 수 있습니다:
  20. 설치 과정이 완료되었습니다.

8.4. 완전 가상화 게스트로 윈도우 서버 2003 설치

This chapter describes installing a fully virtualized Windows Server 2003 guest with the virt-install command. virt-install can be used instead of virt-manager This process is similar to the Windows XP installation covered in 8.3절. “완전 가상화 게스트로 Windows XP 설치 ”.

Itanium® 지원

현재, Red Hat Enterprise Linux는 Itanium® 아키텍처에서 호스트되며 완전 가상화 윈도우 게스트를 지원하지 않습니다. 다음 부분은 x86 및 x86-64 호스트에만 적용됩니다.
  1. Using virt-install for installing Windows Server 2003 as the console for the Windows guest opens the virt-viewer window promptly. The examples below installs a Windows Server 2003 guest with the virt-install command.
    1. Xen virt-install

      # virt-install --virt-type=xen -hvm  \
         --name windows2003sp1 
         --file=/var/lib/libvirt/images/windows2003sp2.img \
         --file-size=6 \
         --cdrom=/var/lib/libvirt/images/ISOs/WIN/en_windows_server_2003_sp1.iso \
         --vnc --ram=1024
      
    2. KVM virt-install

      # virt-install --accelerate --hvm --connect qemu:///system \
         --name rhel3support  \
         --network network:default \
         --file=/var/lib/libvirt/images/windows2003sp2.img \
         --file-size=6 \
         --cdrom=/var/lib/libvirt/images/ISOs/WIN/en_windows_server_2003_sp1.iso \
         --vnc --ram=1024
      
  2. 게스트가 설치를 시작한 후 신속하게 F5를 누릅니다. F5를 바로 누르지 않으면 설치를 다시 시작해야 합니다. F5를 누르면 다른 HAL 또는 컴퓨터 유형을 선택할 수 있습니다. 컴퓨터 유형으로 표준 PC를 선택합니다. Windows Server 2003 의 경우 컴퓨터 유형을 변경해야 합니다.
  3. 나머지 설치 과정을 완료합니다.
  4. 이제 완전 가상화 게스트로 윈도우 서버 2003이 설치되었습니다.

8.5. 완전 가상화 게스트로 Windows Server 2008 설치

This section covers installing a fully virtualized Windows Server 2008 guest. This procedure covers both the KVM and the Xen hypervisors; the steps are interchangeable and different steps are noted.
The KVM hypervisor requires Red Hat Enterprise Linux 5.4 or newer.
절차 8.4. virt-manager로 Windows Server 2008 설치
  1. virt-manager 열기

    virt-manager를 시작합니다. 프로그램 메뉴와 시스템 도구 하위 메뉴에서 가상 장치 관리자 프로그램을 시작합니다. 다른 방법으로 root로 virt-manager 명령을 실행합니다.
  2. 하이퍼바이저 선택

    하이퍼바이저를 선택합니다. 설치되어 있을 경우 Xen 또는 KVM을 선택합니다. 예에서는 KVM을 선택하고 있습니다. 현재 KVM은 qemu로 되어 있습니다.
    옵션을 선택하면 새 장치 버튼을 사용할 수 있게 됩니다. 새 장치 버튼을 누릅니다.
  3. 새 가상 장치 마법사 시작

    Pressing the New button starts the virtual machine creation wizard.
    Press Forward to continue.
  4. 가상 장치 이름 지정

    Provide a name for your virtualized guest. Punctuation and whitespace characters are not permitted in versions before Red Hat Enterprise Linux 5.5. Red Hat Enterprise Linux 5.5 adds support for '_', '.' and '-' characters.
    Press Forward to continue.
  5. 가상화 방식 선택

    Choose the virtualization method for the virtualized guest. Note you can only select an installed virtualization method. If you selected KVM or Xen earlier (step 2) you must use the hypervisor you selected. This example uses the KVM hypervisor.
    Press Forward to continue.
  6. 가상화 방식 선택

    모든 Windows 버전의 경우 ISO 이미지 또는 물리 광학 미디어 중 로컬 설치 미디어를 사용해야 합니다.
    Windows 네트워크 설치 용으로 PXE 서버를 설정한 경우 PXE를 사용할 수 있습니다. PXE Windows 설치는 이 가이드에서 다루고 있지 않습니다.
    Set OS Type to Windows and OS Variant to Microsoft Windows 2008 as shown in the screenshot.
    Press Forward to continue.
  7. 설치 미디어 위치

    ISO 이미지의 위치 또는 CD-ROM 또는 DVD 장치를 선택합니다. 이 예제에서는 Windows Server 2008 설치 CD의 ISO 파일 이미지를 사용하고 있습니다.
    1. 검색 버튼을 누릅니다.
    2. Search to the location of the ISO file and select it.
      Press Open to confirm your selection.
    3. The file is selected and ready to install.
      Press Forward to continue.

    이미지 파일 및 SELinux

    For ISO image files and guest storage images, the recommended directory to use is the /var/lib/libvirt/images/ directory. Any other location may require additional configuration for SELinux, refer to 18.2절. “SELinux 및 가상화 ” for details.
  8. 저장 장치 설정

    Assign a physical storage device (Block device) or a file-based image (File). File-based images must be stored in the /var/lib/libvirt/images/ directory. Assign sufficient space for your virtualized guest and any applications the guest requires.
    Press Forward to continue.
  9. 네트워크 설정

    가상 네트워크 또는 물리적 장치 공유를 선택합니다.
    가상 네트워크 옵션은 NAT (Network Address Translation)를 사용하여 가상 게스트와 함께 기본값 네트워크 장치를 공유합니다. 무선 네트워크의 경우 가상 네트워크 옵션을 사용합니다.
    The shared physical device option uses a network bond to give the virtualized guest full access to a network device.
    Press Forward to continue.
  10. 메모리 및 CPU 할당

    The Memory and CPU Allocation window displays. Choose appropriate values for the virtualized CPUs and RAM allocation. These values affect the host's and guest's performance.
    가상 게스트는 효과적인 실행을 위해 충분한 물리적 메모리 (RAM)를 필요로 합니다. 게스트 운영 체제 및 프로그램 요구 사항에 맞는 메모리 값을 선택합니다. 게스트는 물리적 RAM을 사용함에 유의하십시오. 호스트 시스템에 대해 너무 많은 게스트를 실행하거나 메모리가 충분하지 않을 경우 가상 메모리 및 스왑을 현저하게 사용하게 됩니다. 가상 메모리 속도는 감소하여 시스템 성능 및 응답 저하 현상이 나타나게 됩니다. 보다 효과적으로 실행할 수 있도록 모든 게스트 및 호스트에 대해 충분한 메모리를 할당하였는지 확인합니다.
    가상 게스트에 가상 CPU를 충분히 할당합니다. 게스트가 다중 스레드 어플리케이션을 실행할 경우 게스트를 가장 효율적으로 실행하기 위해 필요한 가상 CPU 수를 지정합니다. 호스트 시스템에서 사용할 수 있는 실제 프로세서 (또는 하이퍼스레드) 수량 이상의 가상 CPU를 할당하지 않습니다. 가상 프로세스의 초과 할당이 가능하지만 초과 할당은 프로세서 문맥 교환 오버헤드를 초래하게 되어 게스트 및 호스트의 성능에 심각한 부정적 영향을 미칠 수 있습니다.
    Press Forward to continue.
  11. 게스트 설치 확인 및 시작

    Verify the configuration.
    Press Finish to start the guest installation procedure.
  12. Windows 설치

    Complete the Windows Server 2008 installation sequence. The installation sequence is not covered by this guide, refer to Microsoft's documentation for information on installing Windows.

부 III. 설정

Red Hat Enterprise Linux에 가상화 설정

These chapters cover configuration procedures for various advanced virtualization tasks. These tasks include adding network and storage devices, enhancing security, improving performance, and using the Para-virtualized drivers on fully virtualized guests.

차례

9. Virtualized storage devices
9.1. 가상 플로피 디스크 제어기 생성
9.2. 게스트에 저장 장치 추가
9.3. Red Hat Enterprise Linux 5에서 영구적 저장 장치 설정
9.4. 게스트에 가상화 CD-ROM 또는 DVD 장치 추가
10. 네트워크 설정
10.1. libvirt를 사용한 NAT (Network address translation)
10.2. libvirt를 사용하여 브리지된 네트워킹
11. 사전 Red Hat Enterprise Linux 5.4 Xen 네트워킹
11.1. 여러 이더넷 카드를 사용하기 위해 다수의 게스트 네트워크 브리지 설정
11.2. Red Hat Enterprise Linux 5.0 랩톱 네트워크 설정
12. Xen 반가상화 드라이버
12.1. 시스템 요구 사항
12.2. 반가상화 제한 및 지원 사항
12.3. 반가상화 드라이버 설치
12.3.1. 일반적인 설치 단계
12.3.2. Red Hat Enterprise Linux 3에서 반가상화 드라이버 설치 및 설정
12.3.3. Red Hat Enterprise Linux 4에서 반가상화 드라이버 설치 및 설정
12.3.4. Xen Para-virtualized Drivers on Red Hat Enterprise Linux 5
12.3.5. Xen Para-virtualized Drivers on Red Hat Enterprise Linux 6
12.4. 반가상화 네트워크 드라이버 설정
12.5. 반가상화 하드웨어 추가 설정
12.5.1. 가상 네트워크 인터페이스
12.5.2. 가상 저장 장치
13. KVM 반가상화 드라이버
13.1. KVM Windows 반가상화 드라이버 설치
13.2. Installing drivers with a virtualized floppy disk
13.3. 기존 장치에 대해 KVM 반가상화 드라이버 사용
13.4. 새 장치에 대해 KVM 반가상화 드라이버 사용
14. PCI passthrough
14.1. Adding a PCI device with virsh
14.2. Adding a PCI device with virt-manager
14.3. PCI passthrough with virt-install
14.4. PCI passthrough for para-virtualized Xen guests on Red Hat Enterprise Linux
15. SR-IOV
15.1. Introduction
15.2. Using SR-IOV
15.3. Troubleshooting SR-IOV
16. KVM 게스트 시간 관리

9장. Virtualized storage devices

This chapter covers installing and configuring storage devices in virtualized guests. The term block devices refers to various forms of storage devices. All the procedures in this chapter work with both Xen and KVM hypervisors.

Valid disk targets

The target variable in libvirt configuration files accepts only the following device names:
  • /dev/xvd[a to z][1 to 15]
    Example: /dev/xvdb13
  • /dev/xvd[a to i][a to z][1 to 15]
    Example: /dev/xvdbz13
  • /dev/sd[a to p][1 to 15]
    Example: /dev/sda1
  • /dev/hd[a to t][1 to 63]
    Example: /dev/hdd3

9.1. 가상 플로피 디스크 제어기 생성

여러 이전 운영 체제의 경우, 특히 드라이버 설치의 경우에 플로피 디스크 제어기가 필요합니다. 현재 물리적 플로피 디스크 장치는 가상 게스트에서 액세스할 수 없습니다. 하지만 가상 플로피 드라이버에서 플로피 디스크 이미지를 생성 및 액세스하는 것은 지원됩니다. 다음 부분에서는 가상 플로피 장치를 생성하는 방법에 대해 설명합니다.
An image file of a floppy disk is required. Create floppy disk image files with the dd command. Replace /dev/fd0 with the name of a floppy device and name the disk appropriately.
# dd if=/dev/fd0 of=~/legacydrivers.img

반가상화 드라이버

The para-virtualized drivers can map physical floppy devices to fully virtualized guests. For more information on using para-virtualized drivers read 13장. KVM 반가상화 드라이버 .
다음 예에서는 /var/lib/libvirt/images/rhel5FV.img에 있는 이미지를 사용하여 완전 가상화 Red Hat Enterprise Linux 설치를 실행하는 virt-manager로 생성된 게스트를 사용하고 있습니다. 예에서 Xen 하이퍼바이저가 사용되고 있습니다.
  1. 실행 중인 게스트에서 virsh 명령을 사용하여 게스트 이미지의 XML 설정 파일을 생성합니다.
    # virsh dumpxml rhel5FV > rhel5FV.xml
    
    This saves the configuration settings as an XML file which can be edited to customize the operations and devices used by the guest. For more information on using the virsh XML configuration files, refer to 33장. 사용자 설정 libvirt 스크립트 생성 .
  2. 게스트 용 플로피 디스크 이미지를 생성합니다.
    # dd if=/dev/zero of=/var/lib/libvirt/images/rhel5FV-floppy.img bs=512 count=2880
    
  3. Add the content below, changing where appropriate, to your guest's configuration XML file. This example is an emulated floppy device using a file-based image.
    <disk type='file' device='floppy'>
    	<source file='/var/lib/libvirt/images/rhel5FV-floppy.img'/>
    	<target dev='fda'/>
    </disk>
    
  4. Force the guest to stop. To shut down the guest gracefully, use the virsh shutdown command instead.
    # virsh destroy rhel5FV
  5. XML 설정 파일을 사용하여 게스트를 다시 시작합니다.
    # virsh create rhel5FV.xml
    
현재 플로피 장치는 게스트에서 사용할 수 있으며 호스트 상에서 이미지 파일로 저장됩니다.

9.2. 게스트에 저장 장치 추가

다음 부분에서는 가상 게스트에 저장 장치를 추가하는 방법에 대해 설명합니다. 추가 저장 장치는 게스트를 생성한 후에만 추가될 수 있습니다. 지원되는 저장 장치 및 프로토콜은 다음과 같습니다:
  • 로컬 하드 드라이브 파티션
  • 논리 볼륨
  • 호스트에 직접 연결된 파이버 채널 또는 iSCSI
  • 호스트 상의 파일 시스템에 있는 파일 컨테이너
  • 가상 장치에 의해 직접 마운트된 NFS 파일 시스템
  • 게스트에 의해 직접 액세스된 iSCSI 저장 장치
  • 클러스터 파일 시스템 (GFS)
게스트에 파일 기반 저장 장치 추가
파일 기반 저장 장치 또는 파일 기반 컨테이너는 가상 게스트에 대해 가상 하드 드라이브로 작동하는 호스트 파일 시스템에 있는 파일입니다. 파일 기반 컨테이너를 추가하려면 다음 절차를 실행합니다:
  1. 빈 컨테이너 파일을 생성하거나 기존 파일 컨테이너 (예: ISO 파일)를 사용합니다.
    1. dd 명령을 사용하여 스파스 (sparse) 파일을 생성합니다. 스파스 파일은 데이터 무결성 및 실행 문제로 인해 권장되지 않습니다. 스파스 파일은 보다 빨리 생성되며 테스트 목적으로 사용될 수 있으나 실제 시스템에서는 사용하지 않습니다.
      # dd if=/dev/zero of=/var/lib/libvirt/images/FileName.img bs=1M seek=4096 count=0
      
    2. 비 sparse, 미리 할당된 파일은 파일 기반 저장 장치 이미지의 경우에 권장됩니다. 비 sparse 파일을 생성하려면 다음을 실행합니다:
      # dd if=/dev/zero of=/var/lib/libvirt/images/FileName.img bs=1M count=4096
      
    Both commands create a 4GB file which can be used as additional storage for a virtualized guest.
  2. 게스트에 대한 설정을 덤프합니다. 예에서 게스트는 Guest1이며 파일은 사용자의 홈 디렉토리에 저장됩니다.
    # virsh dumpxml Guest1 > ~/Guest1.xml
    
  3. 텍스트 편집기로 설정 파일 (예에서 Guest1.xml)을 엽니다. <disk> 항목을 찾습니다. 이러한 항목은 저장 장치를 설명합니다. 디스크 항목의 예는 다음과 같습니다:
    <disk type='file' device='disk'>
        <driver name='tap' type='aio'/>
        <source file='/var/lib/libvirt/images/Guest1.img'/>
        <target dev='xvda'/>
    </disk>
    
  4. 새로운 <disk> 항목을 작성 또는 복사하여 추가 저장 장치를 더합니다. 가상 블록 장치 속성의 장치 이름을 지정했는지 확인합니다. 이러한 속성은 각각의 게스트 설정 파일에 대해 유일한 것이어야 합니다. 다음 예에는 FileName.img라는 추가 파일 기반 저장 장치 컨테이너가 들어있는 설정 파일 부분이 있습니다.
    <disk type='file' device='disk'>
        <driver name='tap' type='aio'/>
        <source file='/var/lib/libvirt/images/Guest1.img'/>
        <target dev='xvda'/>
    </disk>
    <disk type='file' device='disk'>
        <driver name='tap' type='aio'/>
        <source file='/var/lib/libvirt/images/FileName.img'/>
        <target dev='hda'/>
    </disk>
    
  5. 업데이트된 설정 파일에서 게스트를 다시 시작합니다.
    # virsh create Guest1.xml
    
  6. The following steps are Linux guest specific. Other operating systems handle new storage devices in different ways. For other systems, refer to that operating system's documentation
    The guest now uses the file FileName.img as the device called /dev/sdb. This device requires formatting from the guest. On the guest, partition the device into one primary partition for the entire device then format the device.
    1. 새 파티션의 경우 n을 누릅니다.
      # fdisk /dev/sdb
      Command (m for help):
      
    2. 기본 (primary) 파티션의 경우 p를 누릅니다.
      Command action
         e   extended
         p   primary partition (1-4)
      
    3. 사용 가능한 파티션 번호를 선택합니다. 예에서는 1을 입력하여 첫 번째 파티션을 선택합니다.
      Partition number (1-4): 1
      
    4. Enter를 눌러 기본값으로 첫번째 실린더를 입력합니다.
      First cylinder (1-400, default 1):
      
    5. 파티션 크기를 선택합니다. 예에서는 Enter를 눌러 전체 디스크를 할당합니다.
      Last cylinder or +size or +sizeM or +sizeK (2-400, default 400):
      
    6. t를 눌러 파티션 유형을 설정합니다.
      Command (m for help): t
      
    7. 이전 단계에서 생성한 파티션을 선택합니다. 예에서 파티션 번호는 1이 됩니다.
      Partition number (1-4): 1
      
    8. linux 파티션에 대해 83을 입력합니다.
      Hex code (type L to list codes): 83
      
    9. 변경 사항을 디스크에 저장하고 종료합니다.
      Command (m for help): w 
      Command (m for help): q
      
    10. 새 파티션을 ext3 파일 시스템으로 포맷합니다.
      # mke2fs -j /dev/sdb1
      
  7. 게스트에서 디스크를 마운트합니다.
    # mount /dev/sdb1 /myfiles
    
현재 게스트에는 가상 파일 기반 저장 장치가 추가되어 있습니다.
게스트에 하드 드라이브 및 기타 다른 블록 장치 추가
System administrators use additional hard drives for to provide more storage space or to separate system data from user data. This procedure, 절차 9.1. “가상 게스트에 물리적 블록 장치 추가 ”, describes how to add a hard drive on the host to a virtualized guest.
이 절차는 CD-ROM, DVD 및 플로피 디스크와 같은 모든 물리적 블록 장치에 대해 작동합니다.

Block device security

The host should not use disk labels to identify file systems in the fstab file, the initrd file or used by the kernel command line. If less privileged users, especially virtualized guests, have write access to whole partitions or LVM volumes the host system could be compromised.
Guest should not be given write access to whole disks or block devices (for example, /dev/sdb). Virtualized guests with access to block devices may be able to access other block devices on the system or modify volume labels which can be used to compromise the host system. Use partitions (for example, /dev/sdb1) or LVM volumes to prevent this issue.
절차 9.1. 가상 게스트에 물리적 블록 장치 추가
  1. 호스트에 하드 디스크 장치를 물리적으로 부착합니다. 기본값으로 드라이브에 액세스할 수 없을 경우 호스트를 설정합니다.
  2. 필요 시 호스트 상의 영구성 및 multipath로 장치를 설정합니다.
  3. Use the virsh attach command. Replace: myguest with your guest's name, /dev/sdb1 with the device to add, and sdc with the location for the device on the guest. The sdc must be an unused device name. Use the sd* notation for Windows guests as well, the guest will recognize the device correctly.
    Append the --type cdrom parameter to the command for CD-ROM or DVD devices.
    --type floppy 파라미터를 플로피 장치의 명령에 추가합니다.
    # virsh attach-disk myguest
    					/dev/sdb1
    					sdc --driver tap --mode readonly
    
  4. The guest now has a new hard disk device called /dev/sdb on Linux or D: drive, or similar, on Windows. This device may require formatting.

9.3. Red Hat Enterprise Linux 5에서 영구적 저장 장치 설정

다음 부분은 외부 저장 장치 또는 네트워크 저장 장치 (예: 파이버 채널 또는 iSCSI 기반 저장 장치)를 갖는 시스템에 대한 내용입니다. 이러한 시스템에서는 호스트에 대해 영구적 장치 이름을 설정할 것을 권장합니다. 이는 실시간 이전을 돕고 다수의 가상 시스템에 대해 일관성있게 장치 이름 및 저장 장치를 제공합니다.
UUID (Universally Unique Identifiers)는 분산 컴퓨팅 환경에서 컴퓨터 및 장치 식별을 위한 표준화된 방식입니다. 다음 부분에서는 iSCSI 또는 파이버 채널 LUN을 식별하기 위해 UUID를 사용합니다. UUID는 재시작, 연결 해제 및 장치 스왑 후에도 영구적으로 남아 있습니다. UUID는 장치의 레이블과 유사합니다.
Systems which are not running multipath must use 단일 경로 설정 . Systems running multipath can use 다중 경로 설정 .
단일 경로 설정
This procedure implements LUN device persistence using udev. Only use this procedure for hosts which are not using multipath.
  1. /etc/scsi_id.config 파일을 편집합니다.
    1. options=-b 행이 주석 처리되어 있는지를 확인합니다.
      # options=-b
      
    2. 다음과 같은 행을 추가합니다:
      options=-g
      
      이러한 옵션으로 udev를 설정하여 부착된 모든 SCSI 장치가 UUID를 반환하게 합니다.
  2. 주어진 장치의 UUID를 보려면 scsi_id -g -s /block/sd* 명령을 실행합니다. 예:
    # scsi_id -g -s /block/sd*
    3600a0b800013275100000015427b625e
    
    실제 출력 결과는 위의 예제와 다를 수 있습니다. 출력 결과에서는 /dev/sdc 장치의 UUID를 나타내고 있습니다.
  3. scsi_id -g -s /block/sd* 명령에 의한 UUID 출력이 장치에 액세스하는 컴퓨터에서 동일한지 확인합니다.
  4. 장치 이름을 지정하기 위해 규칙을 생성합니다. /etc/udev/rules.d 디렉토리에 있는 20-names.rules 라는 파일을 생성합니다. 이 파일에 새로운 규칙을 추가합니다. 동일한 포맷을 사용하여 모든 규칙은 동일한 파일에 추가됩니다. 규칙은 다음과 같은 포맷으로 되어 있어야 합니다:
    KERNEL=="sd[a-z]", BUS=="scsi", PROGRAM="/sbin/scsi_id -g -s /block/%k", RESULT="UUID", NAME="devicename"
    
    UUIDdevicename을 검색된 UUID 및 장치 이름으로 대체합니다. 예에서 규칙은 다음과 같이 나타납니다:
    KERNEL="sd*", BUS="scsi", PROGRAM="/sbin/scsi_id -g -s", RESULT="3600a0b800013275100000015427b625e", NAME="rack4row16"
    
    udev 데몬은 규칙에 있는 UUID에 대해 /dev/sd*라는 모든 장치를 검색합니다. 일치하는 장치가 시스템에 연결되면 장치는 규칙에서 이름을 할당합니다. 3600a0b800013275100000015427b625e의 UUID를 갖는 장치에서는 /dev/rack4row16으로 표시됩니다.
  5. 이 행을 /etc/rc.local에 추가합니다:
    /sbin/start_udev
    
  6. /etc/scsi_id.config, /etc/udev/rules.d/20-names.rules, /etc/rc.local에서의 변경 사항을 관련된 모든 호스트에 복사합니다.
    /sbin/start_udev
    
설정된 규칙이 있는 네트워크 저장 장치는 파일이 업데이트된 위치의 모든 호스트에 있는 영구적 이름을 갖습니다. 이는 공유 장치를 사용하여 호스트 간에 게스트를 이전할 수 있으며 게스트는 설정 파일에 있는 저장 장치에 액세스할 수 있음을 의미합니다.
다중 경로 설정
multipath 패키지는 컴퓨터에서 저장 장치로 한 개 이상의 물리적 경로를 갖는 시스템에 대해 사용됩니다. multipath는 Red Hat Enterprise Linux 시스템에 부착된 네트워크 저장 장치에 대해 장애 허용, 장애 복구, 성능 향상을 제공합니다.
Implementing LUN persistence in a multipath environment requires defined alias names for your multipath devices. Each storage device has a UUID which acts as a key for the aliased names. Identify a device's UUID using the scsi_id command.
# scsi_id -g -s /block/sdc
멀티패스 장치는 /dev/mpath 디렉토리에 생성됩니다. 아래 예에서는 4 개의 장치가 /etc/multipath.conf에 정의되어 있습니다:
multipaths { 
	multipath { 
	wwid		3600805f30015987000000000768a0019 
	alias		oramp1 
	} 
	multipath { 
	wwid		3600805f30015987000000000d643001a 
	alias		oramp2 
	} 
	mulitpath { 
	wwid		3600805f3001598700000000086fc001b 
	alias		oramp3 
	} 
	mulitpath { 
	wwid		3600805f300159870000000000984001c 
	alias		oramp4 
	} 
}
This configuration will create 4 LUNs named /dev/mpath/oramp1, /dev/mpath/oramp2, /dev/mpath/oramp3 and /dev/mpath/oramp4. Once entered, the mapping of the devices' WWID to their new names are now persistent after rebooting.

9.4. 게스트에 가상화 CD-ROM 또는 DVD 장치 추가

To attach an ISO file to a guest while the guest is online use virsh with the attach-disk parameter.
# virsh attach-disk [domain-id] [source] [target] --driver file --type cdrom --mode readonly
The source and target parameters are paths for the files and devices, on the host and guest respectively. The source parameter can be a path to an ISO file or the device from the /dev directory.

10장. 네트워크 설정

다음 부분에서는 libvirt 기반 어플리케이션을 사용한 일반적인 네트워킹 설정에 대해 소개합니다. 이러한 내용은 Xen, KVM 또는 기타 다른 모든 하이퍼바이저에 적용됩니다. 보다 자세한 내용은 libvirt 네트워크 구조 문서를 참조하십시오.
두 가지 일반적인 설정에는 "가상 네트워크" 또는 "물리적 장치 공유"가 있습니다. 가상 네트워크는 모든 배포판에 걸쳐 동일하며 가상 장치 상자 밖에서 사용 가능합니다. 물리적 장치 공유는 특정 배포판에 대해 수동으로 설정해야 합니다.
Network services on virtualized guests are not accessible by default from external hosts. You must enable either Network address translation (NAT) ir a network Bridge to allow external hosts access to network services on virtualized guests.

10.1. libvirt를 사용한 NAT (Network address translation)

네트워크 연결 공유를 위한 가장 일반적인 방법 중 하나는 NAT (Network address translation) 포워딩 (가상 네트워크라고도 부름)을 사용하는 것입니다.
호스트 설정
Every standard libvirt installation provides NAT based connectivity to virtual machines out of the box. This is the so called 'default virtual network'. Verify that it is available with the virsh net-list --all command.
# virsh net-list --all
Name                 State      Autostart 
-----------------------------------------
default              active     yes
없을 경우, XML 설정 예제 파일을 다시 불러와 활성화할 수 있습니다:
# virsh net-define /usr/share/libvirt/networks/default.xml
기본값 네트워크는 /usr/share/libvirt/networks/default.xml에서 정의됩니다.
기본값 네트워크가 자동으로 시작되도록 표시합니다:
# virsh net-autostart default
Network default marked as autostarted
기본값 네트워크를 시작합니다:
# virsh net-start default
Network default started
libvirt 기본값 네트워크가 실행되면, 고립된 브리지 장치가 나타나게 됩니다. 이러한 장치는 외부와 연결하기 위해 NAT 및 IP 포워딩을 사용한 이래 물리적 인터페이스를 추가하지 않습니다. 새 인터페이스를 추가하시 마십시오.
# brctl show
bridge name     bridge id               STP enabled     interfaces
virbr0          8000.000000000000       yes
libvirtINPUT, FORWARD, OUTPUT, POSTROUTING 체인에 있는 virbr0 장치에 부착된 게스트에서/부터 전송을 허용하는 iptables 규칙을 추가합니다. 그 후 libvirtip_forward 파라미터를 활성 시도합니다. 일부 다른 어플리케이션은 ip_forward를 비활성화할 수 있으므로, 최상의 옵션은 다음을 /etc/sysctl.conf에 추가하는 것입니다.
 net.ipv4.ip_forward = 1
게스트 설정
Once the host configuration is complete, a guest can be connected to the virtual network based on its name. To connect a guest to the 'default' virtual network, the following XML can be used in the guest:
<interface type='network'>
  <source network='default'/>
</interface>

주의

MAC 주소를 설정하는 것은 옵션 사항입니다. MAC 주소 설정을 생략할 경우 이는 자동으로 생성됩니다. 특정 상황에서 수동으로 MAC 주소를 설정하는 것이 유용합니다.
<interface type='network'>
  <source network='default'/>
  <mac address='00:16:3e:1a:b3:4a'/>
  </interface>

10.2. libvirt를 사용하여 브리지된 네트워킹

브리지된 네트워킹 (물리적 장치 공유라고도 함)은 가상 장치에 있는 물리적 장치를 위해 사용됩니다. 브리징은 보다 고급 설정에서 서버 상에 여러 네트워크 인터페이스와 함께 사용됩니다.
Xen 네트워크 스크립트 비활성화
시스템이 Xen 브리지를 사용하고 있을 경우, /etc/xen/xend-config.sxp 파일을 편집하고 행을 변경하여 기본값 Xen 네트워크 브리지를 비활성화할 것을 권장합니다.
 (network-script network-bridge)
To:
 (network-script /bin/true)
NetworkManager 비활성화
NetworkManager does not support bridging. Running NetworkManager will overwrite any manual bridge configuration. Because of this, NetworkManager should be disabled in order to use networking via the network scripts (located in the /etc/sysconfig/network-scripts/ directory):
# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start

주의

As an alternative to turning off NetworkManager, add "NM_CONTROLLED=no" to the ifcfg-* scripts used in the examples. If you do not either set this parameter or disable NetworkManager entirely, any bridge configuration will be overwritten and lost when NetworkManager next starts.
네트워크 스크립트 생성
다음의 두 개의 네트워크 설정 파일을 생성 또는 편집합니다. 추가 네트워크 브리지에 대해 이러한 절차가 반복될 수 있습니다 (다른 이름 사용).
/etc/sysconfig/network-scripts 디렉토리로 변경합니다:
# cd /etc/sysconfig/network-scripts
브리지에 추가하려는 장치에 해당하는 네트워크 스크립트를 엽니다. 예에서 ifcfg-eth0는 브리지의 일부분으로 설정된 물리적 네트워크 인터페이스를 정의하고 있습니다:
DEVICE=eth0
# change the hardware address to match the hardware address your NIC uses
HWADDR=00:16:76:D6:C9:45
ONBOOT=yes
BRIDGE=br0

Tip

You can configure the device's Maximum Transfer Unit (MTU) by appending an MTU variable to the end of the configuration file.
MTU=9000
/etc/sysconfig/network-scripts 디렉토리에 ifcfg-br0라는 새로운 네트워크 스크립트를 생성합니다. br0은 브리지 이름이며, 이는 파일 이름이 장치 파라미터와 동일할 경우 어느것이든지 될 수 있습니다.
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
DELAY=0

IP address configuration

IP address configuration, be it dynamic or static, should be configured on the bridge itself (for example, in the ifcfg-br0 file). Network access will not function as expected if IP address details are configured on the physical interface that the bridge is connected to.

경고

The line, TYPE=Bridge, is case-sensitive. It must have uppercase 'B' and lower case 'ridge'.
설정 후 네트워킹을 다시 시작하거나 재부팅합니다.
# service network restart
iptables를 설정하여 모든 전송이 브리지를 통해 포워딩되게 합니다.
# iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
# service iptables save
# service iptables restart

브리지 상의 iptable 비활성화

다른 방법으로 브리지된 전송이 iptables 규칙에 의해 프로세스되지 않게 합니다. /etc/sysctl.conf에 다음과 같은 행을 추가합니다:
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
sysctl로 설정된 커널 파라미터를 다시 불러옵니다.
# sysctl -p /etc/sysctl.conf
libvirt 데몬을 다시 시작합니다.
# service libvirtd reload
이제 "물리적 장치 공유" 절차가 완료되어 게스트를 부착하여 완전 LAN 액세스를 가질 수 있습니다. 새로운 브리지를 확인합니다:
# brctl show
bridge name     bridge id               STP enabled     interfaces
virbr0          8000.000000000000       yes
br0             8000.000e0cb30550       no              eth0
알림: 브리지는 virbr0 브리지와 완전히 독립적인 것입니다. 물리적 장치를 virbr0에 부착하려 하지 마십시오. virbr0 브리지는 NAT (Network Address Translation) 연결을 위한 것입니다.

11장. 사전 Red Hat Enterprise Linux 5.4 Xen 네트워킹

다음 부분에서는 Xen 하이퍼바이저를 사용한 네트워킹 및 네트워크 설정에 대해 설명합니다.
Most guest network configuration occurs during the guest initialization and installation process. To learn about configuring networking during the guest installation process, read the relevant sections of the installation process, 7장. 가상화 게스트 설치 개요 .
Network configuration is also covered in the tool specific reference chapters for virsh (25장. virsh를 사용한 게스트 관리 ) and virt-manager (26장. 가상 장치 관리자(virt-manager)를 사용한 게스트 관리 ). Those chapters provide a detailed description of the networking configuration tasks using both tools.

Tip

Using para-virtualized network drivers improves performance on fully virtualized Linux guests. 12장. Xen 반가상화 드라이버 explains how to utilize para-virtualized network drivers.

11.1. 여러 이더넷 카드를 사용하기 위해 다수의 게스트 네트워크 브리지 설정

네트워크 브리지 설정 절차 (Xen 하이퍼바이저 사용):
  1. system-config-network 어플리케이션을 사용하여 다른 네트워크 인터페이스를 생성합니다. 또는 /etc/sysconfig/network-scripts/ 디렉토리에 ifcfg-ethX라는 새 설정 파일을 생성합니다. 여기서 X는 이미 사용되지 않은 숫자이어야 합니다. 아래에는 eth1이라는 두번째 네트워크 인터페이스에 해당하는 설정 파일의 예가 있습니다.
    $ cat /etc/sysconfig/network-scripts/ifcfg-eth1
    DEVICE=eth1
    BOOTPROTO=static
    ONBOOT=yes
    USERCTL=no
    IPV6INIT=no
    PEERDNS=yes
    TYPE=Ethernet
    NETMASK=255.255.255.0
    IPADDR=10.1.1.1
    GATEWAY=10.1.1.254
    ARP=yes
    
  2. /etc/xen/scripts/network-bridge 파일을 /etc/xen/scripts/network-bridge.xen에 복사합니다.
  3. Comment out any existing network scripts in /etc/xen/xend-config.sxp and add the line (network-xen-multi-bridge). A typical xend-config.sxp file should have the following line. Comment this line out. Use the # symbol to comment out lines.
    network-script network-bridge
    
    Below is the commented out line and the new line, containing the network-xen-multi-bridge parameter to enable multiple network bridges.
    #network-script network-bridge
    network-script network-xen-multi-bridge
  4. Create a script to create multiple network bridges. This example creates a script called network-xen-multi-bridge.sh in the /etc/xen/scripts/ directory. A sample scripts is below, this example script will create two Xen network bridges (xenbr0 and xenbr1) one will be attached to eth1 and the other one to eth0. If you want to create additional bridges just follow the example in the script and copy nad paste the lines as required:
    #!/bin/sh
    # network-xen-multi-bridge
    # Exit if anything goes wrong.
    set -e
    # First arg is the operation.
    OP=$1
    shift
    script=/etc/xen/scripts/network-bridge.xen
    case ${OP} in
    start)
    	$script start vifnum=1 bridge=xenbr1 netdev=eth1
    	$script start vifnum=0 bridge=xenbr0 netdev=eth0
    	;;
    stop)
    	$script stop vifnum=1 bridge=xenbr1 netdev=eth1
    	$script stop vifnum=0 bridge=xenbr0 netdev=eth0
    	;;
    status)
    	$script status vifnum=1 bridge=xenbr1 netdev=eth1
    	$script status vifnum=0 bridge=xenbr0 netdev=eth0
    	;;
    *)
    	echo 'Unknown command: ' ${OP}
    	echo 'Valid commands are: start, stop, status'
    	exit 1
    esac
    
  5. Make the script executable.
    # chmod +x /etc/xen/scripts/network-xen-multi-bridge.sh
  6. Restart networking or restart the system to activate the bridges.
    # service network restart
Multiple bridges should now be configured for guests on the Xen hypervisor.

11.2. Red Hat Enterprise Linux 5.0 랩톱 네트워크 설정

Red Hat Enterprise Linux 5.1 이상 버전의 경우

다음 부분에서는 수동으로 네트워크 브리지를 추가하는 방법에 대해 설명합니다. 이러한 절차는 Red Hat Enterprise Linux 5.0 이상 버전의 경우 필요하거나 권장되지 않습니다. 새 버전의 경우 virt-manager에 게스트를 생성할 때 "Virtual Network" 어댑터를 사용합니다. NetworkManager는 Red Hat Enterprise Linux 5.1 이상 버전에서 기본값으로 가상 네트워크 장치와 함께 작동합니다.
가상 네트워크 장치에 대한 virsh XML 설정 파일의 예:
<interface type='network'>
	<mac address='AA:AA:AA:AA:AA:AA'/>
	<source network='default'/>
	<target dev='vnet0'/>
	<model type='virtio'/>
</interface>
xm 설정 파일에서 가상 네트워크 장치는 "vif"로 레이블됩니다.
The challenge in running the Xen hypervisor on a laptop is that most laptops will connected to the network via wireless network or wired connections. Often these connections are switched multiple times a day. In such an environment, the system assumes it has access to the same interface all the time and it also can perform ifup or ifdown calls to the network interface it is using. In addition wireless network cards do not work well in a virtualization environment due to Xen's (default) bridged network usage.
이러한 설정으로 랩톱에 네트워크 설정이 활성화되어 있지 않을 경우 오프라인 모드에서 Xen을 실행할 수 있게 됩니다. 랩톱에서 Xen을 가장 쉽게 실행하려면 아래의 절차를 따르시기 바랍니다:
  • You will be configuring a 'dummy' network interface which will be used by Xen. In this example the interface is called dummy0. This will also allow you to use a hidden IP address space for your guests.
  • DHCP는 DHCP 요청에 대한 더미 인터페이스를 청취하지 않으므로 고정 IP 주소를 사용해야 합니다. 더미 인터페이스를 청취하기 위해 DHCP 버전을 컴파일할 수 있지만, Xen 환경에서 DNS, DHCP, tftpboot 서비스에 대한 dnsmasq를 사용하여 검색하고자 할 수 도 있습니다. 설정에 관한 자세한 내용은 다음 부분에서 설명합니다.
  • NAT/IP 마스커레이딩을 설정하여 게스트에서 네트워크로의 액세를 활성화할 수 있습니다.
더미 네트워크 인터페이스 설정
호스트에서 다음과 같은 설정 단계를 실행합니다:
  1. dummy0 네트워크 인터페이스를 설정하고 고정 IP 주소를 할당합니다. 예에서는 라우팅 문제가 일어나지 않게 하기 위해 10.1.1.1을 선택하였습니다. 더미 장치 지원을 활성화하려면 /etc/modprobe.conf에 다음과 같은 행을 추가합니다
    alias dummy0 dummy
    options dummy numdummies=1
    
  2. dummy0에 대한 네트워크를 설정하려면 /etc/sysconfig/network-scripts/ifcfg-dummy0을 편집/생성합니다:
    DEVICE=dummy0
    BOOTPROTO=none
    ONBOOT=yes
    USERCTL=no
    IPV6INIT=no
    PEERDNS=yes
    TYPE=Ethernet
    NETMASK=255.255.255.0
    IPADDR=10.1.1.1
    ARP=yes
    
  3. xenbr0dummy0로 바인드하여 실제 네트워크에 연결되지 않을 경우에도 네트워킹을 사용할 수 있게 합니다. netdev=dummy0 항목을 포함시키기 위해 /etc/xen/xend-config.sxp를 편집합니다:
    (network-script 'network-bridge bridge=xenbr0 netdev=dummy0')
    
  4. Open /etc/sysconfig/network in the guest and modify the default gateway to point to dummy0. If you are using a static IP, set the guest's IP address to exist on the same subnet as dummy0.
    NETWORKING=yes
    HOSTNAME=localhost.localdomain
    GATEWAY=10.1.1.1
    IPADDR=10.1.1.10
    NETMASK=255.255.255.0
    
  5. 호스트에 있는 NAT 설정으로 Xen 및 무선 카드 문제를 해결하여 게스트가 무선 인터넷을 포함하여 인터넷에 액세스하게 합니다. 아래의 스크립트는 현재 네트워크 연결에 사용되고 있는 인터페이스에 기반한 NAT를 활성화하게 됩니다.
가상 게스트 용 NAT 설정
NAT (Network address translation)는 패킷을 차단하고 이를 사설 IP 주소에 전달하여 다수의 네트워크 주소가 단일 IP 주소를 통해 연결하게 합니다. 다음의 스크립트를 /etc/init.d/xenLaptopNAT에 복사하고 /etc/rc3.d/S99xenLaptopNAT에 소프트 링크를 생성할 수 있습니다. 이는 부팅시 NAT를 자동으로 시작합니다.

NetworkManager 및 무선 NAT

아래의 스크립트는 시작 지연으로 인해 무선 네트워크나 또는 NetworkManager로 잘 작동하지 않을 수 도 있습니다. 이러한 경우 컴퓨터가 부팅되면 수동으로 스크립트를 실행합니다.
#!/bin/bash
PATH=/usr/bin:/sbin:/bin:/usr/sbin
export PATH
GATEWAYDEV=`ip route | grep default | awk {'print $5'}`
iptables -F
case "$1" in
start)
	if test -z "$GATEWAYDEV"; then
	echo "No gateway device found"
    else
	echo  "Masquerading using $GATEWAYDEV"
	/sbin/iptables -t nat -A POSTROUTING -o $GATEWAYDEV -j MASQUERADE
fi
	echo "Enabling IP forwarding"
	echo 1 > /proc/sys/net/ipv4/ip_forward
	echo "IP forwarding set to `cat /proc/sys/net/ipv4/ip_forward`"
	echo "done."
	;;
*)
echo "Usage: $0 {start|restart|status}"
;;
esac
DNS, DHCP, tftpboot 서비스에 대한 dnsmasq 설정
랩톱 (또는 단일 또는 안정적인 네트워크에 의해 연결되지 않은 기타 다른 컴퓨터)에서 가상화를 실행함에 있어서 하나의 문제는 네트워크 인터페이스 및 가용성 변경입니다. 더미 네트워크 인터페이스를 사용하면 보다 안정적인 환경을 구축하는데 도움이 될 수 있지만, 가상 장치/게스트에 DHCP, DNS, tftpboot 서비스를 제공하는데 있어서 새로운 문제를 불러일으킬 수 있습니다. Red Hat Enterprise Linux 및 Fedora Core에서 제공하는 기본 DHCP 데몬은 더미 인터페이스를 청취하지 않으며, DNS 포워딩 정보는 다른 네트워크 및 VPN에 연결할 경우 변경될 수 도 있습니다.
위의 문제에 대한 해결 방법 중 하나는 단일 패키지에서 위의 모든 서비스를 제공할 수 있는 dnsmasq를 사용하여 더미 인터페이스에서의 요청에만 사용 가능하도록 서비스를 제어할 수 있게 하는 것입니다. 아래에서는 가상화를 실행하고 있는 랩톱에서 dnsmasq를 설정하는 방법에 대해 간략하게 설명합니다:
  • 여기에 최신 dnsmasq 버전이 있습니다.
  • Documentation for dnsmasq can be found here.
  • Copy the other files referenced below from http://et.redhat.com/~jmh/tools/xen/ and grab the file dnsmasq.tgz. The tar archive includes the following files:
    • nm-dnsmasq 파일은 NetworkManager에 대해 디스패처(dispatcher) 스크립트로 사용될 수 있습니다. 이는 NetworkManager가 연결 변경을 감지할 때 마다 실행되어 dnsmasq의 재시작/다시 불러오기를 강제하게 됩니다. 이는 /etc/NetworkManager/dispatcher.d/nm-dnsmasq에 복사해 두어야 합니다
    • xenDNSmasq/etc/init.d/xenDNSmasq에 대한 주요 시작 또는 종료 스크립트로 사용될 수 있습니다
    • dnsmasq.conf/etc/dnsmasq.conf에 대한 예시 설정 파일입니다
    • dnsmasq/usr/local/sbin/dnsmasq에 대한 바이너리 이미지입니다
  • dnsmasq를 풀어 작성한 후 (기본 설치에서는 /usr/local/sbin/dnsmasq로 바이너리됨) dnsmasq 설정 파일을 편집해야 합니다. 파일은 /etc/dnsmaqs.conf에 위치해 있습니다
  • 필요 및 요건에 따라 설정을 수정합니다. 수정하시고자 하는 파라미터에는 다음과 같은 것이 있습니다:
    • interface 파라미터는 특정 인터페이스에서만 dnsmasqDHCPDNS 요청을 청취하게 합니다. 이는 공개 인터페이스가 아닌 더미 인터페이스나 로컬 루프백 인터페이스가 될 수 있습니다. 하나 이상의 인터페이스에 대해 다른 interface 행을 추가합니다. interface=dummy0dummy0 인터페이스에서 청취하는 예입니다.
    • dhcp-range 통합된 DHCP 서버를 활성화하려면, 할당 시간에 대한 사용 가능한 주소 범위를 제공해야 합니다. 네트워크가 하나 이상있을 경우, DHCP 서비스를 제공하고자 하는 각각의 네트워크에 대해 이를 반복해야 합니다. 할당 시간이 12 시간인 네트워크 10.1.1.*의 경우의 예는 다음과 같습니다: dhcp-range=10.1.1.10,10.1.1.50,255.255.255.0,12h
    • dhcp-option dnsmasq에 의해 제공된 기본값 라우트를 덮어쓰기하기 위해 라우터는 dnsmasq가 실행되고 있는 장치와 동일한 장치에 있다고 가정합니다. 예: dhcp-option=3,10.1.1.1
  • dnsmasq를 설정한 후에 아래의 스크립트를 xenDNSmasq로서 /etc/init.d에 복사할 수 있습니다
  • 시스템 부팅 시 자동으로 dnsmasq를 시작하고자 할 경우 chkconfig(8)을 사용하여 이를 등록해야 합니다:
    chkconfig --add xenDNSmasq
    
    자동으로 시작하기 위해 이를 활성화합니다:
    chkconfig --levels 345 xenDNSmasq on
    
  • NetworkManager가 연결 변경을 감지할 때 마다 재시작하기 위해 dnsmasq를 설정하려면 nm-dnsmasq 스크립트를 사용할 수 있습니다.
    • nm-dnsmasq 스크립트를 /etc/NetworkManager/dispatcher.d/에 복사해 둡니다
    • NetworkManager 디스패처는 접속 변경이 있을 때 마다 스크립트를 실행하게 됩니다 (동일한 디렉토리에 다른 스크립트가 있을 경우 알파벳 순으로 실행함)
  • dnsmasq/etc/resolv.conf에서의 변경 사항을 감지하여 자동으로 이를 다시 불러오기 합니다. (예: VPN 세션을 시작할 경우)
  • 숨겨진 네트워크에 있는 가상 게스트가 공개 네트워크로 액세스할 수 있게 하려면 nm-dnsmasqxenDNSmasq 스크립트에 NAT를 설정해야 합니다.

12장. Xen 반가상화 드라이버

Para-virtualized drivers provide increased performance for fully virtualized Red Hat Enterprise Linux guests. Use these drivers if you are using fully virtualized Red Hat Enterprise Linux guests and require better performance.

기타 다른 반가상화 드라이버

Xen 및 KVM 하이퍼바이저 용 윈도우에 해당하는 기타 다른 반가상화 드라이버가 있습니다.
Xen 호스트 상의 윈도우 게스트의 경우, 설치 및 관리 방법을 설명하고 있는윈도우 반가상화 드라이버 가이드를 참조하십시오.
For Windows guests on KVM hosts, refer to 13장. KVM 반가상화 드라이버 .
반가상화 드라이버 용 RPM 패키지에는 Red Hat Enterprise 게스트 지원 운영 체제에 대한 반가상화 드라이버 네트워킹 및 저장 장치 용 모듈이 들어 있습니다. 이러한 드라이버는 Red Hat Enterprise Linux 5.1 (또는 그 이후 버전) 호스트 상단에 있는 수정되지 않은 Red Hat Enterprise Linux 게스트 운영 체제에서 I/O 실행을 고성능으로 처리합니다.
지원되는 게스트 운영 체제는 다음과 같습니다:
  • Red Hat Enterprise Linux 3
  • Red Hat Enterprise Linux 4
  • Red Hat Enterprise Linux 5

반가상화 드라이버 지원 아키텍처

게스트 운영 체제 최소 요구 사항은 아키텍처에 따라 다릅니다. x86 및 x86-64 게스트만이 지원됩니다.
Red Hat Enterprise Linux 3 이전의 Red Hat Enterprise Linux 게스트 운영 체제에서는 드라이버가 지원되지 않습니다.
가상화 플랫폼으로 Red Hat Enterprise Linux 5를 사용하면 시스템 관리자는 Linux 및 Windows 작업량을 전원 및 냉각 장치 효율성이 향상된 보다 새롭고 강력한 하드웨어로 통합시킬 수 있습니다. Red Hat Enterprise Linux 4 (업데이트 버전 6) 및 Red Hat Enterprise Linux 5 게스트 운영 체제에서는 기본적인 가상화 기술을 인식하고 있으며 특정 인터페이스 및 기능을 사용하여 효과적으로 상호작용할 수 있습니다. 이러한 접근으로 베어 메탈 시스템에서 실행과 비교할 때 유사한 처리량 및 성능 특성을 발휘할 수 있습니다.
As para-virtualization requires a modified guest operating system, not all operating systems can use para-virtualization. For operating systems which can not be modified, full virtualization is required. Full virtualization, by default, uses emulated disk, network, video and other hardware devices. Emulated I/O devices can be very slow and are not suited for applications requiring high disk and/or network throughput. The majority of the performance loss with virtualization occurs through the use of emulated devices.
반가상화 장치 드라이버는 Red Hat Enterprise Linux 패키지에 들어 있습니다. 반가상화 장치 드라이버 (운영 체제의 나머지 부분이 아닌) 만이 기본 가상화 플랫폼을 인식하기 때문에 이러한 드라이버는 수정되지 않은 운영 체제에 반가상화 게스트 운영 체제의 여러 성능 장점을 가져옵니다.
반가상화 장치 드라이버를 설치한 후, 디스크 장치 또는 네트워크 카드는 운영 체제에서 정상적인 물리적 디스크 또는 네트워크 카드로 나타나게 됩니다. 하지만, 새 장치 드라이버는 가상화 플랫폼과 (에뮬레이션 없이) 직접 상호작용하여 효과적으로 디스크 및 네트워크 액세스를 전달하며, 디스크 및 네트워크 하부 시스템이 기존 게스트 운영 체제를 변경하지 않고 가상화 환경에서도 본래의 속도로 작동하게 합니다.
반가상화 드라이버에는 특정 호스트 요구 사항이 있습니다. 64 비트 호스트는 다음을 실행할 수 있습니다:
  • 32 비트 게스트
  • 64 비트 게스트
  • 32 비트 및 64 비트 게스트 혼합

12.1. 시스템 요구 사항

다음 부분에서는 Red Hat Enterprise Linux를 사용하는 반가상화 드라이버에 대한 요구 사항을 설명합니다.
설치
반가상화 드라이버를 설치하기 전 다음과 같은 요구 사항 (이하 목록)에 부합되어야 합니다.

Red Hat Enterprise Linux 4.7 및 5.3 이상

모든 Red Hat Enterprise Linux 4.7 및 5.3 버전에는 반가상화 드라이버 용 커널 모듈, pv-on-hvm 모듈이 기본값 커널 패키지로 들어 있습니다. 이는 반가상화 드라이버가 Red Hat Enterprise Linux 4.7 이상 또는 5.3 및 그 이상 버전 게스트에 대해 사용 가능함을 의미합니다.
각각의 게스트 운영 체제 설치를 위해 다음과 같은 반가상화 드라이버 용 RPM 패키지가 필요합니다.
Minimum host operating system version:
  • Red Hat Enterprise Linux 5.1 or newer.
Minimum guest operating system version:
  • Red Hat Enterprise Linux 5.1 or newer.
  • Red Hat Enterprise Linux 4 Update 6 or newer.
  • Red Hat Enterprise Linux 3 Update 9 or newer.
Red Hat Enterprise Linux 5 requires:
  • kmod-xenpv.
Red Hat Enterprise Linux 4 requires:
  • kmod-xenpv,
  • modules-init-tools (for versions prior to Red Hat Enterprise Linux 4.6z you require modules-init-tools-3.1-0.pre5.3.4.el4_6.1 or greater), and
  • modversions.
Red Hat Enterprise Linux 3 requires:
  • kmod-xenpv.
You require at least 50MB of free disk space in the /lib file system.

12.2. 반가상화 제한 및 지원 사항

다음 부분에서는 Red Hat Enterprise Linux에서 반가상화 드라이버를 사용하기 위해 요구 사항 및 지원 제한 사항에 대해 설명합니다. 다음 부분에서는 지원되는 부분과 이에 따른 제한 사항을 다루고 있습니다.
지원되는 게스트 운영 체제
반가상화 드라이버 지원은 다음의 운영 체제 및 버전에 대해 사용 가능합니다:
  • Red Hat Enterprise Linux 5.1 이상
  • Red Hat Enterprise Linux 4 업데이트 6 이상
  • Red Hat Enterprise Linux 3 업데이트 9 이상
64 비트 Red Hat Enterprise Linux 5 Virtualization에 있는 반가상화 드라이버와 함께 32 비트 게스트 운영 체제 실행을 지원합니다.
아래 표에서는 반가상화 드라이버로 지원되는 커널 변형을 보여주고 있습니다. 아래에 있는 명령을 사용하여 현재 호스트에 설치된 정확한 커널 버전을 확인할 수 있습니다. 출력 결과를 표와 비교하여 지원되는 커널인지를 확인합니다.
# rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' kernel
Red Hat Enterprise Linux 5 i686 및 x86_64 커널 변형에는 SMP (Symmetric Multiprocessing)가 포함되어 있으며 분리된 SMP 커널 RPM이 필요하지 않습니다.
아래 표에서 Red Hat Enterprise Linux 3 게스트에 대해 프로세서 의존 커널 요구사항에 유의합니다.
표 12.1. 반가상화 드라이버에 대해 지원되는 게스트 커널 구조
커널 구조 Red Hat Enterprise Linux 3 Red Hat Enterprise Linux 4 Red Hat Enterprise Linux 5
athlon 지원됨 (AMD)   
athlon-SMP 지원됨 (AMD)   
i32e 지원됨 (Intel)   
i686 지원됨 (Intel) 지원됨 지원됨
i686-PAE 지원됨
i686-SMP 지원됨 (Intel) 지원됨  
i686-HUGEMEM 지원됨 (Intel) 지원됨  
x86_64 지원됨 (AMD) 지원됨 지원됨
x86_64-SMP 지원됨 (AMD) 지원됨  
x86_64-LARGESMP 지원됨  
Itanium (IA64) 지원됨

중요

호스트 시스템은 Red Hat Enterprise Linux 5.1 이상의 버전을 필요로 합니다.

사용하고 있는 커널을 검색 중

아래의 명령 출력 결과를 기록하거나 기억해 둡니다. 이는 어떤 패키지와 모듈을 다운로드해야 할 지를 결정하게 하는 값이 됩니다.
# rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' kernel
출력 결과는 다음과 유사하게 나타나야 합니다:
kernel-PAE-2.6.18-53.1.4.el5.i686
커널 이름은 PAE(Physical Address Extension)이며, 커널 버전은 2.6.18이고, 53.1.4.el5 릴리즈, i686 구조입니다. 커널 rpm은 kernel-name-version-release.arch.rpm 형식이어야 합니다.
중요 제한 사항
게스트 운영 체제를 성공적으로 설치한 후 반가상화 장치 드라이버를 설치할 수 있습니다. 이러한 드라이버를 설치하기 전 호스트 및 게스트 기능이 필요합니다.

반가상화 블록 장치 및 GRUB

현재 GRUB은 반가상화 블록 장치를 액세스할 수 없습니다. 따라서, 게스트는 반가상화 블록 장치 드라이버를 사용하는 장치에서 부팅될 수 없습니다. 특히, MBR (Master Boot Record)이 들어있는 디스크나, 부트 로더 (GRUB)가 들어있는 디스크, 또는 커널 initrd 이미지가 들어있는 디스크에서 그러합니다. 즉, /boot 디렉토리 또는 파티션이 있는 디스크는 반가상화 블록 장치 드라이버를 사용할 수 없습니다.
Red Hat Enterprise Linux 3 커널 변형 구조 의존성
아래의 표에서 볼 수 있듯이 Red Hat Enterprise Linux 3 기반 게스트 운영 체제의 경우 프로세서 의존 커널 및 반가상화 드라이버 RPM을 사용해야 합니다. 해당하는 반가상화드라이버 패키지를 설치하지 못했을 경우 xen-pci-platform 모듈을 불러오지 못하게 됩니다.
아래 표에서는 게스트가 Intel 프로세서 용으로 컴파일되어 있을 경우 어떤 호스트 커널이 Red Hat Enterprise Linux 3 게스트 실행에 필요한 지를 보여주고 있습니다.
표 12.2. Intel 프로세서 용 Red Hat Enterprise Linux 3에서 반가상화 드라이버를 사용하는 게스트에 필요한 호스트 커널 구조
게스트 커널 유형 필요한 호스트 커널 유형
ia32e (UP 및 SMP) x86_64
i686 i686
i686-SMP i686
i686-HUGEMEM i686

아래 표에서는 게스트가 AMD 프로세서 용으로 컴파일되어 있을 경우 어떤 호스트 커널이 Red Hat Enterprise Linux 3 게스트 실행에 필요한 지를 보여주고 있습니다.
표 12.3. AMD 프로세서 용 Red Hat Enterprise Linux 3에서 반가상화 드라이버를 사용하는 게스트에 필요한 호스트 커널 구조
게스트 커널 유형 필요한 호스트 커널 유형
athlon i686
athlon-SMP i686
x86_64 x86_64
x86_64-SMP x86_64

12.3. 반가상화 드라이버 설치

다음 부분에서는 Red Hat Enterprise Linux 5.1이나 그 이후 버전에서 실행하기 위해 반가상화 드라이버를 사용한 완전 가상화 게스트 설치 및 설정 방법에 대해 설명합니다.

실행 전 아키텍처가 지원되는지 확인

반가상화 드라이버는 특정 하드웨어 및 버전 통합에서만 지원됩니다. 반가상화 드라이버를 설치하기 위해 실행 전 하드웨어 및 운영 체제 요구 사항에 부합하는지를 확인합니다.

새로 설치하는 반가상화 드라이버의 이점 최대화

새 게스트 시스템을 설치할 경우, 반가상화 블록 장치 드라이버에서 최대 효과를 얻기 위해 최소 두 개의 디스크로 게스틀 생성하셔야 합니다.
MBR 및 부트로더 (GRUB)가 들어있는 디스크 및 /boot 파티션에 대해 반가상화 드라이버를 사용합니다. 이러한 파티션은 /boot 파티션 만을 생성할 수 있을 정도로 작은 용량일 수 있습니다.
기타 다른 파티션 (예: /, /usr) 또는 논리 볼륨 용으로 두 번째 디스크 및 추가 디스크를 사용합니다.
이러한 설치 방법을 사용하면, 게스트 설치 완료 후 나중에 반가상화 블록 장치 드라이버를 설치할 때, 게스트만을 부팅하고 /boot 파티션에 액세스하기 위해 가상화 블록 장치 드라이버를 사용하게 됩니다.

12.3.1. 일반적인 설치 단계

아래의 목록에서는 모든 게스트 운영 체제 버전에 걸친 높은 수준의 설치 단계에 대해 다루고 있습니다.
  1. Copy the RPMs for your hardware architecture to a suitable location in your guest operating system. Your home directory is sufficient. If you do not know which RPM you require verify against the table at 12.2절. “반가상화 제한 및 지원 사항 ”.
  2. rpm 명령이나 yum 명령을 사용하여 패키지를 설치합니다. rpm 유틸리티는 다음과 같은 새로운 네 개의 커널 모듈을 /lib/modules/[%kversion][%kvariant]/extra/xenpv/%release에 설치하게 됩니다:
    • the PCI infrastructure module, xen_platform_pci.ko,
    • the ballooning module, xen_balloon.ko,
    • the virtual block device module, xen_vbd.ko,
    • and the virtual network device module, xen_vnif.ko.
  3. 게스트 운영 체제가 자동으로 반가상화 드라이버를 읽어오지 못할 경우 (예: Red Hat Enterprise Linux 3) 드라이버를 특정한 위치에 있는 운영 체제로 복사하기 위해 사후 설치를 실행합니다.
  4. 게스트 운영 체제를 종료합니다.
  5. Reconfigure the guest operating system's configuration file on the host to use the installed para-virtualized drivers.
  6. 네트워크 장치 용 “type=ioemu” 항목을 삭제합니다.
  7. Add any additional disk partitions, volumes or LUNs to the guest so that they can be accessed via the para-virtualized (xen-vbd) disk driver.
  8. For each physical device, LUN, partition or volume you want to use the para-virtualized drivers you must edit the disk entry for that device in the libvirt configuration file.
  9. A typical disk entry resembles the following:
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/dev/hda6'/>
      <target dev='hda'/>
    </disk>
    
    Modify each disk entry, as desired, to use the para-virtualized by changing the driver elements as shown below.
    <disk type='file' device='disk'>
      <driver name='tap' type='aio'/>
      <source file='/dev/hda6'/>
      <target dev='xvda'/>
    </disk>
    
  10. 반가상화 블록 장치 드라이버 용으로 사용하고자 하는 저장 장치 항목을 추가합니다.
  11. 게스트를 다시 시작합니다:
    # xm start YourGuestName
    Where YourGuestName is the name of the configuration file or the guest operating system's name as defined in its configuration file in the name = "os_name" parameter.
  12. Reconfigure the guest network.

12.3.2. Red Hat Enterprise Linux 3에서 반가상화 드라이버 설치 및 설정

다음 부분에서는 Red Hat Enterprise 3 게스트 운영 체제에서 반가상화 드라이버에 대한 지시사항을 자세하게 설명합니다.

주의

이러한 패키지는 반가상화 디스크에서의 부팅을 지원하지 않습니다. 게스트 운영 체제 커널 부팅에는 IDE 드라이버를 사용해야 하는 반면 다른 (비시스템) 사용자 공간 어플리케이션 및 데이터는 반가상화 블록 장치 드라이버를 사용할 수 있습니다.
드라이버 설치
아래의 목록에서는 반가상화 드라이버를 사용한 Red Hat Enterprise Linux 3 게스트 설치 절차에 대해 설명합니다.
  1. Install the latest kernel version. The para-virtualized drivers require at least Red Hat Enterprise Linux 3.9 kernel version kernel-2.4.21-60.EL for all the required headers.
  2. 하드웨어 구조 및 커널 변형에 따라 kmod-xenpv rpm을 게스트 운영 체제에 복사합니다.
  3. rpm 유틸리티를 사용하여 RPM 패키지를 설치합니다. 게스트 운영 체제 변형 및 구조에 따라 어떤 패키지가 필요한 지를 확인합니다.
    [root@rhel3]# rpm -ivh kmod-xenpv*
    
  4. Use the commands below load the para-virtualized driver modules. %kvariant is the kernel variant the para-virtualized drivers have been build against and %release corresponds to the release version of the para-virtualized drivers.
    [root@rhel3]# mkdir -p /lib/modules/'uname -r'/extra/xenpv
    [root@rhel3]# cp -R /lib/modules/2.4.21-52.EL[%kvariant]/extra/xenpv/%release \
    /lib/modules/'uname -r'/extra/xenpv
    [root@rhel3]# depmod -ae
    [root@rhel3]# modprobe xen-vbd
    [root@rhel3]# modprobe xen-vnif
    

    주의

    Red Hat Enterprise Linux 3에 MODVERSIONS가 활성화되어 있어 바이너리 드라이버 모듈을 설치할 때 insmod에 의해 경고 메세지가 생성됩니다. 이러한 경고 메세지는 무시하셔도 됩니다.
  5. /etc/modules.conf를 확인하여 아래와 같이 eth0에 대한 알리아스가 있는 지를 확인합니다. 다수의 인터페이스를 설정하고자 할 경우 각각의 인터페이스에 대해 추가 행을 더합니다.
    alias eth0 xen-vnif
    
    /etc/rc.local 파일을 편집하고 다음의 행을 추가합니다:
    insmod /lib/modules/'uname -r'/extra/xenpv/%release/xen-vbd.o
    

    주의

    “%release”를 반가상화 드라이버에 대한 실제 릴리즈 버전 (예: 0.1-5.el)으로 대체합니다. 반가상화 드라이버 RPM 패키지를 업데이트할 경우 릴리즈 버전을 해당 버전으로 업데이트하는 지를 확인하셔야 합니다.
  6. 가상 장치를 종료합니다 (게스트 내에서 “#shutdown -h now” 명령 사용).
  7. Edit the guest configuration file in /etc/xen/YourGuestName with a text editor, performing the following changes:
    • vif=” 항목에서 “type=ioemu” 항목을 삭제합니다.
    • 추가 디스크 파티션, 볼륨, LUN을 게스트에 추가하여 반가상화 (xen-vbd) 디스크 드라이버를 통해 액세스할 수 있게 합니다.
    • For each physical device, LUN, partition or volume you want to use the para-virtualized drivers you must edit the disk entry for that device in the libvirt configuration file.
    • A typical disk entry resembles the following:
      <disk type='file' device='disk'>
        <driver name='file'/>
        <source file='/dev/hda6'/>
        <target dev='hda'/>
      </disk>
      
      Modify each disk entry, as desired, to use the para-virtualized by changing the driver elements as shown below.
      <disk type='file' device='disk'>
        <driver name='tap' type='aio'/>
        <source file='/dev/hda6'/>
        <target dev='xvda'/>
      </disk>
      
      
    • Once complete, save the modified configuration file and restart the guest.
  8. Boot the virtual machine:
    # xm start YourGuestName
    Where YourGuestName is the name of the configuration file or the guest operating system's name as defined in its configuration file in the name = "os_name" parameter.

유의 사항

weak-modulesmodversions가 Red Hat Enterprise Linux 3에서 지원되지 않기 때문에 반가상화 드라이버를 시스템에 자동으로 추가하거나 읽어올 수 없습니다. 모듈을 넣으려면 아래의 명령을 실행합니다.
insmod xen_vbd.ko
Red Hat Enterprise Linux 3에서는 xen-vbd를 사용하는 블록 장치에 대한 특정 파일을 수동으로 생성해야 합니다. 다음에서는 반가상화 블록 장치를 생성하고 등록하는 방법에 대해 설명합니다.
반가상화 블록 장치 드라이버를 읽어온 후 다음의 스크립트를 사용하여 특정 파일을 생성합니다.
#!/bin/sh
module="xvd"
mode="664"
major=`awk "\\$2==\"$module\" {print \\$1}" /proc/devices`
# < mknod for as many or few partitions on xvd disk attached to FV guest >
# change/add xvda to xvdb, xvbd, etc. for 2nd, 3rd, etc., disk added in
# in xen config file, respectively.
mknod /dev/xvdb b $major 16
mknod /dev/xvdb1 b $major 17
mknod /dev/xvdb2 b $major 18
chgrp disk /dev/xvd*
chmod 0660 /dev/xvd*
각각의 추가 가상 디스크의 경우, 부번호 (minor number)가 16까지 증가됩니다. 아래의 예에서는 추가 장치에 대해 부번호 16이 생성되어 있습니다.
# mknod /dev/xvdc b $major 16
# mknod /dev/xvdc1 b $major 17
이는 다음번 장치 32를 생성할 수 있으며, 이는 아래와 같이 실행하여 생성될 수 있습니다:
# mknod /dev/xvdd b $major 32
# mknod /dev/xvdd1 b $major 33
이제 생성한 파티션이 사용 가능한 지를 확인합니다.
[root@rhel3]# cat /proc/partitions
major   minor     #blocks   name

  3        0      10485760  hda
  3        1        104391  hda1
  3        2      10377990  hda2
202        16         64000  xvdb
202        17         32000  xvdb1
202        18        32000  xvdb2
253        0       8257536  dm-0
253        1       2031616  dm-1
위의 출력 결과에서, 파티션된 “xvdb” 장치를 시스템에서 사용할 수 있음을 알 수 있습니다.
아래의 절차에서는 게스트에 새 장치를 추가하고 재부팅 후 이를 영구적으로 되게 합니다. 이러한 명령 모두는 게스트 상에서 실행됩니다.
  1. 블럭 장치 이미지를 마운트하기 위해 디렉토리를 생성합니다.
    [root@rhel3]# mkdir /mnt/pvdisk_p1
    [root@rhel3]# mkdir /mnt/pvdisk_p2
    
  2. 새 폴더에 장치를 마운트합니다.
    [root@rhel3]# mount /dev/xvdb1 /mnt/pvdisk_p1
    [root@rhel3]# mount /dev/xvdb2 /mnt/pvdisk_p2
    
  3. 장치가 올바르게 마운트되었는지를 확인합니다.
    [root@rhel3]# df /mnt/pvdisk_p1
    Filesystem           1K-blocks      Used   Available Use%  Mounted on
    /dev/xvdb1               32000        15       31985   1%  /mnt/pvdisk_p1
    
  4. 부팅 도중 장치를 마운트하기 위해 게스트 내부에 /etc/fstab 파일을 업데이트합니다. 다음 행을 추가합니다:
    /dev/xvdb1   /mnt/pvdisk_p1   ext3    defaults        1 2
    /dev/xvdb2   /mnt/pvdisk_p2   ext3    defaults        1 2
    

힌트

Using a Red Hat Enterprise Linux 5.1 host (dom0), the "noapic" parameter should be added to the kernel boot line in your virtual guest's /boot/grub/grub.conf entry as seen below. Keep in mind your architecture and kernel version may be different.
kernel /vmlinuz-2.6.9-67.EL ro root=/dev/VolGroup00/rhel4_x86_64 rhgb noapic
Red Hat Enterprise Linux 5.2 dom0에서는 게스트 용 커널 파라미터가 필요하지 않습니다.

중요

현재 Itanium (ia64) 바이너리 RPM 패키지 및 빌드는 사용 가능하지 않습니다.

12.3.3. Red Hat Enterprise Linux 4에서 반가상화 드라이버 설치 및 설정

다음 부분에서는 Red Hat Enterprise 4 게스트 운영 체제에서 반가상화 드라이버에 대한 지시사항을 자세하게 설명합니다.

주의

이러한 패키지는 반가상화 디스크에서의 부팅을 지원하지 않습니다. 게스트 운영 체제 커널 부팅에는 IDE 드라이버를 사용해야 하는 반면 다른 (비시스템) 사용자 공간 어플리케이션 및 데이터는 반가상화 블록 장치 드라이버를 사용할 수 있습니다.
드라이버 설치
아래의 목록에서는 반가상화 드라이버를 사용한 Red Hat Enterprise Linux 4 게스트 설치 절차에 대해 설명합니다.
  1. 하드웨어 구조 및 커널 변형에 따라 kmod-xenpv, modules-init-toolsmodversions RPM을 게스트 운영 체제에 복사합니다.
  2. rpm 유틸리티를 사용하여 RPM 패키지를 설치합니다. 게스트 운영 체제 변형 및 구조에 따라 어떤 패키지가 필요한 지를 확인하시기 바랍니다. 업데이트된 module-init-tools에는 이러한 패키지가 필요하며, 이는 Red Hat Enterprise Linux4-6-z 커널 이상에서 사용 가능합니다.
    [root@rhel4]# rpm -ivh modversions
    [root@rhel4]# rpm -Uvh module-init-tools
    [root@rhel4]# rpm -ivh kmod-xenpv*
    

    주의

    UP, SMP, Hugemem, 아키텍처에 따라 패키지가 다르므로 커널에 해당하는 올바른 RPM을 갖고 계신지 확인하시기 바랍니다.
  3. Execute cat /etc/modprobe.conf to verify you have an alias for eth0 like the one below. If you are planning to configure multiple interfaces add an additional line for each interface. If it does not look like the entry below change it.
    alias eth0 xen-vnif
    
  4. 가상 장치를 종료합니다 (게스트 내에서 “#shutdown -h now” 명령 사용).
  5. 다음과 같은 방법으로 /etc/xen/YourGuestsName에 있는 게스트 설정 파일을 편집합니다:
    • vif=” 항목에서 “type=ioemu” 항목을 삭제합니다.
    • 추가 디스크 파티션, 볼륨, LUN을 게스트에 추가하여 반가상화 (xen-vbd) 디스크 드라이버를 통해 액세스할 수 있게 합니다.
    • 각각의 추가 물리 장치, LUN, 파티션 또는 볼륨에 대해 게스트 설정 파일에 있는 “disk=” 부분에 아래와 유사한 항목을 추가합니다. 원래의 “disk=” 항목은 아래와 유사하게 나타납니다.
      disk = [ "file:/var/lib/libvirt/images/rhel4_64_fv.dsk,hda,w"]
      
    • 물리 장치, LUN, 파티션, 볼륨을 추가하면; XML 설정 파일에 있는 반가상화 드라이버 항목은 아래와 유사하게 나타납니다.
      disk = [ "file:/var/lib/libvirt/images/rhel3_64_fv.dsk,hda,w",
      "tap:aio:/var/lib/libvirt/images/UserStorage.dsk,xvda,w" ]
      

      주의

      파일 기반 이미지를 사용할 경우 반가상화 장치에 대해 “tap:aio” 명령을 사용합니다.
  6. virsh 명령을 사용하여 가상 장치를 부팅합니다:
    # virsh start YourGuestName
가상 게스트의 첫번째 재부팅에서 kudzu는 "Realtek 네트워크 장치 사용 또는 삭제" 및 "xen-bridge 장치 설정"을 요청하게 됩니다.

힌트

Using a Red Hat Enterprise Linux 5.1 host (dom0), the "noapic" parameter should be added to the kernel boot line in your virtual guest's /boot/grub/grub.conf entry as seen below. Keep in mind your architecture and kernel version may be different.
kernel /vmlinuz-2.6.9-67.EL ro root=/dev/VolGroup00/rhel4_x86_64 rhgb noapic
Red Hat Enterprise Linux 5.2 dom0에서는 게스트 용 커널 파라미터가 필요하지 않습니다.
이제 생성한 파티션이 사용 가능한 지를 확인합니다.
[root@rhel4]# cat /proc/partitions
major    minor   #blocks   name

   3        0    10485760  hda
   3        1      104391  hda1
   3        2    10377990  hda2
 202        0       64000  xvdb
 202        1       32000  xvdb1
 202        2       32000  xvdb2
 253        0     8257536  dm-0
 253        1     2031616  dm-1
위의 출력 결과에서, 파티션된 “xvdb” 장치를 시스템에서 사용할 수 있음을 알 수 있습니다.
아래의 절차에서는 게스트에 새 장치를 추가하고 재부팅 후 이를 영구적으로 되게 합니다. 이러한 명령 모두는 게스트 상에서 실행됩니다.
  1. 블록 장치 이미지를 마운트하기 위해 디렉토리를 생성합니다.
    [root@rhel4]# mkdir /mnt/pvdisk_p1
    [root@rhel4]# mkdir /mnt/pvdisk_p2
    
  2. 새 폴더에 장치를 마운트합니다.
    [root@rhel4]# mount /dev/xvdb1 /mnt/pvdisk_p1
    [root@rhel4]# mount /dev/xvdb2 /mnt/pvdisk_p2
    
  3. 장치가 올바르게 마운트되었는지를 확인합니다.
    [root@rhel4]# df /mnt/pvdisk_p1
    Filesystem           1K-blocks      Used   Available Use%  Mounted on
    /dev/xvdb1               32000        15       31985   1%  /mnt/pvdisk_p1
    
  4. 부팅 도중 장치를 마운트하기 위해 게스트 내부에 /etc/fstab 파일을 업데이트합니다. 다음 행을 추가합니다:
    /dev/xvdb1   /mnt/pvdisk_p1   ext3    defaults        1 2
    /dev/xvdb2   /mnt/pvdisk_p2   ext3    defaults        1 2
    

주의

이 패키지는 Red Hat Enterprise Linux 4 업데이트 2 시스템 및 커널을 통한 Red Hat Enterprise Linux 4-GA를 지원하지 않습니다.

중요 사항

현재 IA64 바이너리 RPM 패키지 및 빌드는 사용 가능하지 않습니다.

자동으로 모듈 불러오기

xen-vbd 드라이버가 자동으로 불러지지 않을 경우, 게스트에서 다음과 같은 명령을 실행합니다. %release는 반가상화 드라이버의 올바른 릴리즈 버전으로 대체합니다.
# insmod /lib/modules/'uname -r'/weak-updates/xenpv/%release/xen_vbd.ko

12.3.4. Xen Para-virtualized Drivers on Red Hat Enterprise Linux 5

This section contains detailed instructions for the para-virtualized drivers in a Red Hat Enterprise Linux 5 guest operating system.

주의

이러한 패키지는 반가상화 디스크에서의 부팅을 지원하지 않습니다. 게스트 운영 체제 커널 부팅에는 IDE 드라이버를 사용해야 하는 반면 다른 (비시스템) 사용자 공간 어플리케이션 및 데이터는 반가상화 블록 장치 드라이버를 사용할 수 있습니다.
The procedure below covers the steps to enable the para-virtualized drivers for a Red Hat Enterprise Linux 5 guest.
절차 12.1. Enable para-virtualized drivers for a Red Hat Enterprise Linux Guest
  1. 가상 장치를 종료합니다 (게스트 내에서 “#shutdown -h now” 명령 사용).
  2. 다음과 같은 방법으로 /etc/xen/<Your GuestsName>에 있는 게스트 설정 파일을 편집합니다:
    1. vif=” 항목에서 “type=ioemu” 항목을 삭제합니다.
    2. 추가 디스크 파티션, 볼륨, LUN을 게스트에 추가하여 반가상화 (xen-vbd) 디스크 드라이버를 통해 액세스할 수 있게 합니다.
    3. 각각의 추가 물리 장치, LUN, 파티션 또는 볼륨에 대해 게스트 설정 파일에 있는 “disk=” 부분에 아래와 유사한 항목을 추가합니다. 원래의 “disk=” 항목은 아래와 유사하게 나타납니다.
      disk = [ "file:/var/lib/libvirt/images/rhel4_64_fv.dsk,hda,w"]
      
    4. 물리 장치, LUN, 파티션, 볼륨을 추가하면; XML 설정 파일에 있는 반가상화 드라이버 항목은 아래와 유사하게 나타납니다.
      disk = [ "file:/var/lib/libvirt/images/rhel3_64_fv.dsk,hda,w",
      "tap:aio:/var/lib/libvirt/images/UserStorage.dsk,xvda,w" ]
      

      주의

      파일 기반 이미지를 사용할 경우 반가상화 장치에 대해 “tap:aio” 명령을 사용합니다.
  3. virsh 명령을 사용하여 가상 장치를 부팅합니다:
    # virsh start YourGuestName
    
반가상화 드라이버를 설치한 후에 네트워크 인터페이스가 나타나는 지를 확인하려면 게스트에서 다음과 같은 명령을 실행합니다. 이는 할당된 IP 주소를 포함하여 인터페이스 정보를 보여줍니다.
[root@rhel5]# ifconfig eth0
이제 생성한 파티션이 사용 가능한 지를 확인합니다.
[root@rhel5]# cat /proc/partitions
major minor  #blocks    name
   3     0   10485760   hda
   3     1     104391   hda1
   3     2   10377990   hda2
 202     0      64000   xvdb
 202     1      32000   xvdb1
 202     2      32000   xvdb2
 253     0    8257536   dm-0
 253     1    2031616   dm-1
위의 출력 결과에서, 파티션된 “xvdb” 장치를 시스템에서 사용할 수 있음을 알 수 있습니다.
아래의 절차에서는 게스트에 새 장치를 추가하고 재부팅 후 이를 영구적으로 되게 합니다. 이러한 명령 모두는 게스트 상에서 실행됩니다.
  1. 블럭 장치 이미지를 마운트하기 위해 디렉토리를 생성합니다.
    [root@rhel5]# mkdir /mnt/pvdisk_p1
    [root@rhel5]# mkdir /mnt/pvdisk_p2
    
  2. 새 폴더에 장치를 마운트합니다.
    [root@rhel5]# mount /dev/xvdb1 /mnt/pvdisk_p1
    [root@rhel5]# mount /dev/xvdb2 /mnt/pvdisk_p2
    
  3. 장치가 올바르게 마운트되었는지를 확인합니다.
    [root@rhel5]# df /mnt/pvdisk_p1
    Filesystem           1K-blocks      Used   Available Use%  Mounted on
    /dev/xvdb1               32000        15       31985   1%  /mnt/pvdisk_p1
    
  4. 부팅 도중 장치를 마운트하기 위해 게스트 내부에 /etc/fstab 파일을 업데이트합니다. 다음 행을 추가합니다:
    /dev/xvdb1   /mnt/pvdisk_p1   ext3    defaults        1 2
    /dev/xvdb2   /mnt/pvdisk_p2   ext3    defaults        1 2
    

힌트

Using a Red Hat Enterprise Linux 5.1 host (dom0), the "noapic" parameter should be added to the kernel boot line in your virtual guest's /boot/grub/grub.conf entry as seen below. Keep in mind your architecture and kernel version may be different.
kernel /vmlinuz-2.6.9-67.EL ro root=/dev/VolGroup00/rhel4_x86_64 rhgb noapic
Red Hat Enterprise Linux 5.2 dom0에서는 게스트 용 커널 파라미터가 필요하지 않습니다.
Hiding fake interfaces
Sometimes, activating the para-virtualized drivers does not delete the old virtualized network interfaces. To remove these interfaces from guests use the following procedure.
  1. Add the following lines to the /etc/modprobe.d/blacklist file. Blacklist 8139cp and 8139too for the RealTek 8139 and e1000 for the virtualized Intel e1000 NIC.
    8139cp
    8139too
    e1000
    
  2. Remove the old network scripts from the /etc/sysconfig/network-scripts directory.
  3. Reboot the guest. The default network interface should now use the para-virtualized drivers.

12.3.5. Xen Para-virtualized Drivers on Red Hat Enterprise Linux 6

This section describes the use of para-virtualized drivers in a Red Hat Enterprise Linux 6 guest.
The para-virtualized drivers are enabled by default for a Red Hat Enterprise Linux 6 guest. The guest will automatically unplug any emulated devices that are presented to it, and will use the para-virtualized drivers instead.
Although the para-virtualized drivers are enabled by default, they can be disabled. Add the following to the guest kernel command line upon boot to disable the para-virtualized drivers:
xen_emul_unplug=never

12.4. 반가상화 네트워크 드라이버 설정

Once the para-virtualized network driver is loaded you may need to reconfigure the guest's network interface to reflect the driver and virtual Ethernet card change.
게스트 내의 네트워크 인터페이스를 재설정하려면 다음의 절차를 실행하시기 바랍니다.
  1. virt-manager에서 게스트 용 콘솔 화면을 열고 root로 로그인합니다.
  2. Red Hat Enterprise Linux 4에서 “alias eth0 xen-vnif” 행이 들어있는 /etc/modprobe.conf 파일을 확인합니다.
    # cat /etc/modprobe.conf
    alias eth0 xen-vnif
    
  3. To display the present settings for eth0 execute “# ifconfig eth0”. If you receive an error about the device not existing you should load the modules manually as outlined in 36.4절. “반가상화 드라이버를 수동으로 불러오기 ”.
    ifconfig eth0
    eth0      Link encap:Ethernet  HWaddr 00:00:00:6A:27:3A  
              BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:630150 errors:0 dropped:0 overruns:0 frame:0
              TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:109336431 (104.2 MiB)  TX bytes:846 (846.0 b)
    
  4. Start the network configuration utility(NetworkManager) with the command “# system-config-network”. Click on the “Forward” button to start the network card configuration.
  5. Select the 'Xen Virtual Ethernet Card (eth0)' entry and click 'Forward'.
    Configure the network settings as required.
  6. Complete the configuration by pressing the 'Apply' button.
  7. Press the 'Activate' button to apply the new settings and restart the network.
  8. 이제 IP 주소가 할당된 새로운 네트워크 인터페이스를 확인하실 수 있습니다.
    ifconfig eth0
    eth0      Link encap:Ethernet  HWaddr 00:16:3E:49:E4:E0
              inet addr:192.168.78.180  Bcast:192.168.79.255  Mask:255.255.252.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:630150 errors:0 dropped:0 overruns:0 frame:0
              TX packets:501209 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:109336431 (104.2 MiB)  TX bytes:46265452 (44.1 MiB)
    

12.5. 반가상화 하드웨어 추가 설정

다음 부분에서는 게스트 운영 체제에 가상 네트워크 또는 저장 장치를 추가하는 방법에 대해 설명합니다. Red Hat Enterprise Linux 5 Virtualization에 네트워크 및 저장 장치 리소스를 설정하는 방법에 대한 자세한 내용은 Emerging Technologies, Red Hat.com에 있는 문서 자료를 읽어보시기 바랍니다

12.5.1. 가상 네트워크 인터페이스

게스트 용 추가 네트워크 장치를 설정하기 위해 다음의 절차를 실행합니다.
/etc/xen/YourGuestName에 있는 게스트 설정 파일을 편집합니다. 여기서 YourGuestName은 게스트 이름으로 대체합니다.
기존 항목은 아래와 같이 나타나게 됩니다.
vif = [ "mac=00:16:3e:2e:c5:a9,bridge=xenbr0" ]
아래와 유사하게 설정 파일의 “vif=” 부분에 추가 항목을 더합니다.
vif = [ "mac=00:16:3e:2e:c5:a9,bridge=xenbr0",
    "mac=00:16:3e:2f:d5:a9,bridge=xenbr0" ]
새 인터페이스에 대해 고유한 MAC 주소를 생성했는지를 확인합니다. 아래의 명령을 사용하실 수 있습니다.
# echo 'import virtinst.util ; print virtinst.util.randomMAC()' | python
게스트를 재부팅한 후에 게스트 운영 체제에서 다음과 같은 절차를 실행합니다. Red Hat Enterprise Linux 3에서는 /etc/modules.conf에 Red Hat Enterprise Linux 4 및 Red Hat Enterprise Linux 5에서는 /etc/modprobe.conf에 업데이트가 추가되었는지를 확인합니다. 추가한 각각의 새 인터페이스에 대해 새 알리아스를 추가합니다.
alias eth1 xen-vnif
추가한 각각의 새 인터페이스를 게스트 안에서 사용할 수 있는 지를 확인하기 위해 테스트해 봅니다.
# ifconfig eth1
위의 명령으로 eth1의 등록 정보를 볼 수 있습니다. 제삼자 인터페이스를 추가하려면 eth2에 대한 명령을 반복합니다.
현재, Red Hat Enterprise Linux 4 및 Red Hat Enterprise Linux 5에서 system-config-network를 사용하거나 Red Hat Enterprise Linux3에서 redhat-config-network를 사용하여 새 네트워크 인터페이스를 설정합니다.

12.5.2. 가상 저장 장치

게스트 용 가상 저장 장치를 추가로 설정하려면 다음의 절차를 실행합니다.
/etc/xen/YourGuestName에서 YourGuestName을 게스트 이름으로 변경하여 게스트 설정 파일을 편집합니다. 원래 항목은 아래와 같이 나타납니다.
disk = [ "file:/var/lib/libvirt/images/rhel5_64_fv.dsk,hda,w"]
설정 파일에 새 물리 장치, LUN, 파티션, 볼륨에 대한 추가 항목을 “disk=” 파라미터에 추가합니다. 반가상화 드라이버를 사용하는 저장 장치 항목은 아래와 유사하게 나타납니다. “tap:aio” 파라미터는 반가상화 드라이버를 사용하기 위해 하이퍼바이저에 지시합니다.
disk = [ "file:/var/lib/libvirt/images/rhel5_64_fv.dsk,hda,w",
    "tap:aio:/var/lib/libvirt/images/UserStorage1.dsk,xvda,w" ]
항목을 더 추가하려면 목록에서 콤마로 구분 지어 이를 “disk=” 부분에 추가합니다.

주의

You need to increment the letter for the 'xvd' device, that is for your second storage entity it would be 'xvdb' instead of 'xvda'.
disk = [ "file:/var/lib/libvirt/images/rhel5_64_fv.dsk,hda,w",
    "tap:aio:/var/lib/libvirt/images/UserStorage1.dsk,xvda,w",
    "tap:aio:/var/lib/libvirt/images/UserStorage2.dsk,xvdb,w" ]
파티션이 생성되어 사용 가능한지를 확인합니다.
# cat /proc/partitions
major minor  #blocks    name
   3     0   10485760   hda
   3     1     104391   hda1
   3     2   10377990   hda2
 202     0      64000   xvda
 202     1      64000   xvdb
 253     0    8257536   dm-0
 253     1    2031616   dm-1
위의 출력 결과에서 파티션 또는 저장 장치 “xvdb”가 시스템에서 사용 가능함을 알 수 있습니다.
새 장치 및 디스크를 로컬 마운트 지점에 마운트하고 게스트 내에 /etc/fstab을 업데이트하여 부팅시 장치 및 파티션을 마운트하게 합니다.
# mkdir /mnt/pvdisk_xvda
# mkdir /mnt/pvdisk_xvdb
# mount /dev/xvda /mnt/pvdisk_xvda
# mount /dev/xvdb /mnt/pvdisk_xvdb
# df /mnt
Filesystem           1K-blocks      Used   Available Use%  Mounted on
/dev/xvda                64000        15       63985   1%  /mnt/pvdisk_xvda
/dev/xvdb                64000        15       63985   1%  /mnt/pvdisk_xvdb

13장. KVM 반가상화 드라이버

Para-virtualized drivers are available for virtualized Windows guests running on KVM hosts. These para-virtualized drivers are included in the virtio-win package. The virtio-win package supports block (storage) devices and network interface controllers.
As with the KVM module, the virtio-win drivers package is only available on hosts running Red Hat Enterprise Linux 5.4 and newer.
반가상화 드라이버는 완전 가상화 게스트의 성능을 향상시킵니다. 반가상화 드라이버로 게스트 I/O 지연을 감소시키고 처리량을 베어-메탈 수준으로 증가시킬 수 있습니다. 대량의 I/O 작업 및 어플리케이션을 실행하고 있는 완전 가상화 게스트의 경우 반가상화 드라이버를 사용할 것을 권장합니다.
The KVM para-virtualized drivers are automatically loaded and installed on the following versions of Red Hat Enterprise Linux:
  • Red Hat Enterprise Linux 4.8 and newer
  • Red Hat Enterprise Linux 5.3 and newer
  • Red Hat Enterprise Linux 6.
Those Red Hat Enterprise Linux versions detect and install the drivers so additional installation steps are not required.

주의

PCI devices are limited by the virtualized system architecture. Out of the 32 available PCI devices for a guest 4 are not removable. This means there are up to 28 PCI slots available for additional devices per guest. Each PCI device can have up to 8 functions; some PCI devices have multiple functions and only use one slot. Para-virtualized network, para-virtualized disk devices, or other PCI devices using VT-d all use slots or functions. The exact number of devices available is difficult to calculate due to the number of available devices. Each guest can use up to 32 PCI devices with each device having up to 8 functions.
다음의 Microsoft Windows 버전은 KVM 반가상화 드라이버를 지원합니다:
  • Windows XP (32-bit only)
  • Windows Server 2003 (32-bit and 64-bit versions)
  • Windows Server 2008 (32-bit and 64-bit versions)
  • Windows 7 (32-bit and 64-bit versions)

13.1. KVM Windows 반가상화 드라이버 설치

다음 부분에서는 KVM Windows 반가상화 드라이버 설치 절차에 대해 설명합니다. 게스트가 설치된 후 Windows 설치 시 또는 설치 된 후 KVM 반가상화 드라이버를 불러올 수 있습니다.
You can install the para-virtualized drivers on your guest by one of the following methods:
  • hosting the installation files on a network accessible to the guest,
  • using a virtualized CD-ROM device of the driver installation disk .iso file, or
  • using a virtualized floppy device to install the drivers during boot time (for Windows guests).
This guide describes installation from the para-virtualized installer disk as a virtualized CD-ROM device.
  1. 드라이버 다운로드

    The virtio-win package contains the para-virtualized block and network drivers for all supported Windows guests.
    If the Red Hat Enterprise Linux Supplementary channel entitlements are not enabled for the system, the download will not be available. Enable the Red Hat Enterprise Linux Supplementary channel to access the virtio-win package.
    Download the virtio-win package with the yum command.
    # yum install virtio-win
    
    The drivers are also available on the Red Hat Enterprise Linux Supplementary disc or from Microsoft (windowsservercatalog.com). Note that the Red Hat Enterprise Virtualization Hypervisor and Red Hat Enterprise Linux are created on the same code base so the drivers for the same version (for example, 5.5) are supported for both environments.
    virtio-win 패키지는 /usr/share/virtio-win/ 디렉토리에 CD-ROM 이미지, virtio-win.iso를 설치합니다.
  2. 반가상화 드라이버 설치

    반가상화 드라이버를 사용하기 위해 장치를 추가 또는 수정하기 전 게스트 상에 드라이버를 설치할 것을 권장합니다.
    root 파일 시스템이나 기타 다른 블록 장치를 저장하고 있는 블록 장치의 경우 게스트를 부팅해야 하며, 드라이버는 장치를 수정하기 전 설치되어야 합니다. 드라이버가 게스트 상에 설치되어 있지 않고 드라이버가 virtio 드라이버에 설정되어 있을 경우 게스트는 시작되지 않게 됩니다.
Installing drivers with a virtualized CD-ROM
This procedure covers installing the para-virtualized drivers with a virtualized CD-ROM after Windows is installed.
Follow 절차 13.1. “Windows 게스트에 대해 CD-ROM 이미지를 마운트하기 위해 virt-manager 사용 ” to add a CD-ROM image with virt-manager and then install the drivers.
절차 13.1. Windows 게스트에 대해 CD-ROM 이미지를 마운트하기 위해 virt-manager 사용
  1. Open virt-manager and the virtualized guest

    Open virt-manager, select your virtualized guest from the list by double clicking the guest name.
  2. Open the hardware tab

    Click the Add Hardware button in the Hardware tab.
  3. Select the device type

    This opens a wizard for adding the new device. Select Storage from the dropdown menu.
    Click the Forward button to proceed.
  4. Select the ISO file

    Choose the File (disk image) option and set the file location of the para-virtualized drivers .iso image file. The location file is named /usr/share/virtio-win/virtio-win.iso.
    드라이버가 물리적 CD-ROM에 저장될 경우 일반적인 디스크 파티션 옵션을 사용합니다.
    Set the Device type to IDE cdrom and click Forward to proceed.
  5. Disc assigned

    The disk has been assigned and is available for the guest once the guest is started. Click Finish to close the wizard or back if you made a mistake.
  6. Reboot

    Reboot or start the guest to add the new device. Virtualized IDE devices require a restart before they can be recognized by guests.
Once the CD-ROM with the drivers is attached and the guest has started, proceed with 절차 13.2. “Windows installation”.
절차 13.2. Windows installation
  1. Open My Computer

    On the Windows guest, open My Computer and select the CD-ROM drive.
  2. Select the correct installation files

    There are four files available on the disc. Select the drivers you require for your guest's architecture:
    • the para-virtualized block device driver (RHEV-Block.msi for 32-bit guests or RHEV-Block64.msi for 64-bit guests),
    • the para-virtualized network device driver (RHEV-Network.msi for 32-bit guests or RHEV-Block64.msi for 64-bit guests),
    • or both the block and network device drivers.
    Double click the installation files to install the drivers.
  3. Install the block device driver

    1. Start the block device driver installation

      Double click RHEV-Block.msi or RHEV-Block64.msi.
      Press Next to continue.
    2. Confirm the exception

      Windows may prompt for a security exception.
      Press Yes if it is correct.
    3. Finish

      Press Finish to complete the installation.
  4. Install the network device driver

    1. Start the network device driver installation

      Double click RHEV-Network.msi or RHEV-Network64.msi.
      Press Next to continue.
    2. Performance setting

      This screen configures advanced TCP settings for the network driver. TCP timestamps and TCP window scaling can be enabled or disabled. The default is, 1, for window scaling to be enabled.
      TCP window scaling is covered by IETF RFC 1323. The RFC defines a method of increasing the receive window size to a size greater than the default maximum of 65,535 bytes up to a new maximum of 1 gigabyte (1,073,741,824 bytes). TCP window scaling allows networks to transfer at closer to theoretical network bandwidth limits. Larger receive windows may not be supported by some networking hardware or operating systems.
      TCP timestamps are also defined by IETF RFC 1323. TCP timestamps are used to better calculate Return Travel Time estimates by embedding timing information is embedded in packets. TCP timestamps help the system to adapt to changing traffic levels and avoid congestion issues on busy networks.
      ValueAction
      0Disable TCP timestamps and window scaling.
      1Enable TCP window scaling.
      2Enable TCP timestamps.
      3Enable TCP timestamps and window scaling.
      Press Next to continue.
    3. Confirm the exception

      Windows may prompt for a security exception.
      Press Yes if it is correct.
    4. Finish

      Press Finish to complete the installation.
  5. Reboot

    Reboot the guest to complete the driver installation.
Change the device configuration to use the para-virtualized drivers (13.3절. “기존 장치에 대해 KVM 반가상화 드라이버 사용 ”) or install a new device which uses the para-virtualized drivers (13.4절. “새 장치에 대해 KVM 반가상화 드라이버 사용 ”).

13.2. Installing drivers with a virtualized floppy disk

다음 부분에서는 Windows 설치 시 반가상화 드라이버를 설치하는 방법에 대해 설명합니다.
  • run-once 메뉴를 사용하여 처음으로 Windows VM을 설치할 때 viostor.vfd를 플로피로 첨부합니다
    1. Windows Server 2003

      윈도우가 제 삼자 드라이버의 경우 F6를 누를 것을 요청할 경우, 이를 실행하고 화면 상에 나타나는 지시 사항을 따릅니다.
    2. Windows Server 2008

      설치 프로그램이 드라이버를 요청할 경우, 드라이버 불러오기를 클릭하고, 설치 프로그램을 드라이버 A로 지정한 후 게스트 운영 체제 및 아키텍처에 적합한 드라이버를 선택합니다.

13.3. 기존 장치에 대해 KVM 반가상화 드라이버 사용

Modify an existing hard disk device attached to the guest to use the virtio driver instead of virtualized IDE driver. This example edits libvirt configuration files. Alternatively, virt-manager, virsh attach-disk or virsh attach-interface can add a new device using the para-virtualized drivers 13.4절. “새 장치에 대해 KVM 반가상화 드라이버 사용 ”.
  1. 아래에는 가상 IDE 드라이버를 사용하는 파일 기반 블록 장치가 있습니다. 이는 전형적인 가상 게스트 용 항목으로 반가상화 드라이버를 사용하지 않습니다.
    <disk type='file' device='disk'>
       <source file='/var/lib/libvirt/images/disk1.img'/>
       <target dev='vda' bus='ide'/>
    </disk>
    
  2. bus= 항목을 virtio로 수정하여 반가상화 장치를 사용하도록 항목을 변경합니다.
    <disk type='file' device='disk'>
       <source file='/var/lib/libvirt/images/disk1.img'/>
       <target dev='vda' bus='virtio'/>
    </disk>
    

13.4. 새 장치에 대해 KVM 반가상화 드라이버 사용

다음 부분에서는 virt-manager로 KVM 반가상화 드라이버를 사용하여 새 장치를 생성하는 방법에 대해 설명합니다.
다른 방법으로 virsh attach-disk 또는 virsh attach-interface 명령으로 반가상화 드라이버를 사용하여 장치를 부착할 수 있습니다.

드라이버 설치

새 장치를 설치하기 위한 절차를 실행하기 전 드라이버가 Windows 게스트 상에 설치되었는지를 확인합니다. 드라이버를 사용할 수 없을 경우 장치는 인식되지 않아 작동할 수 없게 됩니다.
  1. virt-manager에 있는 게스트 이름을 더블 클릭하여 가상 게스트를 엽니다.
  2. 하드웨어 탭을 엽니다.
  3. 하드웨어 추가 버튼을 누릅니다.
  4. 가상 하드웨어 추가 탭에서 장치 유형에 해당하는 저장 장치 또는 네트워크를 선택합니다.
    1. New disk devices
      저장 장치 또는 파일 기반 이미지를 선택합니다. 장치 유형으로 Virtio 디스크를 선택한 후 다음 버튼을 누릅니다.
    2. New network devices
      가상 네트워크 또는 물리적 장치 공유를 선택합니다. 장치 유형으로 virtio를 선택한 후 다음 버튼을 누릅니다.
  5. 완료 버튼을 눌러 장치를 저장합니다.
  6. 게스트를 재부팅합니다. Windows 게스트를 다시 시작할 때 까지 장치가 인식되지 않을 수 있습니다.

14장. PCI passthrough

This chapter covers using PCI passthrough with Xen and KVM hypervisors.
KVM and Xen hypervisors support attaching PCI devices on the host system to virtualized guests. PCI passthrough allows guests to have exclusive access to PCI devices for a range of tasks. PCI passthrough allows PCI devices to appear and behave as if they were physically attached to the guest operating system.
PCI devices are limited by the virtualized system architecture. Out of the 32 available PCI devices for a guest 4 are not removable. This means there are up to 28 PCI slots available for additional devices per guest. Each PCI device can have up to 8 functions; some PCI devices have multiple functions and only use one slot. Para-virtualized network, para-virtualized disk devices, or other PCI devices using VT-d all use slots or functions. The exact number of devices available is difficult to calculate due to the number of available devices. Each guest can use up to 32 PCI devices with each device having up to 8 functions.
The VT-d or AMD IOMMU extensions must be enabled in BIOS.
절차 14.1. Preparing an Intel system for PCI passthrough
  1. Enable the Intel VT-d extensions

    The Intel VT-d extensions provides hardware support for directly assigning a physical devices to guest. The main benefit of the feature is to improve the performance as native for device access.
    The VT-d extensions are required for PCI passthrough with Red Hat Enterprise Linux. The extensions must be enabled in the BIOS. Some system manufacturers disable these extensions by default.
    These extensions are often called various terms in BIOS which differ from manufacturer to manufacturer. Consult your system manufacturer's documentation.
  2. Activate Intel VT-d in the kernel

    Activate Intel VT-d in the kernel by appending the intel_iommu=on parameter to the kernel line of the kernel line in the /boot/grub/grub.conf file.
    The example below is a modified grub.conf file with Intel VT-d activated.
    default=0
    timeout=5
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    title Red Hat Enterprise Linux Server (2.6.18-190.el5)
       root (hd0,0)
       kernel /vmlinuz-2.6.18-190.el5 ro root=/dev/VolGroup00/LogVol00 intel_iommu=on
       initrd /initrd-2.6.18-190.el5.img
  3. Ready to use

    Reboot the system to enable the changes. Your system is now PCI passthrough capable.
절차 14.2. Preparing an AMD system for PCI passthrough
  • Enable AMD IOMMU extensions

    The AMD IOMMU extensions are required for PCI passthrough with Red Hat Enterprise Linux. The extensions must be enabled in the BIOS. Some system manufacturers disable these extensions by default.
AMD systems only require that the IOMMU is enabled in the BIOS. The system is ready for PCI passthrough once the IOMMU is enabled.

PCI passthrough with Xen

Xen and KVM require different kernel arguments to enable PCI passthrough. The previous instructions are for KVM. For both AMD and Intel systems, PCI passthrough on Xen requires the iommu=on parameter to the hypervisor command line. Modify the /boot/grub/grub.conf file as follows to enable PCI passthrough:
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-192.el5)
   root (hd0,0)
   kernel /xen.gz-2.6.18-192.el5 iommu=on
   module /vmlinuz-2.6.18-192.el5xen ro root=/dev/VolGroup00/LogVol00 
   module /initrd-2.6.18-190.el5xen.img

14.1. Adding a PCI device with virsh

These steps cover adding a PCI device to a fully virtualized guest under the Xen or KVM hypervisors using hardware-assisted PCI passthrough. Refer to 14.4절. “PCI passthrough for para-virtualized Xen guests on Red Hat Enterprise Linux” for details on adding a PCI device to a para-virtualized Xen guest.

중요

The VT-d or AMD IOMMU extensions must be enabled in BIOS.
This example uses a USB controller device with the PCI identifier code, pci_8086_3a6c, and a fully virtualized guest named win2k3.
  1. Identify the device

    Identify the PCI device designated for passthrough to the guest. The virsh nodedev-list command lists all devices attached to the system. The --tree option is useful for identifying devices attached to the PCI device (for example, disk controllers and USB controllers).
    # virsh nodedev-list --tree
    For a list of only PCI devices, run the following command:
    # virsh nodedev-list | grep pci
    Each PCI device is identified by a string in the following format (Where **** is a four digit hexadecimal code):
    pci_8086_****
    

    Tip: determining the PCI device

    Comparing lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code.
    Record the PCI device number; the number is needed in other steps.
  2. Information on the domain, bus and function are available from output of the virsh nodedev-dumpxml command:
    # virsh nodedev-dumpxml pci_8086_3a6c
    <device>
      <name>pci_8086_3a6c</name>
      <parent>computer</parent>
      <capability type='pci'>
        <domain>0</domain>
        <bus>0</bus>
        <slot>26</slot>
        <function>7</function>
        <id='0x3a6c'>82801JD/DO (ICH10 Family) USB2 EHCI Controller #2</product>
        <vendor id='0x8086'>Intel Corporation</vendor>
      </capability>
    </device>
  3. Detach the device from the system. Attached devices cannot be used and may cause various errors if connected to a guest without detaching first.
    # virsh nodedev-dettach pci_8086_3a6c 
    Device pci_8086_3a6c dettached
  4. Convert slot and function values to hexadecimal values (from decimal) to get the PCI bus addresses. Append "0x" to the beginning of the output to tell the computer that the value is a hexadecimal number.
    For example, if bus = 0, slot = 26 and function = 7 run the following:
    $ printf %x 0
    0
    $ printf %x 26
    1a
    $ printf %x 7
    7
    The values to use:
    bus='0x00'
    slot='0x1a'
    function='0x7'
  5. Run virsh edit (or virsh attach device) and add a device entry in the <devices> section to attach the PCI device to the guest. Only run this command on offline guests. Red Hat Enterprise Linux does not support hotplugging PCI devices at this time.
    # virsh edit win2k3
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
          <address domain='0x0000' bus='0x00' slot='0x1a' function='0x7'/>
      </source>
    </hostdev>
  6. Once the guest system is configured to use the PCI address, we need to tell the host system to stop using it. The ehci driver is loaded by default for the USB PCI controller.
    $ readlink /sys/bus/pci/devices/0000\:00\:1d.7/driver
    ../../../bus/pci/drivers/ehci_hcd
  7. Detach the device:
    $ virsh nodedev-dettach pci_8086_3a6c
  8. Verify it is now under the control of pci_stub:
    $ readlink /sys/bus/pci/devices/0000\:00\:1d.7/driver
    ../../../bus/pci/drivers/pci-stub
  9. Set a sebool to allow the management of the PCI device from the guest:
    # setsebool -P virt_use_sysfs 1
  10. Start the guest system :
    # virsh start win2k3
    
The PCI device should now be successfully attached to the guest and accessible to the guest operating system.

14.2. Adding a PCI device with virt-manager

PCI devices can be added to guests using the graphical virt-manager tool. The following procedure adds a 2 port USB controller to a virtualized guest.
  1. Identify the device

    Identify the PCI device designated for passthrough to the guest. The virsh nodedev-list command lists all devices attached to the system. The --tree option is useful for identifying devices attached to the PCI device (for example, disk controllers and USB controllers).
    # virsh nodedev-list --tree
    For a list of only PCI devices, run the following command:
    # virsh nodedev-list | grep pci
    Each PCI device is identified by a string in the following format (Where **** is a four digit hexadecimal code):
    pci_8086_****
    

    Tip: determining the PCI device

    Comparing lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code.
    Record the PCI device number; the number is needed in other steps.
  2. Detach the PCI device

    Detach the device from the system.
    # virsh nodedev-dettach pci_8086_3a6c 
    Device pci_8086_3a6c dettached
  3. Power off the guest

    Power off the guest. Hotplugging PCI devices into guests is presently unsupported and may fail or crash.
  4. Open the hardware settings

    Open the virtual machine and select the Hardware tab. Click the Add Hardware button to add a new device to the guest.
  5. Add the new device

    Select Physical Host Device from the Hardware type list. The Physical Host Device represents PCI devices. Click Forward to continue.
  6. Select a PCI device

    Select an unused PCI device. Note that selecting PCI devices presently in use on the host causes errors. In this example a PCI to USB interface device is used.
  7. Confirm the new device

    Click the Finish button to confirm the device setup and add the device to the guest.
The setup is complete and the guest can now use the PCI device.

14.3. PCI passthrough with virt-install

To use PCI passthrough with the virt-install parameter, use the additional --host-device parameter.
  1. Identify the PCI device

    Identify the PCI device designated for passthrough to the guest. The virsh nodedev-list command lists all devices attached to the system. The --tree option is useful for identifying devices attached to the PCI device (for example, disk controllers and USB controllers).
    # virsh nodedev-list --tree
    For a list of only PCI devices, run the following command:
    # virsh nodedev-list | grep pci
    Each PCI device is identified by a string in the following format (Where **** is a four digit hexadecimal code):
    pci_8086_****
    

    Tip: determining the PCI device

    Comparing lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code.
  2. Add the device

    Use the PCI identifier output from the virsh nodedev command as the value for the --host-device parameter.
    # virt-install \
     -n hostdev-test -r 1024 --vcpus 2 \
     --os-variant fedora11 -v --accelerate \
     -l http://download.fedoraproject.org/pub/fedora/linux/development/x86_64/os \
     -x 'console=ttyS0 vnc' --nonetworks --nographics  \
     --disk pool=default,size=8 \
     --debug --host-device=pci_8086_10bd 
    
  3. Complete the installation

    Complete the guest installation. The PCI device should be attached to the guest.

14.4. PCI passthrough for para-virtualized Xen guests on Red Hat Enterprise Linux

PCI passthrough is used to allow a Xen guest exclusive access to a PCI device, rather than sharing with other guests or with dom0. PCI passthrough for para-virtualized Xen guests is supported on all Red Hat Enterprise Linux 5 systems, however PCI passthrough with fully virtualized guests is only supported on Red Hat Enterprise Linux 5.4 and newer.

주의

PCI passthrough to para-virtualized guests is considered insecure and is not supported for Red Hat Enterprise Linux 6 guests.
Limitations of Xen PCI passthrough:
Any guest using PCI passthrough will no longer be available for save, restore, or migration capabilities, as it will be tied to a particular non-virtualized hardware configuration.
A guest which has access to a non-virtualized PCI device via PCI passthrough also has the potential to access the DMA address space of dom0, which is a potential security concern.
To link a PCI device to a guest the device must first be hidden from the host. If the host is using the device the device cannot be assigned to the guest.
절차 14.3. Example: attaching a PCI device
  1. Given a network device which uses the bnx2 driver and has a PCI id of 0000:09:00.0, the following lines added to /etc/modprobe.conf hides the device from dom0. Either the bnx2 module must be reloaded or the host must be restarted.
    install bnx2 /sbin/modprobe pciback; /sbin/modprobe --first-time --ignore-install bnx2
    options pciback hide=(0000:09:00.0)
  2. Multiple PCI identifiers can be added to /etc/modprobe.conf to hide multiple devices.
    options pciback hide=(0000:09:00.0)(0000:0a:04.1)
  3. Use one of the following methods to add the passed-through device to the guest's configuration file:

15장. SR-IOV

15.1. Introduction

The PCI-SIG (PCI Special Interest Group) developed the Single Root I/O Virtualization (SR-IOV) specification. The PCI-SIG Single Root IOV specification is a standard for a type of PCI passthrough which natively shares a single device to multiple guests. SR-IOV does not require hypervisor involvement in data transfer and management by providing an independent memory space, interrupts, and DMA streams for virtualized guests.
SR-IOV enables a Single Root Function (for example, a single Ethernet port), to appear as multiple, separate, physical devices. A physical device with SR-IOV capabilities can be configured to appear in the PCI configuration space as multiple functions, each device has its own configuration space complete with Base Address Registers (BARs).
SR-IOV uses two new PCI functions:
  • Physical Functions (PFs) are full PCIe devices that include the SR-IOV capabilities. Physical Functions are discovered, managed, and configured as normal PCI devices. Physical Functions configure and manage the SR-IOV functionality by assigning Virtual Functions.
  • Virtual Functions (VFs) are simple PCIe functions that only process I/O. Each Virtual Function is derived from a Physical Function. The number of Virtual Functions a device may have is limited by the device hardware. A single Ethernet port, the Physical Device, may map to many Virtual Functions that can be shared to virtualized guests.
The hypervisor can map one or more Virtual Functions to a virtualized guest. The Virtual Function's configuration space is mapped, by the hypervisor, to the virtualized guest's configuration space.
Each Virtual Function can only be mapped once as Virtual Functions require real hardware. A virtualized guest can have multiple Virtual Functions. A Virtual Function appears as a network card in the same way as a normal network card would appear to an operating system.
The SR-IOV drivers are implemented in the kernel. The core implementation is contained in the PCI subsystem, but there must also be driver support for both the Physical Function (PF) and Virtual Function (VF) devices. With an SR-IOV capable device one can allocate VFs from a PF. The VFs appear as PCI devices which are backed on the physical PCI device by resources (queues, and register sets).
Advantages of SR-IOV
SR-IOV devices can share a single physical port with multiple virtualized guests.
Virtual Functions have near-native performance and provide better performance than para-virtualized drivers and emulated access. Virtual Functions provide data protection between virtualized guests on the same physical server as the data is managed and controlled by the hardware.
These features allow for increased virtualized guest density on hosts within a data center.
Disadvantages of SR-IOV
Live migration is presently unsupported. As with PCI passthrough, identical device configurations are required for live (and offline) migrations. Without identical device configurations, guest's cannot access the passed-through devices after migrating.

15.2. Using SR-IOV

This section covers attaching Virtual Function to a guest as an additional network device.
SR-IOV requires Intel VT-d support.

SR-IOV with Xen

Xen requires additional kernel arguments to use SR-IOV. Modify the /boot/grub/grub.conf file to enable SR-IOV. To enable SR-IOV with Xen for Intel systems append the pci_pt_e820_access=on parameter to the kernel.
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux Server (2.6.18-192.el5xen)
   root (hd0,0)
   kernel /xen.gz-2.6.18-192.el5 iommu=1
   module /vmlinuz-2.6.18-192.el5xen ro root=/dev/VolGroup00/LogVol00 pci_pt_e820_access=on
   module /initrd-2.6.18-192.el5xen.img
절차 15.1. Attach an SR-IOV network device
  1. Enable Intel VT-d in BIOS and in the kernel

    Enable Intel VT-D in BIOS. Refer to 절차 14.1. “Preparing an Intel system for PCI passthrough” for more information on enabling Intel VT-d in BIOS and the kernel, or refer to your system manufacturer's documentation for specific instructions.
  2. Verify support

    Verify if the PCI device with SR-IOV capabilities are detected. This example lists an Intel 82576 network interface card which supports SR-IOV. Use the lspci command to verify if the device was detected.
    # lspci
    03:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
    03:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
    

    참고

    Note that the output has been modified to remove all other devices.
  3. Start the SR-IOV kernel modules

    If the device is supported the driver kernel module should be loaded automatically by the kernel. Optional parameters can be passed to the module using the modprobe command. The Intel 82576 network interface card uses the igb driver kernel module.
    # modprobe igb [<option>=<VAL1>,<VAL2>,]
    # lsmod |grep igb
    igb    87592  0
    dca    6708    1 igb
    
  4. Activate Virtual Functions

    The max_vfs parameter of the igb module allocates the maximum number of Virtual Functions. The max_vfs parameter causes the driver to spawn, up to the value of the parameter in, Virtual Functions. For this particular card the valid range is 0 to 7.
    Remove the module to change the variable.
    # modprobe -r igb
    Restart the module with the max_vfs set to 1 or any number of Virtual Functions up to the maximum supported by your device.
    # modprobe igb max_vfs=1
    
  5. Inspect the new Virtual Functions

    Using the lspci command, list the newly added Virtual Functions attached to the Intel 82576 network device.
    # lspci | grep 82576
    03:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
    03:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
    03:10.0 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
    03:10.1 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
    
    The identifier for the PCI device is found with the -n parameter of the lspci command.
    # lspci -n | grep 03:00.0
    03:00.0 0200: 8086:10c9 (rev 01)
    # lspci -n | grep 03:10.0
    03:10.0 0200: 8086:10ca (rev 01)
    
    The Physical Function corresponds to 8086:10c9 and the Virtual Function to 8086:10ca.
  6. Find the devices with virsh

    The libvirt service must find the device to add a device to a guest. Use the virsh nodedev-list command to list available host devices.
    # virsh nodedev-list | grep 8086
    pci_8086_10c9
    pci_8086_10c9_0
    pci_8086_10ca
    pci_8086_10ca_0
    [output truncated]
    
    The serial numbers for the Virtual Functions and Physical Functions should be in the list.
  7. Get advanced details

    The pci_8086_10c9 is one of the Physical Functions and pci_8086_10ca_0 is the first corresponding Virtual Function for that Physical Function. Use the virsh nodedev-dumpxml command to get advanced output for both devices.
    # virsh nodedev-dumpxml pci_8086_10ca
    # virsh nodedev-dumpxml pci_8086_10ca_0
    <device>
      <name>pci_8086_10ca_0</name>
      <parent>pci_8086_3408</parent>
      <driver>
        <name>igbvf</name>
      </driver>
      <capability type='pci'>
        <domain>0</domain>
        <bus>3</bus>
        <slot>16</slot>
        <function>1</function>
        <product id='0x10ca'>82576 Virtual Function</product>
        <vendor id='0x8086'>Intel Corporation</vendor>
      </capability>
    </device>
    
    This example adds the Virtual Function pci_8086_10ca_0 to the guest in 단계 8. Note the bus, slot and function parameters of the Virtual Function, these are required for adding the device.
  8. Add the Virtual Function to the guest

    1. Shut down the guest.
    2. Use the output from the virsh nodedev-dumpxml pci_8086_10ca_0 command to calculate the values for the configuration file. Convert slot and function values to hexadecimal values (from decimal) to get the PCI bus addresses. Append "0x" to the beginning of the output to tell the computer that the value is a hexadecimal number.
      The example device has the following values: bus = 3, slot = 16 and function = 1. Use the printf utility to convert decimal values to hexadecimal values.
      $ printf %x 3
      3
      $ printf %x 16
      10
      $ printf %x 1
      1
      This example would use the following values in the configuration file:
      bus='0x03'
      slot='0x10'
      function='0x01'
    3. Open the XML configuration file with the virsh edit command. This example edits a guest named MyGuest.
      # virsh edit MyGuest
      
    4. The default text editor will open the libvirt configuration file for the guest. Add the new device to the devices section of the XML configuration file.
      <hostdev mode='subsystem' type='pci' managed='yes'>
            <source>
              <address bus='0x03' slot='0x10' function='0x01'/>
            </source>
      </hostdev>
      
    5. Save the configuration.
  9. Restart

    Restart the guest to complete the installation.
    # virsh start MyGuest
    
The guest should start successfully and detect a new network interface card. This new card is the Virtual Function of the SR-IOV device.

15.3. Troubleshooting SR-IOV

This section contains some issues and solutions for problems which may affect SR-IOV.
Error starting the guest
Start the configured vm , an error reported as follows:
# virsh start test
error: Failed to start domain test
error: internal error unable to start guest: char device redirected to
/dev/pts/2
get_real_device: /sys/bus/pci/devices/0000:03:10.0/config: Permission denied
init_assigned_device: Error: Couldn't get real device (03:10.0)!
Failed to initialize assigned device host=03:10.0
This error is often caused by a device which is already assigned to another guest or to the host itself.

16장. KVM 게스트 시간 관리

가상화는 게스트 시간 유지를 위해 여러 기능을 가지고 있습니다. 클럭 소스로서 TSC (Time Stamp Counter)를 사용하는 게스트는 일부 CPU가 constant TSC (Time Stamp Counter)를 갖고 있지 않아 시간 유지 방식에 문제를 일으킬 수 있습니다. 정확한 시간을 유지하는 방식이 없는 게스트는 실제 시간보다 빠르거나 또는 늦게 실행되어 동기화에서 벗어날 수 있으므로 일부 네트워크 어플리케이션 및 프로세스에 문제를 일으킬 수 있습니다.
KVM은 반가상화 클럭을 게스트에 제공하여 이러한 문제를 해결하였습니다. 다른 방법으로 일부 게스트는 차후 해당 운영 체제 버전에 있는 시간 유지를 위해 기타 다른 x86 클럭 리소스를 사용할 수 있습니다.
현재, Red Hat Enterprise Linux 5.4 이상 버전의 게스트만이 반가상화 클럭을 완전 지원합니다.
부정확한 클럭 및 카운터로 인해 게스트에 심각한 문제가 발생할 수 있습니다: \t
  • 클럭은 실제 시간과의 동기화에서 벗어나 세션을 비활성화하고 네트워크에 영향을 미칠 수 있습니다.
  • 늦은 클럭을 갖는 게스트는 마이그레이션 문제가 일어날 수 있습니다.
이 문제는 다른 가상화 플랫폼에 존재하며 타이밍은 항상 테스트해야 합니다.

NTP

NTP (Network Time Protocol) 데몬은 호스트와 게스트에서 실행해야 합니다. ntpd 서비스를 활성화합니다:
# service ntpd start
ntpd 서비스를 기본값 시작 순서에 추가합니다: \t
# chkconfig ntpd on
ntpd 서비스를 사용는 것은 모든 경우 클럭 스큐 (clock skew)의 효과를 최소화하는 것입니다.
CPU가 constant TSC (Time Stamp Counter)를 갖고 있는지 확인 \t
constant_tsc 플래그가 있으면 CPU는 constant TSC (Time Stamp Counter)를 갖습니다. CPU가 constant_tsc 플래그를 갖고 있는지 확인하려면 다음 명령을 실행합니다:
$ cat /proc/cpuinfo | grep constant_tsc
어떠한 결과가 출력되면 해당 CPU가 constant_tsc비트를 갖습니다. 출력이없는 경우에는 다음의 지시를 따르십시오.
constant TSC (Time Stamp Counter) 없이 호스트 설정
constant TSC (Time Stamp Counter) 없는 시스템에는 추가 설정이 필요합니다. 전원 관리 기능은 정확한 시간 유지를 방해하므로 KVM으로 시간을 정확하게 유지하기 위해 게스트에 대해 비활성화합니다.

주의

이러한 지시 사항은 AMD 개정 F cpus 전용에 해당합니다.
CPU에 constant_tsc비트가 없는 경우 모든 전원 관리 기능 (BZ#513138)을 비활성화합니다. 각 시스템은 여러 타이머를 사용하여 시간을 유지합니다. TSC는 호스트에서 불안정하므로 cpufreq 변경, deep C 상태, 보다 빠른 TSC가 있는 호스트로의 이전의 원인이 됩니다. Deep C sleep 상태에서는 TSC를 중지시킬 수 있습니다. 커널이 deep C 상태를 사용하지 못하게 하려면 호스트 상의 grub.conf 파일에 있는 커널 부팅 옵션에 "processor.max_cstate=1" 을 추가합니다:
term Red Hat Enterprise Linux Server (2.6.18-159.el5)
        root (hd0,0)
	kernel /vmlinuz-2.6.18-159.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet processor.max_cstate=1
/etc/sysconfig/cpuspeed 설정 파일을 편집하여 cpufreq를 비활성화하고 (constant_tsc가 없는 호스트에서만) MIN_SPEEDMAX_SPEED 변수를 사용할 수 있는 최상의 주파수로 변경합니다. 유효 한계는 /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies에서 확인하실 수 있습니다.
Red Hat Enterprise Linux 게스트와 함께 반가상화 클럭 사용
특정 Red Hat Enterprise Linux 게스트의 경우, 추가 커널 파라미터가 필요합니다. 이러한 파라미터는 게스트의 /boot/grub/grub.conf 파일에서 /kernel 마지막 줄에 이를 추가하여 설정할 수 있습니다.
아래 표에서는 Red Hat Enterprise Linux 버전과 constant TSC (Time Stamp Counter)가 없는 시스템의 게스트에 필요한 파라미터를 보여줍니다.
Red Hat Enterprise Linux추가 게스트 커널 파라미터
반가상화 클럭이 있는 5.4 AMD64/Intel 64 추가 파라미터가 필요하지 않음
반가상화 클럭이 없는 5.4 AMD64/Intel 64 divider=10 notsc lpj=n
반가상화 클럭이 있는 5.4 x86 추가 파라미터가 필요하지 않음
반가상화 클럭이 없는 5.4 x86 divider=10 clocksource=acpi_pm lpj=n
5.3 AMD64/Intel 64divider=10 notsc
5.3 x86divider=10 clocksource=acpi_pm
4.8 AMD64/Intel 64notsc divider=10
4.8 x86clock=pmtmr divider=10
3.9 AMD64/Intel 64추가 파라미터가 필요하지 않음
3.9 x86추가 파라미터가 필요하지 않음
Using the Real-Time Clock with Windows Server 2003 and Windows XP guests
Windows는 RTC (Real-Time Clock) 및 TSC (Time Stamp Counter)를 사용합니다. Windows 게스트의 경우 RTC (Real-Time Clock)는 게스트 시간 문제를 해결하는 모든 시간 소스에 대해 TSC 대신 사용될 수 있습니다.
PMTIMER 클럭 소스 (PMTIMER는 주로 TSC를 사용)의 경우 RTC (Real-Time Clock)를 활성화하기 위해 Windows 부팅 설정에 다음 행을 추가합니다. Windows 부팅 설정은 boot.ini 파일에 저장되어 있습니다. 다음 행을 boot.ini 파일에 추가합니다:
/use pmtimer
Windows 부팅 설정 및 pmtimer 옵션에 대한 자세한 내용은 Windows XP 및 Windows Server 2003 Boot.ini 파일에서 사용할 수 있는 스위치 옵션에서 참조하십시오.
Using the Real-Time Clock with Windows Vista, Windows Server 2008 and Windows 7 guests
Windows는 RTC (Real-Time Clock) 및 TSC (Time Stamp Counter)를 사용합니다. Windows 게스트의 경우 RTC (Real-Time Clock)는 게스트 시간 문제를 해결하는 모든 시간 소스에 대해 TSC 대신 사용될 수 있습니다.
The boot.ini file is no longer used from Windows Vista and newer. Windows Vista, Windows Server 2008 and Windows 7 use the Boot Configuration Data Editor (bcdedit.exe) to modify the Windows boot parameters.
This procedure is only required if the guest is having time keeping issues. Time keeping issues may not affect guests on all host systems.
  1. Open the Windows guest.
  2. Open the Accessories menu of the start menu. Right click on the Command Prompt application, select Run as Administrator.
  3. Confirm the security exception, if prompted.
  4. Set the boot manager to use the platform clock. This should instruct Windows to use the PM timer for the primary clock source. The system UUID ({default} in the example below) should be changed if the system UUID is different than the default boot device.
    C:\Windows\system32>bcdedit /set {default} USEPLATFORMCLOCK on
    The operation completed successfully
This fix should improve time keeping for Windows Vista, Windows Server 2008 and Windows 7 guests.

부 IV. 관리

17장. 서버 모범 사례

다음의 작업 및 정보를 통해 Red Hat Enterprise Linux 5 서버 호스트(dom0)의 보안 및 안정성에 대한 도움을 받으실 수 있습니다.
  • 강제 모드로 SELinux를 실행합니다. 이를 위해 아래의 명령을 실행합니다.
    # setenforce 1
    
  • AutoFS, NFS, FTP, HTTP, NIS, telnetd, sendmail 등과 같은 불필요한 서비스를 삭제 또는 비활성화합니다.
  • 서버의 플랫폼 관리에 필요한 최소 사용자 계정 수를 추가하고 불필요한 사용자 계정을 삭제합니다.
  • 호스트에서 불필요한 어플리케이션을 실행하지 않습니다. 호스트에서 어플리케이션을 실행하면 가상 장치 실행 및 서버 안정성에 영향을 미칠 수 있습니다. 서버 속도를 감소시킬 수 있는 모든 어플리케이션은 서버의 모든 가상 장치 속도를 감소시키는 원인이 될 수 있습니다.
  • 가상 장치 설치 및 이미지의 경우 중앙에 위치하도록 합니다. 가상 장치 이미지는 /var/lib/libvirt/images/ 아래에 저장되어야 합니다. 가상 장치 이미지에 대해 다른 디렉토리를 사용하고 계실 경우 설치 시작 전 SELinux 정책에 해당 디렉토리를 추가하고 이를 다시 레이블하였는지를 확인합니다.
  • 설치 소스, 트리, 이미지는 중앙에 위치하도록 저장해야 하며, 주로 vsftpd 서버에 저장됩니다.

18장. 가상화 보안

기업의 인프라에 가상화 기술을 도입할 때, 호스트가 침해받지 않도록 주의하셔야 합니다. Xen 하이퍼바이저에서 호스트는 시스템을 관리하고 모든 가상 장치를 관리하는 권한을 갖는 도메인입니다. 호스트가 안전하게 보안되지 않을 경우 시스템에 있는 다른 모든 도메인이 위험에 노출되게 됩니다. 가상화를 사용하여 시스템의 보안을 강화하기 위한 몇 가지 방법이 있습니다. 기업에서는 운영 지침과 가상 게스트 및 호스트 서버에 필요한 서비스 및 이러한 서비스에 필요한 지원 내용이 있는 운용 계획을 세워야 합니다. 운용 계획을 세울 때 고려해야 할 몇 가지의 보안 문제는 다음과 같습니다:
  • 호스트에서 필요한 서비스만 실행합니다. 호스트에서 실행 중인 프로세스 및 서비스가 적은 만큼 보안 및 성능 수준이 높아집니다.
  • Enable Security-Enhanced Linux (SELinux) on the hypervisor. Read 18.2절. “SELinux 및 가상화 ” for more information on using SELinux and virtualization.
  • 방화벽을 사용하여 dom0에서의 소통량을 제한합니다. default-reject 규칙을 사용하여 방화벽을 설정하면 dom0 공격에 대한 보안을 강화할 수 있습니다. 또한 서비스에 대한 네트워크도 제한합니다.
  • 일반 사용자가 dom0에 접속하지 못하도록 설정합니다. 일반 사용자가 dom0에 접속하게 하면, dom0를 위험에 노출시키게 됩니다. dom0는 권한을 가진 도메인으로 비권한 계정을 허용할 경우 보안 수준을 위협할 수 도 있습니다.

18.1. Storage security issues

Administrators of virtualized guests can change the partitions the host boots in certain circumstances. To prevent this administrators should follow these recommendations:
The host should not use disk labels to identify file systems in the fstab file, the initrd file or used by the kernel command line. If less privileged users, especially virtualized guests, have write access to whole partitions or LVM volumes.
Guest should not be given write access to whole disks or block devices (for example, /dev/sdb). Use partitions (for example, /dev/sdb1) or LVM volumes.

18.2. SELinux 및 가상화

Security Enhanced Linux was developed by the NSA with assistance from the Linux community to provide stronger security for Linux. SELinux limits an attackers abilities and works to prevent many common security exploits such as buffer overflow attacks and privilege escalation. It is because of these benefits that Red Hat recommends all Red Hat Enterprise Linux systems should run with SELinux enabled and in enforcing mode.
SELinux prevents guest images from loading if SELinux is enabled and the images are not correctly labeled. SELinux requires that image files have the virt_image_t label applied to them. The /var/lib/libvirt/images directory has this label applied to it and its contents by default. This does not mean that images must be stored in this directory; images can be stored anywhere, provided they are labeled with virt_image_t.
SELinux를 강제 모드로 설정하고 LVM 기반 저장 장치 추가
다음 부분에는 SELinux를 활성화하여 가상 게스트에 논리 볼륨을 추가하는 예제가 있습니다. 이러한 지시 사항은 하드 드라이브 파티션의 경우에도 작동합니다.
절차 18.1. SELinux를 활성화하여 가상 게스트에 논리 볼륨을 생성 및 마운트하기
  1. 논리 볼륨을 생성합니다. 이 예제에서는 volumegroup이라는 볼륨 그룹에 NewVolumeName이라는 5 기가 바이트의 논리 볼륨을 생성하고 있습니다.
    # lvcreate -n NewVolumeName -L 5G volumegroup
  2. NewVolumeName 논리 볼륨을 ext3와 같은 확장 속성을 지원하는 파일 시스템으로 포맷합니다.
    # mke2fs -j /dev/volumegroup/NewVolumeName
    
  3. 새 논리 볼륨을 마운트하기 위해 새 디렉토리를 생성합니다. 이 디렉토리는 파일 시스템 상의 어디에나 위치할 수 있습니다. 하지만 이를 중요한 시스템 디렉토리 (/etc, /var, /sys) 또는 홈 디렉토리 (/home 또는 /root)에 배치하지 않는 것이 좋습니다. 이 예제에서는 /virtstorage라는 디렉토리를 사용하고 있습니다.
    # mkdir /virtstorage
    
  4. 논리 볼륨을 마운트합니다.
    # mount /dev/volumegroup/NewVolumeName /virtstorage
  5. Set the correct SELinux type for a Xen folder.
    semanage fcontext -a -t xen_image_t "/virtstorage(/.*)?"
    
    다른 방법으로 KVM 폴더에 대해 올바른 SELinux 유형을 설정합니다.
    semanage fcontext -a -t virt_image_t "/virtstorage(/.*)?"
    
    targeted 정책을 사용할 경우 (targeted는 기본값 정책임) 명령은 /etc/selinux/targeted/contexts/files/file_contexts.local 파일에 행을 추가하여 변경 사항을 영구화할 수 있습니다. 추가되는 행은 다음과 유사합니다:
    /virtstorage(/.*)?    system_u:object_r:xen_image_t:s0
    
  6. Label the device node (for example, /dev/volumegroup/NewVolumeName with the correct label:
    # semanage fcontext -a -t xen_image_t /dev/volumegroup/NewVolumeName
    # restorecon /dev/volumegroup/NewVolumeName
    

18.3. SELinux

다음 부분에서는 SELinux를 가상화 환경에 구현할 때 반드시 고려해야 할 사항들을 다루고 있습니다. 시스템을 변경하거나 장치를 추가할 때, 이에 따라 SELinux 정책을 업데이트해야 합니다. 게스트 용 LVM 볼륨을 설정하려면, 각 기초 블록 장치 및 볼륨 그룹에 대한 SELinux 문맥을 반드시 수정해야 합니다.
# semanage fcontext -a -t xen_image_t -f -b /dev/sda2
# restorecon /dev/sda2
부울 파라미터 xend_disable_t는 데몬을 다시 시작한 후 xend를 자유 모드에 설정할 수 있습니다. 전체 시스템 보다 하나의 데몬에 대한 보안 기능을 비활성화하는 것이 좋습니다. 디렉토리를 다른 위치에서 사용할 수 있는 xen_image_t로 다시 레이블하지 않을 것을 권장합니다.
KVM and SELinux
There are several SELinux booleans which affect KVM. These booleans are listed below for your convenience.
KVM SELinux Booleans
SELinux BooleanDescription
allow_unconfined_qemu_transitionDefault: off. This boolean controls whether KVM guests can be transitioned to unconfined users.
qemu_full_networkDefault: on. This boolean controls full network access to KVM guests.
qemu_use_cifsDefault: on. This boolean controls KVM's access to CIFS or Samba file systems.
qemu_use_commDefault: off. This boolean controls whether KVM can access serial or parallel communications ports.
qemu_use_nfsDefault: on. This boolean controls KVM's access to NFS file systems.
qemu_use_usbDefault: on. This boolean allows KVM to access USB devices.

18.4. Virtualization firewall information

Various ports are used for communication between virtualized guests and management utilities.

Guest network services

Any network service on a virtualized guest must have the applicable ports open on the guest to allow external access. If a network service on a guest is firewalled it will be inaccessible. Always verify the guests network configuration first.
  • ICMP requests must be accepted. ICMP packets are used for network testing. You cannot ping guests if ICMP packets are blocked.
  • Port 22 should be open for SSH access and the initial installation.
  • Ports 80 or 443 (depending on the security settings on the RHEV Manager) are used by the vdsm-reg service to communicate information about the host.
  • Ports 5634 to 6166 are used for guest console access with the SPICE protocol.
  • Port 8002 is used by Xen for live migration.
  • Ports 49152 to 49216 are used for migrations with KVM. Migration may use any port in this range depending on the number of concurrent migrations occurring.
  • Enabling IP forwarding (net.ipv4.ip_forward = 1) is required for virtual bridge devices. Note that installing libvirt enables this variable so it will be enabled when the virtualization packages are installed unless it was manually disabled.

참고

Note that enabling IP forwarding is not required for physical bridge devices. When a guest is connected through a physical bridge, traffic only operates at a level that does not require IP configuration such as IP forwarding.

19장. xend를 사용한 게스트 관리

xend 노드 제어 데몬은 가상 장치와 관련된 특정 시스템 관리 기능을 수행합니다. 이 데몬은 가상 자원을 제어하며, xend는 반드시 가상 장치와 연동하도록 실행되어야 합니다. xend를 시작하기 전에, 반드시 /etc/xen/xend-config.sxp라는 xend 설정 파일을 편집하여 운영 파라미터를 지정해야 합니다. 다음은 xend-config.sxp 설정 파일에서 활성화 또는 비활성화할 수 있는 파라미터를 보여줍니다:
표 19.1. xend 설정 파라미터
아이템 설명
(console-limit)
Determines the console server's memory buffer limit and assigns that limit on a per domain basis.
(min-mem)
domain0에 사용되는 메가바이트의 최소 수를 결정합니다 (0을 입력하면, 값은 변하지 않음).
(dom0-cpus)
domain0에서 사용되는 CPU 개수를 결정합니다 (기본값으로 최소 1 CPU 할당됨).
(enable-dump)
활성화되어 있을 경우, 충돌 발생 시 Xen은 덤프 파일을 생성합니다. (기본값: 0)
(external-migration-tool)
외부 장치 이전을 제어하는 스크립트 또는 어플리케이션을 지정합니다. 스크립트는 반드시 /etc/xen/scripts/external-device-migrate 디렉토리에 있어야 합니다.
(logfile)
로그 파일의 위치를 결정합니다 (기본값: /var/log/xend.log).
(loglevel)
로그 모드 값을 선별합니다: DEBUG, INFO, WARNING, ERROR, CRITICAL (기본값: DEBUG).
(network-script)
네트워크 환경을 활성화하는 스크립트를 지정합니다. 스크립트는 /etc/xen/scripts/ 디렉토리에 있어야 합니다.
(xend-http-server)
http 스트림 패킷 관리 서버를 활성화합니다 (기본값: no).
(xend-unix-server)
UNIX 도메인 소켓 서버를 활성화합니다. 소켓 서버는 낮은 수준의 네트워크 연결을 처리하는 통신 종단점으로 들어오는 연결을 허용하거나 거부합니다. 기본값은 yes로 설정되어 있습니다.
(xend-relocation-server)
장치 교체 이전을 위한 재배치 서버를 활성화합니다 (기본값: no).
(xend-unix-path)
xend-unix-server 명령 출력 데이터가 있는 위치를 지정합니다. (기본값: /var/lib/xend/xend-socket)
(xend-port)
http 관리 서버가 사용하는 포트를 결정합니다 (기본값: 8000).
(xend-relocation-port)
재배치 서버가 사용하는 포트를 결정합니다 (기본값: 8002).
(xend-relocation-address)
시스템 이전에 사용되는 호스트 주소를 결정합니다. 기본값은 xend-address 값입니다.
(xend-address)
도메인 소켓 서버가 바인드하는 주소를 결정합니다. 기본값은 모든 접속을 허용하는 것입니다.

이러한 운영 파라미터를 설정한 후에, xend가 실행되고 있는지 확인해야 하며, 실행되고 있지 않으면 데몬을 시작해야 합니다. 명령 프롬프트에서 다음 명령을 입력하여 xend 데몬을 시작하시기 바랍니다:
service xend start
다음을 사용하여 xend 데몬을 정지시킬 수 있습니다:
service xend stop
위 명령은 실행 중인 데몬을 정지시킵니다.
다음을 사용하여 xend 데몬을 재시작할 수 있습니다:
service xend restart
데몬은 다시 시작합니다.
xend 데몬의 상태를 확인할 수 있습니다.
service xend status
The output displays the daemon's status.

부팅 시 xend 활성화

chkconfig 명령을 사용하여 initscriptxend를 추가합니다.
chkconfig --level 345 xend
현재 xend는 런레벨 3, 4, 5에서 시작됩니다.

20장. Xen 실시간 이전

The Xen hypervisor supports Virtualization Migration for para-virtualized guests and fully virtualized guests. Migration is only supported on Red Hat Enterprise Linux 5.1 and newer systems. Migration can be performed offline or live.
  • 오프라인 이전에서는 기존 호스트 상의 가상화 게스트를 중지하고 이를 대상 호스트로 전송한 후 게스트가 완전히 전송되면 이를 다시 시작합니다. 오프라인 이전에서는 virsh migrate 명령을 사용합니다.
    # virsh migrate GuestName libvirtURI
  • A live migration keeps the guest running on the source host and begins moving the memory without stopping the guest. All modified memory pages are monitored for changes and sent to the destination while the image is sent. The memory is updated with the changed pages. The process continues until the amount of pause time allowed for the guest equals the predicted time for the final few pages to be transfer. The Xen hypervisor estimates the time remaining and attempts to transfer the maximum amount of page files from the source to the destination until Xen predicts the amount of remaining pages can be transferred during a very brief time while the virtualized guest is paused. The registers are loaded on the new host and the guest is then resumed on the destination host. If the guest cannot be merged (which happens when guests are under extreme loads) the guest is paused and then an offline migration is started instead.
    실시간 이전은 virsh migrate 명령의 --live 옵션을 사용합니다.
    # virsh migrate--live GuestName libvirtURI

Itanium® 지원 주의 사항

현재 이전 기능은 Itanium® 아키텍처에서 지원되지 않습니다.
Xen을 사용하여 이전 기능을 활성화하기 위해 /etc/xen/xend-config.sxp 설정 파일에 일부 사항을 변경해야 합니다. 이전 기능은 잘못 설정되어 있을 경우 보안에 잠재적으로 영향을 미칠 수 있으므로 기본값으로 비활성화되어 있습니다. 이전 포트를 열어두면 인증되지 않은 호스트가 이전 포트로의 연결이나 이전을 초기화하게 할 수 있습니다. 이전 요청을 위해 인증이 설정되어 있지 않으므로 제어 메카니즘을 호스트 및 IP 주소에만 기반하게 되므로 이전 포트가 인증되지 않은 호스트에 액세스할 수 없는지를 각별히 주의하여 확인합니다.

가상화 이전 보안 사항

IP 주소 및 호스트명 필터는 최소한의 보안 기능만을 제공합니다. 공격자가 이전 클라이언트의 주소 또는 호스트명을 알고 있을 경우 이러한 속성은 위조될 수 있습니다. 이전 기능을 보안하기 위한 최상의 방법은 외부 및 인증되지 않은 내부 연결로 부터 네트워크를 분리하는 것입니다.
이전 기능 활성화
이전 기능을 활성화하기 위해 /etc/xen/xend-config.sxp에 있는 다음의 항목을 수정합니다. 필요시 값을 수정하고 다음과 같은 파라미터 앞의 주석 (#)을 삭제합니다:
(xend-relocation-server yes)
이전을 비활성화하는 기본값은 no입니다. xend-relocation-server의 값을 yes로 변경하면 이전 기능을 활성화하게 됩니다.
(xend-relocation-port 8002)
xend-relocation-serveryes로 설정되어 있을 경우, 파라미터 (xend-relocation-port)는 재배치 인터페이스 용으로 사용할 xend 포트를 지정합니다.
디폴트 변수 값은 대부분의 설치에서 작동해야 합니다. 값을 변경하실 경우 재배치 서버 상의 사용되지 않는 포트를 사용하고 있는지를 확인하시기 바랍니다.
xend-relocation-port 파라미터에 의해 설정된 포트는 양쪽 시스템 모두에서 열려있어야 합니다.
(xend-relocation-address '')
xend-relocation-server가 설정되어 있을 경우 (xend-relocation-address)xendrelocation-socket 연결에서의 이전 명령에 대해 청취해야 하는 주소입니다.
The default is to listen on all active interfaces. The (xend-relocation-address) parameter restricts the migration server to only listen to a specific interface. The default value in /etc/xen/xend-config.sxp is an empty string(''). This value should be replaced with a single, valid IP address. For example:
(xend-relocation-address '10.0.0.1')
(xend-relocation-hosts-allow '')
The (xend-relocation-hosts-allow 'hosts') parameter controls which hostnames can communicate on the relocation port.
Unless you are using SSH or TLS, the guest's virtual memory is transferred in raw form without encryption of the communication. Modify the xend-relocation-hosts-allow option to restrict access to the migration server.
위의 예에서 빈 문자열을 작은 따옴표로 묶은 것과 같이 값이 비어있을 경우 모든 연결이 허용됩니다. 이는 재배치 서버가 청취하는 포트 및 인터페이스에 연결이 도달하였다고 가정합니다. xend-relocation-portxend-relocation-address도 살펴보시기 바랍니다.
그렇지 않을 경우, (xend-relocation-hosts-allow) 파라미터는 빈 칸으로 구분된 정규 표현식 순서로 되어야 합니다. 이러한 정규 표현식과 일치하는 FQDN 또는 IP 주소로된 호스트는 허용됩니다.
(xend-relocation-hosts-allow) 속성의 예:
(xend-relocation-hosts-allow '^localhost$ ^localhost\\.localdomain$')
설정 파일에 있는 파라미터를 설정한 후, Xen 서비스를 다시 시작합니다.
# service xend restart

20.1. 실시간 이전의 예

다음에서는 실시간 이전을 위해 간단히 환경 설정하는 방법에 대해 설명합니다. 이 설정에서는 저장 장치 공유 용으로 NFS를 사용하고 있습니다. NFS는 데모 환경 용으로 적합하지만 실제 제품 환경에서는 파이버 채널이나 iSCSI 및 GFS를 사용한 저장 장치 공유 설정을 사용할 것을 권장합니다.
아래의 설정은 두 개의 서버 (et-virt07et-virt08)로 구성되어 있으며, 두 서버 모두 기본값 네트워크 인터페이스로 eth1을 사용하고 있는 반면 Xen 네트워크 브리지로 xenbr1을 사용하고 있습니다. NFS를 사용하는 저장 장치 공유 용으로 et-virt07 상에 로컬로 부착된 SCSI 디스크 (/dev/sdb)를 사용하고 있습니다.
실시간 이전 설정
이전에 사용할 디렉토리를 생성하고 마운트합니다:
# mkdir /var/lib/libvirt/images
# mount /dev/sdb /var/lib/libvirt/images

중요

디렉토리가 올바른 옵션을 사용하여 내보내어 졌는지를 확인합니다. 기본값 디렉토리 /var/lib/libvirt/images/를 내보내고 있을 경우 이 디렉토리는 xend 데몬 및 기타 다른 도구에 의해 사용되고 있으므로 /var/lib/xen/아닌 /var/lib/libvirt/images/ 만을 내보내고 있는지를 확인합니다. /var/lib/xen/ 공유는 예기치 않는 작동의 원인이 될 수 있습니다.
# cat /etc/exports
/var/lib/libvirt/images  *(rw,async,no_root_squash)
NFS를 통해 내보내어지는 지를 확인합니다:
# showmount -e et-virt07
Export list for et-virt07:
/var/lib/libvirt/images *
게스트 설치
게스트 설치를 위해 사용된 설치 명령의 예:
# virt-install -p -f /var/lib/libvirt/images/testvm1.dsk -s 5 -n\
testvm1 --vnc -r 1024 -l http://example.com/RHEL5-tree\
Server/x86-64/os/ -b xenbr1
For step by step installation instructions, refer to 8장. 게스트 운영 체제 설치 절차 .
이전을 위한 가상 환경 확인
가상 네트워크 브리지가 올바르게 설정되어 두 호스트에서 동일한 이름으로 되어 있는지를 확인합니다:
[et-virt08 ~]# brctl show
bridge name     bridge id               STP enabled     interfaces
xenbr1          8000.feffffffffff       no              peth1
vif0.1
[et-virt07 ~]# brctl show
bridge name     bridge id               STP enabled     interfaces
xenbr1          8000.feffffffffff       no              peth1
vif0.1
재배치 파라미터가 두 호스트에 모두 설정되어 있는지를 확인합니다:
[et-virt07 ~]# grep xend-relocation /etc/xen/xend-config.sxp |grep -v '#'
(xend-relocation-server yes)
(xend-relocation-port 8002)
(xend-relocation-address '')
(xend-relocation-hosts-allow '')
[et-virt08 ~]# grep xend-relocation /etc/xen/xend-config.sxp |grep -v '#'
(xend-relocation-server yes)
(xend-relocation-port 8002)
(xend-relocation-address '')
(xend-relocation-hosts-allow '')
재배치 서버가 시작되어 Xen 이전 용 전용 포트 (8002)를 청취하고 있는지를 확인합니다:
[et-virt07 ~]# lsof -i :8002
COMMAND  PID  USER   FD   TYPE  DEVICE SIZE NODE NAME
python 3445 root 14u IPv4 10223 TCP *:teradataordbms (LISTEN)
[et-virt08 ~]# lsof -i :8002
COMMAND  PID USER   FD   TYPE DEVICE SIZE NODE NAME
python 3252 root 14u IPv4 10901 TCP *:teradataordbms (LISTEN)
That the default /var/lib/libvirt/images directory is available and mounted with networked storage on both hosts. Shared, networked storage is required for migrations.
[et-virt08 ~]# df /var/lib/libvirt/images
Filesystem           1K-blocks      Used Available Use% Mounted on
et-virt07:/var/lib/libvirt/images    70562400   2379712  64598336   4% /var/lib/libvirt/images
[et-virt08 ~]# file /var/lib/libvirt/images/testvm1.dsk 
/var/lib/libvirt/images/testvm1.dsk: x86 boot sector; partition 1: ID=0x83,
active, starthead 1, startsector 63, 208782 sectors; partition 2: ID=0x8e, 
starthead 0, startsector 208845, 10265535 sectors, code offset 0x48
[et-virt08 ~]# touch /var/lib/libvirt/images/foo
[et-virt08 ~]# rm -f /var/lib/libvirt/images/foo
게스트 저장 및 복구 확인
가상 장치를 시작합니다 (가상 장치가 활성화되어 있지 않는 경우):
[et-virt07 ~]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
[et-virt07 ~]# virsh start testvm1
Domain testvm1 started
가상 장치가 실행되고 있는 지를 확인합니다:
[et-virt07 ~]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
testvm1        blocked
로컬 호스트에 가상 장치를 저장합니다:
[et-virt07 images]# time virsh save testvm1 testvm1.sav
real    0m15.744s
user    0m0.188s
sys     0m0.044s
[et-virt07 images]# ls -lrt testvm1.sav
-rwxr-xr-x 1 root root 1075657716 Jan 12 06:46 testvm1.sav
[et-virt07 images]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
로컬 호스트에 가상 장치를 복구합니다:
[et-virt07 images]# virsh restore testvm1.sav
[et-virt07 images]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
testvm1        blocked
Start the live migration of domain-id from et-virt08 to et-virt07. The hostname you are migrating to and <domain-id> must be replaced with valid values. This example uses the et-virt08 host which must have SSH access to et-virt07
[et-virt08 ~]# xm migrate --live testvm1 et-virt07
Verify the virtual machine is no longer present on et-virt08
[et-virt08 ~]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
Verify the virtual machine has been migrated to et-virt07:
[et-virt07 ~]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
testvm1        running
작업 실행 테스트 및 실시간 이전 초기화
Create the following script inside the virtual machine to log date and hostname during the migration. This script performs I/O tasks on the guest's file system.
#!/bin/bash

while true
do
touch /var/tmp/$$.log
echo `hostname` >>  /var/tmp/$$.log
	echo `date`     >>  /var/tmp/$$.log
	cat  /var/tmp/$$.log
	df /var/tmp
	ls -l  /var/tmp/$$.log
	sleep 3
	done
스크립트는 테스트 용도로만 사용될 수 있으며 실제 제품에서 실시간 이전을 위해 필요하지 않다는 것을 기억해 두시기 바랍니다.
가상 장치를 et-virt07로 이전하기 전에 가상 장치가 et-virt08에서 실행되는지를 확인합니다:
[et-virt08 ~]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
testvm1        blocked
et-virt07에 실시간 이전을 초기화합니다. time 명령을 추가하여 이전에 얼마의 시간이 걸리는 지를 확인하실 수 있습니다:
[et-virt08 ~]# xm migrate --live testvm1 et-virt07
게스트 내에서 스크립트를 실행합니다:
# ./doit
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:26:27 EST 2007
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2983664   2043120    786536  73% /
-rw-r--r-- 1 root root 62 Jan 12 02:26 /var/tmp/2279.log
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:26:27 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:26:30 EST 2007
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2983664   2043120    786536  73% /
-rw-r--r-- 1 root root 124 Jan 12 02:26 /var/tmp/2279.log
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:26:27 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:26:30 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:26:33 EST 2007
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2983664   2043120    786536  73% /
-rw-r--r-- 1 root root 186 Jan 12 02:26 /var/tmp/2279.log
Fri Jan 12 02:26:45 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:26:48 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:26:51 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:54:57 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:55:00 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:55:03 EST 2007
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2983664   2043120    786536  73% /
-rw-r--r-- 1 root root 744 Jan 12 06:55 /var/tmp/2279.log
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:26:27 EST 2007
가상 장치가 et-virt08에서 종료되었는지를 확인합니다:
[et-virt08 ~]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
가상 장치가 et-virt07에서 시작되었는지를 확인합니다:
[et-virt07 images]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
testvm1        blocked
et-virt07에서 et-virt08로 다른 이전 주기를 실행합니다. et-virt07에서 et-virt08로 이전을 초기화합니다:
[et-virt07 images]# xm migrate --live testvm1 et-virt08
가상 장치가 종료되었는지를 확인합니다:
[et-virt07 images]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
이전을 초기화하기 전 게스트에서 간단한 스크립트를 시작하여 게스트 이전 시 변경 사항에 유의합니다:
# ./doit
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:53 EST 2007
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2983664   2043120    786536  73% /
-rw-r--r-- 1 root root 62 Jan 12 06:57 /var/tmp/2418.log
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:53 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:56 EST 2007
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2983664   2043120    786536  73% /
-rw-r--r-- 1 root root 124 Jan 12 06:57 /var/tmp/2418.log
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:53 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:56 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:58:00 EST 2007
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2983664   2043120    786536  73% /
-rw-r--r-- 1 root root 186 Jan 12 06:57 /var/tmp/2418.log
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:53 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:56 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:58:00 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:30:00 EST 2007
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2983664   2043120    786536  73% /
-rw-r--r-- 1 root root 248 Jan 12 02:30 /var/tmp/2418.log
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:53 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:56 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:58:00 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:30:00 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:30:03 EST 2007
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2983664   2043120    786536  73% /
-rw-r--r-- 1 root root 310 Jan 12 02:30 /var/tmp/2418.log
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:53 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:57:56 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 06:58:00 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:30:00 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:30:03 EST 2007
dhcp78-218.lab.boston.redhat.com
Fri Jan 12 02:30:06 EST 2007
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
2983664   2043120    786536  73% /
-rw-r--r-- 1 root root 372 Jan 12 02:30 /var/tmp/2418.log
et-virt07 상에서 이전 명령을 완료한 후 et-virt08에서 가상 장치가 시작되었는지를 확인합니다:
[et-virt08 ~]# virsh list
 Id Name                 State
----------------------------------
Domain-0                 running
testvm1        blocked
다른 이전 주기를 실행합니다:
[et-virt08 ~]# time virsh migrate --live testvm1 et-virt07
real    0m10.378s
user    0m0.068s
sys     0m0.052s
오프라인 실시간 이전 테스트를 성공적으로 수행하셨습니다.

20.2. 실시간 게스트 이전 설정

다음 부분에서는 Red Hat Enterprise Linux를 실행하고 있는 다른 서버로 Xen 게스트의 오프라인 이전에 대해 다루고 있습니다. 이전은 xm migrate 명령을 사용하여 오프라인 방식으로 수행됩니다. 실시간 이전은 동일한 명령을 사용하여 실행될 수 있지만, xend-config 설정 파일에 몇 가지 수정 사항을 추가해야 합니다. 다음 예에서는 성공적인 이전을 위해 반드시 수정해야 하는 항목을 보여주고 있습니다:
(xend-relocation-server yes)
The default for this parameter is 'no', which keeps the relocation/migration server deactivated (unless on a trusted network) and the domain virtual memory is exchanged in raw form without encryption.
(xend-relocation-port 8002)
이 파라미터는 xend 가 이전에 사용할 포트를 설정합니다. 네트워크 환경이 사용자 설정 값을 요청하지 않을 경우 이 값을 사용합니다. 주석 처리를 제거하여 이를 활성화합니다.
(xend-relocation-address )
이 파라미터는 xend-relocation-server 를 활성화한 후, 재배치 소켓 연결을 청취하는 주소를 가리킵니다. Xen 하이퍼바이저는 특정 인터페이스에 있는 이전 네트워크 소통량 만을 청취합니다.
(xend-relocation-hosts-allow )
이 파라미터는 재배치 포트와 통신하는 호스트를 제어합니다. 값이 비어 있을 경우, 들어오는 연결 모두를 허용합니다. 이를 띄어쓰기로 구분된 정규 표현식 순서로 변경해야 합니다. 예:
(xend-relocation-hosts-allow- '^localhost\\.localdomain$' )>
FQDN (Fully Qualified Domain Name), IP 주소 또는 정규 표현식으로 구분된 공간을 포함한 값을 허용합니다.
설정 후 호스트를 재부팅하여 새 설정 사항을 불러옵니다.

21장. KVM 실시간 이전

다음 부분에서는 KVM 하이퍼바이저 상에서 실행되고 있는 게스트를 다른 KVM 호스트로 이전하는 방법에 대해 설명합니다.
Migration is the process of moving a virtualized guest from one host to another. Migration is a key feature of virtualization as software is completely separated from hardware. Migration is useful for:
  • 로드 밸런싱 - 호스트가 과부하되면 게스트는 사용도가 낮은 다른 호스트로 이동할 수 있습니다.
  • 하드웨어 장애 조치 - 호스트의 하드웨어 장치가 시작 실패할 경우, 게스트는 안전하게 재배치되므로 호스트는 시스템을 종료하여 복구될 수 있습니다.
  • 절전 - 게스트는 다른 호스트에 재배치되고 호스트 시스템은 에너지를 절약하고 사용량을 낮게하여 비용을 절감하기 위해 전원을 끌 수 있습니다.
  • 지역적 이전 - 게스트는 최저 지연을 위해 또는 심각한 상황에서 다른 위치로 이동할 수 있습니다.
Migrations can be performed live or offline. To migrate guests the storage must be shared. Migration works by sending the guests memory to the destination host. The shared storage stores the guest's default file system. The file system image is not sent over the network from the source host to the destination host.
오프라인 이전은 게스트를 일시 중지하고 게스트 메모리 이미지를 대상 호스트로 이동시킵니다. 게스트는 대상 호스트에서 다시 시작되어 소스 호스트에서 게스트가 사용하는 메모리는 해제됩니다.
오프라인 이전에 걸리는 시간은 네트워크 대역폭 및 지연 시간에 따라 달라집니다. 2GB 메모리를 갖는 게스트는 1 기가바이트 이더넷 링크에서 평균 10초 정도 걸릴 수 있습니다.
실시간 이전에서는 소스 호스트에서 실행되고 있는 게스트를 유지하여 게스트를 중지시키지 않고 메모리 이전을 시작합니다. 수정된 모든 메모리 페이지는 변경 사항을 감지하고 이미지가 전송되는 동안 대상으로 전송됩니다. 메모리는 변경된 페이지와 함께 업데이트됩니다. 프로세스는 게스트에 대해 허용된 일시 중지 시간이 전송될 마지막 페이지에 대해 예상된 시간과 일치할 때 까지 계속됩니다. KVM은 가상 게스트가 일시 중지된 매우 짧은 시간 동안 전송될 수 있는 남아있는 페이지 양을 예상할 때 까지 KVM은 남아있는 시간을 예상하고 소스에서 대상으로 최대 페이지 파일 양을 전송 시도합니다. 새 호스트 상의 등록을 불러온 후 게스트는 대상 호스트에서 다시 시작합니다. 게스트가 합치기되지 않을 경우 (게스트가 극한 부하 상태에 있을 경우 발생) 게스트는 일시 중지되고 대신 오프라인 이전이 시작됩니다.
오프라인 이전에 걸리는 시간은 네트워크 대역폭과 지연 시간에 따라 달라집니다. 네트워크를 많이 사용하고 있거나 대역폭이 낮은 경우 이전 시간이 더 길어지게 됩니다.

21.1. 실시간 이전 요구 사항

게스트 이전에는 다음과 같은 사항이 필요합니다:
이전 요구 사항
  • 다음 프로토콜 중 하나를 사용하고 있는 공유 네트워크 저장 장치에 설치된 가상 게스트:
    • 파이버 채널
    • iSCSI
    • NFS
    • GFS2
  • 동일한 업데이트를 갖는 동일한 버전의 Red Hat Enterprise Linux 시스템 2개 이상 .
  • 두 시스템은 올바른 포트를 열어야 합니다.
  • 두 시스템은 동일하게 네트워크가 설정되어 있어야 합니다. 모든 브리지 및 네트워크 설정은 두 호스트에서 정확하게 일치해야 합니다.
  • 저장 장치 공유는 소스 및 대상 시스템 상의 동일한 위치에 마운트되어야 합니다. 마운트된 디렉토리는 반드시 동일해야 합니다.
네트워크 저장 장치 설정
Configure shared storage and install a guest on the shared storage. For shared storage instructions, refer to V부. Virtualization Storage Topics.

21.2. 공유 저장 장치 예제: 단일 이전을 위한 NFS

다음 예제에서는 기타 다른 KVM 호스트로 게스트 이미지를 공유하기 위해 NFS를 사용하고 있습니다. 이러한 예제는 대형 설치에는 적합하지 않으며, 이는 단지 이전 기술 및 배치를 보여주기 위한 것입니다. 이 예제를 몇 가지 이상의 가상 게스트를 이전 또는 실행하는데 사용하지 마십시오.
For advanced and more robust shared storage instructions, refer to V부. Virtualization Storage Topics
  1. libvirt 이미지 디렉토리 내보내기

    기본값 이미지 디렉토리를 /etc/exports 파일에 추가합니다:
    /var/lib/libvirt/images *.example.com(rw,no_root_squash,async)
    
    환경에 필요한 호스트 파라미터를 변경합니다.
  2. NFS 시작

    1. NFS 패키지가 설치되어 있지 않을 경우 이를 설치합니다:
      # yum install nfs
      
    2. iptables에서 NFS에 해당하는 포트를 열고 /etc/hosts.allow 파일에 NFS를 추가합니다.
    3. NFS 서비스를 시작합니다:
      # service nfs start
      
  3. 대상에 공유 저장 장치 마운트하기

    대상 시스템에 /var/lib/libvirt/images 디렉토리를 마운트합니다:
    # mount sourceURL:/var/lib/libvirt/images /var/lib/libvirt/images
    

    소스 및 대상에서 위치가 동일해야 합니다.

    게스트에 대해 어떤 디렉토리를 선택했던지 간에 이는 동일한 호스트 및 게스트 상에 있어야 합니다. 이는 모든 유형의 공유 장치에 적용됩니다. 디렉토리는 동일해야 하며 그렇지 않을 경우 이전 실패하게 됩니다.

21.3. virsh로 실시간 KVM 이전

virsh 명령을 사용하여 게스트를 다른 호스트로 이전할 수 있습니다. migrate 명령은 다음과 같은 형식으로 파라미터를 허용합니다:
# virsh migrate --live GuestName DestinationURL
GuestName 파라미터는 이전하려는 게스트의 이름을 나타냅니다.
DestinationURL 파라미터는 대상 시스템의 URL 또는 호스트 이름입니다. 대상 시스템은 동일한 Red Hat Enterprise Linux 버전을 실행해야 하며, 동일한 하이퍼바이저를 사용하고 libvirt를 실행하고 있어야 합니다.
일단 명령을 입력하면 대상 시스템의 root 암호를 요청하게 됩니다.
예제: virsh를 사용하여 실시간 이전
예제에서는 test1.example.com에서 test2.example.com로 이전하고 있습니다. 사용자 환경에 따라 호스트 이름을 변경합니다. 예제에서는 RHEL4test라는 가상 장치를 이전하고 있습니다.
This example assumes you have fully configured shared storage and meet all the prerequisites (listed here: 이전 요구 사항 ).
  1. 실행되고 있는 게스트 확인

    test1.example.com 소스 시스템에서 RHEL4test가 실행되고 있는지 확인합니다:
    [root@test1 ~]# virsh list
    Id Name                 State
    ----------------------------------
     10 RHEL4                running
    
  2. 게스트 이전

    게스트를 대상 test2.example.com으로 실시간 이전하기 위해 다음 명령을 실행합니다. /system을 대상 URL의 마지막에 첨부하여 libvirt에게 완전 액세스가 필요함을 알립니다.
    # virsh migrate --live RHEL4test qemu+ssh://test2.example.com/system
    일단 명령을 입력하면 대상 시스템의 root 암호를 요청하게 됩니다.
  3. 대기

    게스트 크기 및 로딩에 따라 이전 시간이 길어질 수 있습니다. virsh는 오류만을 보고합니다. 게스트는 완전 이전될 때 까지 소스 호스트에서 계속 실행됩니다.
  4. 게스트가 대상 호스트에 도착하였는지 확인

    test2.example.com 대상 시스템에서 RHEL4test가 실행되고 있는지 확인합니다:
    [root@test2 ~]# virsh list
    Id Name                 State
    ----------------------------------
     10 RHEL4                running
    
이제 실시간 이전이 완료되었습니다.

기타 다른 네트워킹 방식

libvirt supports a variety of networking methods including TLS/SSL, unix sockets, SSH, and unencrypted TCP. Refer to 22장. 가상화 게스트의 원격 관리 for more information on using other methods.

21.4. virt-manager를 사용하여 이전

다음 부분에서는 virt-manager를 사용하여 KVM 기반 게스트를 이전하는 방법에 대해 설명합니다.
  1. 소스 및 대상 호스트에 연결합니다. 파일 메뉴에서 연결 추가를 클릭하면, 연결 추가 창이 나타납니다.
    다음과 같은 정보를 입력합니다:
    • 하이퍼바이저 (Hypervisor): QEMU를 선택합니다.
    • 연결 (Connection): 연결 유형을 선택합니다.
    • 호스트 이름 (Hostname): 호스트 이름을 입력합니다.
    연결 (Connect) 버튼을 클릭합니다.
    가상 장치 관리자는 연결된 호스트 목록을 보여줍니다.
  2. 동일한 NFS를 사용하여 소스 및 대상 호스트에 저장 장치 풀을 추가합니다.
    편집 메뉴에서 호스트 상세 정보를 클릭하면, 호스트 상세 정보 창이 나타납니다.
    저장 장치 탭을 클릭합니다.
  3. 새 저장 장치 풀을 추가합니다. 화면의 왼쪽 하단 부분에 있는 + 버튼을 클릭하면, 새 저장 장치 풀 창이 나타납니다.
    다음과 같은 정보를 입력합니다:
    • 이름: 저장 장치 풀의 이름을 입력합니다.
    • 유형: netfs: Network Exported Directory를 선택합니다.
    다음 버튼을 클릭합니다.
  4. 다음과 같은 정보를 입력합니다:
    • 포맷: 저장 장치 유형을 선택합니다. 이는 실시간 이전을 위한 NFS 또는 iSCSI가 되어야 합니다.
    • 호스트 이름: 저장 장치 서버의 IP 주소 또는 FQDN(Fully Qualified Domain Name)을 입력합니다.
    완료 버튼을 클릭합니다.
  5. 공유 저장 장치 풀에 새 볼륨을 생성하고, 새 볼륨을 클릭합니다.
  6. 상세 정보를 입력하고 볼륨 생성을 클릭합니다.
  7. 새 볼륨과 함께 가상 장치를 생성한 후, 가상 장치를 실행합니다.
    가상 장치 창이 나타납니다.
  8. 가상 장치 관리자 창에 있는 가상 장치를 오른쪽 클릭하고, 이전 (Migrate)을 선택한 후 이전할 위치를 클릭합니다.
  9. 예 (Yes)를 클릭하여 이전을 확인합니다.
    The Virtual Machine Manager displays the virtual machine in its new location.
    The VNC connection displays the remote host's address in its title bar.

22장. 가상화 게스트의 원격 관리

다음 부분에서는 ssh 또는 TLS 및 SSL을 사용하여 가상 게스트를 원격 관리하는 방법에 대해 설명합니다.

22.1. SSH를 통한 원격 관리

ssh 패키지는 원격 가상 장치로 안전하게 보안 기능을 전송할 수 있는 암호화된 네트워크 프로토콜을 제공합니다. 설명된 방식은 원격 장치를 관리하기 위해 SSH 연결을 통해 libvirt 관리 연결 보안 터널을 사용합니다. SSH 공개키 암호화 방식 및 로컬 SSH 에이전트에 의한 암호 또는 암호 문구를 사용하여 모든 인증을 처리합니다. 각각의 게스트 가상 장치에 대해 VNC 콘솔은 SSH를 통해 터널링됩니다.
주로 ssh는 디폴트로 설정되므로 SSH 키가 이미 설정되어 있어 관리 서비스 또는 VNC 콘솔에 액세스하기 위해 추가로 방화벽 규칙을 설정할 필요가 없습니다.
가상 장치를 원격으로 관리하기 위해 SSH 사용함에 있어서 다음과 같은 사항에 유의합니다:
  • 가상 장치를 관리하기 위해 원격 장치로의 root 로그인 액세스가 필요합니다.
  • 초기 연결 설정 프로세스가 느려질 수 도 있습니다
  • there is no standard or trivial way to revoke a user's key on all hosts or guests, and
  • ssh는 대량의 원격 장치를 잘 측정하지 못합니다.
Configuring password less or password managed SSH access for virt-manager
The following instructions assume you are starting from scratch and do not already have SSH keys set up. If you have SSH keys set up and copied to the other systems you can skip this procedure.

The user is important for remote management

SSH keys are user dependent. Only the user who owns the key may access that key.
virt-manager must run as the user who owns the keys to connect to the remote host. That means, if the remote systems are managed by a non-root user virt-manager must be run in unprivileged mode. If the remote systems are managed by the local root user then the SSH keys must be own and created by root.
You cannot manage the local host as an unprivileged user with virt-manager.
  1. Optional: Changing user

    Change user, if required. This example uses the local root user for remotely managing the other hosts and the local host.
    $ su -
  2. Generating the SSH key pair

    Generate a public key pair on the machine virt-manager is used. This example uses the default key location, in the ~/.ssh/ directory.
    $ ssh-keygen -t rsa
    
  3. Coping the keys to the remote hosts

    Remote login without a password, or with a passphrase, requires an SSH key to be distributed to the systems being managed. Use the ssh-copy-id command to copy the key to root user at the system address provided (in the example, root@example.com).
    # ssh-copy-id -i ~/.ssh/id_rsa.pub root@example.com root@example.com's password: Now try logging into the machine, with "ssh 'root@example.com'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting 
    
    Repeat for other systems, as required.
  4. Optional: Add the passphrase to the ssh-agent

    Add the passphrase for the SSH key to the ssh-agent, if required. On the local host, use the following command to add the passphrase (if there was one) to enable password-less login.
    # ssh-add ~/.ssh/id_rsa.pub
The SSH key was added to the remote system.
libvirt 데몬 (libvirtd)
The libvirt daemon provide an interface for managing virtual machines. You must have the libvirtd daemon installed and running on every remote host that needs managing.
$ ssh root@somehost
# chkconfig libvirtd on
# service libvirtd start
libvirtdSSH가 설정된 후 원격으로 액세스하여 가상 장치를 관리할 수 있어야 합니다. 이 때 VNC를 사용하여 게스트를 액세스할 수 도 있어야 합니다.
Accessing remote hosts with virt-manager
Remote hosts can be managed with the virt-manager GUI tool. SSH keys must belong to the user executing virt-manager for password-less login to work.
  1. Start virt-manager.
  2. Open the File->Add Connection menu.
  3. Input values for the hypervisor type, the connection, Connection->Remote tunnel over SSH, and enter the desired hostname, then click connection.

22.2. TLS 및 SSL을 통한 원격 관리

You can manage virtual machines using TLS and SSL. TLS and SSL provides greater scalability but is more complicated than ssh (refer to 22.1절. “SSH를 통한 원격 관리 ”). TLS and SSL is the same technology used by web browsers for secure connections. The libvirt management connection opens a TCP port for incoming connections, which is securely encrypted and authenticated based on x509 certificates. In addition the VNC console for each guest virtual machine will be setup to use TLS with x509 certificate authentication.
This method does not require shell accounts on the remote machines being managed. However, extra firewall rules are needed to access the management service or VNC console. Certificate revocation lists can revoke users' access.
virt-manager 용 TLS/SSL 액세스 설정 절차
다음 부분에서는 어떤 TLS/SSL 인증 관련 지식이 없이 처음부터 시작한다고 가정하고 설명합니다. 인증 관리 서버가 있으실 경우 첫번째 절차를 생략하실 수 있습니다.
libvirt 서버 설정
인증서 설정에 관한 보다 자세한 내용은 libvirt 웹사이트 http://libvirt.org/remote.html에서 참조하시기 바랍니다.
Xen VNC 서버
Xen VNC 서버는 /etc/xen/xend-config.sxp 설정 파일을 편집하여 TLS를 활성화할 수 있습니다. 설정 파일에서 (vnc-tls 1) 설정 파라미터에 있는 주석을 삭제합니다.
The /etc/xen/vnc directory needs the following 3 files:
  • ca-cert.pem - The CA certificate
  • server-cert.pem - The Server certificate signed by the CA
  • server-key.pem - The server private key
This provides encryption of the data channel. It might be appropriate to require that clients present their own x509 certificate as a form of authentication. To enable this remove the commenting on the (vnc-x509-verify 1) parameter.
virt-managervirsh 클라이언트 설정
여기서 클라이언트를 위한 설정은 다소 일관성이 없습니다. TLS를 통해 libvirt 관리 API를 활성화하려면 CA 및 클라이언트 인증서가 반드시 /etc/pki에 위치해 있어야 합니다. 보다 자세한 내용은 http://libvirt.org/remote.html에서 참조하시기 바랍니다.
In the virt-manager user interface, use the 'SSL/TLS' transport mechanism option when connecting to a host.
virsh의 경우 URI는 다음과 같은 형식으로 되어 있습니다:
  • KVM의 경우 qemu://hostname.guestname/system
  • Xen의 경우 xen://hostname.guestname/
VNC 용 SSL 및 TLS을 활성화하려면, 인증서 권한 및 클라이언트 인증서가 $HOME/.pki에 위치해 있어야 합니, 즉 다음의 세 개의 파일이 이에 해당합니다:
  • CA 또는 ca-cert.pem - CA 인증서
  • libvirt-vnc 또는 clientcert.pem - CA에 의해 인증된 클라이언트 인증서
  • libvirt-vnc 또는 clientkey.pem - 클라이언트 개인키

22.3. 전송 모드

원격 관리의 경우 libvirt는 다음과 같은 전송 모드를 지원합니다:
TLS (Transport Layer Security)
Transport Layer Security TLS 1.0 (SSL 3.1)은 주로 공개 포트 번호에서 청취하는 TCP/IP 소켓을 인증 및 암호화합니다. 이를 사용하려면 클라이언트 및 서버 인증을 생성해야 합니다. 표준 포트는 16514입니다.
UNIX 소켓
Unix 도메인 소켓은 로컬 장치에서만 액세스할 수 있습니다. 소켓은 암호화되지 않으며 인증을 위해 UNIX 권한 또는 SELinux를 사용합니다. 표준 소켓 이름은 /var/run/libvirt/libvirt-sock/var/run/libvirt/libvirt-sock-ro 입니다. (읽기 전용 연결의 경우)
SSH
보안 쉘 프로토콜 (SSH) 연결을 통해 전송됩니다. Netcat (nc 패키지)를 설치해야 합니다. libvirt 데몬 (libvirtd)은 원격 장치 상에서 실행해야 합니다. 포트 22는 SSH 액세스에 대해 열려야 합니다. 일부 ssh 키 관리 종류를 사용 (예: ssh-agent 유틸리티)하거나 또는 암호를 입력하라는 메세지가 나타나게 됩니다.
ext
ext 파라미터는 libvirt 범위 밖의 수단으로 원격 장치에 연결할 수 있는 외부 프로그램에 대해 사용됩니다. 이러한 파라미터는 지원되지 않습니다.
tcp
암호화되지 않은 TCP/IP 소켓. 일반 제품 사용 용도로 적합히지 않으며, 이는 주로 비활성화되어 있지만 관리자가 테스트 목적으로 이를 활성화하거나 신뢰하는 네트워크를 통해 사용할 수 있습니다. 기본값 포트는 16509입니다.
기타 다른 값이 지정되어 있지 않을 경우, 기본값 전송은 tls입니다.
원격 URI
URI (Uniform Resource Identifier)는 원격 호스트로 연결하기 위해 virshlibvirt에 의해 사용됩니다. URI는 원격 호스트에서 단일 명령이나 이전을 실행하기 위해 virsh 명령에 대해 --connect 파라미터와 함께 사용될 수 있습니다.
libvirt URI는 일반적인 형식을 취합니다 (사각 괄호, "[]"에 있는 내용은 옵션 기능을 나타냄):
driver[+transport]://[username@][hostname][:port]/[path][?extraparameters]
외부 위치를 대상으로 하기 위해 전송 방식이나 호스트 이름을 제공해야 합니다.
원격 관리 파라미터 예제
  • SSH 전송 및 SSH 사용자 이름 ccurran을 사용하여 towada라는 호스트 상의 원격 Xen 하이퍼바이저로 연결합니다.
    xen+ssh://ccurran@towada/
    
  • TLS를 사용하는 towada라는 호스트 이름에서 원격 Xen 하이퍼바이저로 연결합니다.
    xen://towada/
    
  • Connect to a remote Xen hypervisor on host towada using TLS. The no_verify=1 tells libvirt not to verify the server's certificate.
    xen://towada/?no_verify=1
    
  • SSH를 사용하여 towada 호스트에 있는 원격 KVM 하이퍼바이저로 연결합니다.
    qemu+ssh://towada/system
    
예제 테스트
  • 비표준 UNIX 소켓으로 로컬 KVM 하이퍼바이저에 연결합니다. 이러한 경우 Unix 소켓으로의 완전 경로는 정확하게 제공됩니다.
    qemu+unix:///system?socket=/opt/libvirt/run/libvirt/libvirt-sock
    
  • 암호화되지 않은 TCP/IP 연결을 사용하여 libvirt 데몬에 포트 5000에 있는 IP 주소 10.1.1.10을 사용하여 서버에 연결합니다. 이는 기본 설정과 함께 테스트 드라이버를 사용합니다.
    test+tcp://10.1.1.10:5000/default
    
추가 URI 파라미터
Extra parameters can be appended to remote URIs. The table below 표 22.1. “추가 URI 파라미터 ” covers the recognized parameters. All other parameters are ignored. Note that parameter values must be URI-escaped (that is, a question mark (?) is appended before the parameter and special characters are converted into the URI format).
표 22.1. 추가 URI 파라미터
이름 전송 모드 설명 사용 예제
이름 모든 모드 이름은 원격 virConnectOpen 함수에 전달됩니다. 주로 원격 URI에서 전송, 호스트 이름, 포트 번호, 사용자 이름, 추가 파라미터를 제거하여 이름이 형성되지만 특정한 경우 명시적으로 이름을 제공하는 것이 더 나을 수 있습니다. name=qemu:///system
명령 ssh 및 ext 외부 명령. ext 전송의 경우 필요합니다. ssh의 경우 기본값은 ssh입니다. 경로(PATH)는 명령으로 검색됩니다. command=/opt/openssh/bin/ssh
소켓 unix 및 ssh 기본값을 덮어쓰기하는 UNIX 도메인 소켓으로의 경로. ssh 전송의 경우, 이는 원격 netcat 명령으로 전달됩니다 (netcat 참조). socket=/opt/libvirt/run/libvirt/libvirt-sock
netcat ssh
netcat 명령을 사용하여 원격 시스템으로 연결할 수 있습니다. 기본 netcat 파라미터는 nc 명령을 사용합니다. SSH 전송의 경우, libvirt는 아래의 형식을 사용하여 SSH 명령을 구성합니다:
								command -p port [-l username] hostname
								netcat -U socket
port, username, hostname 파라미터는 원격 URI의 부분으로 지정될 수 있습니다. command, netcat, socket은 기타 다른 추가 파라미터에서 비롯됩니다.
netcat=/opt/netcat/bin/nc
no_verify tls If set to a non-zero value, this disables client checks of the server's certificate. Note that to disable server checks of the client's certificate or IP address you must change the libvirtd configuration. no_verify=1
no_tty ssh 0이 아닌 값으로 설정되어 있을 경우, 자동으로 원격 장치에 로그인(ssh-agent 또는 이와 유사하게 사용)할 수 없으면 이는 암호를 요청하는 ssh를 중지하게 됩니다. no_tty=1

부 V. Virtualization Storage Topics

Introduction to storage administration for virtualization

This part covers using shared, networked storage with virtualization on Red Hat Enterprise Linux.
The following methods are supported for virtualization:
  • Fibre Channel
  • iSCSI
  • NFS
  • GFS2
Networked storage is essential for live and offline guest migrations. You cannot migrate guests without shared storage.

23장. Using shared storage with virtual disk images

This chapter covers the use of shared and network storage devices for virtual disks.

23.1. Using iSCSI for storing virtual disk images

This section demonstrates how to set up an iSCSI target on Red Hat Enterprise Linux and how to configure iSCSI on a libvirt KVM host using virsh, and finally how to provision a guest on iSCSI using virt-install.

중요

Setting up a Red Hat Enterprise Linux server as an iSCSI target is not recommended. The example used in this section should not be used in production, and is provided as an example which should only be referred to for basic shared storage testing and educational purposes.

23.1.1. How to set up an iSCSI target on Red Hat Enterprise Linux

  1. Install and enable the iSCSI target service

    Install and enable the iSCSI target service with the following commands:
    # yum install scsi-target-utils
    # chkconfig tgtd on
    # service tgtd start
    

    중요

    The scsi-target-utils package required for this example is provided only in the Cluster Storage add-on for Red Hat Enterprise Linux 5, and may not be available for your system. Contact your support agent to activate this add-on if you are currently unable to install this package.
  2. Allocate storage for the LUNs

    The iSCSI target service is not dependent on a particular type of exported LUN. The LUNs can be plain files, LVM volumes, or block devices. There is however a performance overhead if using the LVM and/or file system layers as compared to block devices. The guest providing the iSCSI service in this example has no spare block or LVM devices, so raw files will be used.
    This example demonstrates the creation of two LUNs; one is a 10GB thin-provisioned (sparse file) LUN, and the other has 500MB, of which are fully-allocated. The following commands will achieve this configuration. Be aware that your environment will be different and this is provided only as an example:
    # mkdir -p /var/lib/tgtd/kvmguest
    # dd if=/dev/zero of=/var/lib/tgtd/kvmguest/rhelx86_64.img bs=1M seek=10240 count=0
    # dd if=/dev/zero of=/var/lib/tgtd/kvmguest/shareddata.img bs=1M count=512
    # restorecon -R /var/lib/tgtd
    
  3. Export the iSCSI target and LUNs

    For Red Hat Enterprise Linux 5, a series of tgtadm commands is required to create a target and associate the storage volumes created earlier. First, the following command adds a target using an iSCSI Qualified Name (IQN):
    # tgtadm --lld iscsi --op new --mode target --tid 1 --targetname \ 
    iqn.2004-04.rhel:rhel5:iscsi.kvmguest
    
    Now the storage volumes must be associated with LUNs in the iSCSI target with these two commands:
    # tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 \
    --backing-store /var/lib/tgtd/kvmguest/rhelx86_64.img
    
    # tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 2 \
    --backing-store /var/lib/tgtd/kvmguest/shareddata.img
    

    중요

    Add the previous 3 tgtadm commands to the end of the /etc/rc.local file to ensure normal operation upon restarting of the system.
    To confirm the successful operation of the previous commands, query the iSCSI target setup:
    tgtadm --lld iscsi --op show --mode target
    Target 1: iqn.2004-04.rhel:rhel5:iscsi.kvmguest
        System information:
            Driver: iscsi
            State: ready
        I_T nexus information:
        LUN information:
            LUN: 0
                Type: controller
                SCSI ID: IET     00010000
                SCSI SN: beaf10
                Size: 0 MB, Block size: 1
                Online: Yes
                Removable media: No
                Readonly: No
                Backing store type: null
                Backing store path: None
                Backing store flags: 
            LUN: 1
                Type: disk
                SCSI ID: IET     00010001
                SCSI SN: beaf11
                Size: 10737 MB, Block size: 512
                Online: Yes
                Removable media: No
                Readonly: No
                Backing store type: rdwr
                Backing store path: /var/lib/tgtd/kvmguest/rhelx86_64.img
                Backing store flags: 
            LUN: 2
                Type: disk
                SCSI ID: IET     00010002
                SCSI SN: beaf12
                Size: 537 MB, Block size: 512
                Online: Yes
                Removable media: No
                Readonly: No
                Backing store type: rdwr
                Backing store path: /var/lib/tgtd/kvmguest/shareddata.img
                Backing store flags: 
        Account information:
        ACL information:
    
  4. Allow client access to the target

    Finally, this example command allows access to all clients without any authentication:
    # tgtadm --lld iscsi --op bind --mode target --tid 1 --initiator-address ALL
    

Two common mistakes

The two most common problems encountered when configuring the iSCSI target are SELinux and iptables. If adding plain files as LUNs in an iSCSI target, ensure the files are labelled system_u:object_r:tgtd_var_lib_t:s0. TCP port 3260 must also be open in your iptables configuration.

23.1.2. How to configure iSCSI on a libvirt KVM host and provision a guest using virt-install

The previous section described how to set up an iSCSI target. This section demonstrates how to configure iSCSI on a libvirt KVM instance using virsh, and then how to provision a guest using virt-install.
  1. Defining the storage pool

    All libvirt storage is managed through storage pools, of which there are many possible types: SCSI, NFS, ext4, plain directory and iSCSI. All libvirt objects are configured via XML description files, and storage pools are no different in this regard. For an iSCSI storage pool there are three important pieces of information to provide:
    • The target path - this determines how libvirt will expose device paths for the pool. Paths like /dev/sda and /dev/sdb are not an ideal choice as they can change between reboots, and can change across machines within a cluster; in other words, the names are assigned on a first come, first served basis by the kernel. It is strongly recommended to use the /dev/disk/by-path format. This results in a consistent naming scheme across all machines.
    • The host name - this is simply the fully-qualified DNS name of the iSCSI server.
    • The source path - this is the iSCSI qualified name (IQN) seen in the previous setup procedure (iqn.2004-04.rhel:rhel5:iscsi.kvmguest).
    Although your environment will likely be different, the following text is what an iSCSI configuration will look like:
    <pool type='iscsi'>
        <name>kvmguest</name>
        <source>
            <host name='myiscsi.example.com'/>
            <device path='iqn.2004-04.rhel:rhel5:iscsi.kvmguest'/>
        </source>
        <target>
            <path>/dev/disk/by-path</path>
        </target>
    </pool>
    
    Save this XML code to a file named iscsirhel5.xml and load it into libvirt using the pool-define command:
    # virsh pool-define iscsirhel5.xml
    Pool kvmguest defined from iscsirhel5.xml
    
    # virsh pool-list --all
    Name                 State      Autostart
    -----------------------------------------
    default              active     yes
    kvmguest             inactive   no
    
  2. Starting the storage pool

    The configuration is saved, but the iSCSI target has not yet been logged into, so no LUNs will be visible on the host at this point. Use the pool-start command the make the LUNs visible with the vol-list command.
    # virsh pool-start kvmguest
    Pool kvmguest started
    
    # virsh vol-list kvmguest
    Name                 Path
    -----------------------------------------
    10.0.0.1             /dev/disk/by-path/ip-192.168.122.2:3260-iscsi-iqn.2004-04.rhel:rhel5:iscsi.kvmguest-lun-1
    10.0.0.2             /dev/disk/by-path/ip-192.168.122.2:3260-iscsi-iqn.2004-04.rhel:rhel5:iscsi.kvmguest-lun-2
    
  3. Querying LUN information

    Further information about each LUN can be obtained using the vol-info and vol-dumpxml commands:
    # virsh vol-info /dev/disk/by-path/ip-192.168.122.2:3260-iscsi-iqn.2004-04.rhel:rhel5:iscsi.kvmguest-lun-1
    
    Name:           10.0.0.1
    Type:           block
    Capacity:       10.00 GB
    Allocation:     10.00 GB
    
    
    # virsh vol-dumpxml /dev/disk/by-path/ip-192.168.122.2:3260-iscsi-iqn.2004-04.rhel:rhel5:iscsi.kvmguest-lun-1
    <volume>
      <name>10.0.0.1</name>
      <key>/dev/disk/by-path/ip-192.168.122.2:3260-iscsi-iqn.2004-04.rhel:rhel5:iscsi.kvmguest-lun-1</key>
      <source>
      </source>
      <capacity>10737418240</capacity>
      <allocation>10737418240</allocation>
      <target>
        <path>/dev/disk/by-path/ip-192.168.122.2:3260-iscsi-iqn.2004-04.rhel:rhel5:iscsi.kvmguest-lun-2</path>
        <format type='unknown'/>
        <permissions>
          <mode>0660</mode>
          <owner>0</owner>
          <group>6</group>
          <label>system_u:object_r:fixed_disk_device_t:s0</label>
        </permissions>
      </target>
    </volume>
    
  4. Activating the storage at boot time

    If everything is configured properly, the pool can be set to start automatically upon booting of the host:
    # virsh pool-autostart kvmguest
    Pool kvmguest marked as autostarted
    
  5. Provisioning a guest on iSCSI

    The virt-install command can be used to install new guests from the command line. The --disk argument can take the name of a storage pool, followed by the name of any contained volumes. Continuing this example, the following command will begin the installation of a guest with two disks; the first disk is the root file system, the second disk can be shared between multiple guests for common data:
    # virt-install --accelerate --name rhelx86_64 --ram 800 --vnc --disk \ vol=kvmguest/10.0.0.1 --disk vol=kvmguest/10.0.0.2,perms=sh --pxe
    
    Once this rhelx86_64 guest is installed, the following command and output shows the XML that virt-install used to associate the guest with the iSCSI LUNs:
    # virsh dumpxml rhelx86_64
    
    <domain type='kvm' id='4'>
      <name>rhelx86_64</name>
      <uuid>ad8961e9-156f-746f-5a4e-f220bfafd08d</uuid>
      <memory>819200</memory>
      <currentMemory>819200</currentMemory>
      <vcpu>1</vcpu>
      <os>
        <type arch='x86_64' machine='rhel'>hvm</type>
        <boot dev='network'/>
      </os>
      <features>
        <acpi/>
        <apic/>
        <pae/>
      </features>
      <clock offset='utc'/>
      <on_poweroff>destroy</on_poweroff>
      <on_reboot>destroy</on_reboot>
      <on_crash>destroy</on_crash>
      <devices>
        <emulator>/usr/libexec/qemu-kvm</emulator>
        <disk type='block' device='disk'>
          <driver name='qemu' type='raw'/>
          <source dev='/dev/disk/by-path/ip-192.168.122.170:3260-iscsi-iqn.2004-04.rhel:rhel5:iscsi.kvmguest-lun-1'/>
          <target dev='hda' bus='ide'/>
          <alias name='ide0-0-0'/>
          <address type='drive' controller='0' bus='0' unit='0'/>
        </disk>
        <disk type='block' device='disk'>
          <driver name='qemu' type='raw'/>
          <source dev='/dev/disk/by-path/ip-192.168.122.170:3260-iscsi-iqn.2004-04.rhel:rhel5:iscsi.kvmguest-lun-2'/>
          <target dev='hdb' bus='ide'/>
          <shareable/>
          <alias name='ide0-0-1'/>
          <address type='drive' controller='0' bus='0' unit='1'/>
        </disk>
        <controller type='ide' index='0'>
          <alias name='ide0'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
        </controller>
        <interface type='network'>
          <mac address='52:54:00:0a:ca:84'/>
          <source network='default'/>
          <target dev='vnet1'/>
          <alias name='net0'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
        </interface>
        <serial type='pty'>
          <source path='/dev/pts/28'/>
          <target port='0'/>
          <alias name='serial0'/>
        </serial>
        <console type='pty' tty='/dev/pts/28'>
          <source path='/dev/pts/28'/>
          <target port='0'/>
          <alias name='serial0'/>
        </console>
        <input type='mouse' bus='ps2'/>
        <graphics type='vnc' port='5901' autoport='yes' keymap='en-us'/>
        <video>
          <model type='cirrus' vram='9216' heads='1'/>
          <alias name='video0'/>
          <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
        </video>
      </devices>
    </domain>
    
    There are two important items of note in this output:
    • The guest uses the large /dev/disk/by-path paths to refer to the LUNs. As described earlier, this is so that file names and paths will remain constant.
    • The second disk has the <shareable/> flag set. Critical for the disk to be safely shared between guests, this ensures that the SELinux labelling will be appropriate for multiple guests to access the disk and that all I/O caching is disabled on the host.
For migration of guests between hosts to succeed, some form of shared storage is required. Although NFS is often used for this purpose, the lack of SELinux labelling for NFS means there is limited sVirt protection between guests. This lack of sVirt support could allow one guest to use another guest's disks, which is usually undesirable.
Using iSCSI provides full sVirt isolation between guests to the same degree of non-shared storage.

부 VI. 가상화 참조 가이드

24장. 가상화 도구

다음은 Xen을 실행하는 시스템에서 유용한 디버깅 및 네트워킹 도구 목록, 가상화 관리를 위한 도구 목록입니다.
시스템 관리 도구
  • vmstat
  • iostat
  • lsof
    # lsof -i :5900
    xen-vncfb 10635  root  5u  IPv4 218738  TCP grumble.boston.redhat.com:5900 (LISTEN)
    
  • qemu-img
고급 디버깅 도구
  • systemTap
  • crash
  • xen-gdbserver
  • sysrq
  • sysrq t
  • sysrq w
  • sysrq c
네트워킹
brtcl
  • # brctl show
    bridge name  bridge id            STP enabled    interfaces
    xenbr0       8000.feffffffffff    no             vif13.0
    						 pdummy0
                                                     vif0.0
    
  • # brctl showmacs xenbr0
    port no  mac addr                is local?       aging timer
      1      fe:ff:ff:ff:ff:ff       yes             0.00
    
  • # brctl showstp xenbr0
    xenbr0
    bridge id              8000.feffffffffff
    designated root        8000.feffffffffff
    root port              0                    path cost                 0
    max age                20.00                bridge max age            20.00
    hello time             2.00                 bridge hello time         2.00
    forward delay          0.00                 bridge forward delay      0.00
    aging time            300.01
    hello timer            1.43                 tcn timer                 0.00
    topology change timer  0.00                 gc timer                  0.02
    flags
    
    vif13.0 (3)
    port id                8003                 state                    forwarding
    designated root        8000.feffffffffff    path cost                100
    designated bridge      8000.feffffffffff    message age timer        0.00
    designated port        8003                 forward delay timer      0.00
    designated cost        0                    hold timer               0.43
    flags
    
    pdummy0 (2)
    port id                8002                 state                    forwarding
    designated root        8000.feffffffffff    path cost                100
    designated bridge      8000.feffffffffff    message age timer        0.00
    designated port        8002                 forward delay timer      0.00
    designated cost        0                    hold timer               0.43
    flags
    
    vif0.0 (1)
    port id                8001                 state                    forwarding
    designated root        8000.feffffffffff    path cost                100
    designated bridge      8000.feffffffffff    message age timer        0.00
    designated port        8001                 forward delay timer      0.00
    designated cost        0                    hold timer               0.43
    flags
    
  • ifconfig
  • tcpdump
KVM 도구
  • ps
  • pstree
  • top
  • kvmtrace
  • kvm_stat
Xen 도구
  • xentop
  • xm dmesg
  • xm log

25장. virsh를 사용한 게스트 관리

virsh는 게스트 및 하이퍼바이저 관리를 위한 명령행 인터페이스 도구입니다.
virsh 도구는 libvirt 관리 API에 작성되며 xm 또는 그래픽형식 게스트 관리자 (virt-manager)를 대체하는 도구로서 사용됩니다. virsh는 비권한 사용자에 의해 읽기 전용 모드로 사용될 수 있습니다. virsh를 사용하여 게스트 장치에 대한 스크립트를 실행할 수 있습니다.
virsh 명령 빠른 참조
다음 표에서는 모든 virsh 명령행 옵션에 대해 빠른 참조를 제공합니다.
표 25.1. 게스트 관리 명령
명령 설명
help 기본적인 도움말 정보를 출력합니다.
list 모든 게스트를 나열합니다.
dumpxml 게스트 용 XML 설정 파일을 출력합니다.
create XML 설정 파일에서 게스트를 생성하고 새 게스트를 시작합니다.
start 비활성화 게스트를 시작합니다.
destroy 중지하기 위해 게스트를 강제합니다.
define 게스트 용 XML 설정 파일을 출력합니다.
domid Displays the guest's ID.
domuuid Displays the guest's UUID.
dominfo 게스트 정보를 보여줍니다.
domname Displays the guest's name.
domstate 게스트 상태를 보여줍니다.
quit 상호 대화식 터미널을 종료합니다.
reboot 게스트를 재부팅합니다.
restore 파일에 복구된 이전에 저장한 게스트를 다시 복구합니다.
resume 일시 중지된 게스트를 다시 시작합니다.
save 게스트의 현재 상태를 파일에 저장합니다.
shutdown 게스트를 종료합니다.
suspend 게스트를 일시 중지합니다.
undefine 게스트와 관련된 모든 파일을 삭제합니다.
migrate 게스트를 다른 호스트로 이전합니다.

다음의 virsh 명령 옵션을 사용하여 게스트 및 하이퍼바이저 리소스를 관리합니다:
표 25.2. 리소스 관리 옵션
명령 설명
setmem 게스트에 대해 할당된 메모리를 설정합니다.
setmaxmem 하이퍼바이저에 대해 최대 메모리 한계를 설정합니다.
setvcpus 게스트에 할당된 가상 CPU 수를 변경합니다.
vcpuinfo 게스트에 관한 가상 CPU 정보를 보여줍니다.
vcpupin 게스트의 가상 CPU 친화력을 제어합니다.
domblkstat 실행 중인 게스트에 대해 블록 장치 통계를 보여줍니다.
domifstat 실행 중인 게스트에 대해 네트워크 인터페이스 통계를 보여줍니다.
attach-device XML 파일에 있는 장치 정의를 사용하여 게스트에 장치를 부착합니다.
attach-disk 게스트에 새 디스크 장치를 부착합니다.
attach-interface 게스트에 새 네트워크 인터페이스를 부착합니다.
detach-device 게스트에서 장치를 분리하고, attach-device 명령으로 동일한 종류의 XML 설명을 얻습니다.
detach-disk 게스트에서 디스크 장치를 분리합니다.
detach-interface 게스트에서 네트워크 인터페이스를 분리합니다.

기타 virsh 옵션은 다음과 같습니다:
표 25.3. 기타 옵션
명령 설명
version virsh 버전 보기
nodeinfo 하이퍼바이저에 관한 정보 출력

하이퍼바이저로 접속
virsh로 하이퍼바이저 세션 연결:
# virsh connect {hostname OR URL}
여기서 <name>은 하이퍼바이저의 장치 이름입니다. 읽기-전용 연결을 시작하려면, 위 명령에 -readonly를 추가합니다.
가상 장치 XML 덤프 (설정 파일) 생성
Output a guest's XML configuration file with virsh:
# virsh dumpxml {domain-id, domain-name or domain-uuid}
This command outputs the guest's XML configuration file to standard out (stdout). You can save the data by piping the output to a file. An example of piping the output to a file called guest.xml:
# virsh dumpxml GuestID > guest.xml
This file guest.xml can recreate the guest (refer to Editing a guest's configuration file. You can edit this XML configuration file to configure additional devices or to deploy additional guests. Refer to 33.1절. “virsh로 XML 설정 파일 사용 ” for more information on modifying files created with virsh dumpxml.
virsh dumpxml 명령 출력 결과의 예는 다음과 같습니다:
# virsh dumpxml r5b2-mySQL01
<domain type='xen' id='13'>
    <name>r5b2-mySQL01</name>
    <uuid>4a4c59a7ee3fc78196e4288f2862f011</uuid>
    <bootloader>/usr/bin/pygrub</bootloader>
    <os>
        <type>linux</type>
        <kernel>/var/lib/libvirt/vmlinuz.2dgnU_</kernel>
	<initrd>/var/lib/libvirt/initrd.UQafMw</initrd>
        <cmdline>ro root=/dev/VolGroup00/LogVol00 rhgb quiet</cmdline>
    </os>
    <memory>512000</memory>
    <vcpu>1</vcpu>
    <on_poweroff>destroy</on_poweroff>
    <on_reboot>restart</on_reboot>
    <on_crash>restart</on_crash>
    <devices>
        <interface type='bridge'>
            <source bridge='xenbr0'/>
            <mac address='00:16:3e:49:1d:11'/>
            <script path='vif-bridge'/>
        </interface>
        <graphics type='vnc' port='5900'/>
        <console tty='/dev/pts/4'/>
    </devices>
</domain>
설정 파일에서 게스트 생성
Guests can be created from XML configuration files. You can copy existing XML from previously created guests or use the dumpxml option (refer to 가상 장치 XML 덤프 (설정 파일) 생성 ). To create a guest with virsh from an XML file:
# virsh create configuration_file.xml
Editing a guest's configuration file
Instead of using the dumpxml option (refer to 가상 장치 XML 덤프 (설정 파일) 생성 ) guests can be edited either while they run or while they are offline. The virsh edit command provides this functionality. For example, to edit the guest named softwaretesting:
# virsh edit softwaretesting
이는 텍스트 편집기를 엽니다. 기본값 텍스트 편집기는 $EDITOR 쉘 파라미터입니다. (기본값으로 vi로 설정)
게스트 일시 중지
virsh를 사용하여 게스트 일시 중지:
# virsh suspend {domain-id, domain-name or domain-uuid}
When a guest is in a suspended state, it consumes system RAM but not processor resources. Disk and network I/O does not occur while the guest is suspended. This operation is immediate and the guest can be restarted with the resume (게스트 재시작 ) option.
게스트 재시작
resume 옵션을 사용하여 virsh로 일시 중지 상태의 게스트를 복구하려면 다음을 실행합니다:
# virsh resume {domain-id, domain-name or domain-uuid}
이 기능은 즉각적이며, 게스트 파라미터는 suspendresume 실행에서 보존됩니다.
게스트 저장
virsh 명령을 사용하여 현재 게스트 상태를 파일에 저장하려면 다음을 실행합니다:
# virsh save {domain-name, domain-id or domain-uuid} filename
This stops the guest you specify and saves the data to a file, which may take some time given the amount of memory in use by your guest. You can restore the state of the guest with the restore (게스트 복구 ) option. Save is similar to pause, instead of just pausing a guest the present state of the guest is saved.
게스트 복구
Restore a guest previously saved with the virsh save command (게스트 저장 ) using virsh:
# virsh restore filename
This restarts the saved guest, which may take some time. The guest's name and UUID are preserved but are allocated for a new id.
게스트 종료
virsh 명령을 사용하여 게스트를 종료하려면 다음을 실행합니다:
# virsh shutdown {domain-id, domain-name or domain-uuid}
You can control the behavior of the rebooting guest by modifying the on_shutdown parameter in the guest's configuration file.
게스트 재부팅
virsh 명령을 사용하여 게스트를 재부팅하려면 다음을 실행합니다:
#virsh reboot {domain-id, domain-name or domain-uuid}
You can control the behavior of the rebooting guest by modifying the on_reboot element in the guest's configuration file.
게스트 강제 종료
virsh 명령을 사용하여 게스트를 강제 종료하려면 다음을 실행합니다:
# virsh destroy {domain-id, domain-name or domain-uuid}
This command does an immediate ungraceful shutdown and stops the specified guest. Using virsh destroy can corrupt guest file systems . Use the destroy option only when the guest is unresponsive. For para-virtualized guests, use the shutdown option(게스트 종료 ) instead.
게스트의 도메인 ID 얻기
게스트의 도메인 ID 얻기:
# virsh domid {domain-name or domain-uuid}
게스트의 도메인 이름 얻기
게스트의 도메인 이름 얻기:
# virsh domname {domain-id or domain-uuid}
게스트의 UUID 얻기
게스트 용 UUID (Universally Unique Identifier)를 얻으려면 다음을 실행합니다:
# virsh domuuid {domain-id or domain-name}
virsh domuuid 명령 출력 결과의 예입니다:
# virsh domuuid r5b2-mySQL01
4a4c59a7-ee3f-c781-96e4-288f2862f011
게스트 정보 보기
Using virsh with the guest's domain ID, domain name or UUID you can display information on the specified guest:
# virsh dominfo {domain-id, domain-name or domain-uuid}
virsh dominfo 명령 출력 결과의 예입니다:
# virsh dominfo r5b2-mySQL01
id:             13
name:           r5b2-mysql01
uuid:           4a4c59a7-ee3f-c781-96e4-288f2862f011
os type:      	linux
state:          blocked
cpu(s):         1
cpu time:     	11.0s
max memory:     512000 kb
used memory:    512000 kb
호스트 정보 보기
호스트에 관한 정보를 보려면 다음을 실행합니다:
# virsh nodeinfo
virsh nodeinfo 명령 출력 결과의 예:
# virsh nodeinfo
CPU model                    x86_64
CPU (s)                      8
CPU frequency                2895 Mhz
CPU socket(s)                2      
Core(s) per socket           2
Threads per core:            2
Numa cell(s)                 1
Memory size:                 1046528 kb
가상화 프로세스를 지원하는 노드 정보와 장치를 표시합니다.
게스트 보기
virsh를 사용하여 게스트 목록 및 게스트의 현재 상태를 보려면 다음을 실행합니다:
# virsh list
사용 가능한 기타 다른 옵션은 다음과 같습니다:
--inactive 옵션은 비활성화 게스트를 나열합니다 (즉, 정의되어 있으나 현재 활성화되지 않은 게스트)
--all 옵션은 모든 게스트를 나열합니다. 예:
# virsh list --all
 Id Name                 State
----------------------------------
  0 Domain-0             running
  1 Domain202            paused
  2 Domain010            inactive
  3 Domain9600           crashed
virsh list로 부터의 출력 결과는 여섯 가지 상태 중 하나로 구분됩니다. (아래 나열됨).
  • running 상태는 현재 CPU 상에서 활성화되어 있는 게스트를 의미합니다.
  • blocked로 나열된 게스트는 차단되어 실행되지 않거나 또는 실행될 수 없습니다. 이는 게스트가 I/O에서 대기하고 (전형적인 대기 상태) 있거나 게스트가 절전 모드에 있기 때문입니다.
  • paused 상태는 일시 중지된 도메인을 나열합니다. 이는 관리자가 virt-manager, xm pause, virsh suspend에서 pause 버튼을 사용할 경우 발생합니다. 게스트가 일시 중지되면, 이는 메모리 및 기타 자원을 사용하지만 하이퍼바이저에서 스케줄링 및 CPU 자원을 사용할 수 없습니다.
  • shutdown 상태는 종료 단계에 있는 게스트를 말합니다. 게스트가 종료 신호를 전송하면 실행을 중지해야 합니다. 이는 모든 운영 체제에서 작동하지 않을 수 있으며, 일부 운영 체제는 이러한 신호에 응답하지 않을 수 있습니다.
  • dying 상태에 있는 도메인은 프로세서가 종료되어 가는 과정으로 도메인이 완전히 종료되거나 손상된 상태를 말합니다.
  • 실행 도중 virsh vcpuinfo 게스트가 실패하여 더이상 실행되지 않습니다. 게스트가 크래시에서 다시 시작하지 않도록 설정되었을 경우 이러한 상태가 발생할 수 있습니다.
가상 CPU 정보 보기
virsh를 사용하여 게스트에서 가상 CPU 정보를 보려면 다음을 실행합니다:
# virsh vcpuinfo {domain-id, domain-name or domain-uuid}
virsh vcpuinfo 명령 출력 결과의 예:
# virsh vcpuinfo r5b2-mySQL01
VCPU:           0
CPU:            0
State:          blocked
CPU time:       0.0s
CPU Affinity:   yy
가상 CPU 친화력 설정
실제 CPU에서 가상 CPU의 친화력을 설정하려면 다음을 실행합니다:
# virsh vcpupin domain-id vcpu cpulist
The domain-id parameter is the guest's ID number or name.
vcpu 파라미터는 게스트에 할당된 가상 CPU 수를 나타냅니다. vcpu 파라미터는 반드시 제공되어야 합니다.
cpulist 파라미터는 콤마로 구분된 실제 CPU 식별 번호 목록입니다. cpulist 파라미터는 VCPU가 실행할 수 있는 실제 CPU를 지정합니다.
가상 CPU 개수 설정
virsh로 게스트에 할당된 CPU 수를 수정하려면 다음을 실행합니다:
# virsh setvcpus {domain-name, domain-id or domain-uuid} count
새로운 count 값은 게스트를 생성할 때 지정했던 수를 초과할 수 없습니다.
메모리 할당량 설정
To modify a guest's memory allocation with virsh :
# virsh setmem {domain-id or domain-name} count
count는 킬로바이트 단위로 지정되어야 합니다. 새로운 카운트 값은 게스트를 생성할 때 지정했던 값을 초과할 수 없습니다. 64 MB보다 작은 값은 대부분의 게스트 운영 체제에서 작동하지 않습니다. 최대 메모리 값은 활성 게스트에 영향을 미치지 않습니다. 새 값이 더 작아서 사용 가능한 메모리 양을 줄일 경우 게스트는 충돌하게 됩니다.
게스트 블록 장치 정보 보기
virsh domblkstat 명령을 사용하여 실행 중인 게스트에 대한 블럭 장치 상태를 표시합니다.
# virsh domblkstat GuestName block-device
게스트 네트워크 장치 정보 보기
실행 중인 게스트에 대한 네트워크 인터페이스 통계를 보기위해 virsh domifstat 명령을 사용합니다.
# virsh domifstat GuestName interface-device 
virsh로 게스트 이전
virsh 명령으로 게스트는 다른 호스트로 이전할 수 있습니다. 도메인을 다른 호스트로 이전합니다. 실시간 이전의 경우 --live를 추가합니다. migrate 명령은 다음 형식의 파라미터를 허용합니다:
# virsh migrate --live GuestName DestinationURL
--live 파라미터는 옵션 사항입니다. 실시간 이전의 경우 --live 파라미터를 추가합니다.
GuestName 파라미터는 이전하고자 하는 게스트 이름을 나타냅니다.
DestinationURL 파라미터는 대상 시스템의 URL 또는 호스트 이름을 나타냅니다. 대상 시스템에는 다음과 같은 사항이 필요합니다:
  • 동일한 Red Hat Enterprise Linux 버전
  • 동일한 하이퍼바이저 (KVM 또는 Xen)
  • 반드시 libvirt 서비스를 실행하고 있어야 함
일단 명령을 입력하면 대상 시스템의 root 암호를 입력하라는 메세지가 나타나게 됩니다.
가상 네트워크 관리
다음 부분에서는 virsh 명령을 사용하여 가상 네트워크를 관리하는 방법에 대해 설명합니다. 가상 네트워크 목록을 나열하려면 다음을 실행합니다:
# virsh net-list
이 명령어를 실행하면 다음과 유사한 출력 결과가 나타납니다:
# virsh net-list
Name                 State      Autostart
-----------------------------------------
default              active     yes      
vnet1	             active     yes      
vnet2	             active     yes
특정 가상 네트워크에 대한 네트워크 정보를 확인하시려면 다음을 실행합니다:
# virsh net-dumpxml NetworkName
이는 XML 포맷으로 특정 가상 네트워크에 관한 정보를 보여줍니다:
# virsh net-dumpxml vnet1
<network>
  <name>vnet1</name>
  <uuid>98361b46-1581-acb7-1643-85a412626e70</uuid>
  <forward dev='eth0'/>
  <bridge name='vnet0' stp='on' forwardDelay='0' />
  <ip address='192.168.100.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.100.128' end='192.168.100.254' />
    </dhcp>
  </ip>
</network>
가상 네트워크 관리에 사용되는 다른 virsh 명령에는 다음과 같은 것이 있습니다:
  • virsh net-autostart network-namenetwork-name으로 지정된 네트워크 자동 시작
  • virsh net-create XMLfile — 기존 XML 파일을 사용하여 새 네트워크 생성 및 시작
  • virsh net-define XMLfile — XML 파일을 시작하지 않고 기존 XML 파일에서 새 네트워크 장치 생성
  • virsh net-destroy network-namenetwork-name으로 지정된 네트워크 강제 종료
  • virsh net-name networkUUID — 특정 networkUUID를 네트워크 이름으로 변환
  • virsh net-uuid network-name — 특정 network-name을 네트워크 UUID로 변환
  • virsh net-start nameOfInactiveNetwork — 비활성화 네트워크 시작
  • virsh net-undefine nameOfInactiveNetwork — 비활성화 네트워크 정의 삭제

26장. 가상 장치 관리자(virt-manager)를 사용한 게스트 관리

다음 부분에서는 가상 장치 관리자 (virt-manager) 창, 대화 상자, 다양한 GUI 제어에 대해 설명합니다.
virt-manager는 시스템 및 원격 장치에 있는 게스트와 하이퍼바이저의 그래픽 보기를 제공합니다. virt-manager를 사용하여 반가상화 및 완전 가상화 게스트를 지정할 수 있습니다. virt-manager는 다음과 같은 가상화 관리 작업을 수행합니다:
  • 메모리 할당
  • 가상 CPU 할당
  • 실행 성능 감시
  • 가상 게스트 저장 및 복구, 일시 중지 및 재시작, 종료 및 시작
  • 텍스트 및 그래픽 콘솔로의 연결
  • 실시간 및 오프라인 이전

26.1. The Add Connection window

이 창이 먼저 나타나 사용자에게 하이퍼바이저 세션을 선택할 수 있게 합니다. 권한이 없는 사용자는 읽기 전용으로 시작할 수 있습니다. Root 사용자는 읽기-쓰기 상태로 세션을 시작할 수 있습니다. 일반적인 사용의 경우 로컬 Xen 호스트 옵션 또는 QEMU (KVM의 경우)를 선택합니다.
가상 장치 관리자 연결 창
그림 26.1. 가상 장치 관리자 연결 창

26.2. 가상 장치 관리자 메인 창

This main window displays all the running guests and resources used by guests. Select a virtualized guest by double clicking the guest's name.
가상 장치 관리자 메인 창
그림 26.2. 가상 장치 관리자 메인 창

26.3. The guest Overview tab

The Overview tab displays graphs and statistics of a guest's live resource utilization data available from virt-manager. The UUID field displays the globally unique identifier for the virtual machines.
The Overview tab
그림 26.3. The Overview tab

26.4. 가상 장치 그래픽형식 콘솔

This window displays a virtual machine's graphical console. Para-virtualized and fully virtualized guests use different techniques to export their local virtual framebuffers, but both technologies use VNC to make them available to the Virtual Machine Manager's console window. If your virtual machine is set to require authentication, the Virtual Machine Graphical console prompts you for a password before the display appears.
그래픽형식 콘솔 창
그림 26.4. 그래픽형식 콘솔 창

보안 및 VNC 상의 주의 사항

VNC is considered insecure by many security experts, however, several changes have been made to enable the secure usage of VNC for virtualization on Red Hat enterprise Linux. The guest machines only listen to the local host (dom0)'s loopback address (127.0.0.1). This ensures only those with shell privileges on the host can access virt-manager and the virtual machine through VNC.
Remote administration can be performed following the instructions in 22장. 가상화 게스트의 원격 관리 . TLS can provide enterprise level security for managing guest and host systems.
Your local desktop can intercept key combinations (for example, Ctrl+Alt+F11) to prevent them from being sent to the guest machine. You can use the virt-manager sticky key capability to send these sequences. To use this capability, you must press any modifier key (Ctrl or Alt) 3 times and the key you specify gets treated as active until the next non-modifier key is pressed. You can then send Ctrl-Alt-F11 to the guest by entering the key sequence 'Ctrl Ctrl Ctrl Alt+F1'.

참고

Due to a limitation of virt-manager, it is not possible to use this sticky key feature to send a Sysrq key combination to a guest.

26.5. virt-manager 시작

virt-manager 세션을 시작하려면, 프로그램 메뉴에서 시스템 도구를 클릭하고 가상 장치 관리자(virt-manager)를 선택합니다.
virt-manager 메인 화면이 나타납니다.
virt-manager 시작
그림 26.5. virt-manager 시작

Alternatively, virt-manager can be started remotely using ssh as demonstrated in the following command:
ssh -X host's address[remotehost]# virt-manager
Using ssh to manage virtual machines and hosts is discussed further in 22.1절. “SSH를 통한 원격 관리 ”.

26.6. 저장된 장치 복구

가상 장치 관리자를 시작한 후에, 시스템의 모든 가상 장치는 메인 창에 표시됩니다. domain0는 호스트 시스템입니다. 메인 창에 어떤 장치도 나타나지 않으면, 시스템에 현재 실행 중인 장치가 없음을 가리킵니다.
이전에 저장한 세션을 복구하려면, 다음을 수행하시기 바랍니다:
  1. 파일 메뉴에서 저장된 장치 복구를 선택합니다.
    가상 장치 복구
    그림 26.6. 가상 장치 복구

  2. 가상 장치 복구 메인 창이 나타납니다.
  3. 적절한 디렉토리를 탐색하여 저장된 세션 파일을 선택합니다.
  4. 열기 클릭합니다.
저장된 가상 시스템은 이제 가상 장치 관리자 메인 창에 나타납니다.
복구된 가상 장치 관리자 세션
그림 26.7. 복구된 가상 장치 관리자 세션

26.7. 게스트 정보 표시

가상 장치 감시 기능을 사용하여 시스템의 모든 가상 장치의 활성 데이터 정보를 볼 수 있습니다.
To view a virtual system's details:
  1. 가상 장치 관리자 메인 창에 보기를 원하는 가상 장치를 하이라이트하시기 바랍니다.
    보기를 원하는 가상 장치 선택
    그림 26.8. 보기를 원하는 가상 장치 선택

  2. From the Virtual Machine Manager Edit menu, select Machine Details (or click the Details button on the bottom of the Virtual Machine Manager main window).
    Displaying the overview window
    그림 26.9. Displaying the overview window

    On the Virtual Machine window, click the Overview tab.
    The Overview tab summarizes CPU and memory usage for the virtualized guest you specified.
    게스트 상세정보 개요 보기
    그림 26.10. 게스트 상세정보 개요 보기

  3. On the Virtual Machine window, click the Hardwaretab.
    게스트 하드웨어 상세 정보 보기
    그림 26.11. 게스트 하드웨어 상세 정보 보기

  4. 하드웨어 탭에서 프로세서를 클릭하여 현재 프로세서 할당량을 확인하고 수정할 수 있습니다.
    프로세서 할당 패널
    그림 26.12. 프로세서 할당 패널

  5. 하드웨어 탭에서 Memory를 클릭하면 현재 RAM 메모리 할당량을 보고 수정할 수 있습니다.
    메모리 할당량 보기
    그림 26.13. 메모리 할당량 보기

  6. 하드웨어 탭에서 Disk를 클릭하면 현재 하드 디스크 구성을 보고 수정할 수 있습니다.
    디스크 설정 보기
    그림 26.14. 디스크 설정 보기

  7. On the Hardware tab, click on NIC to view or change the current network configuration.
    네트워크 설정 보기
    그림 26.15. 네트워크 설정 보기

26.8. 상태 모니터링

Status status monitoring preferences can be modified with virt-manager's preferences window.
To configure status monitoring:
  1. 편집 메뉴에서 기본 설정을 선택하시기 바랍니다.
    가상 장치 등록정보 수정
    그림 26.16. 가상 장치 등록정보 수정

    The Preferences window appears.
  2. From the Stats tab specify the time in seconds or stats polling options.
    상태 감시 설정
    그림 26.17. 상태 감시 설정

26.9. 게스트 식별자 표시

시스템의 모든 가상 장치에 대한 게스트 ID를 볼 수 있습니다:
  1. 보기 메뉴에서, 도메인 ID 확인 상자를 선택하시기 바랍니다.
    게스트 ID 보기
    그림 26.18. 게스트 ID 보기

  2. 가상 장치 관리자는 시스템의 모든 도메인에 대한 도메인 ID 목록을 보여줍니다.
    도메인 ID 보기
    그림 26.19. 도메인 ID 보기

26.10. Displaying a guest's status

시스템의 모든 가상 장치에 대한 상태 정보를 보려면 다음을 수행하시기 바랍니다:
  1. 보기 메뉴에서, 상태 확인 상자를 선택합니다.
    Selecting a virtual machine's status
    그림 26.20. Selecting a virtual machine's status

  2. 가상 장치 관리자는 시스템의 모든 가상 장치에 대한 상태 정보를 표시합니다.
    Displaying a virtual machine's status
    그림 26.21. Displaying a virtual machine's status

26.11. 가상 CPU 보기

시스템의 모든 가상 장치에 대한 가상 CPU 개수를 보려면, 다음을 수행하셔야 합니다:
  1. 보기 메뉴에서 가상 CPU 확인 상자를 선택하시기 바랍니다.
    가상 CPU 옵션 선택
    그림 26.22. 가상 CPU 옵션 선택

  2. 가상 장치 관리자는 시스템의 모든 가상 장치에 대한 가상 CPU를 표시합니다.
    가상 CPU 표시
    그림 26.23. 가상 CPU 표시

26.12. CPU 사용량 보기

시스템의 모든 가상 장치에 사용되는 CPU 사용량을 볼 수 있습니다:
  1. 보기 메뉴에서, CPU 사용량 확인 상자를 선택하시기 바랍니다.
    CPU 사용량 선택
    그림 26.24. CPU 사용량 선택

  2. 가상 장치 관리자는 시스템의 모든 가상 장치에 사용되는 CPU 사용량을 표시합니다.
    CPU 사용량 보기
    그림 26.25. CPU 사용량 보기

26.13. 메모리 사용량 보기

시스템의 모든 가상 장치에 사용되는 메모리 사용량을 볼 수 있습니다:
  1. 보기 메뉴에서, 메모리 사용량 확인 상자를 선택하시기 바랍니다.
    메모리 사용량 선택
    그림 26.26. 메모리 사용량 선택

  2. 가상 장치 관리자는 시스템의 모든 가상 장치에 사용되는 메모리 사용량을 (메가바이트 단위로) 표시합니다.
    메모리 사용량 보기
    그림 26.27. 메모리 사용량 보기

26.14. 가상 네트워크 관리

시스템 상에 가상 네트워크를 설정하려면 다음을 실행합니다:
  1. 편집 메뉴에서 호스트 정보를 선택합니다.
    Selecting a host's details
    그림 26.28. Selecting a host's details

  2. 호스트 정보 메뉴를 열어 가상 네트워크 탭을 클릭합니다.
    가상 네트워크 설정
    그림 26.29. 가상 네트워크 설정

  3. 사용 가능한 모든 가상 네트워크 목록은 메뉴의 왼쪽 박스에 있습니다. 이 박스에서 가상 네트워크를 선택하여 네트워크 설정을 편집하실 수 있습니다.

26.15. 가상 네트워크 생성

시스템 상에 가상 네트워크를 생성하려면 다음을 실행합니다:
  1. Open the Host Details menu (refer to 26.14절. “가상 네트워크 관리 ”) and click the Add button.
    가상 네트워크 설정
    그림 26.30. 가상 네트워크 설정

    여기서 새 가상 네트워크 생성 메뉴를 열고 앞으로 버튼을 클릭하여 계속 진행합니다.
    새로운 가상 네트워크 생성
    그림 26.31. 새로운 가상 네트워크 생성

  2. 가상 네트워크 이름을 입력하고 앞으로 버튼을 클릭합니다.
    가상 네트워크 이름 지정하기
    그림 26.32. 가상 네트워크 이름 지정하기

  3. 가상 네트워크의 IPv4 주소 공간을 입력하고 앞으로 버튼을 클릭합니다.
    IPv4 주소 공간 선택
    그림 26.33. IPv4 주소 공간 선택

  4. IP 주소의 시작 범위를 지정하여 가상 네트워크의 DHCP 범위를 지정합니다. 앞으로 버튼을 클릭하여 계속 진행합니다.
    DHCP 범위 선택
    그림 26.34. DHCP 범위 선택

  5. 가상 네트워크를 물리적 네트워크에 어떻게 연결할 지를 선택합니다.
    물리적 네트워크에 연결
    그림 26.35. 물리적 네트워크에 연결

    물리적 네트워크로 포워딩하기를 선택할 경우 수신지아무 물리적 장치로 NAT 또는 물리적 장치 eth0로 NAT로 할 지를 선택합니다.
    앞으로 버튼을 클릭하여 계속 진행합니다.
  6. 네트워크 생성 준비가 완료되었습니다. 네트워크 설정을 확인하고 완료 버튼을 클릭합니다.
    네트워크 생성 준비 완료
    그림 26.36. 네트워크 생성 준비 완료

  7. 새 가상 네트워크는 호스트 정보 메뉴의 가상 네트워크 탭에서 사용할 수 있습니다.
    현재 사용 가능한 새 가상 네트워크
    그림 26.37. 현재 사용 가능한 새 가상 네트워크

27장. xm 명령 빠른 참조

xm 명령은 Xen 하이퍼바이저를 관리할 수 있습니다. 대부분의 작업은 libvirt 도구, virt-manager 어플리케이션 또는 virsh 명령으로 실행될 수 있습니다. xm 명령에는 libvirt 도구의 오류 확인 기능이 없으며 libvirt 도구가 지원하는 작업에 대해 사용될 수 없습니다.
일부 작업은 virt-manager를 사용하여 실행될 수 없습니다. xm 명령의 기타 다른 Xen 구현에 해당하는 일부 옵션은 Red Hat Enterprise Linux 5에서 작동하지 않습니다. 아래 목록은 사용 가능 및 사용 가능하지 않은 명령 옵션에 대한 개요입니다.

경고

xm 대신에 virsh 또는 virt-manager를 사용할 것을 권장합니다. xm 명령은 오류 확인이나 설정 파일 오류를 잘 처리할 수 없으며 실수로 시스템이 불안정하게 되거나 가상 장치에 오류를 발생하게 할 수 있습니다. 수동으로 Xen 설정 파일을 편집하는 것은 위험하므로 하지 말아야 합니다. 위험을 감수하시고 다음 부분을 사용하십시오.
기본적인 관리 옵션
다음은 기본적으로 주로 사용되는 xm 명령입니다:
  • xm help [--long]: 사용 가능한 옵션 및 도움말 텍스트 보기
  • xm list 명령을 사용하여 활성 도메인 목록 나열:
    $ xm list
    Name                                ID  Mem(MiB)   VCPUs      State      Time(s)
    Domain-0                            0     520       2         r-----     1275.5
    r5b2-mySQL01                       13     500       1         -b----       16.1
    
  • xm create [-c] DomainName/ID: start a virtual machine. If the -c option is used, the start up process will attach to the guest's console.
  • xm console DomainName/ID: attach to a virtual machine's console.
  • xm destroy DomainName/ID: 가상 장치 종료, 전원 끄기와 유사함
  • xm reboot DomainName/ID: 가상 장치 재부팅, 정상적인 시스템 종료 실행 후 프로세스 시작
  • xm shutdown DomainName/ID: 가상 장치 종료, 정상적인 시스템 종료 절차 실행
  • xm pause
  • xm unpause
  • xm save
  • xm restore
  • xm migrate
리소스 관리 옵션
다음의 xm 명령을 사용하여 리소스를 관리합니다:
  • xm mem-set
  • xm vcpu-list 명령을 사용하여 가상 CPU 친화성 나열:
    $ xm vcpu-list
    Name                          ID  VCPUs   CPU State  Time(s)  CPU Affinity
    Domain-0                       0    0      0    r--   708.9    any cpu
    Domain-0                       0    1      1   -b-    572.1    any cpu
    r5b2-mySQL01                  13    0      1   -b-     16.1    any cpu
    
  • xm vcpu-pin
  • xm vcpu-set
  • xm sched-credit 명령을 사용하여 주어진 도메인에 대한 스케줄러 매개 변수 보기:
    $ xm sched-credit -d 0
    {'cap': 0, 'weight': 256}
    $ xm sched-credit -d 13
    {'cap': 25, 'weight': 256}
    
모니터링 및 문제 해결 옵션
다음의 xm 명령을 사용하여 모니터링 및 문제를 해결합니다:
  • xm top
  • xm dmesg
  • xm info
  • xm log
  • xm uptime 명령을 사용하여 게스트 및 호스트 가동 시간 보기:
    $ xm uptime
    Name                       ID  Uptime
    Domain-0                    0  3:42:18
    r5b2-mySQL01               13  0:06:27
    
  • xm sysrq
  • xm dump-core
  • xm rename
  • xm domid
  • xm domname
현재 지원되지 않는 옵션
현재 xm vnet-list는 지원되지 않습니다.

28장. Xen 커널 부트 파라미터 설정

GNU Grand Unified Boot Loader (GRUB)는 설치된 여러 운영 체제 또는 커널을 부팅하기 위한 프로그램입니다. 또한 사용자는 GRUB을 사용하여 커널에 인수를 써 넣을 수 있습니다. GRUB 설정 파일 (/boot/grub/grub.conf에 위치)은 GRUB 메뉴 인터페이스에서 시작할 수 있는 운영 체제의 목록을 만드는데 사용됩니다. kernel-xen RPM을 설치할 때, 스크립트는 GRUB 설정 파일에 kernel-xen 항목을 추가하여 기본값으로 kernel-xen을 시작합니다. grub.conf 파일을 편집하여 기본값 커널을 수정하거나 커널 파라미터를 추가할 수 있습니다.
title Red Hat Enterprise Linux Server (2.6.18-3.el5xen)
root (hd0,0)
	kernel  /xen.gz.-2.6.18-3.el5
	module  /vmlinuz-2.6..18-3.el5xen ro root=/dev/VolGroup00/LogVol00  rhgb quiet
	module  /initrd-2.6.18-3. el5xenxen.img
Linux grub 항목을 위 예제와 같이 설정하면, 부트로더는 하이퍼바이저(initrd 이미지)와 Linux 커널을 읽어옵니다. 이 커널 항목이 다른 항목보다 위에 있으므로 이 커널이 먼저 메모리에 상주하게 됩니다. 부트로더는 하이퍼바이저와 Linux 커널로 또는 하이퍼바이저와 Linux 커널에서 명령행 인수를 보내거나 받습니다. 다음 예제 항목은 어떻게 Dom0 리눅스 커널 메모리를 800MB로 제한하는지를 보여줍니다.
title Red Hat Enterprise Linux Server (2.6.18-3.el5xen)
root (hd0,0)
	kernel  /xen.gz.-2.6.18-3.el5 dom0_mem=800M
	module  /vmlinuz-2.6..18-3.el5xen ro root=/dev/VolGroup00/LogVol00  rhgb quiet
	module  /initrd-2.6.18-3. el5xenxen.img
다음의 GRUB 파라미터를 사용하여 Virtualization hypervisor를 구성할 수 있습니다:
mem
하이퍼바이저 커널에서 사용 가능한 메모리의 양을 제한합니다.
com1=115200, 8n1
이는 시스템의 첫번째 시리얼 포트를 시리얼 콘솔로 작동하도록 활성화합니다 (com2는 다음 포트 등으로 할당됩니다).
dom0_mem
하이퍼바이저에 사용 가능한 메모리의 양을 제한합니다.
dom0_max_vcpus
Xen domain0에 보이는 CPU 수를 제한합니다.
acpi
ACPI hypervisor를 hypervisor와 domain0으로 전환합니다. ACPI 파라미터 옵션은 다음을 포함합니다:
/*   ****  Linux config options: propagated to domain0  ****/
/*   "acpi=off":      Disables both ACPI table parsing and interpreter.   */
/*   "acpi=force":    Overrides the disable blacklist.                    */
/*   "acpi=strict":   Disables out-of-spec workarounds.                   */
/*   "acpi=ht":       Limits ACPI from boot-time to enable HT.            */
/*   "acpi=noirq":    Disables ACPI interrupt routing.                    */
noacpi
인터럽트 전달을 위해 ACPI를 비활성화시킵니다.

29장. ELILO 설정

ELILO는 EFI 기반 시스템, 특히 Itanium®에서 사용되는 부트로더입니다. x86 및 x86-64 시스템 상의 부트로더 GRUB과 유사하게, ELILO는 시스템 부팅 순서에서 어떤 설치된 커널을 읽어올 지를 선택하게 합니다. 또한 ELILO는 사용자가 커널에 인수를 전송할 수 있게 합니다. EFI 부팅 파티션에 위치하여 /etc/elilo.conf로 심볼릭 링크된 ELILO 설정 파일에는 글로벌 옵션 및 이미지 모음 목록이 들어있습니다. kernel-xen RPM을 설치하면, 사후 설치 스크립트는 해당 이미지 모음을 elilo.conf 파일에 추가합니다.

ELILO

ELILO에 대한 다음 부분은 intel Itanium 아키텍처에서 Xen 커널을 실행하고 있는 시스템에 적용됩니다.
ELILO 설정 파일에는 두 부분이 있습니다:
  • ELILO 및 모든 항목 작동에 영향을 미치는 글로벌 옵션. 일반적으로 디폴트 값에서 이를 변경할 필요가 없음
  • 관련 옵션과 함께 부팅 선택을 정의하는 이미지 모음
Here is a sample image stanza in elilo.conf:
image=vmlinuz-2.6.18-92.el5xen
        vmm=xen.gz-2.6.18-92.el5
        label=linux
        initrd=initrd-2.6.18-92.el5xen.img
        read-only
        root=/dev/VolGroup00/rhel5_2
        append="-- rhgb quiet"
The image parameter indicates the following lines apply to a single boot selection. This stanza defines a hypervisor (vmm), initrd, and command line arguments (read-only, root and append) to the hypervisor and kernel. When ELILO is loaded during the boot sequence, the image is labeled linux.
ELILO는 initscripts가 읽기-쓰기 전용으로 root 드라이브를 마운트할 때 까지 root 파일 시스템이 읽기 전용 (read-only)에 마운트되게 하는 커널 명령행 옵션 ro에서 read-only만을 해석합니다. ELILO는 "root" 행을 커널 명령행에 복사합니다. 이는 완전한 명령행을 작성하기 위해 "append" 행으로 통합됩니다:
"-- root=/dev/VolGroup00/rhel5_2 ro rhgb quiet"
-- 구분 기호를 사용하여 하이퍼바이저 및 커널 인수를 구분합니다. 하이퍼바이저 인수가 먼저 오고, 그 후 -- 구분 기호, 그 다음으로 커널 인수가 옵니다. 주로 하이퍼바이저는 어떠한 인수도 갖지 않습니다.

기술적 유의 사항

ELILO는 명령행 전체를 하이퍼바이저에 전달합니다. 하이퍼 바이저는 컨텐트를 나누어 커널에 커널 옵션을 전달합니다.
하이퍼바이저를 사용자 설정하려면, -- 전에 파라미터를 삽입합니다. 커널 용 하이퍼바이저 메모리(mem) 파라미터 및 quiet 파라미터의 예는 다음과 같습니다:
append="dom0_mem=2G -- quiet"
ELILO 하이퍼바이저 파라미터
파라미터설명
mem=mem 파라미터는 하이퍼바이저 최대 RAM 사용량을 정의합니다. 시스템에서 추가된 RAM은 무시하게 됩니다. 파라미터는 B, K, M, G 접미사로 지정되며 이는 각각 바이트, 킬로바이트, 메가바이트, 기가바이트를 나타냅니다. 접미사가 지정되지 않을 경우 디폴트 단위는 킬로바이터가 됩니다.
dom0_mem=dom0_mem=은 dom0로의 RAM 할당량을 설정합니다. 동일한 접미사는 위의 mem 파라미터로 취급됩니다. Itanium® 상의 Red Hat Enterprise Linux 5.2에서 디폴트 값은 4G입니다.
dom0_max_vcpus=dom0_max_vcpus=은 하이퍼이저로의 CPU 할당 수를 설정합니다. Itanium® 상의 Red Hat Enterprise Linux 5.2에서 디폴트 값은 4입니다.
com1=<baud>,DPS,<io_base>,<irq>com1=은 첫번째 직렬행의 파라미터를 설정합니다. 예: com1=9600,8n1,0x408,5. io_baseirq 옵션을 생략하여 이를 표준 디폴트 값으로 둘 수 있습니다. baud 파라미터는 auto로 설정하여 부트로더 설정이 보존되어야 함을 나타낼 수 있습니다. 직렬 파라미터가 ELILO 또는 EFI 설정에서 글로벌 옵션으로 설정되어 있을 경우 com1을 생략할 수 있습니다.
com2=<baud>,DPS,<io_base>,<irq>두번째 직렬행의 파라미터를 설정합니다. 위의 com1 파라미터에 대한 설명을 참조하시기 바랍니다.
console=<specifier_list>console은 콘솔 옵션에 대해 콤마로 구분된 환경 설정 목록입니다. 옵션에는 vga, com1, com2가 있습니다. 이러한 설정은 하이퍼바이저가 EFI 콘솔 설정을 넘겨 받으려 하기 때문에 생략해야 합니다.

ELILO 파라미터에 대한 보다 자세한 내용

ELILO 파라미터의 완전 목록은 XenSource에 있습니다.
위의 수정된 설정 예에서는 하이퍼바이저로 추가된 메모리 및 cpu 할당 파라미터에 대한 구문을 보여주고 있습니다:
image=vmlinuz-2.6.18-92.el5xen
        vmm=xen.gz-2.6.18-92.el5
        label=linux
        initrd=initrd-2.6.18-92.el5xen.img
        read-only
        root=/dev/VolGroup00/rhel5_2
        append="dom0_mem=2G dom0_max_vcpus=2 --"
또한 이러한 예에서는 커널 파라미터 "rhgb quiet"를 삭제하여 커널 및 initscript 출력 결과를 콘솔에 생성합니다. 이중 대시 부호는 남아 있게 되어 추가된 행이 하이퍼바이저 인수로서 올바르게 해석됨에 유의하시기 바랍니다.

30장. libvirt configuration reference

This chapter provides is a references for various parameters of libvirt XML configuration files
표 30.1. libvirt configuration files
Item Description
pae
Specifies the physical address extension configuration data.
apic
Specifies the advanced programmable interrupt controller configuration data.
memory
Specifies the memory size in megabytes.
vcpus
Specifies the numbers of virtual CPUs.
console
Specifies the port numbers to export the domain consoles to.
nic
Specifies the number of virtual network interfaces.
vif
Lists the randomly-assigned MAC addresses and bridges assigned to use for the domain's network addresses.
disk
Lists the block devices to export to the domain and exports physical devices to domain with read only access.
dhcp
Enables networking using DHCP.
netmask
Specifies the configured IP netmasks.
gateway
Specifies the configured IP gateways.
acpi
Specifies the advanced configuration power interface configuration data.

31장. Xen 설정 파일

Red Hat Enterprise Linux uses libvirt configuration files for most tasks. Some users may need Xen configuration files which contain the following standard variables. Configuration items within these files must be enclosed in single quotes('). These configuration files reside in the /etc/xen directory.
The table below, 표 31.1. “Xen 설정 파일 참조 ”, is formatted output from xm create --help_config.
표 31.1. Xen 설정 파일 참조
Parameter
Description
vncpasswd=NAME HVM 데몬에서 VNC 콘솔 암호
vncviewer=no | yes 도메인에 vnc 서버 용 vncviewer 목록을 생성합니다. vncviewer 주소는 VNC_SERVER=<host>:<port>를 사용하여 커널 명령행에서 도메인으로 전달됩니다. vnc에 의해 사용되는 포트는 5500 + DISPLAY입니다. 가능하면 무료 포트를 사용하는 디스플레이 값을 선택합니다. vnc=1일 때에만 유효합니다.
vncconsole=no | yes Spawn a vncviewer process for the domain's graphical console. Only valid when vnc=1.
name=NAME 도메인 이름. 고유한 이름이어야 합니다.
bootloader=FILE 부트로더 까지의 경로
bootargs=NAME 부트로더로 전달할 인수
bootentry=NAME 삭제됨. 부트로더를 통해 부팅할 항목. bootargs 사용.
kernel=FILE 커널 이미지로의 경로
ramdisk=FILE ramdisk 까지의 경로
features=FEATURES 게스트 커널에서 활성화하기 위한 기능
builder=FUNCTION 도메인 빌드에 사용할 기능
memory=MEMORY MB 단위의 도메인 메모리
maxmem=MEMORY MB 단위의 최대 도메인 메모리
shadow_memory=MEMORY MB 단위의 도메인 셰도우 메모리
cpu=CPU VCPU0를 호스트하는 CPU
cpus=CPUS 도메인 실행을 위한 CPUS
pae=PAE HVM 도메인의 PAE 활성화 또는 비활성화
acpi=ACPI HVM 도메인의 ACPI 활성화 또는 비활성화
apic=APIC HVM 도메인의 APIC 활성화 또는 비활성화
vcpus=VCPUs 도메인에서의 가상 CPUS 수
cpu_weight=WEIGHT Set the new domain's cpu weight. WEIGHT is a float that controls the domain's share of the cpu.
restart=onreboot | always | never 삭제됨. 대신 on_poweroff, on_reboot, on_crash 사용. 종료 시 도메인 재시작 여부. - onreboot: 종료 시 종료 코드 재부팅과 함께 재시작 - always: 종료 시 항상 재시작, 종료 코드 무시 - never: 종료 시 재시작하지 않음, 종료 코드 무시
on_poweroff=destroy | restart | preserve | destroy Behavior when a domain exits with reason 'poweroff'. - destroy: the domain is cleaned up as normal; - restart: a new domain is started in place of the old one; - preserve: no clean-up is done until the domain is manually destroyed (using xm destroy, for example); - rename-restart: the old domain is not cleaned up, but is renamed and a new domain started in its place.
on_reboot=destroy | restart | preserve | destroy Behavior when a domain exits with reason 'reboot'. - destroy: the domain is cleaned up as normal; - restart: a new domain is started in place of the old one; - preserve: no clean-up is done until the domain is manually destroyed (using xm destroy, for example); - rename-restart: the old domain is not cleaned up, but is renamed and a new domain started in its place.
on_crash=destroy | restart | preserve | destroy Behavior when a domain exits with reason 'crash'. - destroy: the domain is cleaned up as normal; - restart: a new domain is started in place of the old one; - preserve: no clean-up is done until the domain is manually destroyed (using xm destroy, for example); - rename-restart: the old domain is not cleaned up, but is renamed and a new domain started in its place.
blkif=no | yes 도메인을 블록 장치 백엔드되게 합니다.
netif=no | yes 도메인을 네트워크 인터페이스 백엔드되게 합니다.
tpmif=no | yes 도메인을 TPM 인터페이스 백엔드되게 합니다.
disk=phy:DEV,VDEV,MODE[,DOM] 도메인에 디스크 장치를 추가합니다. 물리적 장치는 DEV로 도메인에 VDEV로 내보내어 집니다. 디스크의 MODEr일 경우 읽기 전용이며, MODEw일 경우 읽기-쓰기 전용이 됩니다. DOM이 지정되어 있을 경우, 백엔드 드라이버 도메인이 디스크를 사용하도록 정의하게 됩니다. 하나 이상의 디스크를 추가하려면 옵션을 반복하면 됩니다.
pci=BUS:DEV.FUNC 주어진 파라미터 값 (십육 진수로 됨)을 사용하여 도메인에 PCI 장치를 추가합니다. 예: pci=c0:02.1a. 하나 이상의 pci 장치를 추가하려면 옵션을 반복하면 됩니다.
ioports=FROM[-TO] 주어진 파라미터 값 (십육 진수로 됨)을 사용하여 도메인에 레거시 I/O 범위를 추가합니다. 예: ioports=02f8-02ff. 하나 이상의 I/O 범위를 추가하려면 옵션을 반복하면 됩니다.
irq=IRQ 도메인에 IRQ (인터럽트 행)을 추가합니다. 예: irq=7. 하나 이상의 IRQ를 추가하려면 이 옵션을 반복하면 됩니다.
usbport=PATH 포트까지 지정된 경로데로 도메인에 물리적 USB 포트를 추가합니다. 하나 이상의 포트를 추가하려면 이 옵션을 반복하면 됩니다.
vfb=type={vnc,sdl}, vncunused=1, vncdisplay=N,
vnclisten=ADDR, display=DISPLAY,
xauthority=XAUTHORITY, vncpasswd=PASSWORD,
keymap=KEYMAP
Make the domain a framebuffer backend. The backend type should be either sdl or vnc. For type=vnc, connect an external vncviewer. The server will listen on ADDR (default 127.0.0.1) on port N+5900. N defaults to the domain id. If vncunused=1, the server will try to find an arbitrary unused port above 5900. For type=sdl, a viewer will be started automatically using the given DISPLAY and XAUTHORITY, which default to the current user's ones.
vif=type=TYPE, mac=MAC, bridge=BRIDGE, ip=IPADDR,
script=SCRIPT, backend=DOM, vifname=NAME
주어진 MAC 주소 및 브리지를 사용하여 네트워크 인터페이스를 추가합니다. vif는 주어진 설정 스크립트를 호출하여 설정됩니다. 유형이 지정되어 있지 않을 경우, ioemu 장치가 아닌 netfront가 디폴트로 됩니다. mac가 지정되어 있지 않을 경우, 임의의 MAC 주소가 사용됩니다. 아무것도 지정되어 있지 않을 경우, 네트워크 백엔드는 자신의 MAC 주소를 선택합니다. 브리지가 지정되어 있지 않을 경우 첫번째로 발견된 브리지가 사용됩니다. 스크립트가 지정되어 있지 않을 경우 디폴트 스크립트가 사용됩니다. 백엔드가 지정되어 있지 않을 경우, 디폴트 백엔드 드라이버 도메인이 사용됩니다. vifname이 지정되어 있지 않을 경우 백엔드 가상 인터페이스는 vifD.N 이름을 갖게 됩니다. 여기서 D는 도메인 id이며 N은 인터페이스 id입니다. 하나 이상의 vif를 추가하려면 이 옵션을 반복합니다. vif를 지정하면 필요한 인터페이스 수가 증가될 수 있습니다.
vtpm=instance=INSTANCE,backend=DOM TPM 인터페이스를 추가합니다. 백엔드에서는 가상 TPM 인스턴스로서 주어진 인스턴스를 사용합니다. 주어진 번호는 단지 선호하는 인스턴스 번호에 불과합니다. 핫플러그 스크립트는 어떤 인스턴스 번호를 도메인에 할당할 지를 결정하게 됩니다. 가상 장치 및 TPM 인스턴스 번호의 연합은 /etc/xen/vtpm.db에서 찾으실 수 있습니다. 주어진 도메인에서 백엔드를 사용합니다.
access_control=policy=POLICY,label=LABEL 보안 레이블 및 이를 정의한 보안 정책 참조를 추가합니다. 도메인을 시작/재시작할 때 로컬 ssid 참조가 계산됩니다. 이때에 활성화된 정책에서 정책을 확인하게 됩니다. 이러한 방식에서 저장/복구를 통한 이전 작업은 복구되고 로컬 레이블은 도메인이 시작/재시작된 위치의 시스템에서 자동으로 생성됩니다.
nics=NUM 삭제됨. 대신 빈 vif 항목을 사용합니다. 네트워크 인터페이스 수를 설정합니다. vif 옵션을 사용하여 인터페이스 파라미터를 정의합니다. 정의하지 않을 경우 디폴트 값이 사용됩니다. vif를 지정하면 필요한 인터페이스 수가 증가됩니다.
root=DEVICE 커널 명령행에 root= 파라미터를 설정합니다. NFS root의 경우 /dev/sda1, 또는 /dev/nfs와 같은 장치를 사용합니다.
extra=ARGS 커널 명령행에 더할 추가 인수를 지정합니다.
ip=IPADDR 커널 IP 인터페이스 주소를 지정합니다.
gateway=IPADDR 커널 IP 게이트웨이 지정합니다.
netmask=MASK 커널 IP 넷마스크를 지정합니다.
hostname=NAME 커널 IP 호스트명을 지정합니다.
interface=INTF 커널 IP 인터페이스명을 지정합니다.
dhcp=off|dhcp 커널 dhcp 옵션을 지정합니다.
nfs_server=IPADDR NFS root에 대한 NFS 서버 주소를 지정합니다.
nfs_root=PATH root NFS 디렉토리 경로를 지정합니다.
device_model=FILE 장치 모델 프로그램 경로
fda=FILE fda 경로
fdb=FILE fdb 경로
serial=FILE 시리얼 또는 pty 또는 vc로의 경로
localtime=no | yes RTC는 로컬 시간으로 지정되어 있습니까?
keymap=FILE 키보드 레이아웃 지정
usb=no | yes USB 장치 처럼 사용
usbdevice=NAME 추가할 USB 장치 이름
stdvga=no | yes Use std vga or Cirrus Logic graphics
isa=no | yes ISA 전용 시스템 모의 사용
boot=a|b|c|d 디폴트 부팅 장치
nographic=no | yes 장치 모델이 그래픽을 사용해야 합니까?
soundhw=audiodev 장치 모델이 오디오 장치를 사용해야 합니까?
vnc 장치 모델이 VNC를 사용해야 합니까?
vncdisplay 사용할 VNC 보기
vnclisten 청취할 VNC 서버 용 주소
vncunused VNC 서버 용으로 사용하지 않을 포트를 찾습니다. vnc=1일 때에만 유효합니다.
sdl 장치 모델이 SDL을 사용해야 합니까?
display=DISPLAY 사용할 X11 보기
xauthority=XAUTHORITY 사용할 X11 권한
uuid 사용할 xenstore UUID (universally unique identifier). 이러한 옵션이 설정되어 있지 않을 경우, 가상 네트워크의 MAC 주소와 같이 임의로 생성되게 됩니다. 이는 전체 클러스터에서 고유한 값이어야 합니다.

표 31.3. “설정 파라미터 디폴트 값 ” lists all configuration parameters available, the Python parser function which sets the value and default values. The setter function gives an idea of what the parser does with the values you specify. It reads these as Python values, then feeds them to a setter function to store them. If the value is not valid Python, you get an obscure error message. If the setter rejects your value, you should get a reasonable error message, except it appears to get lost somehow, along with your bogus setting. If the setter accepts, but the value is incorrect the application may fail.
표 31.2. 파라미터 값을 설정하는 Python 기능
구문 분석 기능 유효한 인수
set_bool
허용되는 값:
  • yes
  • y
  • no
  • yes
set_float
Accepts a floating point number with Python's float(). For example:
  • 3.14
  • 10.
  • .001
  • 1e100
  • 3.14e-10
set_int
Accepts an integer with Python's int().
set_value
어떤 Python 값이던지 허용합니다.
append_value
어떤 Python 값이던지 허용하며, 이를 어레이에 저장된 이전 값에 더합니다.

표 31.3. 설정 파라미터 디폴트 값
Parameter 구문 분석 기능 디폴트 값
name setter default value
vncpasswd set_value None
vncviewer set_bool None
vncconsole set_bool None
name set_value None
bootloader set_value None
bootargs set_value None
bootentry set_value None
kernel set_value None
ramdisk set_value ''
features set_value ''
builder set_value 'linux'
memory set_int 128
maxmem set_int None
shadow_memory set_int 0
cpu set_int None
cpus set_value None
pae set_int 0
acpi set_int 0
apic set_int 0
vcpus set_int 1
cpu_weight set_float None
restart set_value None
on_poweroff set_value None
on_reboot set_value None
on_crash set_value None
blkif set_bool 0
netif set_bool 0
tpmif append_value 0
disk append_value []
pci append_value []
ioports append_value []
irq append_value []
usbport append_value []
vfb append_value []
vif append_value []
vtpm append_value []
access_control append_value []
nics set_int -1
root set_value ''
extra set_value ''
ip set_value ''
gateway set_value ''
netmask set_value ''
hostname set_value ''
interface set_value "eth0"
dhcp set_value 'off'
nfs_server set_value None
nfs_root set_value None
device_model set_value ''
fda set_value ''
fdb set_value ''
serial set_value ''
localtime set_bool 0
keymap set_value ''
usb set_bool 0
usbdevice set_value ''
stdvga set_bool 0
isa set_bool 0
boot set_value 'c'
nographic set_bool 0
soundhw set_value ''
vnc set_value None
vncdisplay set_value None
vnclisten set_value None
vncunused set_bool 1
sdl set_value None
display set_value None
xauthority set_value None
uuid set_value None

부 VII. 힌트 및 도움말

32장. 힌트 및 도움말

다음에는 가상화 성능, 규모와 안정성을 향상시키기 위한 유용한 힌트 및 도움말이 있습니다.

32.1. 자동으로 게스트 시작

This section covers how to make virtualized guests start automatically during the host system's boot phase.
예에서는 virsh를 사용하여 TestServer 게스트를 설정하고 호스트 부팅 시 자동으로 시작되게 합니다.
# virsh autostart TestServer
Domain TestServer marked as autostarted
이제 게스트는 호스트와 함께 자동으로 시작됩니다.
자동으로 게스트가 부팅되는 것을 중지시키려면 --disable 파라미터를 사용합니다
# virsh autostart --disable TestServer
Domain TestServer unmarked as autostarted
더이상 게스트는 호스트와 함께 자동으로 시작되지 않습니다.

32.2. KVM과 Xen 하이퍼바이저 사이에서 변경

다음 부분에서는 KVM과 Xen 하이퍼바이저 사이에서 변경하는 방법에 대해 설명합니다.
Red Hat은 한 번에 하나의 활성화된 하이퍼바이저만을 지원합니다.

하이퍼바이저 사이에서 가상 게스트 이전

현재 Xen 기반 게스트를 KVM 으로 또는 KVM 기반 게스트를 Xen으로 전환하기 위한 프로그램이 없습니다. 게스트는 생성된 하이퍼바이저 유형에서만 사용될 수 있습니다.

경고

다음 절차는 Red Hat Enterprise Linux 5.4 이상 버전의 Intel 64 또는 AMD6에서만 사용할 수 있습니다. 기타 다른 설정이나 Red Hat Enterprise Linux 버전은 지원되지 않습니다. Red Hat Enterprise Linux 5.4 이전 버전에서 KVM을 사용할 수 없습니다.

32.2.1. Xen에서 KVM으로

다음 절차에서는 Xen 하이퍼바이저에서 KVM 하이퍼바이저로 변경하는 방법에 대해 설명합니다. 이러한 절차에서는 kernel-xen 패키지가 설치 및 활성화되어 있다고 가정합니다.
  1. KVM 패키지 설치

    kvm 패키지를 설치하지 않았을 경우 이를 설치합니다.
    # yum install kvm
    
  2. 사용 중인 커널 확인

    kernel-xen 패키지가 설치되었을 것입니다. uname 명령을 사용하여 사용 중인 커널을 확인합니다:
    $ uname -r
    2.6.18-159.el5xen
    
    현재 "2.6.18-159.el5xen" 커널을 시스템에서 사용하고 있습니다. 기본값 커널 "2.6.18-159.el5"를 사용하고 있을 경우 하부 절차를 생략할 수 있습니다.
    1. Xen 커널을 기본값 커널로 변경

      grub.conf 파일은 어떤 커널을 부팅할지를 결정합니다. 기본값 커널을 변경하려면 아래에서와 같이 /boot/grub/grub.conf 파일을 편집합니다.
      								default=1
      timeout=5
      splashimage=(hd0,0)/grub/splash.xpm.gz
      hiddenmenu
      title Red Hat Enterprise Linux Server (2.6.18-159.el5)
              root (hd0,0)
              kernel /vmlinuz-2.6.18-159.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
              initrd /initrd-2.6.18-159.el5.img
      title Red Hat Enterprise Linux Server (2.6.18-159.el5xen)
              root (hd0,0)
              kernel /xen.gz-2.6.18-159.el5
              module /vmlinuz-2.6.18-159.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet
              module /initrd-2.6.18-159.el5xen.img
      
      default=1 파라미터에 유의합니다. 이는 GRUB 부트 로더가 두번째 항목인 Xen 커널을 부팅하도록 지시합니다. 기본값을 0 (또는 기본값 커널 번호) 으로 변경합니다.
      								default=0
      timeout=5
      splashimage=(hd0,0)/grub/splash.xpm.gz
      hiddenmenu
      title Red Hat Enterprise Linux Server (2.6.18-159.el5)
              root (hd0,0)
              kernel /vmlinuz-2.6.18-159.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
              initrd /initrd-2.6.18-159.el5.img
      title Red Hat Enterprise Linux Server (2.6.18-159.el5xen)
              root (hd0,0)
              kernel /xen.gz-2.6.18-159.el5
              module /vmlinuz-2.6.18-159.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet
              module /initrd-2.6.18-159.el5xen.img
      
  3. 새 커널을 불러오기 위해 재부팅

    시스템을 재부팅합니다. 컴퓨터는 기본값 커널로 다시 시작하게 됩니다. KVM 모듈은 자동으로 커널을 불러와야 합니다. KVM이 실행되고 있는지 확인합니다:
    $ lsmod | grep kvm
    kvm_intel              85992  1 
    kvm                   222368  2 ksm,kvm_intel
    
    모든것이 올바르게 작동할 경우 kvm 모듈 및 kvm_intel 모듈 또는 kvm_amd 모듈이 나타나게 됩니다.

32.2.2. KVM에서 Xen으로

다음 부분에서는 KVM 하이퍼바이저에서 Xen 하이퍼바이저로 변경하는 절차에 대해 설명합니다. 이러한 절차에서는 kvm 패키지가 설치 및 활성화되어 있다고 가정합니다.
  1. Xen 패키지 설치

    kernel-xenxen 패키지가 설치되어 있지 않을 경우 이를 설치합니다.
    # yum install kernel-xen xen
    
    kernel-xen 패키지가 설치되어 있으나 비활성화되어 있을 수 도 있습니다.
  2. 사용 중인 커널 확인

    uname 명령을 사용하여 어떤 커널을 실행할 지를 결정합니다.
    $ uname -r
    2.6.18-159.el5
    
    시스템에서 현재 "2.6.18-159.el5" 커널이 실행되고 있습니다. 이는 기본값 커널입니다. 커널 마지막에 xen이 있고 (예: 2.6.18-159.el5xen) Xen 커널이 실행되고 있을 경우 하부 절차를 생략할 수 있습니다.
    1. 기본값 커널에서 Xen 커널로 변경

      grub.conf 파일은 어떤 커널을 부팅할지를 결정합니다. 기본값 커널을 변경하려면 아래에서와 같이 /boot/grub/grub.conf 파일을 편집합니다.
      								default=0
      timeout=5
      splashimage=(hd0,0)/grub/splash.xpm.gz
      hiddenmenu
      title Red Hat Enterprise Linux Server (2.6.18-159.el5)
              root (hd0,0)
              kernel /vmlinuz-2.6.18-159.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
              initrd /initrd-2.6.18-159.el5.img
      title Red Hat Enterprise Linux Server (2.6.18-159.el5xen)
              root (hd0,0)
              kernel /xen.gz-2.6.18-159.el5
              module /vmlinuz-2.6.18-159.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet
              module /initrd-2.6.18-159.el5xen.img
      
      default=0 파라미터에 유의합니다. 이는 GRUB 부트 로더가 첫번째 항목인 기본값 커널을 부팅하도록 지시합니다. 기본값을 1 (또는 Xen 커널 번호)로 변경합니다.
      								default=1
      timeout=5
      splashimage=(hd0,0)/grub/splash.xpm.gz
      hiddenmenu
      title Red Hat Enterprise Linux Server (2.6.18-159.el5)
              root (hd0,0)
              kernel /vmlinuz-2.6.18-159.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
              initrd /initrd-2.6.18-159.el5.img
      title Red Hat Enterprise Linux Server (2.6.18-159.el5xen)
              root (hd0,0)
              kernel /xen.gz-2.6.18-159.el5
              module /vmlinuz-2.6.18-159.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet
              module /initrd-2.6.18-159.el5xen.img
      
  3. 새 커널을 불러오기 위해 재부팅

    시스템을 재부팅합니다. 컴퓨터는 Xen 커널로 다시 시작하게 됩니다. uname 명령을 사용하여 확인합니다:
    $ uname -r
    2.6.18-159.el5xen
    
    출력 결과 마지막에 xen이 있을 경우 Xen 커널은 실행되고 있는 것입니다.

32.3. qemu-img 사용

qemu-img 명령행 도구는 Xen 및 KVM에 의해 사용되는 다양한 파일 시스템을 포맷하는데 사용됩니다. qemu-img는 가상 게스트 이미지, 추가 저장 장치 및 네트워크 저장 장치를 포맷하기 위해 사용됩니다. qemu-img 옵션 및 사용법은 다음과 같습니다.
새 이미지 또는 장치 포맷 및 생성
새 디스크 이미지 파일 이름의 크기 size 및 포맷format을 생성합니다.
# qemu-img create [-6] [-e] [-b base_image] [-f format] filename [size]
base_image가 지정되어 있을 경우, base_image와 다른 이미지 만이 기록됩니다. 이러한 경우 크기를 지정할 필요가 없습니다. "commit" 감시 명령을 사용하지 않을 경우 base_image는 절대 수정되지 않습니다.
기존 이미지를 다른 포맷으로 변환
convert 옵션은 인식된 포맷을 다른 이미지 포맷으로 변환하는데 사용됩니다.
명령 포맷:
# qemu-img convert [-c] [-e] [-f format] filename [-O output_format] output_filename
output_format 포맷을 사용하여 디스크 이미지 filename을 디스크 이미지 output_filename으로 변환합니다. 디스크 이미지는 옵션 사항으로 -e 옵션을 사용하여 암호화하거나 -c 옵션을 사용하여 압축할 수 있습니다.
"qcow" 포맷만이 암호화 또는 압축을 지원합니다. 압축은 읽기 전용으로 압축된 부분이 다시 작성되어야 할 경우 이는 압축되지 않은 데이터로 다시 작성되어야 함을 의미합니다.
암호화는 여러 보안 128 비트 키가 있는 AES 포맷을 사용합니다. 보안을 최대화하기 위해 암호(16자 이상)를 길게합니다.
qcow 또는 cow와 같이 증가할 수 있는 포맷을 사용할 때 크기가 적은 이미지를 갖기 위해 이미지 변환이 유용합니다. 대상 이미지에서 빈 섹터가 감지되어 억제됩니다.
이미지 정보 얻기
info 파라미터는 디스크 이미지에 관한 정보를 표시합니다. info 옵션의 포맷은 다음과 같습니다:
# qemu-img info [-f format] filename
디스크 이미지 파일 이름에 관한 정보를 제공합니다. 특히 표시된 크기와 다를 수 있는 디스크에 보유된 크기를 알기 위해 사용합니다. 디스크 이미지에 vm 스냅샷이 저장되어 있을 경우, 이것 또한 표시됩니다.
지원되는 포맷
주로 이미지의 포맷은 자동으로 추측됩니다. 다음과 같은 포맷이 지원됩니다:
raw
Raw 디스크 이미지 포맷 (기본값). 이 포맷은 간단하고 기타 모든 에뮬레이터로 쉽게 내보내기 할 수 있는 장점이 있습니다. 파일 시스템이 Linux에서 ext2 또는 ext3를 Windows에서 NTFS를 지원하고 있을 경우, 쓰기 섹터만이 공간을 보유하게 됩니다. qemu-img info 명령을 사용하여 Unix/Linux 상에서 이미지 또는 ls -ls 명령에 의해 사용되는 실제 크기를 알 수 있습니다.
qcow2
QEMU 이미지 포맷, 가장 다양한 형식의 포맷. 작은 이미지 (파일 시스템이 Windows 상에서 지원되지 않을 경우 유용), AES 암호화 옵션, zlib 기반 압축 및 여러 VM 스냅샷 지원을 얻기 위해 이를 사용합니다.
qcow
이전 QEMU 이미지 포맷. 이전 버전과의 호환을 위해 포함되어 있습니다.
cow
Write 이미지 포맷에서 사용자 모드 Linux 사본. cow 포맷은 이전 버전과의 호환을 위해 포함되어 있습니다. 이는 Windows와 작동하지 않습니다.
vmdk
VMware 3 및 4 호환 이미지 포맷.
cloop
Linux 압축 루프 이미지, Knoppix CD-ROM에 있는 압축된 CD-ROM 이미지를 다시 사용하기 위해 유용합니다.

32.4. Overcommitting Resources

The KVM hypervisor supports overcommitting CPUs and memory. Overcommitting is the process of allocating more virtualized CPUs or memory than there are physical resources on the system. CPU overcommit allows under-utilized virtualized servers or desktops to run on fewer servers which saves power and money.

Xen 지원

Memory overcommitting is not supported for the Xen hypervisor, however CPU overcommitting is supported.
메모리 오버커밋
대부분의 운영 체제 및 어플리케이션은 사용 가능한 RAM을 100% 사용하지 않습니다. 이러한 동작은 실제 사용 가능한 크기 보다 가상 게스트에 대해 더 많은 메모리를 사용하기 위해 KVM으로 악용될 수 있습니다.
When using KVM, virtual machines operate as Linux processes. Guests on the KVM hypervisor do not have blocks of physical RAM assigned to them, instead they function as processes. Each process in a Linux system is allocated memory when it requests more memory. In a similar way, KVM allocates memory for guests when the guest requests more or less memory. The guest only uses slightly more physical memory than the virtualized operating system appears to use.
When physical memory is nearly completely used or a process is inactive for some time, Linux moves the process's memory to swap. Swap is usually a partition on a hard disk drive or solid state drive which Linux uses to extend virtual memory. Swap is significantly slower than RAM.
As KVM virtual machines are Linux processes, memory used by virtualized guests can be put into swap if the guest is idle or not in heavy use. Memory can be committed over the total size of the swap and physical RAM. This can cause issues if virtualized guests use their total RAM. Without sufficient memory and swap space for the virtual machine processes, the system can run completely out of memory, leading to the failure of one or more virtual machine processes.

경고

사용 가능한 스왑 공간이 충분하지 않을 경우 게스트 운영 체제는 강제로 종료됩니다. 이는 게스트를 작동할 수 없게 할 수 있습니다. 따라서 사용 가능한 스왑 공간보다 많은 메모리를 오버커밋하지 않습니다.
메모리 성능을 향상시키기 위해 충분히 사용하지 않은 메모리를 하드 드라이브로 스왑하기 위해 스왑 파티션을 사용합니다. 스왑 파티션의 기본값 크기는 RAM 용량 및 오버커밋 비율에서 계산됩니다. KVM으로 메모리를 오버커밋하고자 할 경우 스왑 파티션을 크게 만드는 것이 좋습니다. 권장되는 오버커밋 비율은 50% (0.5)입니다. 사용되는 수식은 다음과 같습니다:
(0.5 * RAM) + (overcommit ratio * RAM) = Recommended swap size
Red Hat Knowledgebase에는 스왑 파티션 크기를 효과적이고 안전하게 결정하는 방법에 대한 내용이 있습니다.
Overcommitting guests by swapping out temporarily unused guest memory can be very slow, due to the IO latency introduced by disk seek times. However, Red Hat Enterprise Linux virtualization with KVM can often avoid this disk IO penalty by merging multiple pages with identical content into the same physical pages. This is done by the KSM (Kernel Samepage Merging) kernel process, which scans memory to find identical pages. The KSM kernel process uses CPU time to avoid disk IO. This tradeoff is often beneficial in workloads with many smaller, similar guests.
시스템의 실제 RAM 용량 이상의 가상 게스트 수가 되는 10 배의 오버커밋 비율로 실행할 수 있습니다. 이는 특정 어플리케이션 로드와만 작동합니다 (예: 100% 이하 사용하는 데스크탑 가상화). 오버커밋 비율을 설정하는 것은 어렵지 않지만 사용자 환경에 맞도록 테스트하고 사용자 설정해야 합니다.
가상 CPU 오버 커밋
KVM 하이퍼바이저는 가상 CPU 오버커밋을 지원합니다. 가상 CPU는 가상 게스트에 허용된 제한 용량을 불러오는 한 오버커밋될 수 있습니다. 100% 근접하게 로드하는 것은 요청 실패하거나 응답 시간을 사용할 수 없는 원인이 될 수 있으므로 VCPU를 오버커밋할 때 주의해야 합니다.
각각의 가상 게스트가 단일 VCPU를 갖을 때 가상 CPU는 최상으로 오버커밋됩니다. Linux 스케줄러는 이러한 유형의 로드에서 아주 유용합니다. KVM은 다섯개의 VCPU 비율에서 100% 이하로 로드하는 게스트를 가장 안전하게 지원합니다. 단일 VCPU 가상 게스트를 오버커밋하는 것은 문제가 되지 않습니다.
실제 프로세스 코어 수 보다 많은 대칭적인 멀티 프로세싱 게스트를 오버커밋할 수 없습니다. 예를 들어, 네 개의 VCPU를 갖는 게스트는 듀얼 코어 프로세서를 갖는 호스트에서 실행될 수 없습니다. 실제 프로세싱 코어 수 이상을 갖는 대칭적인 멀티 프로세싱 게스트를 오버커밋하는 것은 심각한 실행 성능 저하의 원인이 될 수 있습니다.
최대 실제 코어 수 만큼 게스트에 VCPU를 할당하는 것이 적절하며 예상한대로 작동하게 됩니다. 예를 들어, 네 개의 코어 호스트에서 네 개의 VCPU로 가상 게스트를 실행하는 것입니다. 100% 보다 적게 불러오는 게스트는 설정에서 효과적으로 작동합니다.

테스트 우선

광범위한 테스트를 거치지 않고 실제 제품 환경에서 메모리 또는 CPU를 오버커밋하지 않습니다. 100% 메모리 또는 프로세스 리소스를 사용하는 어플리케이션은 오버커밋된 환경에서 불안정할 수 있습니다. 사용하기 전 테스트하도록 합니다.

32.5. /etc/grub.conf 수정

This section describes how to safely and correctly change your /etc/grub.conf file to use the virtualization kernel. You must use the xen kernel to use the Xen hypervisor. Copy your existing xen kernel entry make sure you copy all of the important lines or your system will panic upon boot (initrd will have a length of '0'). If you require xen hypervisor specific values you must append them to the xen line of your grub entry.
아래의 출력 결과는 kernel-xen 패키지를 실행하고 있는 시스템에서의 grub.conf 항목의 예입니다. 시스템 상의 grub.conf는 다를 수 있습니다. 아래의 예에서 중요한 부분은 title 행에서 다음의 새로운 행 까지입니다.
#boot=/dev/sda
default=0
timeout=15
#splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console

title Red Hat Enterprise Linux Server (2.6.17-1.2519.4.21.el5xen)
	root (hd0,0)
	kernel /xen.gz-2.6.17-1.2519.4.21.el5 com1=115200,8n1
	module /vmlinuz-2.6.17-1.2519.4.21.el5xen ro root=/dev/VolGroup00/LogVol00
	module /initrd-2.6.17-1.2519.4.21.el5xen.img

grub.conf 수정 관련 중요 사항

Your grub.conf could look very different if it has been manually edited before or copied from an example. Read 28장. Xen 커널 부트 파라미터 설정 for more information on using virtualization and grub.
부팅 시 호스트 시스템에 할당된 메모리 양을 256MB로 설정하려면 dom0_mem=256Mgrub.conf에 있는 xen 행에 추가해야 합니다. 이전 예에서 grub 설정 파일의 수정된 버전은 다음과 같습니다:
#boot=/dev/sda
default=0
timeout=15
#splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console

title Red Hat Enterprise Linux Server (2.6.17-1.2519.4.21.el5xen)
	root (hd0,0)
	kernel /xen.gz-2.6.17-1.2519.4.21.el5 com1=115200,8n1 dom0_mem=256MB
	module /vmlinuz-2.6.17-1.2519.4.21.el5xen ro
	root=/dev/VolGroup00/LogVol00
	module /initrd-2.6.17-1.2519.4.21.el5xen.img

32.6. 가상화 확장자 확인

다음 부분을 통해 시스템이 하드웨어 가상화 확장자를 사용할 수 있는 지를 결정합니다. 가상화 확장자 (Intel VT 또는 AMD-V)는 완전 가상화의 경우 필요합니다.

가상화 확장자없이 가상화를 사용할 수 있습니까?

하드웨어 가상화 확장자가 나타나지 않을 경우 Red Hat kernel-xen 패키지와 함께 Xen 반가상화를 사용할 수 있습니다.
  1. 다음 명령을 실행하여 CPU 가상화 확장자를 사용할 수 있는지를 확인합니다:
    $ grep -E 'svm|vmx' /proc/cpuinfo
    
  2. Analyze the output.
    • 다음의 출력 결과에는 Intel VT 확장자와 함께 Intel 프로세서를 가리키는 vmx 항목이 들어 있습니다:
      flags   : fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush 
      	dts acpi mmx fxsr sse sse2 ss ht  tm syscall lm constant_tsc pni monitor ds_cpl
      	vmx est tm2 cx16 xtpr lahf_lm
      
    • 다음의 출력 결과에는 AMD-V 확장자와 함께 AMD 프로세서를 가리키는 svm 항목이 들어 있습니다:
      flags   :  fpu tsc msr pae mce cx8 apic mtrr mca cmov pat pse36 clflush
      	mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni cx16
      	lahf_lm cmp_legacy svm cr8legacy ts fid vid ttp tm stc
      
    If any output is received, the processor has the hardware virtualization extensions. However in some circumstances manufacturers disable the virtualization extensions in BIOS.
    "flags:" 내용은 시스템에 있는 각각의 하이퍼스레드, 코어 또는 CPU에 대해 여러번 나타날 수 있습니다.
    The virtualization extensions may be disabled in the BIOS. If the extensions do not appear or full virtualization does not work refer to 절차 35.1. “BIOS에서 가상화 확장자 활성화 ”.
  3. For users of the KVM hypervisor

    If the kvm package is installed. I As an additional check, verify that the kvm modules are loaded in the kernel:
    # lsmod | grep kvm
    
    If the output includes kvm_intel or kvm_amd then the kvm hardware virtualization modules are loaded and your system meets requirements. sudo

Additional output

If the libvirt package is installed, the virsh command can output a full list of virtualization system capabilities. Run virsh capabilities as root to receive the complete list.

32.7. Accessing data from a guest disk image

There are various methods for accessing the data from guest image files. One common method is to use the kpartx tool, covered by this section, to mount the guest file system as a loop device which can then be accessed.
The kpartx command creates device maps from partition tables. Each guest storage image has a partition table embedded in the file.
The libguestfs and guestfish packages, available from the EPEL repository, allow advanced modification and access to guest file systems. The libguestfs and guestfish packages are not covered in this section at this time.

경고

Guests must be offline before their files can be read. Editing or reading files of an active guest is not possible and may cause data loss or damage.
절차 32.1. Accessing guest image data
  1. Install the kpartx package.
    # yum install kpartx
    
  2. Use kpartx to list partition device mappings attached to a file-based storage image. This example uses a image file named guest1.img.
    # kpartx -l /var/lib/libvirt/images/guest1.img
    loop0p1 : 0 409600 /dev/loop0 63
    loop0p2 : 0 10064717 /dev/loop0 409663
    guest1 is a Linux guest. The first partition is the boot partition and the second partition is an EXT3 containing the root partition.
  3. Add the partition mappings to the recognized devices in /dev/mapper/.
    # kpartx -a /var/lib/libvirt/images/guest1.img
    
    1. Test that the partition mapping worked. There should be new devices in the /dev/mapper/ directory
      # ls /dev/mapper/
      loop0p1
      loop0p2
      
      The mappings for the image are named in the format loopXpY.
  4. Mount the loop device which to a directory. If required, create the directory. This example uses /mnt/guest1 for mounting the partition.
    # mkdir /mnt/guest1
    # mount /dev/mapper/loop0p1 /mnt/guest1 -o loop,ro
  5. The files are now available for reading in the /mnt/guest1 directory. Read or copy the files.
  6. Unmount the device so the guest image can be reused by the guest. If the device is mounted the guest cannot access the image and therefore cannot start.
    # umount /mnt/tmp
  7. Disconnect the image file from the partition mappings.
    # kpartx -d /var/lib/libvirt/images/guest1.img
    
The guest can now be started again.
Accessing data from guest LVM volumes
Many Linux guests use Logical Volume Management (LVM) volumes. Additional steps are required to read data on LVM volumes on virtual storage images.
  1. Add the partition mappings for the guest1.img to the recognized devices in the /dev/mapper/ directory.
    # kpartx -a /var/lib/libvirt/images/guest1.img
    
  2. In this example the LVM volumes are on a second partition. The volumes require a rescan with the vgscan command to find the new volume groups.
    # vgscan
    Reading all physical volumes . This may take a while...
    Found volume group "VolGroup00" using metadata type lvm2
  3. Activate the volume group on the partition (called VolGroup00 by default) with the vgchange -ay command.
    # vgchange -ay VolGroup00
    2 logical volumes in volume group VolGroup00 now active.
  4. Use the lvs command to display information about the new volumes. The volume names (the LV column) are required to mount the volumes.
    # lvs
    LV VG Attr Lsize Origin Snap% Move Log Copy%
    LogVol00 VolGroup00 -wi-a- 5.06G
    LogVol01 VolGroup00 -wi-a- 800.00M
  5. Mount /dev/VolGroup00/LogVol00 in the /mnt/guestboot/ directory.
    # mount /dev/VolGroup00/LogVol00 /mnt/guestboot
  6. The files are now available for reading in the /mnt/guestboot directory. Read or copy the files.
  7. Unmount the device so the guest image can be reused by the guest. If the device is mounted the guest cannot access the image and therefore cannot start.
    # umount /mnt/
  8. Disconnect the volume group VolGroup00
    # vgchange -an VolGroup00
    
  9. Disconnect the image file from the partition mappings.
    # kpartx -d /var/lib/libvirt/images/guest1.img
    
The guest can now be restarted.

32.8. Setting KVM processor affinities

This section covers setting processor and processing core affinities with libvirt for KVM guests.
By default, libvirt provisions guests using the hypervisor's default policy. For most hypervisors, the policy is to run guests on any available processing core or CPU. There are times when an explicit policy may be better, in particular for systems with a NUMA (Non-Uniform Memory Access) architecture. A guest on a NUMA system should be pinned to a processing core so that its memory allocations are always local to the node it is running on. This avoids cross-node memory transports which have less bandwidth and can significantly degrade performance.
On a non-NUMA systems some form of explicit placement across the hosts’ sockets, cores and hyperthreads may be more efficient.
Identifying CPU and NUMA topology
The first step in deciding what policy to apply is to determine the host’s memory and CPU topology. The virsh nodeinfo command provides information about how many sockets, cores and hyperthreads there are attached a host.
# virsh nodeinfo
CPU model:           x86_64
CPU(s):              8
CPU frequency:       1000 MHz
CPU socket(s):       2
Core(s) per socket:  4
Thread(s) per core:  1
NUMA cell(s):        1
Memory size:         8179176 kB
This system has eight CPUs, in two sockets, each processor has four cores.
The output shows that that the system has a NUMA architecture. NUMA is more complex and requires more data to accurately interpret. Use the virsh capabilities to get additional output data on the CPU configuration.
# virsh capabilities
<capabilities>
  <host>
    <cpu>
      <arch>x86_64</arch>
    </cpu>
    <migration_features>
      <live/>
      <uri_transports>
        <uri_transport>tcp</uri_transport>
      </uri_transports>
    </migration_features>
    <topology>
      <cells num='2'>
        <cell id='0'>
          <cpus num='4'>
            <cpu id='0'/>
            <cpu id='1'/>
            <cpu id='2'/>
            <cpu id='3'/>
          </cpus>
        </cell>
        <cell id='1'>
          <cpus num='4'>
            <cpu id='4'/>
            <cpu id='5'/>
            <cpu id='6'/>
            <cpu id='7'/>
          </cpus>
        </cell>
      </cells>
    </topology>
    <secmodel>
      <model>selinux</model>
      <doi>0</doi>
    </secmodel>
  </host>

 [ Additional XML removed ]

</capabilities>
The output shows two NUMA nodes (also know as NUMA cells), each containing four logical CPUs (four processing cores). This system has two sockets, therefore we can infer that each socket is a separate NUMA node. For a guest with four virtual CPUs, it would be optimal to lock the guest to physical CPUs 0 to 3, or 4 to 7 to avoid accessing non-local memory, which are significantly slower than accessing local memory.
If a guest requires eight virtual CPUs, as each NUMA node only has four physical CPUs, a better utilization may be obtained by running a pair of four virtual CPU guests and splitting the work between them, rather than using a single 8 CPU guest. Running across multiple NUMA nodes significantly degrades performance for physical and virtualized tasks.
Decide which NUMA node can run the guest
Locking a guest to a particular NUMA node offers no benefit if that node does not have sufficient free memory for that guest. libvirt stores information on the free memory available on each node. Use the virsh freecell command to display the free memory on all NUMA nodes.
# virsh freecell
0: 2203620 kB
1: 3354784 kB
If a guest requires 3 GB of RAM allocated, then the guest should be run on NUMA node (cell) 1. Node 0 only has 2.2GB free which is probably not sufficient for certain guests.
Lock a guest to a NUMA node or physical CPU set
Once you have determined which node to run the guest on, refer to the capabilities data (the output of the virsh capabilities command) about NUMA topology.
  1. Extract from the virsh capabilities output.
    <topology>
      <cells num='2'>
        <cell id='0'>
        <cpus num='4'>
          <cpu id='0'/>
          <cpu id='1'/>
          <cpu id='2'/>
          <cpu id='3'/>
        </cpus>
      </cell>
      <cell id='1'>
        <cpus num='4'>
          <cpu id='4'/>
          <cpu id='5'/>
          <cpu id='6'/>
          <cpu id='7'/>
        </cpus>
      </cell>
      </cells>
    </topology>
  2. Observe that the node 1, <cell id='1'>, has physical CPUs 4 to 7.
  3. The guest can be locked to a set of CPUs by appending the cpuset attribute to the configuration file.
    1. While the guest is offline, open the configuration file with virsh edit.
    2. Locate where the guest's virtual CPU count is specified. Find the vcpus element.
      <vcpus>4</vcpus>
      The guest in this example has four CPUs.
    3. Add a cpuset attribute with the CPU numbers for the relevant NUMA cell.
      <vcpus cpuset='4-7'>4</vcpus>
  4. Save the configuration file and restart the guest.
The guest has been locked to CPUs 4 to 7.
Automatically locking guests to CPUs with virt-install
The virt-install provisioning tool provides a simple way to automatically apply a 'best fit' NUMA policy when guests are created.
The cpuset option for virt-install can use a CPU set of processors or the parameter auto. The auto parameter automatically determines the optimal CPU locking using the available NUMA data.
For a NUMA system, use the --cpuset=auto with the virt-install command when creating new guests.
Tuning CPU affinity on running guests
There may be times where modifying CPU affinities on running guests is preferable to rebooting the guest. The virsh vcpuinfo and virsh vcpupin commands can perform CPU affinity changes on running guests.
The virsh vcpuinfo command gives up to date information about where each virtual CPU is running.
In this example, guest1 is a guest with four virtual CPUs is running on a KVM host.
# virsh vcpuinfo guest1
VCPU:           0
CPU:            3
State:          running
CPU time:       0.5s
CPU Affinity:   yyyyyyyy
VCPU:           1
CPU:            1
State:          running
CPU Affinity:   yyyyyyyy
VCPU:           2
CPU:            1
State:          running
CPU Affinity:   yyyyyyyy
VCPU:           3
CPU:            2
State:          running
CPU Affinity:   yyyyyyyy
The virsh vcpuinfo output (the yyyyyyyy value of CPU Affinity) shows that the guest can presently run on any CPU.
To lock the virtual CPUs to the second NUMA node (CPUs four to seven), run the following commands.
# virsh vcpupin guest1 0 4
# virsh vcpupin guest1 1 5
# virsh vcpupin guest1 2 6
# virsh vcpupin guest1 3 7
The virsh vcpuinfo command confirms the change in affinity.
# virsh vcpuinfo guest1
VCPU:           0
CPU:            4
State:          running
CPU time:       32.2s
CPU Affinity:   ----y---
VCPU:           1
CPU:            5
State:          running
CPU time:       16.9s
CPU Affinity:   -----y--
VCPU:           2
CPU:            6
State:          running
CPU time:       11.9s
CPU Affinity:   ------y-
VCPU:           3
CPU:            7
State:          running
CPU time:       14.6s
CPU Affinity:   -------y

32.9. 고유한 새 MAC 주소 생성

In some case you will need to generate a new and unique MAC address for a guest. There is no command line tool available to generate a new MAC address at the time of writing. The script provided below can generate a new MAC address for your guests. Save the script to your guest as macgen.py. Now from that directory you can run the script using ./macgen.py and it will generate a new MAC address. A sample output would look like the following:
$ ./macgen.py 
00:16:3e:20:b0:11
	
#!/usr/bin/python
# macgen.py script to generate a MAC address for virtualized guests on Xen
#
import random
#
def randomMAC():
	mac = [ 0x00, 0x16, 0x3e,
		random.randint(0x00, 0x7f),
		random.randint(0x00, 0xff),
		random.randint(0x00, 0xff) ]
	return ':'.join(map(lambda x: "%02x" % x, mac))
#
print randomMAC()
게스트 용 새 MAC 생성을 위한 다른 방식
python-virtinst의 내장 모듈을 사용하여 게스트 설정 파일에서 사용할 새 MAC 주소 및 UUID를 생성할 수 있습니다:
# echo  'import virtinst.util ; print\
 virtinst.util.uuidToString(virtinst.util.randomUUID())' | python
# echo  'import virtinst.util ; print virtinst.util.randomMAC()' | python
위의 스크립트로 아래와 같은 스트립트 파일을 구현할 수 있습니다.
#!/usr/bin/env python
#  -*- mode: python; -*-
print ""
print "New UUID:"
import virtinst.util ; print virtinst.util.uuidToString(virtinst.util.randomUUID())
print "New MAC:"
import virtinst.util ; print virtinst.util.randomMAC()
print ""

32.10. Xen 게스트 용 네트워크 대역폭 제한

In some environments it may be required to limit the network bandwidth available to certain guests. This can be used to implement basic Quality of Service on a host running multiple virtual machines. By default, the guest can use any bandwidth setting available which your physical network card supports. The physical network card must be mapped to one of virtual machine's virtual network interfaces. In Xen the “rate” parameter part of the VIF entries can throttle virtualized guests.
다음은 변수 목록입니다.
rate
The rate= option can be added to the VIF= entry in a virtual machine configuration file to limit a virtual machine's network bandwidth or specify a specific time interval for a time window.
time window
time window는 rate= 옵션에서 옵션 사항입니다:
디폴트 time window는 50ms입니다.
보다 적은 time window는 보다 적은 버스트를 전송하게 되지만, 보급 속도 및 지연 시간이 증가하게 됩니다.
디폴트 50ms time window는 지연 속도 및 처리량 사이에서 균형을 유지하며 대부분의 경우 변경 요청을 하지 않습니다.
rate 파라미터 값 및 사용 예시
rate=10Mb/s
게스트에서 내보내는 네트워크 소통량을 10MB/s으로 제한합니다.
rate=250KB/s
게스트에서 내보내는 네트워크 소통량을 250KB/s으로 제한합니다.
rate=10MB/s@50ms
10MB/s 까지 대역폭을 제한하고 게스트에게 50ms 마다 50KB 정도를 제공합니다.
가상 장치 설정에서 예시 VIF 항목은 다음과 같이 나타납니다:
vif = [ 'rate=10MB/s , mac=00:16:3e:7a:55:1c, bridge=xenbr1']
This rate entry would limit the virtual machine's interface to 10MB/s for outgoing traffic

32.11. Xen 프로세서 친화력 설정

Xen은 하나 이상의 호스트 CPU와 연계시키기 위해 가상 CPU를 할당할 수 있습니다. 이는 가상 게스트에 실제 프로세스 자원을 할당합니다. 이 기술은 듀얼코어, 하이퍼스레딩 또는 다른 고급 CPU 기술을 도입할 때 Red Hat Enterprise Linux가 프로세스 자원을 최적화하여 사용할 수 있도록 해줍니다. Xen 크레디트 스케줄러는 시스템 사용을 최적화하기 위해서 자동으로 실제 CPU에서 가상 CPU를 재조정합니다. Red Hat Enterprise Linux에서 가상 CPU가 실제 CPU로 고정되어 있는한 필요시 크래디트 스케줄러는 CPU를 조정할 수 있습니다.
I/O 집약 작업을 실행하고 있을 경우, domain0을 실행하기 위해 하이퍼스레드나 전체 프로세스 코어를 제공하는 것이 좋습니다.
KVM은 기본값 Linux 커널 스케줄러를 사용하므로 이는 KVM의 경우 필요하지 않음에 유의하십시오.
CPU 친화력은 virsh 또는 virt-manager 명령을 사용하여 설정할 수 있습니다:
To set CPU affinities using virsh refer to 가상 CPU 친화력 설정 for more information.
To configure and view CPU information with virt-manager refer to 26.11절. “가상 CPU 보기 ” for more information.

32.12. Xen 하이퍼바이저 수정

Managing host systems often involves changing the boot configuration file /boot/grub/grub.conf. Managing several or more hosts configuration files quickly becomes difficult. System administrators often prefer to use the 'cut and paste' method for editing multiple grub.conf files. If you do this, ensure you include all five lines in the Virtualization entry (or this will create system errors). Hypervisor specific values are all found on the 'xen' line. This example represents a correct grub.conf virtualization entry:
# boot=/dev/sda/
default=0
timeout=15
#splashimage=(hd0, 0)/grub/splash.xpm.gz

hiddenmenu
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console
title Red Hat Enterprise Linux Server (2.6.17-1.2519.4.21. el5xen)
root (hd0, 0)
kernel /xen.gz-2.6.17-1.2519.4.21.el5 com1=115200,8n1
    module /vmlinuz-2.6.17-1.2519.4.21el5xen ro root=/dev/VolGroup00/LogVol00
    module /initrd-2.6.17-1.2519.4.21.el5xen.img
For example, to change the memory entry on your hypervisor (dom0) to 256MB at boot time, edit the 'xen' line and append it with this entry: 'dom0_mem=256M'. This example is the grub.conf with the hypervisor's memory entry modified.
# boot=/dev/sda
default=0
timeout=15
#splashimage=(hd0,0)/grubs/splash.xpm.gz
hiddenmenu
serial --unit=0 --speed =115200 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console
title Red Hat Enterprise Linux Server (2.6.17-1.2519.4.21. el5xen)
root (hd0,0)
kernel /xen.gz-2.6.17-1.2519.4.21.el5 com1=115200,8n1 dom0_mem=256MB
    module /vmlinuz-2.6.17-1.2519.4.21.el5xen ro root=/dev/VolGroup00/LogVol00
    module /initrd-2.6.17-1.2519.4.21.el5xen.img

32.13. 보안 ftpd

vsftpd는 반가상화 게스트 (예: Red Hat Enterprise Linux 5 리포지터리) 또는 기타 다른 데이터에 대한 설치 트리로 액세스할 수 있게 합니다. 서버 설치시 vsftpd를 설치하지 않은 경우 설치 미디어의 서버 디렉토리에서 RPM 패키지를 가져와서 rpm -ivh vsftpd*.rpm을 사용하여 이를 설치할 수 있습니다. (RPM 패키지는 현재 디렉토리에 위치하고 있어야 함에 유의하십시오)
  1. To configure vsftpd, edit /etc/passwd using vipw and change the ftp user's home directory to the directory where you are going to keep the installation trees for your para-virtualized guests. An example entry for the FTP user would look like the following:
    ftp:x:14:50:FTP User:/xen/pub:/sbin/nologin
    
  2. chkconfig --list vsftpd를 사용하여 vsftpd가 활성화되지 않았는지를 확인합니다:
    $ chkconfig --list vsftpd
    vsftpd          0:off   1:off   2:off   3:off   4:off   5:off   6:off
    
  3. 런레벨 3, 4, 5에서 자동으로 vsftpd를 시작하기 위해 chkconfig --levels 345 vsftpd on을 실행합니다.
  4. chkconfig --list vsftpd 명령을 사용하여 시스템 부팅 시 vsftpd 데몬을 시작하도록 활성화되어 있는지를 확인합니다:
    $ chkconfig --list vsftpd
    vsftpd          0:off   1:off   2:off   3:on    4:on    5:on    6:off
    
  5. service vsftpd start vsftpd를 사용하여 vsftpd 서비스를 시작합니다:
    $service vsftpd start vsftpd
    Starting vsftpd for vsftpd:                  [  OK  ]
    

32.14. LUN 지속성 구현

This section covers how to implement LUN persistence in guests and on the host machine with and without multipath.
다중 경로를 사용하지 않고 LUN 지속성 구현
시스템이 다중 경로를 지원하지 않으면, udev 를 사용하여 LUN 지속성을 구현할 수 있습니다. 시스템에 LUN 지속성을 구현하기 전에 적절한 UUID를 갖고 있는지 확인하시기 바랍니다. UUID를 갖고 있으면 /etc 디렉토리의 scsi_id 파일을 편집하여 LUN 지속성을 구현할 수 있습니다. 편집 도구를 사용해 파일을 열어서 다음 줄의 주석처리를 해제해야 합니다:
# options=-b
그 후 다음의 파라미터로 대체합니다:
# options=-g
이는 udev가 모든 시스템 SCSI 장치를 검사하여 UUID를 가져옵니다. 시스템 UUID를 확인하려면 scsi_id 명령을 사용합니다:
# scsi_id -g -s /block/sdc
*3600a0b80001327510000015427b625e*
출력 결과에 있는 긴 문자열이 UUID입니다. 시스템에 새로운 장치를 추가할 때 UUID는 변하지 않습니다. 장치 규칙을 생성하려면 각각의 장치에 해당하는 UUID가 필요합니다. 새 장치 규칙을 생성하려면 /etc/udev/rules.d 디렉토리에 있는 20-names.rules 파일을 편집합니다. 장치 이름 지정 규칙은 다음 형식을 따릅니다:
# KERNEL="sd*",  BUS="scsi",  PROGRAM="sbin/scsi_id", RESULT="UUID", NAME="devicename"
기존 UUID장치 이름 을 위의 UUID 검색 항목으로 대체하시기 바랍니다. 규칙은 다음과 비슷합니다:
KERNEL="sd*",  BUS="scsi",  PROGRAM="sbin/scsi_id", RESULT="3600a0b80001327510000015427b625e", NAME="mydevicename"
이는 시스템이 주어진 UUID를 검사하기 위해 /dev/sd* 패턴과 일치하는 모든 장치를 활성화합니다. 일치된 장치를 검색했을 때, /dev/devicename이라는 장치 노드를 생성합니다. 이 예제에서 장치 노드는 /dev/mydevice 입니다. 마지막으로, /etc/rc.local 파일에 다음 경로를 추가해야 합니다:
/sbin/start_udev
다중 경로를 사용한 LUN 지속성 구현
다중 경로 환경에서 LUN 지속성을 구현하려면 다중 경로 장치에 대한 별칭을 정의해야 합니다. 다음의 예제에서는 /etc/ 디렉토리에 있는 multipath.conf 파일을 편집하여 네 가지 장치를 정의해야 합니다:
multipath  {  
             wwid       3600a0b80001327510000015427b625e
             alias      oramp1
}
multipath  {  
             wwid       3600a0b80001327510000015427b6
             alias      oramp2
}
multipath  {  
             wwid       3600a0b80001327510000015427b625e
             alias      oramp3
}
multipath  {  
             wwid       3600a0b80001327510000015427b625e
             alias      oramp4
}
네 종류의 LUN을 정의합니다: /dev/mpath/oramp1, /dev/mpath/oramp2, /dev/mpath/oramp3, dev/mpath/oramp4. 이 장치들은 /dev/mpath 디렉토리에 위치하며 LUN 이름은 LUN의 wwid에서 생성된 별칭으로 재부팅후 지속적으로 사용됩니다.

32.15. 게스트 용 SMART 디스크 모니터링 비활성화

SMART 디스크 모니터링은 가상 디스크에서 실행되고 있으므로 비활성화될 수 있으며 실제 저장 장치는 호스트에 의해 관리됩니다.
/sbin/service smartd stop
/sbin/chkconfig --del smartd

32.16. 이전 Xen 설정 파일 삭제

Over time you will see a number of files accumulate in /var/lib/xen, the usually named vmlinuz.****** and initrd.******. These files are the initrd and vmlinuz files from virtual machines which either failed to boot or failed for some other reason. These files are temporary files extracted from virtual machine's boot disk during the start up sequence. These files should be automatically removed after the virtual machine is shut down cleanly. Then you can safely delete old and stale copies from this directory.

32.17. VNC 서버 설정

VNC 서버를 설정하려면 시스템 > 환경 설정에 있는 원격 데스크탑 어플리케이션을 사용합니다. 다른 방법으로 vino-preferences 명령을 실행할 수 있습니다.
다음의 절차를 통해 단독 VNC 서버 세션을 설정합니다:
  1. vncserver가 시작될 때 마다 GNOME 세션을 시작하기 위해 ~/.vnc/xstartup 파일을 편집합니다. 처음으로 vncserver 스크립트를 실행할 경우 VNC 세션 용으로 사용할 암호를 묻게 됩니다.
  2. 예시 xstartup 파일:
    #!/bin/sh
    # Uncomment the following two lines for normal desktop:
    # unset SESSION_MANAGER
    # exec /etc/X11/xinit/xinitrc
    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
    #xsetroot -solid grey
    #vncconfig -iconic &
    #xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    #twm &
    if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
    	eval `dbus-launch --sh-syntax –exit-with-session`
    	echo "D-BUS per-session daemon address is: \
    	$DBUS_SESSION_BUS_ADDRESS"
    fi
    exec  gnome-session
    

32.18. 게스트 설정 파일 복제

You can copy an existing configuration file to create an all new guest. You must modify the name parameter of the guests' configuration file. The new, unique name then appears in the hypervisor and is viewable by the management utilities. You must generate an all new UUID as well by using the uuidgen command. Then for the vif entries you must define a unique MAC address for each guest (if you are copying a guest configuration from an existing guest, you can create a script to handle it). For the xen bridge information, if you move an existing guest configuration file to a new host, you must update the xenbr entry to match your local networking configuration. For the Device entries, you must modify the entries in the 'disk=' section to point to the correct guest image.
You must also modify these system configuration settings on your guest. You must modify the HOSTNAME entry of the /etc/sysconfig/network file to match the new guest's hostname.
ifconfig eth0 파일 출력 결과를 일치시키기 위해 /etc/sysconfig/network-scripts/ifcfg-eth0 파일에 있는 HWADDR 주소를 수정하고, 고정 IP 주소를 사용하려면 IPADDR 항목을 수정해야 합니다.

32.19. 기존 게스트 및 게스트 설정 파일 중복

This section outlines copying an existing configuration file to create a new guest. There are key parameters in your guest's configuration file you must be aware of, and modify, to successfully duplicate a guest.
name
하이퍼바이저로 알려진 관리 유틸리티에 나타나는 게스트 이름입니다. 시스템에서 이 항목은 고유한 것이어야 합니다.
uuid
게스트 용 고유 처리기, 새 UUID는 uuidgen 명령을 사용하여 재생성될 수 있습니다. 예시 UUID 출력 결과는 다음과 같습니다:
$ uuidgen 
a984a14f-4191-4d14-868e-329906b211e5
vif
  • The MAC address must define a unique MAC address for each guest. This is automatically done if the standard tools are used. If you are copying a guest configuration from an existing guest you can use the script 32.9절. “고유한 새 MAC 주소 생성 ”.
  • 기존 게스트 설정 파일을 새 호스트로 이전 또는 복사할 경우 로컬 네트워킹 설정에 해당하는 xenbr 항목을 조정하였는 지를 확인해야 합니다 (brctl show 명령을 사용하여 브리지 정보를 얻을 수 있습니다).
  • 장치 항목, disk= 부분에 있는 항목이 올바른 게스트 이미지를 가리키도록 조정되었는지를 확인합니다.
이제 게스트에서 시스템 구성 설정을 조정합니다:
/etc/sysconfig/network
Modify the HOSTNAME entry to the guest's new hostname.
/etc/sysconfig/network-scripts/ifcfg-eth0
  • HWADDR 주소를 ifconfig eth0에서의 출력 결과로 수정합니다.
  • 고정 IP 주소를 사용할 경우 IPADDR 항목을 수정합니다.

33장. 사용자 설정 libvirt 스크립트 생성

다음 부분에서는 프로그래머 및 시스템 관리자가 libvirt를 사용하여 보다 간편하게 사용자 설정 스크립트 작성하는 방법에 대해 설명합니다.
32장. 힌트 및 도움말 is recommended reading for programmers thinking of writing new applications which use libvirt.

33.1. virsh로 XML 설정 파일 사용

virsh can handle XML configuration files. You may want to use this to your advantage for scripting large deployments with special options. You can add devices defined in an XML file to a running para-virtualized guest. For example, to add a ISO file as hdc to a running guest create an XML file:
# cat satelliteiso.xml
<disk type="file" device="disk">
	<driver name="file"/>
	<source file="/var/lib/libvirt/images/rhn-satellite-5.0.1-11-redhat-linux-as-i386-4-embedded-oracle.iso"/>
	<target dev="hdc"/>
	<readonly/>
</disk>
Run virsh attach-device to attach the ISO as hdc to a guest called "satellite" :
# virsh attach-device satellite satelliteiso.xml

부 VIII. 문제 해결

문제 해결 개요

다음 부분에서는 가상화를 사용하면서 발생할 수 있는 문제를 해결하는 방법에 대해 설명합니다.

가상화 문제를 다루고 있는 주요 문서

지속적인 버그 생성 및 수정으로 인해 특정한 문제는 이러한 문서에 나타나지 않을 수 도 있습니다. 가장 최근 알려진 버그, 문제, 버그 수정에 대한 내용은 해당 버전 및 하드웨어 아키텍처의 Red Hat Enterprise Linux 릴리즈 노트에서 읽어보시기 바랍니다. 릴리즈 노트는 Red Hat 웹사이트의 문서 부분에서 찾아보실 수 있습니다 www.redhat.com/docs/manuals/enterprise/.

문제 해결 방법을 찾지 못했을 경우...

Red Hat 글로벌 고객 지원 서비스 (https://www.redhat.com/apps/support/)로 연락주시면, 문제 해결을 도와드립니다.

차례

34. Xen 문제 해결
34.1. Xen 디버깅 및 문제해결
34.2. 로그 파일 개요
34.3. 로그 파일 설명
34.4. 주요 디렉토리 위치
34.5. 로그를 사용한 문제해결
34.6. 직렬 콘솔을 사용한 문제해결
34.7. 반가상화 게스트 콘솔 액세스
34.8. 완전 가상화 게스트 콘솔 액세스
34.9. 일반적인 Xen 문제
34.10. 게스트 생성 오류
34.11. 직렬 콘솔을 사용한 문제해결
34.11.1. Xen에 대한 직렬 콘솔 출력 결과
34.11.2. 반가상화 게스트에서 Xen 직렬 콘솔 출력 결과
34.11.3. 완전 가상화 게스트에서 직렬 콘솔 출력 결과
34.12. Xen 설정 파일
34.13. Xen 오류 메세지 해석
34.14. 로그 디렉토리의 레이아웃
35. 문제 해결
35.1. 사용 가능한 저장 장치 및 파티션 확인
35.2. Xen 기반 게스트를 다시 시작한 후 콘솔 정지
35.3. 네트워크 도구로 찾을 수 없는 가상 이더넷 장치
35.4. Loop 장치 오류
35.5. 메모리 부족으로 인한 도메인 생성 실패
35.6. 잘못된 커널 이미지 오류
35.7. 잘못된 커널 이미지 오류 - PAE 플랫폼 상의 비-PAE 커널
35.8. 완전 가상화 64 비트 게스트 부팅 실패
35.9. 로컬 호스트 항목 부재로 virt-manager 실패 초래
35.10. 게스트 부팅 도중 마이크로코드 오류
35.11. 가상 장치 시작 시 Python depreciation 경고 메세지
35.12. BIOS에 있는 Intel VT 및 AMD-V 가상화 하드웨어 확장자 활성화
35.13. KVM 네트워킹 실행
36. Xen 반가상화 드라이버 문제 해결
36.1. Red Hat Enterprise Linux 5 Virtualization 로그 파일 및 디렉토리
36.2. Red Hat Enterprise Linux 3 게스트 운영 체제에서 반가상화 게스트 불러오기 실패
36.3. Red Hat Enterprise Linux 3에서 반가상화 드라이버를 설치하는 동안 나타나는 경고 메세지
36.4. 반가상화 드라이버를 수동으로 불러오기
36.5. 반가상화 드라이버가 성공적으로 불려졌는지 확인
36.6. 반가상화 드라이버 사용에서 시스템 처리량 제한

34장. Xen 문제 해결

다음 부분에서는 Xen에서의 문제 해결 방법에 대한 중요한 개념을 설명합니다. 문제 해결 부분에서 다루고 있는 주제는 다음과 같습니다:
  • Linux 및 가상화 용 문제 해결 도구
  • 문제를 인식하기 위한 문제해결 기술
  • 로그 파일 위치 및 로그에 있는 정보 설명.
다음 부분에서는 가상화 기술과 관련된 문제 발생 위치 확인을 위한 배경에 대해 설명합니다. 문제 해결은 경험과 실습을 통해 이루어지므로 서적을 통해서만 배우기는 어렵습니다. 문제 해결 기술을 향상시키기 위해 Red Hat Enterprise Linux 상의 가상화를 테스트하실것을 권장합니다.
If you cannot find the answer in this document there may be an answer online from the virtualization community. Refer to A.1절. “온라인 자료 ” for a list of Linux virtualization websites.

34.1. Xen 디버깅 및 문제해결

다음 부분에서는 시스템 관리자 프로그램, 네트워크 유틸리티, 디버깅 도구에 대해 요약 설명합니다. 이러한 표준 시스템 관리자 도구와 로그를 이용하여 문제를 해결할 수 있습니다:
문제 해결을 위한 유용한 명령 및 어플리케이션
xentop
xentop은 호스트 시스템 및 게스트 도메인에 관한 실시간 정보를 보여줍니다.
xm
dmesglog 사용
  • vmstat
  • iostat
  • lsof
iostat, mpstat, sar 명령은 모두 sysstat 패키지에 의해 제공됩니다.
고급 디버깅 도구와 로그 파일을 이용하여 문제를 해결할 수 있습니다:
  • XenOprofile
  • systemtap
  • crash
  • sysrq
  • sysrq t
  • sysrq w
네트워크 도구를 이용하여 가상화 네트워크 문제를 해결할 수 있습니다:
  • ifconfig
  • tcpdump
    The tcpdump command 'sniffs' network packets. tcpdump is useful for finding network abnormalities and problems with network authentication. There is a graphical version of tcpdump named wireshark.
  • brctl
    brctl은 Virtualization 리눅스 커널에서 이더넷 브리지 구성을 검사하고 설정하는 네트워크 도구입니다. 아래 예제 명령을 실행하려면 반드시 루트 권한이 있어야 합니다:
    # brctl show 
    
    bridge-name    bridge-id          STP  enabled  interfaces  
    -----------------------------------------------------------------------------
    xenbr0             8000.feffffff       no        vif13.0
    xenbr1             8000.ffffefff       yes       pddummy0
    xenbr2             8000.ffffffef       no        vif0.0
    
    # brctl showmacs xenbr0
    
    port-no           mac-addr                  local?       aging timer
    
    1                 fe:ff:ff:ff:ff:           yes            0.00
    2                 fe:ff:ff:fe:ff:           yes            0.00
    
    
    # brctl showstp xenbr0
    xenbr0 
    bridge-id              8000.fefffffffff
    designated-root        8000.fefffffffff
    root-port              0                   path-cost             0
    max-age                20.00               bridge-max-age        20.00
    hello-time             2.00                bridge-hello-time     2.00
    forward-delay          0.00                bridge-forward-delay  0.00
    aging-time            300.01
    hello-timer            1.43                tcn-timer             0.00
    topology-change-timer  0.00                gc-timer              0.02
    
아래 목록에는 Red Hat Enterprise Linux 5에서 가상화 문제 해결을 위한 유용한 명령이 나열되어 있습니다. 언급된 모든 유틸리티는 Red Hat Enterprise Linux 5의 Server 리포지터리에 있습니다.
  • strace는 다른 프로세스에 의해 사용 및 전달받는 시스템 호출과 이벤트를 추적하는 명령입니다.
  • vncviewer: connect to a VNC server running on your server or a virtual machine. Install vncviewer using the yum install vnc command.
  • vncserver: 서버 상의 원격 데스크톱을 시작합니다. 원격 세션을 통해 virt-manager와 같은 그래픽 모드 사용자 인터페이스를 실행할 수 있게 됩니다. yum install vnc-server 명령을 사용하여 vncserver를 설치합니다.

34.2. 로그 파일 개요

When deploying Red Hat Enterprise Linux 5 with Virtualization into your network infrastructure, the host's Virtualization software uses many specific directories for important configuration, log files, and other utilities. All the Xen logs files are standard ASCII files, and accessible with a text editor:
  • Xen 설정 디렉토리는 /etc/xen/입니다. 이 디렉토리에는 xend 데몬과 다른 가상 장치 설정 파일이 들어 있습니다. 네트워킹 스크립트 파일은 scripts 디렉토리에 있습니다.
  • 모든 Xen 로그 파일은 /var/log/xen 디렉토리에 저장됩니다.
  • 파일 기반 이미지에 대한 기본값 디렉토리는 /var/lib/libvirt/images 디렉토리입니다.
  • Xen 커널 정보는 /proc/xen/ 디렉토리에 저장됩니다.

34.3. 로그 파일 설명

Xen 기능에는 xend 데몬과 qemu-dm 프로세스라는 두 가지의 주요 유틸리티가 있으며, 이를 사용하여 /var/log/xen/ 디렉토리에 여러 로그 파일을 작성합니다:
  • xend.log는 일반적인 시스템 이벤트나 운영자에 의한 작업과 같이 xend 데몬에 의해 수집된 모든 데이터가 들어있는 로그 파일입니다. 모든 가상 장치 운영 작업 (예: 생성, 종료, 강제 종료 등)은 이 로그에 나타납니다. xend.log는 주로 이벤트나 실행 문제를 추적할 때 가장 먼저 살펴보아야 할 파일입니다. 이는 오류 메세지에 대한 자세한 내용 및 상황이 들어 있습니다.
  • xend-debug.logxend 및 가상화 하위 시스템 (예: 프레임 버퍼, Python 스크립트 등)에서 이벤트 오류 기록이 들어있는 로그 파일입니다.
  • xen-hotplug-log는 핫플러그 이벤트의 데이터가 들어있는 로그 파일입니다. 장치 또는 네트워크 스크립트가 온라인으로 연결되지 않으면, 이벤트는 여기에 나타납니다.
  • qemu-dm.[PID].log는 모든 완전 가상화 게스트를 위해 qemu-dm 프로세스에 의해 생성된 로그 파일입니다. 이 로그 파일을 사용할 때, ps 명령을 사용하여 가상 장치의 qemu-dm 프로세스를 분리하도록 프로세스 인수를 확인하여 반드시 주어진 qemu-dm 프로세스 PID를 검색해야 합니다. 반드시 [PID] 기호를 실제 PID qemu-dm 프로세스로 대체해야 하는 것에 주의하시기 바랍니다.
가상 장치 관리자에서 오류가 발생하면, /.virt-manager 디렉토리에 있는 virt-manager.log 파일에 생성된 데이터를 살펴보셔야 합니다. 가상 장치 관리자를 시작할 때 마다, 기존의 로그 파일 내용은 덮어 쓰기 됨에 유의하시기 바랍니다. 따라서, 시스템 오류 발생 시 가상 장치 관리자를 재시작하기 전에 virt-manager.log 파일을 백업해 두시기 바랍니다.

34.4. 주요 디렉토리 위치

Xen에서 오류 추적 및 문제 해결을 위해 반드시 알아두어야 할 기타 다른 유틸리티와 로그 파일이 있습니다:
  • 가상 게스트 이미지는 /var/lib/libvirt/images 디렉토리에 위치합니다.
  • xend 데몬을 재시작하면, /var/lib/xen/xend-db 디렉토리에 위치한 xend-database를 업데이트합니다.
  • 가상 장치 덤프(xm dump-core 명령으로 실행)는 /var/lib/xen/dumps 디렉토리에 위치합니다.
  • /etc/xen 디렉토리에는 시스템 리소스를 관리하는 데 사용되는 설정 파일이 들어 있습니다. xend 데몬 설정 파일은 /etc/xen/xend-config.sxp입니다. 이 파일은 전체 시스템 변경 및 네트워킹을 설정하기 위해 편집될 수 있지만 /etc/xen/ 폴더에서 파일을 수동으로 편집하는 것은 권장하지 않습니다.
  • proc 명령은 시스템 정보를 검색할 수 있는 또 다른 리소스입니다. 이 proc 항목은 /proc/xen 디렉토리에 위치합니다:
/proc/xen/capabilities
/proc/xen/balloon
/proc/xen/xenbus/

34.5. 로그를 사용한 문제해결

When encountering installation issues with Xen, refer to the host system's two logs to assist with troubleshooting. The xend.log file contains the same basic information as when you run the xm log command. This log is found in the /var/log/ directory. Here is an example log entry for when you create a domain running a kernel:
[2006-12-27 02:23:02 xend] ERROR (SrvBase: 163) op=create: Error creating domain: (0, 'Error')
Traceback (most recent call list)
File "/usr/lib/python2.4/site-packages/xen/xend/server/SrvBase.py" line 107 in_perform val = op_method (op,req)
File
"/usr/lib/python2.4/site-packages/xen/xend/server/SrvDomainDir.py line 71 in op_create
raise XendError ("Error creating domain: " + str(ex))
XendError: Error creating domain: (0, 'Error')
다른 로그 파일인 xend-debug.log에는 xend.log 보다 더 자세한 정보가 들어 있어 시스템 관리자에게 매우 유용합니다. 아래 예제에서는 동일한 커널 도메인 생성 시 발생하는 문제에 대한 동일한 오류 데이터를 보여줍니다:
ERROR: Will only load images built for Xen v3.0
ERROR: Actually saw: GUEST_OS=netbsd, GUEST_VER=2.0, XEN_VER=2.0; LOADER=generic, BSD_SYMTAB'
ERROR: Error constructing guest OS
고객 지원 서비스의 기술자와 연락할 때 항상 이 두 로그 파일의 복사본을 준비하시기 바랍니다.

34.6. 직렬 콘솔을 사용한 문제해결

The serial console is helpful in troubleshooting difficult problems. If the Virtualization kernel crashes and the hypervisor generates an error, there is no way to track the error on a local host. However, the serial console allows you to capture it on a remote host. You must configure the host to output data to the serial console. Then you must configure the remote host to capture the data. To do this, you must modify these options in the grub.conf file to enable a 38400-bps serial console on com1 /dev/ttyS0:
title Red Hat Enterprise Linux (2.6.18-8.2080_xen0)
	root (hd0,2)
	kernel /xen.gz-2.6.18-8.el5 com1=38400,8n1 
	module /vmlinuz-2.618-8.el5xen ro root=LABEL=/rhgb quiet console=xvc console=tty xencons=xvc 	
	module /initrd-2.6.18-8.el5xen.img
sync_console은 비동기식 하이퍼바이저 콘솔 출력에서 제어 불능 상태를 가져오는 문제를 해결하도록 도와주며, "pnpacpi=off"를 사용하면 직렬 콘솔에서 입력을 방해하는 문제를 해결할 수 있습니다. "console=ttyS0" "console=tty" 파라미터는 일반 VGA 콘솔과 직렬 콘솔 모두에서 커널 오류가 로그로 기록되는 것을 의미합니다. ttywatch를 설치하고 설정하여 표준 널 모뎀 케이블로 연결된 원격 호스트에서 데이터를 캡쳐할 수 있습니다. 예를 들어, 원격 호스트에서 다음을 입력합니다:

Itanium 직렬 콘솔 문제 해결

To access the hypervisor via a serial console on the Itanium® architecture you must enable the console in ELILO. For more information on configuring ELILO, refer to 29장. ELILO 설정 .
ttywatch --name myhost --port /dev/ttyS0
/dev/ttyS0의 출력을 /var/log/ttywatch/myhost.log 파일로 보냅니다.

34.7. 반가상화 게스트 콘솔 액세스

Para-virtualized guest operating systems automatically has a virtual text console configured to transmit data to the host operating system. Connect to a guest's virtual console with the following command:
# virsh console [guest name, ID or UUID]
You can also use virt-manager to display the virtual text console. In the guest console window, select Serial Console from the View menu.

34.8. 완전 가상화 게스트 콘솔 액세스

Fully virtualized guest operating systems automatically has a text console configured for use, but the difference is the kernel guest is not configured. To enable the guest virtual serial console to work with the Full Virtualized guest, you must modify the guest's grub.conf file, and include the 'console =ttyS0 console=tty0' parameter. This ensures that the kernel messages are sent to the virtual serial console (and the normal graphical console). To use the guest's serial console, you must edit the libvirt configuration file configuration file. On the host, access the serial console with the following command:
# virsh console
You can also use virt-manager to display the virtual text console. In the guest console window, select Serial Console from the View menu.

34.9. 일반적인 Xen 문제

xend 서비스를 시작할 때 아무것도 발생하지 않습니다. virsh list를 입력하면 다음 내용이 출력될 것입니다:
Error: Error connecting to xend: Connection refused. Is xend running?
xend start를 수동으로 실행하면 다음과 같이 더 많은 오류가 뜰 것입니다:
Error: Could not obtain handle on privileged command interfaces (2 = No such file or directory)
Traceback (most recent call last:)
File "/usr/sbin/xend/", line 33 in ?
from xen.xend.server. import SrvDaemon
File "/usr/lib/python2.4/site-packages/xen/xend/server/SrvDaemon.py" , line 26 in ?
from xen.xend import XendDomain
File "/usr//lib/python2.4/site-packages/xen/xend/XendDomain.py" , line 33, in ?
		
from xen.xend import XendDomainInfo
File "/usr/lib/python2.4/site-packages/xen/xend/image.py" , line37, in ?
import images
File "/usr/lib/python2.4/site-packages/xen/xend/image.py" , line30, in ?
xc = xen.lowlevel.xc.xc ()
RuntimeError: (2, 'No such file or directory' )
kernel-xen 커널이 아닌 커널로 호스트를 재부팅했을 때 발생할 수 있는 상황입니다. 이 문제를 해결하려면, 부팅 시 kernel-xen 커널을 선택합니다. (또는 grub.conf 파일에서 기본값으로 kernel-xen 커널을 설정합니다)

34.10. 게스트 생성 오류

게스트를 생성할 때, "Invalid argument" 라는 오류 메세지가 나타납니다. 이것은 주로 시작하려는 커널 이미지가 hypervisor와 호환이 안되는 것을 의미하며, PAE 전용 FC6 hypervisor에서 PAE가 아닌 FC5 커널을 실행하려고 할 때 주로 발생합니다.
yum 업데이트를 통해 새로운 커널을 받고, grub.conf에서 기본 커널로 Vritualization 커널 대신 완전한 커널로 전환합니다.
To correct this problem you must modify the default kernel RPM that resides in the /etc/sysconfig/kernel/ directory. You must ensure that kernel-xen parameter is set as the default option in your grub.conf file.

34.11. 직렬 콘솔을 사용한 문제해결

Linux 커널은 직렬 포트로 정보를 출력할 수 있습니다. 이는 커널 패닉 및 비디오 장치 또는 헤드리스 서버를 갖는 하드웨어 문제를 디버깅하는데 유용합니다. 다음 부분에서는 Red Hat Enterprise Linux 가상화 커널 및 이의 가상 게스트를 실행하는 시스템에서 직렬 콘솔 출력을 설정하는 방법에 대해 설명합니다.

34.11.1. Xen에 대한 직렬 콘솔 출력 결과

By default, the serial console for the Xen hypervisor is disabled and no data is output from serial ports.
직렬 포트에서 커널 정보를 받으려면 해당 직렬 장치 파라미터를 설정하여 /boot/grub/grub.conf 파일을 수정합니다.
직렬 콘솔이 com1에 있을 경우, com1=115200,8n1, console=tty0, console=ttyS0,115200 행을 삽입하여 /boot/grub/grub.conf 파일을 수정합니다.
title Red Hat Enterprise Linux 5 i386 Xen (2.6.18-92.el5xen)
	root (hd0, 8)
	kernel /boot/xen.gz-2.6.18-92.el5 com1=115200,8n1
	module /boot/vmlinuz-2.6.18-92.el5xen ro root=LABEL=VG_i386 console=tty0
				console=ttyS0,115200
	module /boot/initrd-2.6.18-92.el5xen.img
직렬 콘솔이 com2에 있을 경우 com2=115200,8n1 console=com2L, console=tty0, console=ttyS0,115200 행을 삽입하여 /boot/grub/grub.conf 파일을 수정합니다.
title Red Hat Enterprise Linux 5 i386 Xen (2.6.18-92.el5xen)
	root (hd0, 8)
	kernel /boot/xen.gz-2.6.18-92.el5 com2=115200,8n1 console=com2L
	module /boot/vmlinuz-2.6.18-92.el5xen ro root=LABEL=VG_i386 console=tty0
	console=ttyS0,115200
	module /boot/initrd-2.6.18-92.el5xen.img
변경 사항을 저장하고 호스트를 재부팅합니다. 하이퍼바이저는 이전 단계에서 선택하신 직렬 콘솔 (com1, com2 등)에 직렬 데이터를 출력합니다.
com2 포트를 사용하는 예에서, vmlinuz 행에 있는 console=ttyS0 파라미터가 사용되고 있습니다. console=ttyS0로 사용되고 있는 모든 포트는 표준 Linux 동작이 아니며 Xen 환경에만 적용됩니다.

34.11.2. 반가상화 게스트에서 Xen 직렬 콘솔 출력 결과

다음 부분에서는 Red Hat Enterprise Linux 반가상화 게스트 용 가상 직렬 콘솔을 설정하는 방법에 대해 설명합니다.
"virsh console" 또는 virt-manager의 "Serial Console" 창을 사용하여 반가상화 게스트로 부터의 직렬 콘솔 출력 결과를 받을 수 있습니다. 이러한 절차를 사용하여 가상 직렬 콘솔을 설정합니다:
  1. 반가상화 게스트로 로그인합니다.
  2. 다음과 같이 /boot/grub/grub.conf를 편집합니다:
    Red Hat Enterprise Linux 5 i386 Xen (2.6.18-92.el5xen)
    	root (hd0, 0) kernel /boot/vmlinuz-2.6.18-92.el5xen ro root=LABEL=VG_i386 console=xvc0 
    	initrd /boot/initrd-2.6.18-92.el5xen.img
    
  3. 반가상화 게스트를 재부팅합니다.
virt-manager "Serial Console" 및 "virsh console"에 있는 커널 메세지를 받을 수 있습니다.
반가상화 도메인 직렬 콘솔 출력 결과 기록
반가상화 게스트의 직렬 콘솔에서의 출력 결과를 기록하기 위해 Xen 데몬(xend)을 설정할 수 있습니다.
xend를 설정하려면 /etc/sysconfig/xend를 편집합니다. 다음 항목을 변경합니다:
# Log all guest console output (cf xm console)
#XENCONSOLED_LOG_GUESTS=no
to:
# Log all guest console output (cf xm console)
XENCONSOLED_LOG_GUESTS=yes
게스트 직렬 콘솔 출력 로그를 활성화하기 위해 호스트를 재부팅합니다.
게스트 직렬 콘솔에서의 로그는 /var/log/xen/console 파일에 저장됩니다.

34.11.3. 완전 가상화 게스트에서 직렬 콘솔 출력 결과

다음 부분에서는 완전 가상 게스트의 경우 직렬 콘솔 출력을 활성화하는 방법에 대해 설명합니다.
완전 가상화 게스트 직렬 콘솔 출력 결과는 "virsh console" 명령을 사용하여 볼 수 있습니다.
완전 가상화 게스트 직렬 콘솔에는 일부 제한 사항이 있음에 유의하십시오. 다음과 같은 제한 사항이 포함됩니다:
  • xend로 로깅 출력 결과를 사용할 수 없습니다.
  • 출력 데이터는 삭제되거나 혼합됩니다.
직렬 포트는 Linux 상에서 ttyS0 또는 Windows 상에서는 COM1이라고 부릅니다.
가상 직렬 포트에 정보를 출력하기 위해 가상 운영 체제를 설정해야 합니다.
완전 가상 Linux 게스트에서 도메인으로 커널 정보를 출력하기 위해 "console=tty0 console=ttys0,115200" 행을 삽입하여 /boot/grub/grub.conf 파일을 수정합니다.
title Red Hat Enterprise Linux Server (2.6.18-92.el5)
	root (hd0,0)
	kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/volgroup00/logvol00
	console=tty0 console=ttys0,115200
	initrd /initrd-2.6.18-92.el5.img
게스트를 재부팅합니다.
"virsh console" 명령을 사용하여 직렬 콘솔 메세지를 확인합니다.

주의

완전 가상화 도메인에서의 직렬 콘솔 메세지는 반가상화 게스트에 해당하는 것으로 /var/log/xen/console에 기록되지 않습니다.

34.12. Xen 설정 파일

When you create guests with the virt-manager or virt-install tools on Red Hat Enterprise Linux 5, the guests configuration files are created automatically in the /etc/xen directory.

Warning

Red Hat advises users not to manually edit Xen configuration files. Xen configuration files have limited error checking and many unsupported variables. Editing Xen configuration files may damage your guests, make guests unbootable or cause data loss.
The example below is a typical a para-virtualized guest configuration file:
name = "rhel5vm01"
memory = "2048"
disk = ['tap:aio:/var/lib/libvirt/images/rhel5vm01.dsk,xvda,w',]
vif = ["type=ieomu, mac=00:16:3e:09:f0:12 bridge=xenbr0', 
"type=ieomu, mac=00:16:3e:09:f0:13 ]
vnc = 1
vncunused = 1
uuid = "302bd9ce-4f60-fc67-9e40-7a77d9b4e1ed"
bootloader = "/usr/bin/pygrub"
vcpus=2
on_reboot = "restart"
on_crash = "restart"
serial="pty"는 구성 파일에 사용되는 디폴트입니다. 아래 예제는 완전 가상화 게스트에 대한 구성 파일을 보여줍니다:
name = "rhel5u5-86_64"
builder = "hvm"
memory = 500
disk = ['/var/lib/libvirt/images/rhel5u5-x86_64.dsk.hda,w']
vif = [ 'type=ioemu, mac=00:16:3e:09:f0:12, bridge=xenbr0', 'type=ieomu, mac=00:16:3e:09:f0:13, bridge=xenbr1']
uuid = "b10372f9-91d7-ao5f-12ff-372100c99af5'
device_model = "/usr/lib64/xen/bin/qemu-dm"
kernel = "/usr/lib/xen/boot/hvmloader/"
vnc = 1
vncunused = 1
apic = 1
acpi = 1
pae = 1
vcpus =1
serial ="pty" # enable serial console
on_boot = 'restart'

Xen 설정 파일

Xen 설정 파일 편집은 지원되지 않습니다. virsh dumpxmlvirsh create (또는 virsh edit)를 사용하여 오류 및 안전성을 확인하는 libvirt 설정 파일 (xml 기반)을 편집합니다.

34.13. Xen 오류 메세지 해석

다음과 같은 오류 메세지를 볼 수 있습니다:
failed domain creation due to memory shortage, unable to balloon domain0
충분한 RAM 공간이 없으므로 도메인이 실패했습니다. domain0에 새롭게 생성되는 게스트에 필요한 메모리 공간을 제공하도록 확장할 수 없습니다. 이 오류에 대해 xend.log 파일을 확인해 보시기 바랍니다:
[2006-12-21] 20:33:31 xend 3198] DEBUG (balloon:133) Balloon: 558432 Kib free; 0 to scrub; need 1048576; retries: 20
[2006-12-21] 20:33:31 xend. XendDomainInfo 3198] ERROR (XendDomainInfo: 202
Domain construction failed
xm list domain0 명령을 사용하여 domain0에 의해 사용되고 있는 메모리 양을 확인할 수 있습니다. dom0는 축소되지 않을 경우, 메모리를 확인하기 위해 virsh setmem dom0 NewMemSize 명령을 사용할 수 있습니다.
다음과 같은 오류 메세지를 볼 수 있습니다:
wrong kernel image: non-PAE kernel on a PAE
이 메세지는 하이퍼바이저에서 지원되지 않는 게스트 커널 이미지를 실행하려할 때 나타나며, Red Hat Enterprise Linux 5 호스트에서 PAE가 아닌 반가상화 게스트 커널을 시작하려고 할 때 발생합니다. Red Hat kernel-xen 패키지는 PAE와 64비트 구조를 사용하는 게스트 커널만을 지원합니다.
다음과 같은 명령을 입력하시기 바랍니다:
# xm create -c va-base

Using config file "va-base"
Error: (22, 'invalid argument')
[2006-12-14 14:55:46 xend.XendDomainInfo 3874] ERRORs
(XendDomainInfo:202) Domain construction failed

Traceback (most recent call last)
File "/usr/lib/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 195 in create vm.initDomain()
File " /usr/lib/python2.4/site-packages/xen/xend/XendDomainInfo.py", line 1363 in initDomain raise VmError(str(exn))
VmError: (22, 'Invalid argument')
[2006-12-14 14:55:46 xend.XendDomainInfo 3874] DEBUG (XenDomainInfo: 1449]
XendDlomainInfo.destroy: domain=1
[2006-12-14 14:55:46 xend.XendDomainInfo 3874] DEBUG (XenDomainInfo: 1457]
XendDlomainInfo.destroy:Domain(1)
32비트이며 PAE가 아닌 커널을 실행하려면 완전 가상화된 가상 장치로서 게스트를 실행해야 합니다. 반가상화 게스트에 32비트 PAE 게스트를 실행하고자 한다면, 반드시 32비트 PAE 하이퍼바이저가 있어야 하며, 64비트 PAE 게스트를 실행하려면 64비트 PAE 하이퍼바이저가 있어야 합니다. 완전 가상화 게스트의 경우 64비트 하이퍼바이저로 64비트 게스트를 실행해야 합니다. Red Hat Enterprise Linux 5 i686에서 32비트 PAE 하이퍼바이저는 단지 32비트 PAE 반가상화 및 32비트 완전 가상화 게스트 OS만을 지원하며, 64비트 하이퍼바이저는 64비트 반가상화 게스트만을 지원합니다.
이는 완전 가상화 HVM 게스트를 Red Hat Enterprise Linux 5 시스템으로 이동시킬 때 발생합니다. 게스트는 시작 실패할 수 있으며 콘솔 화면에 오류 메세지가 나타납니다. 설정 파일에 있는 PAE 항목을 확인하여 pae=1로 설정되어 있는지 확인하시기 바랍니다. 반드시 32비트 배포판을 사용하셔야 합니다.
다음과 같은 오류 메세지를 볼 수 있습니다:
Unable to open a connection to the Xen hypervisor or daemon
이 오류 메세지는 가상 장치 관리자 프로그램이 시작하지 못하고 실패하였을 때 볼 수 있으며, 주로 /etc/hosts 구성 파일에 localhost 항목이 없을 때 발생합니다. 파일을 확인하여 localhost 항목이 활성화되어 있는지 확인하시기 바랍니다. 아래 예제는 부정확한 localhost 항목을 보여줍니다:
# Do not remove the following line, or various programs
# that require network functionality will fail.
localhost.localdomain localhost
아래 예제는 정확한 localhost 항목을 보여줍니다:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
localhost.localdomain. localhost
xen-xend.logfile 파일에서 다음과 같은 오류가 나타날 수 있습니다:
Bridge xenbr1 does not exist!
This happens when the guest's bridge is incorrectly configured and this forces the Xen hotplug scripts to timeout. If you move configuration files between hosts, you must ensure that you update the guest configuration files to reflect network topology and configuration modifications. When you attempt to start a guest that has an incorrect or non-existent Xen bridge configuration, you will receive the following errors:
# xm create mySQL01

Using config file " mySQL01"
Going to boot Red Hat Enterprise Linux Server (2.6.18.-1.2747 .el5xen)
kernel: /vmlinuz-2.6.18-12747.el5xen
initrd: /initrd-2.6.18-1.2747.el5xen.img
Error: Device 0 (vif) could not be connected. Hotplug scripts not working.
또한, xend.log는 다음과 같은 오류를 표시합니다:
[2006-11-14 15:07:08 xend 3875] DEBUG (DevController:143) Waiting for devices vif
[2006-11-14 15:07:08 xend 3875] DEBUG (DevController:149) Waiting for 0
[2006-11-14 15:07:08 xend 3875] DEBUG (DevController:464) hotplugStatusCallback

/local/domain/0/backend/vif/2/0/hotplug-status

[2006-11-14 15:08:09 xend.XendDomainInfo 3875] DEBUG (XendDomainInfo:1449) XendDomainInfo.destroy: domid=2
[2006-11-14 15:08:09 xend.XendDomainInfo 3875] DEBUG (XendDomainInfo:1457) XendDomainInfo.destroyDomain(2)
[2006-11-14 15:07:08 xend 3875] DEBUG (DevController:464) hotplugStatusCallback

/local/domain/0/backend/vif/2/0/hotplug-status
To resolve this problem, open the guest's configuration file found in the /etc/xen directory. For example, editing the guest mySQL01
# vim /etc/xen/mySQL01
Locate the vif entry. Assuming you are using xenbr0 as the default bridge, the proper entry should resemble the following:
# vif = ['mac=00:16:3e:49:1d:11, bridge=xenbr0',]
다음과 같은 python depreciation 오류를 볼 수 있습니다:
# xm shutdown win2k3xen12
# xm create win2k3xen12

Using config file "win2k3xen12".

/usr/lib64/python2.4/site-packages/xenxm/opts.py:520: Deprecation Warning:
Non ASCII character '\xc0' in file win2k3xen12 on line 1, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details

execfile (defconfig, globs, locs,)
Error: invalid syntax 9win2k3xen12, line1)
Python은 유효하지 않은(또는 부정확한) 구성파일에서 이 오류 메시지를 생성합니다. 이 문제를 해결하려면 부정확한 구성 파일을 수정하거나 새로운 구성 파일을 생성해야 합니다.

34.14. 로그 디렉토리의 레이아웃

Red Hat Enterprise Linux 5 Virtualization 환경에서의 기본적인 디렉토리 구조는 다음과 같습니다:
/etc/xen/ 디렉토리에 들어있는 내용
  • xend 데몬에 의해 사용된 설정 파일
  • 가상화 네트워킹에 대한 스크립트가 들어있는 scripts 디렉토리
/var/log/xen/
  • 모든 Xen 관련 로그 파일이 있는 디렉토리
/var/lib/libvirt/images/
  • 가상 장치 이미지 파일에 대한 디폴트 디렉토리
  • 가상 장치 이미지에 대해 다른 디렉토리를 사용하고 계실 경우 설치 프로그램을 시작하기 전 SELinux 정책에 이 디렉토리를 추가하여 레이블했는지를 확인합니다.
/proc/xen/
  • /proc 파일 시스템에 있는 Xen 관련 정보

35장. 문제 해결

다음 부분에서는 Red Hat Enterprise Linux virtualization에서 발생하는 일반적인 문제 및 문제 해결 방법에 대해 설명합니다.

35.1. 사용 가능한 저장 장치 및 파티션 확인

블록 드라이버가 로딩되었는지와 장치 및 파티션을 게스트가 사용할 수 있는 지를 확인합니다. 아래에서와 같이 "cat /proc/partitions" 명령을 실행하여 이를 확인할 수 있습니다.
# cat /proc/partitions
major minor  #blocks   name 
 202    16  104857600  xvdb
   3     0    8175688  hda

35.2. Xen 기반 게스트를 다시 시작한 후 콘솔 정지

Occasionally, a Xen guest's console freezes when the guest boots. The console still displays messages but the user cannot log in.
이 문제를 해결하려면 다음 행을 /etc/inittab 파일에 추가합니다:
1:12345:respawn:/sbin/mingetty xvc0
파일을 저장한 후 다시 시작합니다. 콘솔 세션은 대화식 모드로 됩니다.

35.3. 네트워크 도구로 찾을 수 없는 가상 이더넷 장치

네트워크 도구는 게스트 운영 체제 내에 있는 Xen Virtual Ethernet 네트워크 카드를 인식할 수 없습니다. 다음을 실행하여 (Red Hat Enterprise Linux 4 및 Red Hat Enterprise Linux 5의 경우) 이를 확인합니다:
cat /etc/modprobe.conf
또는 (Red Hat Enterprise Linux 3의 경우) 다음을 실행합니다:
cat /etc/modules.conf
출력 결과에는 각각의 추가 인터페이스에 대해 행 및 유사한 행이 들어 있어야 합니다.
alias eth0 xen-vnif
이 문제를 해결하려면 게스트의 각 반가상화 인터페이스에 대해 알리아스 행 (예: alias eth0 xen-vnif)을 추가해야 합니다.

35.4. Loop 장치 오류

파일 기반 게스트 이미지를 사용할 때, 설정된 루프 장치 수를 늘려야 할 수 도 있습니다. 기본값 설정으로 최대 8개의 루프 장치를 활성화할 수 있습니다. 8개 보다 많은 파일 기반 게스트 또는 루프 장치가 필요할 경우, /etc/modprobe.conf에서 루프장치 수 설정을 조정할 수 있습니다. /etc/modprobe.conf 파일을 편집하고 이 파일에 다음의 행을 추가합니다:
                options loop max_loop=64
예에서는 최대 루프 값으로 64를 사용하고 있지만, 다른 숫자를 지정할 수 도 있습니다. 또한, 시스템에서 루프 장치 기반 게스트를 실행해야 합니다. 반가상화게스트 용 루프 장치 기반 게스트를 도입하려면 phy: block device 또는 tap:aio 명령을 사용하시기 바랍니다. 완전 가상화 시스템 용 루프 장치 기반 게스트를 도입하려면 phy: device 또는 file: file 명령을 사용합니다.

35.5. 메모리 부족으로 인한 도메인 생성 실패

This may cause a domain to fail to start. The reason for this is there is not enough memory available or dom0 has not ballooned down enough to provide space for a recently created or started guest. In your /var/log/xen/xend.log, an example error message indicating this has occurred:
[2006-11-21 20:33:31 xend 3198] DEBUG (balloon:133) Balloon: 558432 KiB free;
	0 to scrub; need 1048576; retries: 20.
[2006-11-21 20:33:52 xend.XendDomainInfo 3198] ERROR (XendDomainInfo:202) Domain construction failed
You can verify the amount of memory currently used by dom0 with the command “xm list Domain-0”. If dom0 is not ballooned down you can use the command “xm mem-set Domain-0 NewMemSize” where NewMemSize should be a smaller value.

35.6. 잘못된 커널 이미지 오류

반가상화 게스트는 kernel-xen 커널을 사용할 수 없습니다. 반가상화 게스트 용 표준 커널만을 사용합니다.
Attempting to boot any kernel other than the Xen kernel as a para-virtualized guest results in the following error message:
# xm create testVM
Using config file "./testVM".
Going to boot Red Hat Enterprise Linux Server (2.6.18-1.2839.el5)
kernel: /vmlinuz-2.6.18-1.2839.el5
initrd: /initrd-2.6.18-1.2839.el5.img
Error: (22, 'Invalid argument')
In the above error you can see that the kernel line shows that the system is trying to boot a non kernel-xen kernel. The correct entry in the example is ”kernel: /vmlinuz-2.6.18-1.2839.el5xen”.
해결 방법은 게스트에 정말로 kernel-xen이 설치되어 있으며 이 커널이 /etc/grub.conf 설정 파일에서 부팅하기 위해 디폴트 커널로 되어 있는 지를 확인합니다.
게스트에 kernel-xen이 설치되어 있을 경우 게스트를 시작할 수 있습니다:
xm create -c GuestName
Where GuestName is the name of the guest. The previous command will present you with the GRUB boot loader screen and allow you to select the kernel to boot. You will have to choose the kernel-xen kernel to boot. Once the guest has completed the boot process you can log into the guest and edit /etc/grub.conf to change the default boot kernel to your kernel-xen. Simply change the line “default=X” (where X is a number starting at '0') to correspond to the entry with your kernel-xen line. The numbering starts at '0' so if your kernel-xen entry is the second entry you would enter '1' as the default,for example “default=1”.

35.7. 잘못된 커널 이미지 오류 - PAE 플랫폼 상의 비-PAE 커널

If you to boot a non-PAE kernel, para-virtualized guest the error message below will display. It indicates you are trying to run a guest kernel on your Hypervisor which at this time is not supported. The Xen hypervisor presently only supports PAE and 64 bit para-virtualized guest kernels.
# xm create -c va-base 
Using config file "va-base".
Error: (22, 'Invalid argument')
[2006-12-14 14:55:46 xend.XendDomainInfo 3874] ERROR (XendDomainInfo:202) Domain construction failed
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/xen/xend/XendDomainInfo.py", 
	line 195, in  create vm.initDomain()
File "/usr/lib/python2.4/site-packages/xen/xend/XendDomainInfo.py", 
	line 1363, in initDomain raise VmError(str(exn))
VmError: (22, 'Invalid argument')
[2006-12-14 14:55:46 xend.XendDomainInfo 3874] DEBUG (XendDomainInfo:1449) XendDomainInfo.destroy: domid=1
[2006-12-14 14:55:46 xend.XendDomainInfo 3874] DEBUG (XendDomainInfo:1457) XendDomainInfo.destroyDomain(1)
If you need to run a 32 bit or non-PAE kernel you will need to run your guest as a fully-virtualized virtual machine. The rules for hypervisor compatibility are:
  • 반가상화 게스트는 하이퍼바이저의 아키텍처 유형과 반드시 일치해야 합니다. 32 비트 PAE 게스트를 실행하려면 32 비트 PAE 하이퍼바이저가 있어야 합니다.
  • 64 비트 반가상화 게스트를 실행하려면 하이퍼바이저는 반드시 64 비트 버전이어야 합니다.
  • 32 비트 완전 가상화 게스트의 경우 하이퍼바이저는 32 비트나 또는 64 비트여야 합니다. 32 비트 또는 64 비트 하이퍼바이저에서 32 비트 (PAE 및 비-PAE) 게스트를 실행할 수 있습니다.
  • 64 비트 완전 가상화 게스트를 실행하려면 하이퍼바이저도 64 비트여야 합니다.

35.8. 완전 가상화 64 비트 게스트 부팅 실패

If you have moved the configuration file to a Red Hat Enterprise Linux 5 causing your fully-virtualized guest to fail to boot and present the error, Your CPU does not support long mode. Use a 32 bit distribution. This problem is caused by a missing or incorrect pae setting. Ensure you have an entry “pae=1” in your guest's configuration file.

35.9. 로컬 호스트 항목 부재로 virt-manager 실패 초래

virt-manager 어플리케이션이 시작 실패하여 “Unable to open a connection to the Xen hypervisor/daemon”과 같은 오류가 나타날 수 도 있습니다. 이는 주로 /etc/hosts 파일에서 localhost 항목이 생략되었기 때문입니다. localhost 항목이 있는 지를 확인하고 /etc/hosts에서 생략되어 있을 경우 localhost에 대한 새 항목을 삽입합니다. 잘못된 /etc/hosts 파일은 다음과 유사하게 나타납니다:
# Do not remove the following line, or various programs
# that require network functionality will fail.
localhost.localdomain localhost
올바른 항목은 다음과 같이 나타나야 합니다:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
localhost.localdomain localhost

35.10. 게스트 부팅 도중 마이크로코드 오류

During the boot phase of your virtual machine you may see an error message similar to:
Applying Intel CPU microcode update: FATAL: Module microcode not found.
ERROR: Module microcode does not exist in /proc/modules
As the virtual machine is running on virtual CPUs there is no point updating the microcode. Disabling the microcode update for your virtual machines will stop this error:
/sbin/service microcode_ctl stop
/sbin/chkconfig --del microcode_ctl

35.11. 가상 장치 시작 시 Python depreciation 경고 메세지

일부 경우 Python은 유효하지 않은 또는 잘못된 설정 파일 때문에 아래와 같은 메세지가 나타나게 됩니다. 아스키 (ascii)가 아닌 문자가 들어있는 설정 파일은 오류를 일으킬 수 있습니다. 설정 파일을 올바르게 고치거나 또는 새 설정 파일을 생성하여 문제를 해결합니다.
현재 작업중인 디렉토리에 있는 잘못된 설정 파일이 다른 원인이 될 수 있습니다. “xm create”는 설정 파일에 대한 현재 디렉토리를 살펴보고 /etc/xen 파일을 살펴봅니다.
# xm shutdown win2k3xen12
# xm create win2k3xen12
Using config file "win2k3xen12".
/usr/lib64/python2.4/site-packages/xen/xm/opts.py:520: DeprecationWarning:
Non-ASCII character '\xc0' in file win2k3xen12 on line 1, but no encoding
declared; see http://www.python.org/peps/pep-0263.html for details
execfile(defconfig, globs, locs)
Error: invalid syntax (win2k3xen12, line 1)

35.12. BIOS에 있는 Intel VT 및 AMD-V 가상화 하드웨어 확장자 활성화

다음 부분에서는 하드웨어 가상화 확장자를 식별하고 비활성화되어 있을 경우 BIOS에서 이를 활성화하는 방법에 대해 설명합니다.
Intel VT 확장자는 BIOS에서 비활성화될 수 있습니다. 특정 랩톱 제조 업체는 CPU에서 기본값으로 Intel VT 확장자를 비활성화합니다.
가상화 확장자는 AMD-V 용 BIOS에서 비활성화될 수 없습니다.
The virtualization extensions are sometimes disabled in BIOS, usually by laptop manufacturers. Refer to 35.12절. “BIOS에 있는 Intel VT 및 AMD-V 가상화 하드웨어 확장자 활성화 ” for instructions on enabling disabled virtualization extensions.
가상화 확장자가 BIOS에서 활성화되어 있는지를 확인합니다. Intel® VT 또는 AMD-V 용 BIOS 설정은 주로 칩셋 또는 프로세서 메뉴에 있습니다. 이 가이드에서 메뉴 이름은 다를 수 도 있지만, 가상화 확장자 설정은 보안 설정 또는 기타 비표준 메뉴 이름에 있을 수 있습니다.
절차 35.1. BIOS에서 가상화 확장자 활성화
  1. Reboot the computer and open the system's BIOS menu. This can usually be done by pressing the delete key, the F1 key or Alt and F4 keys depending on the system.
  2. Select Restore Defaults or Restore Optimized Defaults, and then select Save & Exit.
  3. 장치 전원을 끄고 전원 공급을 차단합니다.
  4. Enabling the virtualization extensions in BIOS

    Note: BIOS steps

    Many of the steps below may vary depending on your motherboard, processor type, chipset and OEM. Refer to your system's accompanying documentation for the correct information on configuring your system.
    1. Power on the machine and open the BIOS (as per Step 1).
    2. Open the Processor submenu The processor settings menu may be hidden in the Chipset, Advanced CPU Configuration or Northbridge.
    3. Enable Intel Virtualization Technology (also known as Intel VT) or AMD-V depending on the brand of the processor. The virtualization extensions may be labeled Virtualization Extensions, Vanderpool or various other names depending on the OEM and system BIOS.
    4. Enable Intel VTd or AMD IOMMU, if the options are available. Intel VTd and AMD IOMMU are used for PCI passthrough.
    5. Select Save & Exit.
  5. 장치 전원을 끄고 전원 공급을 차단합니다.
  6. cat /proc/cpuinfo | grep vmx svm을 실행합니다. 명령이 결과를 출력하면 가상화 확장자가 활성화된 것입니다. 시스템에 출력 결과가 없을 경우 가상화 확장자가 없거나 BIOS 설정이 올바르게 활성화되지 않은 것입니다.

35.13. KVM 네트워킹 실행

기본값으로 KVM 가상 장치는 가상 Realtek 8139 (rtl8139) NIC (Network Interface Controller)를 할당합니다.
rtl8139 가상 NIC는 대부분의 환경에서 잘 작동합니다. 하지만 이러한 장치는 10 기가바이트 이더넷 네트워크와 같은 일부 네트워크에서 성능 저하 문제를 일으킬 수 있습니다.
이러한 문제를 해결하려면 다른 유형의 가상 NIC로 전환하는 것입니다. 예: Intel PRO/1000 (e1000) 또는 virtio (반가상화 네트워크 드라이버).
e1000 드라이버로 전환하려면 다음을 실행합니다:
  1. 게스트 운영 체제를 종료합니다.
  2. Edit the guest's configuration file with the virsh command (where GUEST is the guest's name):
    # virsh edit GUEST
    virsh edit 명령은 $EDITOR 쉘 변수를 사용하여 사용할 편집기를 결정합니다.
  3. 네트워크 인터페이스 설정 부분을 검색합니다. 이 부분은 아래와 유사하게 나타납니다:
    <interface type='network'>
      [output truncated]
      <model type='rtl8139' />
    </interface>
    
  4. Change the type attribute of the model element from 'rtl8139' to 'e1000'. This will change the driver from the rtl8139 driver to the e1000 driver.
    <interface type='network'>
      [output truncated]
      <model type='e1000' />
    </interface>
    
  5. 변경 사항을 저장하고 텍스트 편집기를 종료합니다
  6. 게스트 운영 체제를 다시 시작합니다.
다른 방법으로 다른 네트워크 드라이버를 사용하여 새 가상 게스트를 설치할 수 있습니다. 네트워크 연결을 통해 게스트를 설치하는데 어려움이 있을 경우 이러한 작업이 필요할 수 있습니다. 이러한 방식에서는 템플릿으로 사용하기 위해 이미 생성된 (CD 또는 DVD에서 생성된) 최소 하나의 가상 장치가 필요합니다.
  1. 기존 가상 장치에서 XML 템플릿을 생성합니다:
    # virsh dumpxml GUEST > /tmp/guest.xml
    
  2. XML 파일을 복사 및 편집하고 가상 장치 이름, UUID, 디스크 이미지, MAC 주소, 기타 다른 고유한 파라미터와 같이 고유한 영역을 업데이트합니다. UUID 및 MAC 주소를 삭제하면 virsh가 UUID 및 MAC 주소를 생성하게 됨에 유의하십시오.
    # cp /tmp/guest.xml /tmp/new-guest.xml
    # vi /tmp/new-guest.xml
    
    네트워크 인터페이스 부분에 모델 행을 추가합니다:
     <interface type='network'>
      [output truncated]
      <model type='e1000' />
    </interface>
    
  3. 새 가상 장치를 생성합니다:
    # virsh define /tmp/new-guest.xml
    # virsh start new-guest
    
네트워크 성능은 e1000 또는 virtio 드라이버와 함께 보다 더 향상되어야 합니다. (BZ#517181)

36장. Xen 반가상화 드라이버 문제 해결

다음 부분에서는 반가상화 드라이버를 사용함에 있어서 Xen 호스트 및 완전 가상화 Red Hat Enterprise Linux 게스트에서 발생할 수 있는 문제에 대해 다루고 있습니다.

36.1. Red Hat Enterprise Linux 5 Virtualization 로그 파일 및 디렉토리

/var/log/xen/
xend 데몬 및 qemu-dm 프로세스에 의해 생성된 모든 로그 파일이 들어 있는 디렉토리입니다.
xend.log
  • 이러한 로그 파일은 일반적인 시스템 이벤트 또는 운영자에 의한 이벤트에 의해 생성된 모든 작업을 기록하기 위해 xend를 사용합니다.
  • 생성, 종료, 삭제 등과 같은 가상 장치 작업은 모두 이 로그파일에 기록됩니다.
  • 주로 이러한 로그 파일은 문제를 조사할 때 가장 먼저 살펴보아야 할 파일입니다. 대부분의 경우 로그 파일을 살펴보고 실제 오류 메세지를 살펴보기 이전에 기록된 항목을 살펴봄으로서 근본적인 원인을 발견할 수 있게 됩니다.
xend-debug.log
  • xend 및 xend 하부 시스템 (예: 프레임버퍼 및 Python 스크립트 등) 에서 오류 이벤트를 기록하는데 사용됩니다.
xen-hotplug.log
  • hotplug 이벤트에서 이벤트를 기록하는데 사용됩니다.
  • 장치가 온라인 상에 있지 않거나 네트워크 브리지가 온라인 상에 있지 않는 것과 같은 이벤트 통지는 이 파일에 기록됩니다.
qemu-dm.PID.log
  • 이 파일은 각각의 완전 가상화 게스트에 대해 시작되는 qemu-dm 프로세스에 의해 생성됩니다.
  • PID는 관련된 qemu-dm 프로세스의 PID로 대체합니다
  • ps 명령을 사용하여 주어진 qemu-dm 프로세스에 해당하는 PID를 검색할 수 있으며 프로세스 인수에서 qemu-dm 프로세스가 속한 가상 장치를 확인할 수 있습니다.
If you are troubleshooting a problem with the virt-manager application you can also review the logfile generated by it. The logfile for virt-manager will be in a directory called .virt-manager in the user's home directory whom ran virt-manager. This directory will usually be ~/.virt-manager/virt-manager.

참고

virt-manager를 시작할 때 마다 로그파일을 덮어쓰게 됩니다. virt-manager로 문제를 해결할 경우, 오류 발생 후 virt-manager를 재시작하기전 로그파일을 저장하도록 합니다.
/var/lib/libvirt/images/
파일 기반 게스트 이미지 용 표준 디렉토리
/var/lib/xen/xend-db/
데몬을 재시작할 때 마다 생성되는 xend 데이터베이스가 있는 디렉토리
/etc/xen/
Xen 하이퍼바이저 용 여러 설정 파일을 저장합니다.
  • /etc/xen/xend-config.sxp는 xend 데몬에 대한 주요 설정입니다. xend-config.sxp 파일은 libvirt에 의해 설정되지 않은 기타 다른 기능 및 이전 기능을 활성/비활성합니다. 기타 다른 기능의 경우 libvirt를 사용합니다.
/var/lib/xen/dump/
가상 장치 또는 xm dump-core 명령을 사용할 때 생성되는 덤프가 있습니다.
/proc/xen/
다음과 같은 파일에 xen-kernel 정보를 저장합니다:
  • /proc/xen/capabilities
  • /proc/xen/privcmd
  • /proc/xen/balloon
  • /proc/xen/xenbus
  • /proc/xen/xsd_port
  • /proc/xen/xsd_kva

36.2. Red Hat Enterprise Linux 3 게스트 운영 체제에서 반가상화 게스트 불러오기 실패

Red Hat Enterprise Linux 3은 프로세서 의존 커널 RPM을 사용하기 때문에 반가상화 드라이버 RPM이 설치된 커널 구조와 일치하지 않을 경우 반가상화 드라이버를 불러올 수 없을 수 도 있습니다.
When the para-virtualized driver modules are inserted, a long list of unresolved modules will be displayed. A shortened excerpt of the error can be seen below.
# insmod xen-platform-pci.o 
Warning: kernel-module version mismatch
xen-platform-pci.o was compiled for kernel version 2.4.21-52.EL
while this kernel is version 2.4.21-50.EL
xen-platform-pci.o: unresolved symbol __ioremap_R9eac042a
xen-platform-pci.o: unresolved symbol flush_signals_R50973be2
xen-platform-pci.o: unresolved symbol pci_read_config_byte_R0e425a9e
xen-platform-pci.o: unresolved symbol __get_free_pages_R9016dd82
[...]
The solution is to use the correct RPM package for your hardware architecture for the para-virtualized drivers.

36.3. Red Hat Enterprise Linux 3에서 반가상화 드라이버를 설치하는 동안 나타나는 경고 메세지

2.4.21-52 이전 Red Hat Enterprise Linux 3 커널에 반가상화 드라이버를 설치하면 모듈이 실행 중인 커널보다 이전 버전으로 컴파일되었음을 알리는 경고 메세지가 나타날 수 도 있습니다.
아래와 같은 메세지는 무시해도 됩니다.
Warning: kernel-module version mismatch
xen-platform-pci.o was compiled for kernel version 2.4.21-52.EL
while this kernel is version 2.4.21-50.EL
Warning: loading xen-platform-pci.o will taint the kernel: forced load
See http://www.tux.org/lkml/#export-tainted for information about tainted modules
Module xen-platform-pci loaded, with warnings
위의 메세지에서 중요한 부분은 마지막 행으로 이는 모듈을 불러올 때 경고 메세지가 나타난다고 명시하고 있습니다.

36.4. 반가상화 드라이버를 수동으로 불러오기

일부 경우 부팅을 실행하는 동안 반가상화 드라이버를 자동으로 불러올 수 없을 경우 이를 수동으로 불러올 수 있습니다.
이는 네트워크나 또는 저장 장치 항목을 재설정하거나 또는 첫번째 단계에서 로딩 실패한 원인을 확인할 수 있게 합니다. 아래의 절차로 반가상화 드라이버 모듈을 불러옵니다.
먼저, 시스템에 반가상화 드라이버 모듈을 배치합니다.
# cd /lib/modules/`uname -r`/
# find . -name 'xen_*.ko' -print
모듈 위치에 유의하여 수동으로 모듈을 불러옵니다. 위의 명령 출력 결과에 따라 알맞은 위치로 {LocationofPV-drivers}를 대체합니다.
# insmod \
/lib/modules/'uname -r'/{LocationofPV-drivers}/xen_platform_pci.ko
# insmod /lib/modules/'uname -r'/{LocationofPV-drivers}/xen_balloon.ko
# insmod /lib/modules/'uname -r'/{LocationofPV-drivers}/xen_vnif.ko
# insmod /lib/modules/'uname -r'/{LocationofPV-drivers}/xen_vbd.ko

36.5. 반가상화 드라이버가 성공적으로 불려졌는지 확인

실행하시고자 하는 첫번째 작업 중 하나는 실제로 드라이버가 시스템으로 로딩되었는지를 확인하는 것입니다.
After the para-virtualized drivers have been installed and the guest has been rebooted you can verify that the drivers have loaded. First you should confirm the drivers have logged their loading into /var/log/messages
# grep -E "vif|vbd|xen" /var/log/messages
                    xen_mem: Initialising balloon driver
                    vif vif-0: 2 parsing device/vif/0/mac
                    vbd vbd-768: 19 xlvbd_add at /local/domain/0/backend/vbd/21/76
                    vbd vbd-768: 19 xlvbd_add at /local/domain/0/backend/vbd/21/76
                    xen-vbd: registered block device major 202
You can also use the lsmod command to list the loaded para-virtualized drivers. It should output a list containing the xen_vnif, xen_vbd, xen_platform_pci and xen_balloon modules.
# lsmod|grep xen
xen_vbd                19168  1 
xen_vnif               28416  0 
xen_balloon            15256  1 xen_vnif
xen_platform_pci       98520  3 xen_vbd,xen_vnif,xen_balloon,[permanent]

36.6. 반가상화 드라이버 사용에서 시스템 처리량 제한

If network throughput is still limited even after installing the para-virtualized drivers and you have confirmed they are loaded correctly (refer to 36.5절. “반가상화 드라이버가 성공적으로 불려졌는지 확인 ”). To fix this problem, remove the 'type=ioemu' part of 'vif=' line in your guest's configuration file.

Glossary

이 용어집에서는 설치 가이드에서 사용된 용어를 정의하고자 합니다.
Bare-metal (베어 메탈)
The term bare-metal refers to the underlying physical architecture of a computer. Running an operating system on bare-metal is another way of referring to running an unmodified version of the operating system on the physical hardware. Examples of operating systems running on bare metal are dom0 or a normally installed operating system.
dom0
Also known as the host or host operating system.
dom0 refers to the host instance of Red Hat Enterprise Linux running the Xen hypervisor. Domain0 facilitates virtualized devices and virtualization for the guest operating systems. Dom0 runs on and manages the physical hardware and resource allocation for itself and the guest operating systems.
Domains
domU and dom0 are both domains. A domain is a term for a guest or virtual machine on the Xen hypervisor. The term domains has a similar meaning to virtual machines and the two are technically interchangeable.
domU
domU refers to the guest operating systems which run on the host system (the dom0 domain).
Full virtualization (완전 가상화)
Xen and KVM can use full virtualization. Full virtualization uses hardware features of the processor to provide total abstraction of the underlying physical system (bare metal) and create a new virtual machine in which the guest operating systems can run. No modifications are needed in the guest operating system. The guest operating system and any applications on the guest are not aware of the virtualized environment and run normally. Para-virtualization requires a modified version of the Linux operating system.
Fully virtualized (완전 가상화)
See Full virtualization.
Guest system (게스트 시스템)
Also known as guests, virtual machines, virtual servers or domU.
Hardware Virtual Machine
See Full virtualization.
Host (호스트)
The host operating system, also known as dom0.
The host operating system environment runs the virtualization software for Fully Virtualized and Para virtualized guest systems.
Hypervisor (하이퍼바이저)
The hypervisor is the software layer that abstracts the hardware from the operating system permitting multiple operating systems to run on the same hardware. The hypervisor runs on a host operating system allowing other virtualized operating systems to run on the host's hardware.
The Kernel-based Virtual Machine (KVM) and Xen) hypervisors are provided with Red Hat Enterprise Linux 5.
I/O
입력(input)/출력(output)의 줄임말입니다 ("eye-oh"라고 발음함). I/O라는 용어는 컴퓨터 또는 주변 장치에서 데이터를 전송하거나 데이터를 컴퓨터 또는 주변 장치로 전송하는 모든 프로그램, 운영 체제, 장치를 설명하기 위해 사용됩니다. 모든 전송은 하나의 장치에서 출력되어 다른 장치로 입력됩니다. 키보드 및 마우스와 같은 장치는 입력 전용 장치인 반면 프린터와 같은 장치는 출력 전용 장치입니다. 쓰기 가능한 CD-ROM은 입출력 장치가 됩니다.
Itanium®
Intel Itanium® 프로세서 구조
Kernel SamePage Merging
KSM (Kernel SamePage Merging) 모듈은 KVM 게스트가 동일한 메모리 페이지를 공유할 수 있게 하기 위해 KVM 하이퍼바이저에 의해 사용됩니다. 페이지 공유는 일반적인 라이브러리 또는 기타 동일한, 높은 빈도록 사용되는 데이터입니다. KSM은 여러 게스트 및 증가되는 게스트에 대해 캐시 저장하여 이러한 라이브러리를 유지하여 특정 게스트의 성능을 향상시킬 수 있습니다.
Kernel-based Virtual Machine
KVM (Kernel-based Virtual Machine) is a Full virtualization solution for Linux on AMD64 and Intel 64 hardware. VM is a Linux kernel module built for the standard Red Hat Enterprise Linux kernel. KVM can run multiple, unmodified virtualized guest Windows and Linux operating systems. KVM is a hypervisor which uses the libvirt virtualization tools (virt-manager and virsh).
KVM은 하이퍼바이저 모듈 자체를 위한 관리 API 및 장치, 메모리를 관리하는 Linux 커널 모듈 모음입니다. 가상 게스트는 이러한 모듈에 의해 제어되는 Linux 프로세서 및 스레드로 실행됩니다.
LUN
LUN (Logical Unit Number)은 논리적 단위 (SCSI 프로토콜 엔티티)로 할당된 번호입니다.
MAC Addresses (MAC 주소)
MAC (Media Access Control) 주소는 NIC (Network Interface Controller)에 해당하는 하드웨어 주소입니다. 가상 MAC 주소의 문맥은 유일한 로컬 도메인에 있는 각각의 MAC로 가상 네트워크 인터페이스에 대해 생성되어야 합니다.
Migration (이전)
이전 (Migration)은 가상화된 게스트를 한 개의 호스트에서 다른 호스트로 이동하는 과정을 말합니다. 이전은 오프라인으로나 (여기서 게스트는 일시 중지되고 이동함) 또는 실시간으로 (여기서 게스트는 일시 중지하지 않고 이동함) 수행할 수 있습니다. Xen 완전 가상화 게스트, Xen 반가상화 게스트 및 KVM 완전 가상화 게스트는 이전할 수 있습니다.
이전 기능은 가상화의 핵심 기능으로 소프트웨어가 하드웨어에서 완전히 분리되는 것입니다. 이전 기능은 다음과 같은 부분에서 유용합니다:
  • 로드 밸런싱 - 호스트가 과부하되면 게스트는 사용도가 낮은 다른 호스트로 이동할 수 있습니다.
  • 하드웨어 장애 조치 - 호스트의 하드웨어 장치가 시작 실패할 경우, 게스트는 안전하게 재배치되므로 호스트는 시스템을 종료하여 복구될 수 있습니다.
  • 절전 - 게스트는 다른 호스트에 재배치되고 호스트 시스템은 에너지를 절약하고 사용량을 낮게하여 비용을 절감하기 위해 전원을 끌 수 있습니다.
  • 지역적 이전 - 게스트는 최소 지연을 위해서 또는 심각한 상황의 경우 다른 위치로 이동할 수 있습니다.
공유, 네트워크 저장 장치는 게스트 이미지를 저장하는데 사용됩니다. 공유 저장 장치 없이 이전은 불가능합니다.
오프라인 이전은 게스트를 일시 중지하고 게스트 메모리 이미지를 대상 호스트로 이동시킵니다. 게스트는 대상 호스트에서 다시 시작되어 소스 호스트에서 게스트가 사용하는 메모리는 해제됩니다.
오프라인 이전에 걸리는 시간은 네트워크 대역폭 및 지연 시간에 따라 달라집니다. 2GB 메모리를 갖는 게스트는 1 기가바이트 이더넷 링크에서 몇 초 정도 더 걸릴 수 있습니다.
A live migration keeps the guest running on the source host and begins moving the memory without stopping the guest. All modified memory pages are monitored for changes and sent to the destination while the image is sent. The memory is updated with the changed pages. The process continues until the amount of pause time allowed for the guest equals the predicted time for the final few pages to be transfer. KVM estimates the time remaining and attempts to transfer the maximum amount of page files from the source to the destination until KVM predicts the amount of remaining pages can be transferred during a very brief time while the virtualized guest is paused. The registers are loaded on the new host and the guest is then resumed on the destination host. If the guest cannot be merged (which happens when guests are under extreme loads) the guest is paused and then an offline migration is started instead.
오프라인 이전에 걸리는 시간은 네트워크 대역폭과 지연 시간, 게스트 상의 작업에 따라 달라집니다. 게스트가 많은 양의 I/O 또는 CPU를 사용하는 경우 이전 시간이 더 길어지게 됩니다.
Para-virtualization (반가상화)
Para-virtualization uses a special kernel, sometimes referred to as the Xen kernel or the kernel-xen package. Para-virtualized guest kernels are run concurrently on the host while using the host's libraries and devices. A para-virtualized installation can have complete access to all devices on the system which can be limited with security settings (SELinux and file controls). Para-virtualization is faster than full virtualization. Para-virtualization can effectively be used for load balancing, provisioning, security and consolidation advantages.
Fedora 9에서 더이상 특정 커널이 필요하지 않습니다. 이러한 패치가 주요 Linux 트리로 승인되면 해당 버전 이후의 모든 리눅스 커널에서는 반가상화가 활성화 또는 사용 가능하게 됩니다.
Para-virtualized (반가상화)
See Para-virtualization.
Para-virtualized drivers (반가상화 드라이버)
반가상화 드라이버는 완전 가상화 Linux 게스트에서 실행되는 장치 드라이버입니다. 이러한 드라이버는 완전 가상화 게스트에 대해 네트워크 성능 및 블록 장치 I/O 성능을 현저하게 향상시킵니다.
PCI passthrough
KVM and Xen hypervisors support attaching PCI devices on the host system to virtualized guests. PCI passthrough allows guests to have exclusive access to PCI devices for a range of tasks. PCI passthrough allows PCI devices to appear and behave as if they were physically attached to the guest operating system.
phy device
The phy device parameter allows guest's to access physical disks. Physical disks includes:
  • LVM volumes (for example, /dev/VolGroup00/LogVol02),
  • disk partitions (for example, /dev/sda5), and
  • whole block devices (for example, /dev/sda).
Physical mode provides the best performance as the hypervisor bypasses extra layers of software on the host at the price of slightly less flexibility in managing the device.
Security Enhanced Linux
Security Enhanced Linux의 약어인 SELinux는 Linux 커널에서 LSM (Linux Security Modules)을 사용하여 보안 정책에 필요한 여러 최소 권한을 제공합니다.
tap:aio
The tap:aio parameter sets the Xen hypervisor to use an advanced access mode designed for safety and performance. File-based, are accessed using a kernel thread and a user-space process. The tap:aio method respects guest flush requests which makes it safer than the file driver. The virtualization tools use tap:aio by default for accessing file-based guest disks on the Xen Hypervisor.
Universally Unique Identifier
UUID (Universally Unique Identifier)는 분산 컴퓨팅 환경에서 장치, 시스템 및 특정 소프트웨어 객체를 위해 표준화된 번호 부여 방식입니다. 가상화에서 UUID 유형에는 ext2ext3 파일 시스템 식별자, RAID 장치 식별자, iSCSI 및 LUN 장치 식별자, MAC 주소와 가상 장치 식별자가 있습니다.
Virtual machines (가상 장치)
가상 장치는 물리 장치 또는 프로그램 언어 (예: JRE (Java Runtime Environment) 또는 LISP)의 소프트웨어 구현입니다. 가상화 문맥에서의 가상 장치는 가상 하드웨어에서 실행되고 있는 운영 체제가 됩니다.
Virtualization (가상화)
Virtualization is a broad computing term for running software, usually operating systems, concurrently and isolated from other programs on one system. Most existing implementations of virtualization use a hypervisor, a software layer on top of an operating system, to abstract hardware. The hypervisor allows multiple operating systems to run on the same physical system by giving the guest operating system virtualized hardware. There are various methods for virtualizing operating systems:
  • Hardware-assisted virtualization is the technique used for full virtualization with Xen and KVM.
  • Para-virtualization is a technique used by Xen to run Linux guests.
  • 소프트웨어 가상화 또는 에뮬레이션. 소프트웨어 가상화는 바이너리 변환 및 기타 다른 에뮬레이션 기술을 사용하여 수정되지 않은 운영 체제를 실행합니다. 소프트웨어 가상화는 하드웨어 지원가사와나 반가상화 보다 현저하게 느립니다. QEMU 형식에서 소프트웨어 가상화는 Red Hat Enterprise Linux에 의해 지원되지 않습니다.
Red Hat Enterprise Linux 5 supports hardware-assisted, full virtualization with the Xen and KVM hypervisors and software para-virtualization with the Xen hypervisor for hosting Red Hat Enterprise Linux guests.
Virtualized CPU
시스템에는 실제 프로세서 코어와 관련하여 가상 CPU (VCPU) 수가 있습니다. 가상 CPU 수는 유한 수이며 게스트 가상 장치에 할당할 수 있는 총 가상 CPU 수를 나타냅니다.
Xen
Red Hat Enterprise Linux supports the Xen hypervisor and the KVM hypervisor. Both hypervisors have different architectures and development approaches. The Xen hypervisor runs underneath a Red Hat Enterprise Linux operating system which acts as a host managing system resources and virtualization APIs. The host is sometimes referred to as dom0, or Domain0.

추가 자료

Red Hat Enterprise Linux 및 가상화에 관한 더 자세한 내용은 다음 자료에서 참조하시기 바랍니다.

A.1. 온라인 자료

  • http://www.cl.cam.ac.uk/research/srg/netos/xen/ Red Hat kernel-xen 패키지에서 파생된 Xen™ 반가상화 장치 관리자의 프로젝트 웹사이트입니다. 이 사이트에서는 업스트림 Xen 프로젝트 바이너리와 소스 코드를 유지 관리하며, Xen에 관한 정보, 구조 개요, 문서 자료, Xen 관련 링크 및 관련 기술을 다루고 있습니다.
  • Xen 커뮤니티 웹사이트
  • http://www.libvirt.org/libvirt 가상화 API의 공식 웹사이트입니다.
  • http://virt-manager.et.redhat.com/은 가상 장치를 관리하는 그래픽 형식 프로그램인 가상 장치 관리자 (virt-manager)의 프로젝트 웹사이트입니다.

A.2. 설치된 문서 자료

  • /usr/share/doc/xen-<version-number>/는 디렉토리로 Xen 반 가상화 하이퍼바이저와 관리 도구에 대한 내용을 다루고 있으며, 다양한 구성 예제, 하드웨어 전용 정보, 현재 Xen 업스트림 사용자 문서 자료가 들어 있습니다.
  • man virsh/usr/share/doc/libvirt-<version-number>virsh 가상 장치 관리 유틸리티에 대한 하위 명령과 옵션 및 libvirt 가상화 라이브러리 API에 관한 종합적인 정보를 다룹니다.
  • /usr/share/doc/gnome-applet-vm-<version-number> — 내부에서 실행 중인 가상 장치를 감시하고 관리하는 GNOME 그래픽형식 패널 애플릿에 대한 문서자료입니다.
  • /usr/share/doc/libvirt-python-<version-number>libvirt 라이브러리에서 Python 바인딩에 대한 상세정보를 제공합니다. Python 개발자는 libvirt-python 패키지를 사용하여 libvirt 가상화 관리 라이브러리와 연동하는 프로그램을 생성할 수 있습니다.
  • /usr/share/doc/python-virtinst-<version-number> — 가상 장치안에서 Fedora와 Red Hat Enterprise Linux 관련 배포판 설치를 시작하도록 도와주는 virt-install 명령에 대한 문서 자료를 제공합니다.
  • /usr/share/doc/virt-manager-<version-number> — 가상 장치를 관리하기 위한 그래픽형식 도구를 제공하는 가상 장치 관리자에 대한 문서 자료를 제공합니다.

판권 페이지

메뉴얼은 DocBook XML v4.3 형식으로 작성되어 있습니다.
This book is based on the work of Jan Mark Holzer, Chris Curran and Scott Radvan.
기타 다른 저자는 다음과 같습니다:
  • Don Dutile은 반가상화 드라이버 부분의 기술 편집에 공헌.
  • Barry Donahue는 반가상화 드라이버 부분의 기술 편집에 공헌.
  • Rick Ring은 가상 장치 관리자 부분의 기술 편집에 공헌.
  • Michael Kearey는 virsh 및 가상 플로피 드라이브와 함께 XML 설정 파일을 사용하고 있는 부분의 기술 편집에 공헌.
  • Marco Grigull은 소프트웨어 호환성 및 성능 부분의 기술 편집에 공헌
  • Eugene Teo는 virsh로 게스트를 관리하는 부분의 기술 편집에 공헌.
이 문서를 제작한 출판 도구인 Publican은 Jeffrey Fearn에 의해 작성됨.
Red Hat 로컬라이제이션 팀은 다음과 같이 구성되어 있습니다:
  • 중국어 (간체)
    • Leah Wei Liu
  • 중국어 (번체)
    • Chester Cheng
    • Terry Chuang
  • 일본어
    • Kiyoto Hashida
  • 한국어
    • Eun-Ju Kim
  • 프랑스어
    • Sam Friedmann
  • 독일어
    • Hedda Peters
  • 이탈리아어
    • Francesco Valente
  • 브라질 포르투갈어
    • Glaucia de Freitas
    • Leticia de Lima
  • 스페인어
    • Angela Garcia
    • Gladys Guerrero
  • 러시아어
    • Yuliya Poyarkova