エディッション 5.8
1801 Varsity Drive
Raleigh, NC 27606-2072 USA
Phone: +1 919 754 3700
Phone: 888 733 4281
Fax: +1 919 754 3701
ftpd等幅の太字
現在作業中のディレクトリ内のファイルmy_next_bestselling_novelの内容を表示させるには、 シェルプロンプトでcat my_next_bestselling_novelコマンドを入力してから Enter を押してそのコマンドを実行します。
Enter を押してコマンドを実行します。1 番目の仮想ターミナルに切り替えるは、 Ctrl+Alt+F2 を押します。 X-Windows セッションに戻るには、 Ctrl+Alt+F1 を押します。
等幅の太字 で表示します。 例えば、
ファイル関連のクラス群はファイルシステムに対してはfilesystem、 ファイルにはfile、 ディレクトリにはdirをそれぞれ含みます。 各クラスは個別に関連する権限セットを持っています。
メインメニューバーから の順で選択し マウスの個人設定 を起動します。 ボタン タブ内で 左ききのマウス チェックボックスをクリックしてから をクリックしマウスの主要ボタンを左から右に切り替えます (マウスを左ききの人が使用するのに適した設定にする)。gedit ファイルに特殊な文字を挿入する場合は、 メインメニューバーから の順で選択します。 次に 文字マップ メニューバーから と選択して 検索 フィールド内にその文字名を入力し をクリックします。 探している文字が 文字表 内で強調表示されます。 この強調表示された文字をダブルクリックすると コピーするテキスト フィールド内に置かれるので次に ボタンをクリックします。 ここでドキュメントに戻り gedit メニューバーから を選択します。
等幅の太字で且つ斜体 または プロポーショナルの太字で且つ斜体
ssh を使用してリモートマシンに接続するには、 シェルプロンプトでsshと入力します。 リモートマシンがusername@domain.nameexample.comであり、 そのマシンで使用しているユーザー名が john ならssh john@example.comと入力します。mount -o remountコマンドは指定したファイルシステムを再マウントします。 例えば、file-system/homeファイルシステムを再マウントするコマンドはmount -o remount /homeになります。現在インストールされているパッケージのバージョンを表示するには、rpm -qコマンドを使用します。 結果として次を返してきます、package。package-version-release
Publican は DocBook の発行システムです。
mono-spaced roman (等幅の Roman) にセットされるので以下のように表示されます。
books Desktop documentation drafts mss photos stuff svn books_tests Desktop1 downloads images notes scripts svgs
mono-spaced roman (等幅の 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")); } }
5.
NFS か、FTP か、 HTTP のプロトコルを使用して 入手できます。
/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 「SELinux と仮想化」 for details.
yum を使用して Xen hypervisor をインストール for more information.
grub.conf file.
virtio ドライバーと PCI デバイスを使用します。現時点では、ゲストは最大 32 PCI デバイスまでに 制限されています。一部の PCI デバイスはゲストの実行に重要なものであり、これらの デバイスは削除できません。デフォルトで以下のようなデバイスが必須です:
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.
/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.
phy デバイスの数には制限がありません。
/etc/modprobe.conf 内で、以下の行を追加します:
options loop max_loop=64
# rmmod loop # modprobe loop
yum コマンドと Red Hat Network (RHN) を 使用してインストールの後にインストールすることが出来ます。

virt-manager、libvirt、及び virt-viewer、それにインストール用のすべての依存関係を選択します。

パッケージをカスタマイズ(必要な場合)

%packages セクションで、以下のパッケージグループを追記します:
%packages @xen
xen-ia64-guest-firmware
rhn_register コマンドを実行して、プロンプトに従います。
yum を使用して Xen hypervisor をインストールxen と kernel-xen のパッケージが必要になります。xen パッケージには 、 Xen hypervisor と 基本的仮想化の ツールが含まれています。kernel-xen パッケージには、 Xen hypervisor 上で仮想マシンゲストとして稼働する修正した linux カーネルが含まれています。
xen と kernel-xen のパッケージを インストールするには、以下を実行します:
# yum install xen kernel-xen
xen-ia64-guest-firmware) が必要になります。 このパッケージは yum コマンドを使用して RHN から インストールすることもできます:
# yum install xen-ia64-guest-firmware
python-virtinstvirt-install コマンドを提供します。
libvirtlibvirt は、hypervisor と通信する API ライブラリです。 libvirt は仮想マシンの 管理と制御の為に xm 仮想化 フレームワークと virsh コマンドラインツールを使用します。
libvirt-pythonlibvirt API で供給されるインターフェイスを使用できるようにするモジュールが含まれています。
virt-managervirt-manager は 仮想マシンの管理の為のグラフィカルなツールを提供します。これは、管理 API として libvirt ライブラリを使用します。
# yum install virt-manager libvirt libvirt-python python-virtinst

virt-manager、 libvirt、及び virt-viewer を選ぶことになります。

パッケージをカスタマイズ(必要な場合)

%packages セクションで、以下のパッケージグループを追記します:
%packages @kvm
rhn_register コマンドを実行して、プロンプトに従います。
yum を使用して KVM hypervisor をインストールkvm パッケージが必要になります。kvm パッケージには 、KVM カーネルモジュールが含まれており、 デフォルトの Red Hat Enterprise Linux カーネル上に KVM hypervisor を提供します。
kvm パッケージをインストールするには、以下を実行します:
# yum install kvm
python-virtinstvirt-install コマンドを提供します。
libvirtlibvirt は、hypervisor と通信する API ライブラリです。 libvirt は仮想マシンの 管理と制御の為に xm 仮想化 フレームワークと virsh コマンドラインツールを使用します。
libvirt-pythonlibvirt API で供給されるインターフェイスを使用できるようにするモジュールが含まれています。
virt-managervirt-manager は 仮想マシンの管理の為のグラフィカルなツールを提供します。これは、管理 API として libvirt ライブラリを使用します。
# yum install virt-manager libvirt libvirt-python python-virtinst
virt-install を使用します。 これらの両方の方法はこの章で説明されています。
virt-install コマンドを使用して、 仮想化ゲストを作成することができます。virt-install は 対話式か、あるいはスクリプトによる自動化で仮想マシンを作成することが できます。キックスタートファイルで virt-install を使用すると 仮想化マシンの無人インストールが可能になります。
virt-install ツールは、コマンドラインで渡すことのできる 多くのオプションを提供します。それらのオプションの完全一覧を見るには、次を実行します:
$ virt-install --help
virt-install man ページはコマンドオプションと重要な変数を それぞれドキュメント化しています。
qemu-img は関連したコマンドであり、ストレージオプションを 設定する為に virt-install の前に使用することができます。
--vnc option which opens a graphical window for the guest's installation.
rhel3support と言う名前の Red Hat Enterprise Linux 3 ゲストを作成します。この例は KVM hypervisor を使用します。
# 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
# virt-install --name fedora11 --ram 512 --file=/var/lib/libvirt/images/fedora11.img \ --file-size=3 --vnc --cdrom=/var/lib/libvirt/images/fedora11.iso
virt-manager は 仮想化ゲストの作成と管理の為のグラフィカルツールです。
Open virt-manager
virt-manager. Launch the application from the menu and submenu. Alternatively, run the virt-manager command as root.
Optional: Open a remote hypervisor

Create a new guest

New guest wizard

Name the virtual machine

Choose virtualization method
kernel-xen が その時点のカーネルとして稼働していない場合は、灰色になって使用不可になっています。

Select the installation method
.iso file).
HTTP, FTP or NFS.

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.
Installation media selection
ISO image or physical media installation

Network install tree installation
NFS, FTP or HTTP. Optionally, a kickstart file can be specified to automated the installation. Kernel parameters can also be specified if required.

Network boot (PXE)
Storage setup
/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 「SELinux と仮想化」 for details.

/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).
Network setup

Memory and CPU allocation

Verify and start guest installation

virt-manager. 8章ゲストオペレーティングシステムのインストール手順 contains step-by-step instructions to installing a variety of common operating systems.
新規ブリッジの作成
/etc/sysconfig/network-scripts/ ディレクトリ内に新規の ネットワークスクリプトファイルを作成します。ここの例では、ifcfg-installation と 言う名前のファイルを作成し、それが installation と言う名前のブリッジを 作ります。
# cd /etc/sysconfig/network-scripts/ # vim ifcfg-installation DEVICE=installation TYPE=Bridge BOOTPROTO=dhcp ONBOOT=yes
TYPE=Bridge, is case-sensitive. It must have uppercase 'B' and lower case 'ridge'.
ifup installation command can start the individual bridge but it is safer to test the entire network restarts properly.
# service network restart
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 で使用される デフォルトのブリッジです。
新規ブリッジにインターフェイスを追加
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
セキュリティの設定
iptables を設定して全てのトラフィックがブリッジまで 転送されるようにします。
# iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT # service iptables save # service iptables restart
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 を再スタート
libvirt デーモンの再スタート
# service libvirtd reload
virt-install に --network=bridge:installation インストールパラメータを追記します。ここで installation とは、該当ブリッジの名前です。PXE インストールには、--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 \
PXE を選択

ブリッジの選択

インストールの開始

virsh update-device Guest1 ~/Guest1.xml (substituting your guest's name and XML file), and select OK to continue past this step.
kernel-xen カーネルを必要とします。
virt-manager, refer to the procedure in 「virt-manager を使用してゲストを作成」.
virt-install ツールを使用して para-virtualized ゲストを作成します。--vnc オプションは、 グラフィックインストールを表示します。この例中のゲストの名前は rhel5PV であり、 ディスクイメージファイルは rhel5PV.dsk となり、Red Hat Enterprise Linux 5 のインストールツリーのローカルミラーは ftp://10.1.1.1/trees/RHEL5-B2-Server-i386/ となります。これらの値をご使用のシステムとネットワーク用に 的確なものに変更して下さい。
# virt-install -nrhel5PV-r 500 \ -f /var/lib/libvirt/images/rhel5PV.dsk-s 3 --vnc -p \ -lftp://10.1.1.1/trees/RHEL5-B2-Server-i386/



DHCP (as shown below) or a static IP address:







Installation Number フィールド内に それを入力します:

rhn_register コマンドを使用して、Red Hat Network アカウントの詳細を 確定することができます。rhn_register コマンドには root アクセスが必要です。












virt-install in 「Red Hat Enterprise Linux 5.0 を para-virtualized ゲストとしてインストール」. If you used the default example the name is rhel5PV.
virsh の使用でゲストの再起動ができます:
# virsh reboot rhel5PVvirt-manager を開いて、ゲスト用の 名前を選択し、 をクリックします。それから をクリックします。








kdump. The use of kdump is unsupported on para-virtualized guests.







yum command or RHN. Click .




virt-manager を開く
virt-manager を開始します。 メニューと サブメニューから のアプリケーションを起動します。別の方法として、root になって virt-manager コマンドを実行することもできます。
Hypervisor を選択
qemu と命名されていることに注意して下さい。
新規仮想マシンウィザードを開始

仮想マシンの命名

仮想化のメソッドを選択

インストールメソッドの選択

インストールメディアの場所を指定

/var/lib/libvirt/images/ directory. Any other location may require additional configuration for SELinux, refer to 「SELinux と仮想化」 for details.
ストレージセットアップ
/var/lib/libvirt/images/ directory. Assign sufficient space for your virtualized guest and any applications the guest requires.

ネットワーク設定

メモリーと CPU の割り当て

確認してゲストインストールを開始

Red Hat Enterprise Linux のインストール
virt-manager の開始
仮想システムの命名

仮想化メソッドの選択

インストールメソッドの選択

/var/lib/libvirt/images/ directory. Any other location may require additional configuration for SELinux, refer to 「SELinux と仮想化」 for details.
Choose installation image

/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 「SELinux と仮想化」 for details.

/var/lib/libvirt/images/ の 使用が推奨されます。別の場所(この例では、/images/)を使用している 場合は、インストールを継続する前に確実にそれが SELinux ポリシーに追加されるように して下さい(このドキュメントの後で SELinux ポリシーの変更の仕方が案内してあります)。
ネットワークのセットアップ



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.








# virsh start WindowsGuestWindowsGuest とは、ご使用の仮想マシンの 名前です。

virsh reboot WindowsGuestName を使用してゲストを再起動して下さい。仮想マシンを再起動すると、 Setup is being restarted のメッセージが出てきます:




virt-install command. virt-install can be used instead of virt-manager This process is similar to the Windows XP installation covered in 「Windows XP を完全仮想化ゲストとしてインストール」.
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.
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
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
Standard PC を選択します。Windows Server 2003 の仮想化ゲストには Computer Type の 変更が必要になります。




virt-manager を開く
virt-manager を開始します。 メニュー内の サブメニューから アプリケーションを起動します。別の方法としては、root として virt-manager コマンドを実行します。
Hypervisor を選択
qemu と言う呼称があることに注意して下さい。
新規仮想マシンウィザードを開始

仮想マシンの命名

仮想化メソッドを選択

インストールメソッドを選択

インストールメディアの位置を指定


/var/lib/libvirt/images/ directory. Any other location may require additional configuration for SELinux, refer to 「SELinux と仮想化」 for details.
ストレージセットアップ
/var/lib/libvirt/images/ directory. Assign sufficient space for your virtualized guest and any applications the guest requires.

ネットワークセットアップ

メモリーと CPU の割り当て

ゲストのインストールを確認してからスタートします。

Windows のインストール

目次
/dev/xvd[a to z][1 to 15]
/dev/xvdb13
/dev/xvd[a to i][a to z][1 to 15]
/dev/xvdbz13
/dev/sd[a to p][1 to 15]
/dev/sda1
/dev/hd[a to t][1 to 63]
/dev/hdd3
dd command. Replace /dev/fd0 with the name of a floppy device and name the disk appropriately.
# dd if=/dev/fd0 of=~/legacydrivers.img
/var/lib/libvirt/images/rhel5FV.img にイメージを 配置した完全仮想化 Red Hat Enterprise Linux のインストールを実行している virt-manager で 作成されたゲストを使用します。Xen hypervisor がこの例で使用されています。
virsh を使用して ゲストイメージ用に XML 設定ファイルを作成します。
# virsh dumpxml rhel5FV > rhel5FV.xml
# dd if=/dev/zero of=/var/lib/libvirt/images/rhel5FV-floppy.img bs=512 count=2880
<disk type='file' device='floppy'> <source file='/var/lib/libvirt/images/rhel5FV-floppy.img'/> <target dev='fda'/> </disk>
virsh shutdown command instead.
# virsh destroy rhel5FV# virsh create rhel5FV.xml
dd コマンドを使用して Sparse ファイルを作成します。 Sparse ファイルは、データの整合性とパフォーマンス問題のために推奨できませんが、 Sparse ファイルは より速く作成できてテストに使用できます。但し実稼働環境では使用できません。
# dd if=/dev/zero of=/var/lib/libvirt/images/FileName.img bs=1M seek=4096 count=0
# dd if=/dev/zero of=/var/lib/libvirt/images/FileName.img bs=1M count=4096
Guest1 と 言う名前であり、ファイルはユーザーのホームディレクトリに保存されます。
# virsh dumpxmlGuest1> ~/Guest1.xml
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>
<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>
# virsh create Guest1.xml
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.
n を押します。
# fdisk /dev/sdb Command (m for help):
p を押します。
Command action e extended p primary partition (1-4)
1 を 入力することにより、最初のパーティションが選択されます。
Partition number (1-4): 1
Enter を押すことでデフォルトの最初の シリンダを入力します。
First cylinder (1-400, default 1):
Enter を 押すことによりディスク全体が割り当てられます。
Last cylinder or +size or +sizeM or +sizeK (2-400, default 400):
t を押すことにより パーティションのタイプをセットします。
Command (m for help): t
1 です。
Partition number (1-4): 1
83 を入力します。
Hex code (type L to list codes): 83
Command (m for help):wCommand (m for help):q
ext3 ファイルシステムを 使用して新規パーティションをフォーマットします。
# mke2fs -j /dev/sdb1
# mount /dev/sdb1 /myfiles
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.
/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.
multipath の使用でデバイスを設定して、必要であれば ホスト上で永続化します。
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.
--type cdrom parameter to the command for CD-ROM or DVD devices.
--type floppy パラメータを フロッピィデバイス用のコマンドに追記します。
# virsh attach-diskmyguest/dev/sdb1sdc--driver tap --mode readonly
/dev/sdb on Linux or D: drive, or similar, on Windows. This device may require formatting.
multipath must use 単独パスの設定. Systems running multipath can use マルチパスの設定.
udev. Only use this procedure for hosts which are not using multipath.
/etc/scsi_id.config ファイルを編集します。
options=-b の行がコメントアウトしてあることを確認します。
# options=-b
options=-g
udev を設定して全ての付帯 SCSI デバイスが UUID を返すことを想定します。
scsi_id -g -s /block/sd* コマンドを使用します。以下のようにします:
# scsi_id -g -s /block/sd* 3600a0b800013275100000015427b625e
/dev/sdc の UUID を表示しています。
scsi_id -g -s /block/sd* コマンドで UUID 出力が 同一かどうか確認します。
/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"
UUIDと devicename を上記で取り込んだ UUID とそのデバイス名で入れ替えます。 以下が上記の例のためのルールです:
KERNEL="sd*", BUS="scsi", PROGRAM="/sbin/scsi_id -g -s", RESULT="3600a0b800013275100000015427b625e", NAME="rack4row16"
udev デーモンはここで、ルール内で UUID 用の /dev/sd* と言う名の全てのデバイスを検索します。マッチするデバイスが、 システムに接続されると、デバイスはルールから名前が割り当てられます。3600a0b800013275100000015427b625e の UUID を持つデバイス内では、/dev/rack4row16 として表示されます。
/etc/rc.local に以下の行を追記します:
/sbin/start_udev
/etc/scsi_id.config、/etc/udev/rules.d/20-names.rules、及び /etc/rc.local のファイル内の変化をそれぞれ全ての関連ホストにコピーします。
/sbin/start_udev
multipath パッケージはコンピュータからストレージデバイスへ 複数のパスを持つシステム用に使用されます。multipath は障害 許容、フェイルオーバー、及びパフォーマンス強化を Red Hat Enterprise Linux システムに 付帯しているネットワークストレージデバイスに提供するものです。
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
}
}
/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.
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.
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
# 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
libvirt は、ゲストとのトラフィックを許可する iptables ルールを追加します。このゲストは INPUT、FORWARD、OUTPUT、及び POSTROUTING のチェーン内の virbr0 デバイスに付帯しています。libvirt はそれから、 ip_forward パラメータの有効化を試みます。他の一部のアプリケーションが ip_forward を無効にする可能性があるため、最善の選択肢は/etc/sysctl.conf に以下を追加することです。
net.ipv4.ip_forward = 1
<interface type='network'> <source network='default'/> </interface>
<interface type='network'> <source network='default'/> <mac address='00:16:3e:1a:b3:4a'/> </interface>
/etc/xen/xend-config.sxp への編集で以下の行を変更することにより、デフォルトの Xen ネットワーキングブリッジを 無効にすることが推奨されます:
(network-script network-bridge)
(network-script /bin/true)
/etc/sysconfig/network-scripts/ directory):
# chkconfig NetworkManager off # chkconfig network on # service NetworkManager stop # service network start
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
MTU variable to the end of the configuration file.
MTU=9000
ifcfg-br0、又はそれに似た名前のネットワークスクリプトを /etc/sysconfig/network-scripts ディレクトリ内に作成します。 br0 とは、ブリッジの名前です。これはファイル名が DEVICE パラメータと同じであれば、どんな名前でも結構です。
DEVICE=br0 TYPE=Bridge BOOTPROTO=dhcp ONBOOT=yes DELAY=0
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.
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
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
# 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) 接続機能だけのために あります。
virsh (25章virsh でゲストを管理) and virt-manager (26章仮想マシンマネージャ(virt-manager) でゲストを管理する). Those chapters provide a detailed description of the networking configuration tasks using both tools.
system-config-network アプリケーションを使用して もう1つのネットワークインターフェイスを設定します。別の方法として、/etc/sysconfig/network-scripts/ ディレクトリ内に ifcfg-ethX と言う名の新しい 設定ファイルを作成します。ここで X とは、いずれかの未使用の番号です。 eth1 と言う名の2つめのネットワークインターフェイス用の サンプルの設定ファイルを以下に示します。
$ 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
/etc/xen/scripts/network-bridge を,/etc/xen/scripts/network-bridge.xen にコピーします。
/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
network-xen-multi-bridge parameter to enable multiple network bridges.
#network-script network-bridge network-script network-xen-multi-bridge
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
# chmod +x /etc/xen/scripts/network-xen-multi-bridge.sh
# service network restart
virt-manager でゲストを作成するときに "仮想ネットワーク" アダプタを使用します。NetworkManager は Red Hat Enterprise Linux 5.1 及び それ以降でデフォルトで仮想ネットワークデバイスを使用して作動します。
<interface type='network'> <mac address='AA:AA:AA:AA:AA:AA'/> <source network='default'/> <target dev='vnet0'/> <model type='virtio'/> </interface>
xm 設定ファイル内で、仮想ネットワークデバイスは "vif" のラベルを持ちます。
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.
dummy0. This will also allow you to use a hidden IP address space for your guests.
/etc/modprobe.conf に追加します。
alias dummy0 dummy options dummy numdummies=1
/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
xenbr0 を dummy0 に バインドして、物理ネットワークに接続していない時でもネットワークを使用できるようにします。 /etc/xen/xend-config.sxp を編集して、netdev=dummy0 エントリを含むようにします:
(network-script 'network-bridge bridge=xenbr0 netdev=dummy0')
/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
/etc/init.d/xenLaptopNAT にコピーして、/etc/rc3.d/S99xenLaptopNAT へのソフトリンクを作成することができます。これが自動的に ブート時に NAT を開始します。
#!/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
dnsmasq を設定する方法についての短い説明を示します:
dnsmasq.tgz. The tar archive includes the following files:
nm-dnsmasq は NetworkManager の為のディスパッチャスクリプトとして 使用できます。これは NetworkManager が接続に変化を検出する度に実行されて、dnsmasq の 再スタート/再ロードを強制します。これは /etc/NetworkManager/dispatcher.d/nm-dnsmasq に コピーする必要があります。
xenDNSmasq は、/etc/init.d/xenDNSmasq の 主要スタートアップ、又はシャットダウンのスクリプトとして使用できます。
dnsmasq.conf は /etc/dnsmasq.conf の サンプルの設定ファイルです。
dnsmasq は /usr/local/sbin/dnsmasq のバイナリイメージです。
/usr/local/sbin/dnsmasq への バイナリ)を展開してビルドした後は、dnsmasq 設定ファイルを編集する必要があります。このファイルは /etc/dnsmaqs.conf にあります。
interface パラメータは dnsmasq が 指定したインターフェイスのみで DHCP と DNS 要求をリッスンするようにします。それは ダミーインターフェイスでもありえますが、ユーザーの公共インターフェイスやローカルループバックインターフェイス ではありえません。複数インターフェイスの為にもう1つの interface 行を 追加します。interface=dummy0 は、dummy0 インターフェイスでリッスンする1つの例です。
DHCP サーバーを有効にする dhcp-range には、リース及びオプションのリース期間用に 利用できるアドレスの範囲を供給する必要があります。複数のネットワークを使用している場合は、 DHCP を適用したい各ネットワーク上でこれを繰り返す 必要があります。1つの例として、dhcp-range=10.1.1.10,10.1.1.50,255.255.255.0,12h が あります(ネットワーク 10.1.1.* 用であり、12時間のリース期間)。
dhcp-option は ルーターが dnsmasq を実行しているマシンと同じだと想定します。例としては dhcp-option=3,10.1.1.1 があります。
xenDNSmasq として、 /etc/init.d にコピーできます。
chkconfig --add xenDNSmasq
chkconfig --levels 345 xenDNSmasq on
dnsmasq を設定するには、 供給されているスクリプト nm-dnsmasq を使用すれば 達成できます。
nm-dnsmasq スクリプトを /etc/NetworkManager/dispatcher.d/ にコピーします。
dnsmasq もまた ユーザーの /etc/resolv.conf 内の変化を検出して自動的にそれらを再ロードします (例えば VPN セッションをスタートした場合など)。
nm-dnsmasq スクリプトと xenDNSmasq スクリプトは両方共、NAT もセットアップします。
pv-on-hvm モジュール用のカーネル モジュールをデフォルトのカーネルパッケージ内に持っています。このことは、 para-virtualized ドライバーが Red Hat Enterprise Linux 4.7 とそれ以降、又は 5.3 とそれ以降のゲスト用に利用可能だと言う意味になります。
kmod-xenpv.
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.
kmod-xenpv.
/lib file system.
# rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' kernel
| カーネルアーキテクチャ | 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) | サポート有り |
# rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' kernel
kernel-PAE-2.6.18-53.1.4.el5.i686
GRUBGRUB) を 含むディスク、又はカーネルの initrd イメージを含むディスクでは出来ません。 /boot のディレクトリやパーティションを含んでいるディスクはいずれも、 para-virtualized ブロックデバイスドライバーを使用できないと言うことになります。
xen-pci-platform モジュールのロードは失敗します。
| ゲストカーネルタイプ | 必須のホストカーネルタイプ |
|---|---|
| ia32e (UP と SMP) | x86_64 |
| i686 | i686 |
| i686-SMP | i686 |
| i686-HUGEMEM | i686 |
| ゲストカーネルタイプ | 必須のホストカーネルタイプ |
|---|---|
| athlon | i686 |
| athlon-SMP | i686 |
| x86_64 | x86_64 |
| x86_64-SMP | x86_64 |
MBR と ブートローダ(GRUB)を収納 しているディスクのため、及び /boot パーティションのために para-virtualized ドライバーを使用します。このパーティションは非常に小さいもので十分です。 その理由は、それが /boot パーティションを保持するだけの十分な 容量があればいいからです。
/、 /usr)、又は論理ボリューム用に使用します。
/boot パーティションへのアクセス のみが仮想化ブロックデバイスドライバーを使用することになります。
rpm コマンド、又は yum コマンドを 使用して、パッケージをインストールします。rpm ユーティリティは 以下の 4つの新規カーネルモジュールを /lib/modules/[%kversion][%kvariant]/extra/xenpv/%release にインストールします:
xen_platform_pci.ko,
xen_balloon.ko,
xen_vbd.ko,
xen_vnif.ko.
xen-vbd) disk driver.
<disk type='file' device='disk'> <driver name='file'/> <source file='/dev/hda6'/> <target dev='hda'/> </disk>
<disk type='file' device='disk'> <driver name='tap' type='aio'/> <source file='/dev/hda6'/> <target dev='xvda'/> </disk>
# xm start YourGuestNameYourGuestName 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.
kernel-2.4.21-60.EL for all the required headers.
kmod-xenpv rpm を ゲストオペレーティングシステムにコピーします。
rpm ユーティリティを使用して RPM パッケージをインストール します。使用するゲストオペレーティングシステムの変種とアーキテクチャに必要なパッケージを 正しく識別していることを確認して下さい。
[root@rhel3]# rpm -ivh kmod-xenpv*
[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
insmod が警告を生成します。これらの警告は無視 できるものです。
/etc/modules.conf を確証して、以下のような eth0 用のエイリアスがあることを 確認します。複数のインターフェイスを設定する予定の場合は、各インターフェイス毎に追加の 行を加えます。
alias eth0 xen-vnif
/etc/rc.local を編集して行を追加します:
insmod /lib/modules/'uname -r'/extra/xenpv/%release/xen-vbd.o
#shutdown -h now” を使用)。
/etc/xen/YourGuestName with a text editor, performing the following changes:
vif=” エントリから “type=ioemu” エントリを削除します。
xen-vbd) ゲストドライバー経由で それらにアクセスできるようにします。
<disk type='file' device='disk'> <driver name='file'/> <source file='/dev/hda6'/> <target dev='hda'/> </disk>
<disk type='file' device='disk'> <driver name='tap' type='aio'/> <source file='/dev/hda6'/> <target dev='xvda'/> </disk>
# xm start YourGuestNameYourGuestName 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-modules と modversions のサポートは Red Hat Enterprise Linux 3 で提供されていないため、 para-virtualized ドライバーはシステムへの自動的追加とロードはされません。 モジュールを挿入するには、以下のコマンドを実行します。
insmod xen_vbd.ko
xen-vbd を使用するブロック デバイス用に特殊ファイルの手動作成が必要になります。以下の手順が、para-virtualized ブロックデバイスの作成法と登録の案内となります。
#!/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*
# mknod /dev/xvdc b $major 16 # mknod /dev/xvdc1 b $major 17
# 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” がシステムに利用可能であることが判ります。
[root@rhel3]# mkdir /mnt/pvdisk_p1 [root@rhel3]# mkdir /mnt/pvdisk_p2
[root@rhel3]# mount /dev/xvdb1 /mnt/pvdisk_p1 [root@rhel3]# mount /dev/xvdb2 /mnt/pvdisk_p2
[root@rhel3]# df /mnt/pvdisk_p1 Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvdb1 32000 15 31985 1% /mnt/pvdisk_p1
/etc/fstab ファイルを更新します。以下の行を追加して下さい:
/dev/xvdb1 /mnt/pvdisk_p1 ext3 defaults 1 2 /dev/xvdb2 /mnt/pvdisk_p2 ext3 defaults 1 2
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
kmod-xenpv、 modules-init-tools、及び modversions の RPM 群を ゲストオペレーティングシステムにコピーします。
rpm ユーティリティを使用して RPM パッケージ群を インストールします。使用するゲストオペレーティングシステムの変種とアーキテクチャに必要な パッケージを正しく識別していることを確認して下さい。このパッケージには、更新した module-init-tools が必要となり、これは Red Hat Enterprise Linux 4-6-z カーネル、又はそれ以降で利用できます。
[root@rhel4]# rpm -ivh modversions [root@rhel4]# rpm -Uvh module-init-tools [root@rhel4]# rpm -ivh kmod-xenpv*
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
#shutdown -h now” を使用)。
/etc/xen/YourGuestsName 内の ゲスト設定ファイルを編集します:
vif=” エントリから “type=ioemu” エントリを削除します。
xen-vbd) ゲストドライバー経由で それらにアクセスできるようにします。
disk=” セクションに追加します。オリジナルの “disk=” エントリも 以下のエントリに似ているかも知れません。
disk = [ "file:/var/lib/libvirt/images/rhel4_64_fv.dsk,hda,w"]
disk = [ "file:/var/lib/libvirt/images/rhel3_64_fv.dsk,hda,w", "tap:aio:/var/lib/libvirt/images/UserStorage.dsk,xvda,w" ]
tap:aio” を使用します。
virsh コマンドを使用して仮想マシンをブートします:
# virsh start YourGuestNamekudzu がユーザーに "Realtek ネットワークデバイスを維持するか、削除する" 、及び "xen-bridge デバイスを設定する" の選択を尋ねてきます。 xen-bridge は設定して、Realtek ネットワークデバイスは 削除すべきです。
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
[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” がシステムに利用可能であることが判ります。
[root@rhel4]# mkdir /mnt/pvdisk_p1 [root@rhel4]# mkdir /mnt/pvdisk_p2
[root@rhel4]# mount /dev/xvdb1 /mnt/pvdisk_p1 [root@rhel4]# mount /dev/xvdb2 /mnt/pvdisk_p2
[root@rhel4]# df /mnt/pvdisk_p1 Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvdb1 32000 15 31985 1% /mnt/pvdisk_p1
/etc/fstab ファイルを 更新します。以下の行を追加して下さい:
/dev/xvdb1 /mnt/pvdisk_p1 ext3 defaults 1 2 /dev/xvdb2 /mnt/pvdisk_p2 ext3 defaults 1 2
xen-vbd ドライバーは自動的にロードしない可能性が あります。以下のコマンドで %release を para-virtualized ドライバー の正しいリリースバージョンで入れ替えて、ゲスト上で実行して 下さい。
# insmod /lib/modules/'uname -r'/weak-updates/xenpv/%release/xen_vbd.ko
#shutdown -h now” を使用)。
/etc/xen/<Your GuestsName> 内のゲスト設定ファイルを編集します。
vif=” エントリから “type=ioemu” エントリを削除します。
xen-vbd) ディスクドライバー経由で それらにアクセスできるようにします。
disk=” セクションに追加します。オリジナルの “disk=” エントリも 以下のエントリに似ているかも知れません。
disk = [ "file:/var/lib/libvirt/images/rhel4_64_fv.dsk,hda,w"]
disk = [ "file:/var/lib/libvirt/images/rhel3_64_fv.dsk,hda,w", "tap:aio:/var/lib/libvirt/images/UserStorage.dsk,xvda,w" ]
tap:aio” を使用します。
virsh コマンドを使用して仮想マシンをブートします:
# virsh start YourGuestName
[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” がシステムに利用可能であることが判ります。
[root@rhel5]# mkdir /mnt/pvdisk_p1 [root@rhel5]# mkdir /mnt/pvdisk_p2
[root@rhel5]# mount /dev/xvdb1 /mnt/pvdisk_p1 [root@rhel5]# mount /dev/xvdb2 /mnt/pvdisk_p2
[root@rhel5]# df /mnt/pvdisk_p1 Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvdb1 32000 15 31985 1% /mnt/pvdisk_p1
/etc/fstab ファイルを更新して、ブートシーケンス中に デバイスをマウントするようにします。以下の行を追加して下さい:
/dev/xvdb1 /mnt/pvdisk_p1 ext3 defaults 1 2 /dev/xvdb2 /mnt/pvdisk_p2 ext3 defaults 1 2
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
/etc/modprobe.d/blacklist file. Blacklist 8139cp and 8139too for the RealTek 8139 and e1000 for the virtualized Intel e1000 NIC.
8139cp8139tooe1000
/etc/sysconfig/network-scripts directory.
xen_emul_unplug=never
virt-manager 内で、ゲスト用のコンソールウィンドウを開いて、 root としてログインします。
/etc/modprobe.conf が “alias eth0 xen-vnif” を含んでいることを 確認します。
# cat /etc/modprobe.conf alias eth0 xen-vnif
eth0 execute “# ifconfig eth0”. If you receive an error about the device not existing you should load the modules manually as outlined in 「para-virtualized ドライバーを手動でロードする」.
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)
# system-config-network”. Click on the “” button to start the network card configuration.





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)
/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" ]
# echo 'import virtinst.util ; print virtinst.util.randomMAC()' | python
/etc/modules.conf か、あるいは Red Hat Enterprise Linux 4 及び Red Hat Enterprise Linux 5 では /etc/modprobe.conf に更新が追加されていることを確認します。追加した 新規のインターフェイス用に新しいエイリアスを加えます。
alias eth1 xen-vnif
# ifconfig eth1
redhat-config-network を使用して、又は 、 Red Hat Enterprise Linux 4 と Red Hat Enterprise Linux 5 上では system-config-network を使用してネットワークインターフェイスを設定します。
/etc/xen/YourGuestName で YourGuestName を 使用するゲスト名で入れ替えることで、ゲストの設定ファイルを編集します。オリジナルのエントリは 以下に似ているでしょう。
disk = [ "file:/var/lib/libvirt/images/rhel5_64_fv.dsk,hda,w"]
disk=” パラメータに加えます。para-virtualized ドライバーを使用するストレージエントリは以下のエントリに似ています。“tap:aio” パラメータは hypervisor に対して para-virtualized ドライバーを使用するように指示します。
disk = [ "file:/var/lib/libvirt/images/rhel5_64_fv.dsk,hda,w",
"tap:aio:/var/lib/libvirt/images/UserStorage1.dsk,xvda,w" ]
disk=” セクションに追加します。
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
ドライバーをダウンロード
yum command.
# yum install virtio-win
virtio-win.iso ファイル)を /usr/share/virtio-win/ ディレクトリ内にインストールします。
para-virtualized ドライバーのインストール
virt-manager を使用して CD-ROM イメージを マウント」 to add a CD-ROM image with virt-manager and then install the drivers.
virt-manager を使用して CD-ROM イメージを マウントOpen virt-manager and the virtualized guest
virt-manager, select your virtualized guest from the list by double clicking the guest name.
Open the hardware tab

Select the device type

Select the ISO file
/usr/share/virtio-win/virtio-win.iso.

Disc assigned

Reboot
Open My Computer

Select the correct installation files
RHEV-Block.msi for 32-bit guests or RHEV-Block64.msi for 64-bit guests),
RHEV-Network.msi for 32-bit guests or RHEV-Block64.msi for 64-bit guests),
Install the block device driver
Start the block device driver installation
RHEV-Block.msi or RHEV-Block64.msi.

Confirm the exception

Finish

Install the network device driver
Start the network device driver installation
RHEV-Network.msi or RHEV-Network64.msi.

Performance setting
| Value | Action |
|---|---|
| 0 | Disable TCP timestamps and window scaling. |
| 1 | Enable TCP window scaling. |
| 2 | Enable TCP timestamps. |
| 3 | Enable TCP timestamps and window scaling. |

Confirm the exception

Finish

Reboot
viostor.vfd をフロッピィとして添付します。
Windows Server 2003
Windows Server 2008
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 「新規デバイス用に KVM para-virtualized ドライバーを使用する」.
<disk type='file' device='disk'> <source file='/var/lib/libvirt/images/disk1.img'/> <target dev='vda' bus='ide'/> </disk>
virtio に 変更することにより、para-virtualized デバイスを使用するためにエントリを変更します。
<disk type='file' device='disk'>
<source file='/var/lib/libvirt/images/disk1.img'/>
<target dev='vda' bus='virtio'/>
</disk>
virt-manager で、KVM para-virtualized ドライバーを使用した新規デバイスの作成を示しています。
virsh attach-disk か virsh attach-interface のコマンドが使用できます。
virt-manager 内のゲスト名をダブルクリックして 仮想化ゲストを開きます。



Enable the Intel VT-d extensions
Activate Intel VT-d in the kernel
intel_iommu=on parameter to the kernel line of the kernel line in the /boot/grub/grub.conf file.
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
Ready to use
Enable AMD IOMMU extensions
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
pci_8086_3a6c, and a fully virtualized guest named win2k3.
Identify the device
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
# virsh nodedev-list | grep pci
**** is a four digit hexadecimal code):
pci_8086_****
lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code.
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># virsh nodedev-dettach pci_8086_3a6c Device pci_8086_3a6c dettached
$ printf %x 0 0 $ printf %x 26 1a $ printf %x 7 7
bus='0x00' slot='0x1a' function='0x7'
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>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
$ virsh nodedev-dettach pci_8086_3a6c
$ readlink /sys/bus/pci/devices/0000\:00\:1d.7/driver ../../../bus/pci/drivers/pci-stub
# setsebool -P virt_use_sysfs 1
# virsh start win2k3
virt-manager tool. The following procedure adds a 2 port USB controller to a virtualized guest.
Identify the device
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
# virsh nodedev-list | grep pci
**** is a four digit hexadecimal code):
pci_8086_****
lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code.
Detach the PCI device
# virsh nodedev-dettach pci_8086_3a6c Device pci_8086_3a6c dettached
Power off the guest
Open the hardware settings

Add the new device

Select a PCI device

Confirm the new device

--host-device parameter.
Identify the PCI device
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
# virsh nodedev-list | grep pci
**** is a four digit hexadecimal code):
pci_8086_****
lspci output to lspci -n (which turns off name resolution) output can assist in deriving which device has which device identifier code.
Add the device
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
Complete the installation
/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)
/etc/modprobe.conf to hide multiple devices.
options pciback hide=(0000:09:00.0)(0000:0a:04.1)
virsh (「Adding a PCI device with virsh」 - Step 5);
virt-manager (「Adding a PCI device with virt-manager」); or
virt-install (「PCI passthrough with virt-install」)
/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
Enable Intel VT-d in BIOS and in the kernel
Verify support
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)
Start the SR-IOV kernel modules
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
Activate Virtual Functions
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.
# modprobe -r igb
max_vfs set to 1 or any number of Virtual Functions up to the maximum supported by your device.
# modprobe igb max_vfs=1
Inspect the new Virtual Functions
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)
-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.
Find the devices with virsh
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]
Get advanced details
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>
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.
Add the Virtual Function to the guest
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.
printf utility to convert decimal values to hexadecimal values.
$ printf %x 3 3 $ printf %x 16 10 $ printf %x 1 1
bus='0x03' slot='0x10' function='0x01'
virsh edit command. This example edits a guest named MyGuest.
# virsh edit MyGuest
devices section of the XML configuration file.
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address bus='0x03' slot='0x10' function='0x01'/>
</source>
</hostdev>
Restart
# virsh start MyGuest
# 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
ntpd サービスを有効にして下さい:
# service ntpd start
# chkconfig ntpd on
ntpd サービスを使用すると、全ての ケースでクロックのずれの効果を最低限に抑えることができるはずです。
constant_tsc フラグが存在する場合は、 使用中の CPU が不変タイムスタンプカウンタを持っていることになります。 その CPU が constant_tsc フラグを持つか どうかを判定するには、以下のコマンドを実行します:
$ cat /proc/cpuinfo | grep constant_tsc
constant_tsc ビットを持つことになります。出力がない場合は以下の案内に 従ってください。
constant_tsc ビットが無い場合、 全てのパワーマネジメント機能 (BZ#513138) を無効にして下さい。 各システムはいくつかのタイマーで時刻を維持しています。TSC はホスト上で不安定 であり、時には cpufreq 変更、deep C 状態、又は より速い 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
constant_tsc の無いホスト上でのみ)cpufreq を 無効にするには、/etc/sysconfig/cpuspeed 設定ファイルの編集により、MIN_SPEED 変数と MAX_SPEED 変数を利用できる最高の周波数に変更します。 その有効な限界は /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies ファイル内で見ることができます。
| Red Hat Enterprise Linux | その他のゲストカーネルパラメータ |
|---|---|
| para-virtualized クロックを持つ 5.4 AMD64/Intel 64 | 追加のパラメータは無用です |
| para-virtualized クロックを持たない 5.4 AMD64/Intel 64 | divider=10 notsc lpj=n |
| para-virtualized クロックを持つ 5.4 x86 | 追加のパラメータは無用です |
| para-virtualized クロックを持たない 5.4 x86 | divider=10 clocksource=acpi_pm lpj=n |
| 5.3 AMD64/Intel 64 | divider=10 notsc |
| 5.3 x86 | divider=10 clocksource=acpi_pm |
| 4.8 AMD64/Intel 64 | notsc divider=10 |
| 4.8 x86 | clock=pmtmr divider=10 |
| 3.9 AMD64/Intel 64 | 追加のパラメータは無用です |
| 3.9 x86 | 追加のパラメータは無用です |
boot.ini ファイルに以下の 行を追加して下さい:
/use pmtimer
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.
{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# setenforce 1
AutoFS, NFS, FTP, HTTP, NIS, telnetd, sendmail などのような不要なサービスを削除、又は 無効にします。
/var/lib/libvirt/images/ の下に格納すべきです。 仮想マシンのイメージ用に異なるディレクトリを使用している場合は、そのディレクトリを 確実に SELinux ポリシーに追加して、インストールを開始する前にそれを再ラベルします。
vsftpd サーバーの場所になります。
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.
/dev/sdb). Use partitions (for example, /dev/sdb1) or LVM volumes.
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.
NewVolumeName と言う名前の 5ギガバイトの論理ボリュームを volumegroup と言う名前のボリュームグループ上に 作成します。
# lvcreate -nNewVolumeName-L5G volumegroup
NewVolumeName の論理ボリュームを ext3 などの 拡張属性をサポートするファイルシステムでフォーマットします。
# mke2fs -j /dev/volumegroup/NewVolumeName
/etc、/var、/sys など)や、ホームディレクトリ(/home 又は /root)には配置しないように推奨します。 このサンプルでは、/virtstorage と言うディレクトリを使用します。
# mkdir /virtstorage
# mount /dev/volumegroup/NewVolumeName /virtstoragesemanage fcontext -a -t xen_image_t "/virtstorage(/.*)?"
semanage fcontext -a -t virt_image_t "/virtstorage(/.*)?"
/etc/selinux/targeted/contexts/files/file_contexts.local ファイルに1行を追加して、それがこの変更を 恒久化します。追加される1行は以下に似ているものです:
/virtstorage(/.*)? system_u:object_r:xen_image_t:s0
/dev/volumegroup/NewVolumeName with the correct label:
# semanage fcontext -a -t xen_image_t /dev/volumegroup/NewVolumeName # restorecon /dev/volumegroup/NewVolumeName
# semanage fcontext -a -t xen_image_t -f -b /dev/sda2 # restorecon /dev/sda2
xend_disable_t はデーモンを再起動した後に xend を規制のないモードにします。システム全体よりも単独デーモンだけの保護を無効にする方が無難です。ディレクトリを他の場所で使用する xen_image_t として再ラベルすることは避けるように 推奨します。
| SELinux Boolean | Description |
|---|---|
| allow_unconfined_qemu_transition | Default: off. This boolean controls whether KVM guests can be transitioned to unconfined users. |
| qemu_full_network | Default: on. This boolean controls full network access to KVM guests. |
| qemu_use_cifs | Default: on. This boolean controls KVM's access to CIFS or Samba file systems. |
| qemu_use_comm | Default: off. This boolean controls whether KVM can access serial or parallel communications ports. |
| qemu_use_nfs | Default: on. This boolean controls KVM's access to NFS file systems. |
| qemu_use_usb | Default: on. This boolean allows KVM to access USB devices. |
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.
xend を使用したゲストの管理/etc/xen/xend-config.sxp を編集することにより、操作パラメータを 指定する必要があります。xend-config.sxp 設定ファイルで 有効、又は無効にできるパラメータを以下に示します:
| 項目 | 説明 |
|---|---|
|
(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)
|
ドメインソケットサーバーのバインド先のアドレスを決定します。デフォルト値は 全ての接続を許可します。
|
service xend start
service xend stop
service xend restart
service xend status
xend を有効にするchkconfig コマンドを使用して、xend を initscript に追加します。
chkconfig --level 345 xend
xend は、ランレベル 3、4、及び 5 で開始します。
virsh migrate コマンドを使用します。
# virsh migrateGuestNamelibvirtURI
virsh migrate コマンドで --live オプションを使用します。
# virsh migrate--liveGuestNamelibvirtURI
/etc/xen/xend-config.sxp の 設定ファイルにいくつかの変更が必要になります。 不正確な設定がセキュリティ問題になる可能性があるため、デフォルトでは移行は 無効になっています。移行ポートを開くと権限の無いホストが移行を開始したり、移行ポートに 接続したりできるようになります。移行要求用に認証と権限授与が設定されておらず、唯一の 制御メカニズムはホスト名と IP アドレスを基にしています。移行ポートが無許可のホストに アクセスされないように特別な注意が必要です。
/etc/xen/xend-config.sxp 内で以下のエントリを修正して、 移行を有効にします。必要であれば値を修正して、以下のパラメータの前にあるコメント (# マーク)を削除します。
(xend-relocation-server yes)no です。xend-relocation-server の値を yes に 変更して移行を有効にします。
(xend-relocation-port 8002)xend-relocation-server が yes に セットされている場合、このパラメータ、(xend-relocation-port)、は ポート xend が移動インターフェイスの 為に使用されるべきことを指定します。
xend-relocation-port パラメータでセットされたポートは両方の システムで開かれる必要があります。
(xend-relocation-address '')(xend-relocation-address) は、 xend-relocation-server がセットされている場合に、 relocation-socket 接続の移行コマンドの為に、xend がリッスンするアドレスです。
(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 '')(xend-relocation-hosts-allow 'hosts') parameter controls which hostnames can communicate on the relocation port.
xend-relocation-hosts-allow option to restrict access to the migration server.
xend-relocation-port と xend-relocation-address も参照して下さい)
(xend-relocation-hosts-allow) パラメータは空白で分離された正規表現の連続でなければなりません。 これらの正規表現の1つに一致する完全修飾ドメイン名、又は IP アドレスを持つ ホストはいずれも受理されます。
(xend-relocation-hosts-allow) 属性の サンプル:
(xend-relocation-hosts-allow '^localhost$ ^localhost\\.localdomain$')
# service xend restart
et-virt07 と et-virt08)。この両方は eth1 をそのデフォルトネットワークインターフェイスとして 使用しているため、xenbr1 をその Xen ネットワーキング ブリッジとして使用しています。この例では、et-virt07 上でローカルに取り付けた SCSI disk (/dev/sdb) をNFS を 介して共有ストレージ用に使用しています。
# mkdir /var/lib/libvirt/images # mount /dev/sdb /var/lib/libvirt/images
/var/lib/libvirt/images/ を エキスポートしている場合は、/var/lib/libvirt/images/ のみを エキスポートすることと、/var/lib/xen/ ではないこと を 確認して下さい。/var/lib/xen/ ディレクトリは xend デーモンと他のツールにより使用されるものであり、このディレクトリを共有すると、 予知できない動作を起こす可能性があります。
# cat /etc/exports /var/lib/libvirt/images *(rw,async,no_root_squash)
# 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
[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 '')
[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)
/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 starttestvm1Domaintestvm1started
[et-virt07 ~]# virsh list
Id Name State
----------------------------------
Domain-0 running
testvm1 blocked
[et-virt07 images]# time virsh savetestvm1testvm1.sav real 0m15.744s user 0m0.188s sys 0m0.044s
[et-virt07 images]# ls -lrttestvm1.sav -rwxr-xr-x 1 root root 1075657716 Jan 12 06:46testvm1.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
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
et-virt08
[et-virt08 ~]# virsh list Id Name State ---------------------------------- Domain-0 running
et-virt07:
[et-virt07 ~]# virsh list
Id Name State
----------------------------------
Domain-0 running
testvm1 running
#!/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 へと もう 1度移行サイクルを実行します。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
xm migrate コマンドを使用)。ライブ移行は 同じコマンドで実行できますが、その場合、xend-config 設定ファイルにいくらかの追加修正が必要になります。この例では、正しい移行を達成する為に 修正すべきエントリを識別しています:
(xend-relocation-server yes)(xend-relocation-port 8002)xend が移行用に使用するポートを設定します。使用するネットワーク環境がカスタム値を要求しない限りは、この値を使用します。コメント用の シンボルを削除して有効にします。
(xend-relocation-address )xend-relocation-server を有効にした後に、移動ソケット接続の為にリッスンするアドレスです。Xen hypervisor は 指定されたインターフェイス上の移行ネットワークトラフィックだけをリッスンします。
(xend-relocation-hosts-allow )(xend-relocation-hosts-allow- '^localhost\\.localdomain$' )>
virsh コマンドを使用してゲストを別のホストに移行することが できます。migrate コマンドは 以下の形式のパラメータを 受け付けます:
# virsh migrate --live GuestName DestinationURLGuestName パラメータは、移行したいゲストの 名前を表すものです。
DestinationURL パラメータは目的地システムの URL かホスト名です。目的地システムは Red Hat Enterprise Linux の同じバージョンを 実行しなければならず、同じ hypervisor を使用して、libvirt が 稼働している必要があります。
test1.example.com から test2.example.com へ移行をします。ご自分の 環境に適したホスト名に変更して下さい。この例は RHEL4test と言う 仮想マシンを移行します。
ゲストが稼働していることを確認します
test1.example.com から RHEL4test が稼働していることを確認します:
[root@test1 ~]# virsh list Id Name State ---------------------------------- 10 RHEL4 running
ゲストを移行
test2.example.com に ライブ移行します。/system を目的地の URL の末尾に追記することで全面的アクセスが 必要であることを libvirt に伝えます。
# virsh migrate --live RHEL4test qemu+ssh://test2.example.com/system待ち時間
virsh は エラーを報告するだけです。このゲストは完全に移行が終了するまで送信元のホストで稼働し続けます。
ゲストが目的地のホストに到着したことを確認
test2.example.com から、 RHEL4test が稼働していることを確認します:
[root@test2 ~]# virsh list Id Name State ---------------------------------- 10 RHEL4 running
virt-manager を使用した KVM ベース ゲストの移行を取り扱います。













ssh か、TLS か、あるいは SSL を 使用して仮想化ゲストをリモートで管理する方法を説明しています。
libvirt 管理接続を使用して、リモートマシンを管理します。全ての認証は 使用中の SSH エージェントに よって収集された SSH パブリックキー暗号とパスワード、又はパスフレーズを 使用して行われます。更には、各ゲスト仮想マシンの VNC コンソールは SSH 経由でトンネル通過します。
virt-manager 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.
virt-manager.
Optional: Changing user
$ su -
Generating the SSH key pair
virt-manager is used. This example uses the default key location, in the ~/.ssh/ directory.
$ ssh-keygen -t rsa
Coping the keys to the remote hosts
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
Optional: Add the passphrase to the ssh-agent
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
libvirt デーモン (libvirtd)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
libvirtd と SSH の設定が終了した後は、リモートで仮想マシンへ アクセスして管理できるはずです。また、この時点で VNC を 使用してゲストへもアクセスできるはずです。
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.
libvirt サーバーセットアップ/etc/xen/xend-config.sxp を 編集することにより TLS を有効にすることができます。設定ファイル内の (vnc-tls 1) 設定パラメータのコメント化を外します。
/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
(vnc-x509-verify 1) parameter.
virt-manager と virsh のクライアントセットアップlibvirt 管理 API を有効にするには、CA と クライアントの証明書が /etc/pki 内に 配置されなければなりません。この詳細に関しては http://libvirt.org/remote.html をご覧下さい。
virt-manager user interface, use the '' transport mechanism option when connecting to a host.
virsh 用に URI は以下のような形式を持ちます:
qemu://hostname.guestname/system
xen://hostname.guestname/ .
$HOME/.pki に入れる必要があります。それは以下の 3つのファイルです:
ca-cert.pem - CA 証明書
libvirt-vnc 又は clientcert.pem - CA によって署名されたクライアント証明書。
libvirt-vnc 又は clientkey.pem - クライアントのプライベートキーです。
libvirt が以下のようなトランスポートモードをサポートします:
/var/run/libvirt/libvirt-sock と /var/run/libvirt/libvirt-sock-ro (読み込み専用接続)です。
libvirtd) がリモートマシン上で 実行している必要があります。Port 22 が SSH アクセス用に開いていなければ なりません。なんらかの ssh キー管理(例えば、ssh-agent ユーティリティ)を 使用する必要があり、そうでないとパスワードを要求されます。
ext パラメータはいずれかの外部プログラム用に使用 されるものです。これは libvirt の範疇にはない手法でリモートマシンに接続をします。 このパラメータはサポートされていません。
virsh と libvirt により使用されます。\n URI はまた、virsh コマンド用に --connect パラメータと 一緒にリモートホスト上で単独コマンドや移行を実行するのに使用されます。
driver[+transport]://[username@][hostname][:port]/[path][?extraparameters]
ccurran を使用して towada と言うホスト上のリモート Xen hypervisor に接続します。
xen+ssh://ccurran@towada/
towada と言う名前のホスト上のリモート Xen hypervisor に接続します。
xen://towada/
towada using TLS. The no_verify=1 tells libvirt not to verify the server's certificate.
xen://towada/?no_verify=1
towada 上のリモート KVM hypervisor に 接続します。
qemu+ssh://towada/system
qemu+unix:///system?socket=/opt/libvirt/run/libvirt/libvirt-sock
test+tcp://10.1.1.10:5000/default
| 名前 | トランスポートモード | 説明 | 使用法のサンプル |
|---|---|---|---|
| name | 全てのモード | リモート virConnectOpen 関数に渡される名前です。この名前は通常、リモート URI からトランスポート、ホスト名、 ポート番号、ユーザー名、及び余分のパラメータを削除したものですが、一部の複雑なケースでは、名前を明示的に 供給するのが適切な場合もあります。 | name=qemu:///system |
| command | ssh と ext | 外部コマンドです。外部のトランスポートにはこれが必須となります。ssh 用には デフォルトは ssh です。コマンドの為に PATH が検索されます。 | command=/opt/openssh/bin/ssh |
| socket | unix と ssh | UNIX ドメインソケットへのパスです。これはデフォルトを上書きします。 ssh トランスポートには、これがリモート netcat コマンドに渡されます(netcat 参照)。 | socket=/opt/libvirt/run/libvirt/libvirt-sock |
| netcat | ssh |
netcat コマンドはリモートシステムに接続するのに 使用できます。デフォルトの netcat パラメータは nc コマンドを 使用します。SSH トランスポート用には、libvirt が以下の形式を使用して SSH コマンドを 構築します:
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 | ゼロ以外の値にセットしてある場合、(ssh-agent 又は同類の使用で)自動的にリモートマシンに ログインできない場合に、ssh がパスワードを要求することを止めます。例えば、 libvirt を使用するグラフィカルプログラム内のターミナルにアクセスを持たない時に これを使用します。 | no_tty=1 |
目次
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
ps
pstree
top
kvmtrace
kvm_stat
xentop
xm dmesg
xm log
virsh はゲストと hypervisor を管理するための コマンドラインインターフェイスです。
virsh ツールは libvirt 管理 API を 土台にして構築されており、xm コマンドとグラフィカルゲスト マネージャ (virt-manager) への代替として機能します。 virsh は特別権限のないユーザーにより読み込み専用モードで 使用可能です。 virsh を使用してゲストマシン用のスクリプトを 実行することができます。
| コマンド | 説明 |
|---|---|
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 コマンドはゲストと hypervisor リソースを 管理します:
| コマンド | 説明 |
|---|---|
setmem
| ゲストのために割り当てたメモリーを設定します。 |
setmaxmem
| hypervisor 用の最大メモリー限度を設定します。 |
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 オプションを示します:
| コマンド | 説明 |
|---|---|
version
|
virshのバージョンを表示します。
|
nodeinfo
| hypervisor に関する情報を出力します。 |
virsh で hypervisor セッションへ接続します:
# virsh connect {hostname OR URL}<name> は hypervisor のマシン名です。読み込み専用の接続を開始したい場合、上記のコマンドに -readonly を追記します。
virsh:
# virsh dumpxml {domain-id, domain-name or domain-uuid}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 dumpxmlThis fileGuestID>guest.xml
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 「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>
dumpxml option (refer to 仮想マシン XML ダンプ(設定ファイル)を作成). To create a guest with virsh from an XML file:
# virsh create configuration_file.xmldumpxml 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}resume (ゲストの復帰) option.
resume オプションと共に virsh を 使用して休止中のゲストを復帰します:
# virsh resume {domain-id, domain-name or domain-uuid} suspend と resume 操作用に保持されます。
virsh コマンドを使用してゲストの現在の状態をファイルに 保存します:
# virsh save {domain-name, domain-id or domain-uuid} filenamerestore (ゲストの復帰) option. Save is similar to pause, instead of just pausing a guest the present state of the guest is saved.
# virsh restore filenamevirsh コマンドを使用してゲストをシャットダウンします:
# virsh shutdown {domain-id, domain-name or domain-uuid}on_shutdown parameter in the guest's configuration file.
virsh コマンドを使用してゲストを再起動します:
#virsh reboot {domain-id, domain-name or domain-uuid}on_reboot element in the guest's configuration file.
virsh コマンドを使用してゲストの停止を強制します:
# virsh destroy {domain-id, domain-name or domain-uuid}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.
# virsh domid {domain-name or domain-uuid}# virsh domname {domain-id or domain-uuid}# virsh domuuid {domain-id or domain-name}virsh domuuid の出力の例:
# virsh domuuid r5b2-mySQL01 4a4c59a7-ee3f-c781-96e4-288f2862f011
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 からの出力は6つの状態の1つとして 分類されます(以下の一覧)。
running 状態は CPU 上で現在活動中のゲストを 示します。
blocked として表示してあるゲストは阻止されており、 実行していないか、又は実行不可能です。これは I/O 待ちのゲスト(旧来の wait 状態)か、 スリープモードのゲストがその要因です。
paused 状態は休止中のドメインを一覧表示します。 これは、管理者が virt-manager、xm pause、 又は virsh suspend で、pause ボタンを使用する ことで発生します。ゲストが休止している時は、メモリーとその他のリソースを消費しますが、スケジュールと hypervisor からの CPU リソースには無視できる量です。
shutdown 状態は シャットダウンプロセスにある ゲスト用のものです。ゲストはシャットダウン信号を受けてその運用を丁寧に終了するプロセスに 入るべき状態です。これは全てのゲストオペレーティングシステムでは機能しないかも知れません。 一部のオペレーティングシステムはこの信号に良く反応しません。
dying 状態のドメインはご臨終のプロセスにある ものです。これはドメインがシャットダウンやクラッシュを完全に終了していない状態を指します。
crashed の場合、ゲストは実行中に障害を受け、もう 実行していない状態です。この状態はクラッシュ時にゲストが再スタートしないように設定されている 場合にのみ発生します。
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
# virsh vcpupin domain-id vcpu cpulistdomain-id parameter is the guest's ID number or name.
vcpu パラメータは、ゲストに割り当てられた仮想 CPU の数を示します。 vcpu パラメータは必須項目です。
cpulist パラメータは、コンマで区切られた物理 CPU の 識別子番号の一覧です。cpulist パラメータはどの物理 CPU で VCPU が稼働するかを決定します。
virsh を使用してゲストに割り当てられた CPU の数を 修正するには:
# virsh setvcpus {domain-name, domain-id or domain-uuid} countcount 値はゲストが作成された時に指定されたカウントを 超過することは出来ません。
virsh :
# virsh setmem {domain-id or domain-name} count
virsh domblkstat を使用すると稼働中のゲストの ブロックデバイス統計が表示できます。
# virsh domblkstat GuestName block-devicevirsh domifstat を使用すると、稼働中のゲストの ネットワークインターフェイス統計が表示できます。
# virsh domifstat GuestName interface-device virsh を使用して別のホストへ移行することが できます。ドメインを別のホストへ移行します。ライブ移行用には --live を追加します。 migrate コマンドは以下の形式のパラメータを受け付けます:
# virsh migrate --live GuestName DestinationURL--live パラメータはオプションです。ライブ移行用には --live パラメータを追加します。
GuestName パラメータは移行したいゲストの名前を示します。
DestinationURL パラメータは移行先システムの URL 又はホスト名です。移行先システムは以下を必要とします:
libvirt サービスが開始する必要があります。
virsh コマンドを使用した仮想化 ネットワークの管理を説明します。仮想化ネットワークを一覧表示するには:
# virsh net-list
# virsh net-list Name State Autostart ----------------------------------------- default active yes vnet1 active yes vnet2 active yes
# virsh net-dumpxml NetworkName# 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 name] — network-name で指定された ネットワークを自動開始します。
virsh net-create XMLfile — 既存の XML ファイルを使用して新規のネットワークを生成して開始します。
virsh net-define XMLfile — 既存の XML ファイルから新規のネットワークデバイスを生成しますが開始しません。
virsh net-destroy network-name — network-name として指定された ネットワークを破棄します。
virsh net-name networkUUID — 指定された networkUUID をネットワーク名に変換します。
virsh net-uuid network-name — 指定された network-name をネットワーク UUID に変換します。
virsh net-start nameOfInactiveNetwork — 休止中のネットワークを開始します。
virsh net-undefine nameOfInactiveNetwork — 休止中のネットワークを定義解除します。
virt-manager) ウィンドウ、ダイアログボックス、各種 GUI 制御などを説明しています。
virt-manager はユーザーのシステム上とリモートマシン上の hypervisor とゲストのグラフィカル表示を提供します。para-virtualized と完全仮想化の両方の ゲストを定義するのにも virt-manager を使用できます。そして virt-manager は以下を含む、仮想化管理のタスクも演じることができます:


virt-manager. The UUID field displays the globally unique identifier for the virtual machines.


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.
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'.
virt-manager, it is not possible to use this sticky key feature to send a Sysrq key combination to a guest.
virt-manager のセッションを開始するには、 メニューを開いて、それから メニュー、 (virt-manager) と進んで行きます。
virt-manager の主要ウィンドウが表示されます。

virt-manager の開始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 「SSH を使用したリモート管理」.









virt-manager's preferences window.



















DHCP の範囲を選択


xm コマンドには Xen hypervisor を管理する機能があります。 ほとんどの操作は libvirt ツール、virt-manager アプリケーション、 あるいは、virsh コマンドで実行されます。xm コマンドは、libvirt ツールのエラーチェック機能を持ちませんので libvirt ツールのタスクには 使用すべきではありません。
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 には、現在サポートがありません。
/boot/grub/grub.conf に存在) は GRUB ブートメニューインターフェイス用にオペレーティングシステムのリストを作成します。kernel-xen RPM をインストールすると、スクリプトが kernel-xen エントリを GRUB 設定ファイルに追加し、これがデフォルトで 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
initrd イメージと Linux カーネルをロードします。カーネルエントリは他のエントリの上部にある為、カーネルが最初にメモリーにロードされます。ブートローダはコマンドライン引数を hypervisor と Linux カーネルに送り、またそれらから受理します。次の例では Dom0 linux カーネルメモリーを 800 MB に制限する方法を示しています:
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
mem
com1=115200, 8n1
dom0_mem
dom0_max_vcpus
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
/etc/elilo.conf にシンボルリンクがあるもので、グローバル オプションとイメージスタンザの一覧を含んでいます。kernel-xen RPM をインストール すると、ポストインストールスクリプトが適切なイメージスタンザを 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"
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.
read-only をカーネルコマンドラインオプションの ro と解釈して、ルートファイルシステムが読み込み専用としてマウントされる要因となります。この状態は initscripts がルート ドライブを読み込み/書き込みとしてマウントするまで継続します。ELILO は "root" 行を カーネルコマンドラインにコピーします。これらは "append" 行とマージされて、以下の ような 完全なコマンド行を構成します:
"-- root=/dev/VolGroup00/rhel5_2 ro rhgb quiet"
-- シンボルは、hypervisor とカーネルの引数に 区切りを付けます。hypervisor 引数が最初に来て、それから -- デリミタで、 その後、カーネル引数が来ます。hypervisor は通常引数を取りません。
-- の前にパラメータを 挿入します。hypervisor メモリー (mem) パラメータと カーネル用の quiet パラメータのサンプルを以下に示します:
append="dom0_mem=2G -- quiet"
| パラメータ | 説明 |
|---|---|
mem= | mem パラメータは hypervisor の最大 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= は、hypervisor に割り当てる CPU の 数量をセットします。Itanium® 上での Red Hat Enterprise Linux 5.2 のデフォルトは 4 です。 |
com1= | com1= は最初のシリアル行の為のパラメータをセットします。 例えば、com1=9600,8n1,0x408,5 。io_base と irq のオプションは無視して標準のデフォルトで結構です。baud パラメータは auto にセットしてブートローダ設定がそのまま保持 されるようにします。ELILO 内か、EFI 設定内でグローバルシリアルオプションとしてシリアルパラメータが セットされている場合は、com1 パラメータは無視できます。 |
com2= | 2つめのシリアル行にパラメータをセットします。上述の com1 パラメータの説明を参照して下さい。 |
console= | console はコンソールオプション用のコンマで区切られた 個人設定一覧です。オプションには、vga、com1 、及び com2 が含まれます。hypervisor が EFI コンソール設定の継承を試みるため、この設定は除外されるべきです。 |
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 の出力がコンソールで 生成されるようにしています。append 行が hypervisor 引数として正しく解釈されるように 2つのダッシュは保持されることに注意して下さい。
| 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.
|
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.
xm create --help_config.
|
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
|
ドメインが 終了時に再スタートすべきかどうかを決定するものです。 - onreboot= シャットダウンコード reboot を付けて終了時に再スタート - always = 常に終了時に再スタート、終了コードを無視。 - never = 終了時に再スタートしない、終了コードを無視。 これらはすべて破棄されました。代わりにon_poweroff、 on_reboot、及び on_crash を使います。
|
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 として現れます。MODE が r の場合は、 読み込み専用で、 MODE が w の場合は、読み込み/書き込みと なります。DOM が指定されると、それはディスクの為に使用するようにバックエンドドライバー ドメインを定義します。このオプションは複数のディスクを追加するために繰り返すことができます。
|
pci=BUS:DEV.FUNC
|
任意のパラメータ(16進法で)を使用して、ドメインに PCI デバイスを追加します。 例えば、pci=c0:02.1a。このオプションは、繰り返して 複数の PCI デバイスを追加することができます。
|
ioports=FROM[-TO]
|
パラメータ(16進法で)使用してドメインにレガシー I/O の幅を追加します。 ioports=02f8-02ff。このオプションは、繰り返して 複数の I/O の幅を追加することができます。
|
irq=IRQ
|
ドメインに IRQ(割り込みの行)を追加します。例えば、irq=7。このオプションは繰り返して複数の IRQ を追加することができます。
|
usbport=PATH
| そのポートへのパスで指定されている通りにドメインに物理 USB ポートを追加します。 このオプションは繰り返して複数のポートを追加することが出来ます。 |
vfb=type=
vnclisten=
xauthority=
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=
script==NAME
|
該当する MAC アドレスとブリッジを使用してネットワーク インターフェイスを追加します。vif は該当する設定スクリプトを コールすることにより、設定されます。タイプが指定されていない場合は、デフォルトは netfront となり、 ioemu ではありません。MAC が指定されていない場合は、ランダムに MAC アドレスが使用されます。指定されていないと、ネットワークバックエンドはそれ自身の MAC アドレスを選択します。ブリッジが指定されていないと、最初に見付かったブリッジが使用されます。スクリプトが 指定されていないと、デフォルトのスクリプトが使用されます。バックエンドが指定されていないと、デフォルトの バックエンドドライバードメインが使用されます。vif 名が指定されていない場合は、バックエンドの仮想インターフェイスが vifD.N と言う名前を取り、この D はドメイン id であり、N がインターフェイスの id となります。このオプションは 複数の vif を追加する時に繰り返されます。vif を指定することにより、必要に応じてインターフェイスの数を増加できます。
|
vtpm=instance=INSTANCE,backend=DOM
|
TPM インターフェイスを追加します。バックエンド側では、該当するインスタンスを 仮想 TPM インスタンスとして使用します。与えられた数値は単に好みのインスタンス番号です。 hotplug スクリプトはどのインスタンス番号が実際にドメインに割り当てられるかを決定します。 仮想マシンと 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) です。このオプションが セットされていないと、ランダムに1つ生成されます。仮想ネットワークインターフェイス用の MAC アドレスと同様です。これはクラスター全域に渡って特有である必要があります。 |
| パーサー関数 | 有効な引数 |
|---|---|
set_bool
|
受理される値:
|
set_float
|
Accepts a floating point number with Python's float(). For example:
|
set_int
|
Accepts an integer with Python's int().
|
set_value
|
いずれの Python 値も受理します。
|
append_value
|
いずれの Python 値も受理して、アレイに格納されている以前の値に追記します。
|
| 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
|
目次
ftpdftpdvirsh を使用して、 TestServer を 介してホストがブートする時点に自動的にスタートします。
# virsh autostart TestServer
Domain TestServer marked as autostarted
--disable パラメータを使用します。
# virsh autostart --disable TestServer
Domain TestServer unmarked as autostarted
KVM パッケージをインストール
# yum install kvm
どのカーネルが使用中かを確認
uname コマンドを使用して、どのカーネルが稼働しているか判定します:
$ uname -r 2.6.18-159.el5xen
2.6.18-159.el5xen" がシステムで稼働中です。 デフォルトカーネル、"2.6.18-159.el5" が稼働している場合は、 このサブステップは無視できます。
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
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
再起動して新しいカーネルをロードします。
$ lsmod | grep kvm kvm_intel 85992 1 kvm 222368 2 ksm,kvm_intel
kvm モジュールと、 kvm_intel モジュール、あるいは kvm_amd モジュールが存在するはずです。
Xen パッケージをインストール
# yum install kernel-xen xen
どのカーネルが使用中かを確認
uname コマンドを使用すると、どのカーネルが実行中であるか 判定できます。
$ uname -r 2.6.18-159.el5
2.6.18-159.el5" はシステム上で実行中です。 これがデフォルトのカーネルです。カーネルがその末尾に xen を 持つ場合(例えば、2.6.18-159.el5xen)、Xen カーネルが 実行中であるため、このサブステップは無視しても結構です。
デフォルトカーネルから 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
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
再起動して新しいカーネルをロードします。
uname コマンドを使用して確認します:
$ uname -r 2.6.18-159.el5xen
xen を示すなら、Xen カーネルが稼働しています。
qemu-img コマンドラインツールは、Xen と KVM で使用している 各種ファイルシステムのフォーマットに使用されます。qemu-img は 仮想化ゲストイメージ、追加のストレージデバイス、及びネットワークストレージのフォーマットに 使用されるものです。qemu-img のオプションと使用法は以下の一覧に 示されています。
size と形式 format の 新しいディスクイメージファイル名を作成します。
# qemu-img create [-6] [-e] [-b base_image] [-f format] filename [size]
convert オプションが使用されます。
# qemu-img convert [-c] [-e] [-f format]filename[-Ooutput_format]output_filename
output_format を使用して、ディスクイメージ filename を ディスクイメージ output_filename に 変換します。ディスクイメージは -e オプションを使用して暗号化したり、 -c オプションで圧縮したりできます。
qcow" フォーマットのみが暗号化、又は圧縮をサポートします。 圧縮は読み込み専用です。このことは圧縮したセクターが再書き込みされると、それは 圧縮無しのデータとして再書き込みされると言う意味です。
qcow 又は cow などの 増大する形式を使用する時には小さいイメージを取得するのに役立ちます。空のセクターは検知されて 目的地イメージから抑圧されます。
info パラメータはディスクイメージに関する情報を 表示します。info オプション用の形式は以下のようになります:
# qemu-img info [-f format] filename
rawqemu-img info を使用して、イメージ又は Unix/Linux 上で ls -ls で使用されている本当のサイズを知ることができます。
qcow2 qcow cowcow フォーマットは以前のバージョンとの互換性の為にのみ含まれています。Windows では機能しません。
vmdk cloop (0.5 * RAM) + (overcommit ratio * RAM) = Recommended swap size
/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.
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 の編集に関する重要点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.
grub.conf の xen 行に dom0_mem=256M を追記する必要があります。 以前の例の中の 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
$ grep -E 'svm|vmx' /proc/cpuinfo
vmx エントリを含んでおり、 Intel VT 拡張を持つ Intel プロセッサを示しています:
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
svm エントリを含んでおり、 AMD-V 拡張を持つ AMD プロセッサを示しています:
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
flags:" の内容は、システム上の各ハイパースレッド、コア、 又は CPU の複数倍として表ることがあります。
For users of the KVM hypervisor
kvm modules are loaded in the kernel:
# lsmod | grep kvm
kvm_intel or kvm_amd then the kvm hardware virtualization modules are loaded and your system meets requirements. sudo
virsh command can output a full list of virtualization system capabilities. Run virsh capabilities as root to receive the complete list.
kpartx tool, covered by this section, to mount the guest file system as a loop device which can then be accessed.
kpartx command creates device maps from partition tables. Each guest storage image has a partition table embedded in the file.
# yum install kpartx
guest1.img.
# kpartx -l /var/lib/libvirt/images/guest1.img
loop0p1 : 0 409600 /dev/loop0 63
loop0p2 : 0 10064717 /dev/loop0 409663guest1 is a Linux guest. The first partition is the boot partition and the second partition is an EXT3 containing the root partition.
/dev/mapper/.
# kpartx -a /var/lib/libvirt/images/guest1.img
# ls /dev/mapper/ loop0p1 loop0p2
loopXpY.
/mnt/guest1 for mounting the partition.
# mkdir /mnt/guest1
# mount /dev/mapper/loop0p1 /mnt/guest1 -o loop,ro/mnt/guest1 directory. Read or copy the files.
# umount /mnt/tmp
# kpartx -d /var/lib/libvirt/images/guest1.img
guest1.img to the recognized devices in the /dev/mapper/ directory.
# kpartx -a /var/lib/libvirt/images/guest1.img
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
VolGroup00 by default) with the vgchange -ay command.
# vgchange -ay VolGroup00 2 logical volumes in volume group VolGroup00 now active.
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
/dev/VolGroup00/LogVol00 in the /mnt/guestboot/ directory.
# mount /dev/VolGroup00/LogVol00 /mnt/guestboot
/mnt/guestboot directory. Read or copy the files.
# umount /mnt/
VolGroup00
# vgchange -an VolGroup00
# kpartx -d /var/lib/libvirt/images/guest1.img
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
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>virsh freecell command to display the free memory on all NUMA nodes.
# virsh freecell 0: 2203620 kB 1: 3354784 kB
virsh capabilities command) about NUMA topology.
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><cell id='1'>, has physical CPUs 4 to 7.
cpuset attribute to the configuration file.
virsh edit.
vcpus element.
<vcpus>4</vcpus>
cpuset attribute with the CPU numbers for the relevant NUMA cell.
<vcpus cpuset='4-7'>4</vcpus>
virt-install provisioning tool provides a simple way to automatically apply a 'best fit' NUMA policy when guests are created.
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.
--cpuset=auto with the virt-install command when creating new guests.
virsh vcpuinfo and virsh vcpupin commands can perform CPU affinity changes on running guests.
virsh vcpuinfo command gives up to date information about where each virtual CPU is running.
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: yyyyyyyyvirsh vcpuinfo output (the yyyyyyyy value of CPU Affinity) shows that the guest can presently run on any CPU.
# virsh vcpupinguest10 4 # virsh vcpupinguest11 5 # virsh vcpupinguest12 6 # virsh vcpupinguest13 7
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: -------ymacgen.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()
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 ""
rate” parameter part of the VIF entries can throttle virtualized guests.
rate 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.
rate= オプションへの選択肢です:
rate パラメータ値と使用法の例
rate=10Mb/s rate=250KB/s rate=10MB/s@50ms VIF エントリは以下のように なります:
vif = [ 'rate=10MB/s , mac=00:16:3e:7a:55:1c, bridge=xenbr1']
rate entry would limit the virtual machine's interface to 10MB/s for outgoing traffic
virsh か virt-manager でセットできます:
virsh refer to 仮想 CPU 類似物の設定 for more information.
virt-manager refer to 「仮想 CPU の表示」 for more information.
/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
'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
ftpdvsftpd は para-virtualized ゲストの インストールツリー(例えば、Red Hat Enterprise Linux 5 のレポジトリ)又は他のデータ へのアクセスを提供します。サーバーのインストール時に vsftpd を インストールしていない場合は、インストールメディアの Server ディレクトリから RPM パッケージを取得して、rpm -ivh vsftpd*.rpm を 使用してインストールできます(RPM パッケージは作業中のディレクトリになければならないことに 注意して下さい)。
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
chkconfig --list vsftpd を使用して、vsftpd が 有効になっていないことを確認します:
$ chkconfig --list vsftpd vsftpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
chkconfig --levels 345 vsftpd on を実行して、ランレベル 3 と 4 と 5 で vsftpd が自動的にスタートするようにします。
chkconfig --list vsftpd コマンドを使用すると、vsftpd デーモン が システムブート時にスタートするように有効になっていることを確認できます:
$ chkconfig --list vsftpd vsftpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
service vsftpd start vsftpd を使用して、vsftpd サービスを スタートします:
$service vsftpd start vsftpd Starting vsftpd for vsftpd: [ OK ]
udev を使用して LUN 永続化を実装することができます。自分のシステムで LUN 永続化の実装をする前に、正しい UUID を取得することを確認して下さい。これらを取得した後は、/etc ディレクトリ内にある scsi_id ファイルを編集して LUN 永続化を設定できます。テキストエディタでこのファイルを開いたら、以下の行をコメントアウトする必要があります:
# options=-b
# options=-g
scsi_id コマンドを使用します:
# scsi_id -g -s /block/sdc *3600a0b80001327510000015427b625e*
/etc/udev/rules.d ディレクトリ内にある 20-names.rules ファイルを 編集します。デバイス命名ルールは以下の形式に従います:
# KERNEL="sd*", BUS="scsi", PROGRAM="sbin/scsi_id", RESULT="UUID", NAME="devicename"
UUID と devicename を、上記の取り込んだ UUID エントリに入れ換えます。その規則は以下に似たものになります:
KERNEL="sd*", BUS="scsi", PROGRAM="sbin/scsi_id", RESULT="3600a0b80001327510000015427b625e", NAME="mydevicename"
/dev/sd* パターンに一致する全てのデバイスを有効にして、任意の UUID を検査するようになります。一致するデバイスを発見した場合、 /dev/devicename と呼ばれるデバイスノードを作成します。この例では、デバイスノードは /dev/mydevice にしています。最後に /etc/rc.local ファイルに以下の行を追記します:
/sbin/start_udev
/etc/ ディレクトリ内にある multipath.conf ファイルを編集して、四つのデバイスエイリアスを定義する必要があります。
multipath {
wwid 3600a0b80001327510000015427b625e
alias oramp1
}
multipath {
wwid 3600a0b80001327510000015427b6
alias oramp2
}
multipath {
wwid 3600a0b80001327510000015427b625e
alias oramp3
}
multipath {
wwid 3600a0b80001327510000015427b625e
alias oramp4
}
/dev/mpath/oramp1、/dev/mpath/oramp2、/dev/mpath/oramp3、及び dev/mpath/oramp4 です。デバイスは /dev/mpath ディレクトリ内に存在します。これらの LUN 名は、各 LUN 毎の wwid 上でエイリアス名を作成する為、再起動後にも残る永続性を持ちます。
/sbin/service smartd stop /sbin/chkconfig --del smartd
/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.
vino-preferences コマンドを実行することもできます。
~/.vnc/xstartup ファイルを編集することで、 vncserver がスタートする時にはいつも GNOME セッションが スタートするようにします。vncserver スクリプトを初めて 実行する時は使用する VNC セッション用のパスワードを要求して来ます。
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
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.
/etc/sysconfig/network file to match the new guest's hostname.
/etc/sysconfig/network-scripts/ifcfg-eth0 ファイルの HWADDR アドレスを修正して、ifconfig eth0 からの 出力に一致するようにしなければなりません。そして、静的 IP アドレスを使用している場合は、IPADDR エントリを修正する必要があります。
name uuid uuidgen コマンドを 使用して再生成できます。UUID の出力のサンプルは以下のようになります:
$ uuidgen a984a14f-4191-4d14-868e-329906b211e5
vifxenbr エントリを調節して使用中のローカル ネットワーキング設定に対応するようにしなければなりません。(brctl show コマンドを使用すると、ブリッジ情報を取得できます)。
disk= セクション内で調節して、正しいゲストイメージにポイントする ように確認します。
/etc/sysconfig/network HOSTNAME entry to the guest's new hostname.
/etc/sysconfig/network-scripts/ifcfg-eth0 HWADDR アドレスを ifconfig eth0 からの 出力に合わせて変更します。
IPADDR エントリを 変更します。
libvirt の使用により、操作を簡単にするためのカスタムスクリプト作成を計画しているプログラマとシステム管理者に役立つ 一部の情報を提供します。
libvirt.
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
目次
xentop xentop はホストシステムとゲストドメインに関するリアルタイムの 情報を表示します。
xmdmesg と log の使用
vmstat
iostat
lsof
iostat コマンド、mpstat コマンド、及び sar コマンドは全て sysstat パッケージで用意されています。
XenOprofile
systemtap
crash
sysrq
sysrq t
sysrq w
ifconfig
tcpdump
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 linux カーネル内のイーサネットブリッジ構成を検査して設定するネットワーキングツールです。これらのサンプルコマンドを実行するには root アクセスが必要になります:
# 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
Server レポジトリ内で見ることが できます。
yum install vnc command.
yum install vnc-server コマンドを使用します。
/etc/xen/ です。 このディレクトリには、xend デーモンと他の仮想マシン設定ファイルが含まれています。ネットワークスクリプトファイルは scripts ディレクトリ内に存在します。
/var/log/xen ディレクトリに 格納してあります。
/var/lib/libvirt/images ディレクトリです。
/proc/xen/ ディレクトリに格納して あります。
xend デーモンと qemu-dm プロセスを特長とします。これらの二つのユーティリティは複数ログファイルを /var/log/xen/ ディレクトリに書き込みます:
xend.log は xend デーモンにより収集された通常のシステムイベント、又はオペレータ先導のアクションのどちらでも、全てのデータを含むログファイルです。全ての仮想マシン運用 (作成、シャットダウン、破棄など) はこのログに現われます。 xend.log は通常、ユーザーがイベントやパフォーマンス問題を追跡する時に調査する最初の場所です。ここには、エラーメッセージの 詳細なエントリと状況が含まれています。
xend-debug.log は xend と Virtualization サブシステム (フレームバッファ、Python スクリプトなど) からのイベントエラーの記録を含むログファイルです。
xen-hotplug-log は、hotplug イベントからのデータを含むログファイルです。デバイス、又はネットワークのスクリプトがオンラインに出ない場合はイベントはここに表示されます。
qemu-dm.[PID].log は各完全仮想化ゲスト用の qemu-dm プロセスで作成されたログファイルです。このログファイルを使用する時には、仮想マシン上の qemu-dm プロセスを隔離する為のプロセス引数を検査するのに ps コマンドを使用することで任意の qemu-dm プロセス PID を取り込む必要があります。この [PID] シンボルは実際の PID qemu-dm プロセスで入れ換えることに注意して下さい。
/.virt-manager ディレクトリ内にある virt-manager.log ファイルの生成データで確認することができます。仮想マシンマネージャを開始する度に既存のログファイル内容は書き変えられることに注意して下さい。システムエラーの後では、 仮想マシンマネージャを再起動する前に virt-manager.log をバックアップすることを忘れないで下さい。
/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 フォルダは、ユーザーがシステム情報を取得できるようにするもう1つのリソースです。以下の proc エントリは /proc/xen ディレクトリにあります:
/proc/xen/capabilities
/proc/xen/balloon
/proc/xen/xenbus/
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
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 は非同期の hypervisor コンソール出力でハングの原因となる問題の判定の手助けになります。そして "pnpacpi=off" はシリアルコンソール上で入力を破損する問題を回避します。パラメータ "console=ttyS0" と "console=tty" はカーネルエラーが通常の VGA コンソールと シリアルコンソールの両方でログされることを意味します。それから、 ttywatch をインストール及び設定をして、標準の null-modem ケーブルで接続されたリモートホスト上でデータをキャプチャすることができます。例えば、リモートホスト上で以下のように入力します:
ttywatch --name myhost --port /dev/ttyS0
/dev/ttyS0 からの出力をファイル /var/log/ttywatch/myhost.log にパイプします。
# virsh console [guest name, ID or UUID]
virt-manager to display the virtual text console. In the guest console window, select Serial Console from the View menu.
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
virt-manager to display the virtual text console. In the guest console window, select Serial Console from the View menu.
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 ファイル内でデフォルトのカーネルにセットします)。
"Invalid argument" のエラーメッセージが出ることがあります。これは通常、ブートしようとしているカーネルイメージが hypervisor に不適合と言う意味です。例として、PAE のみの FC6 hypervisor で非 PAE FC5 カーネルを実行しようとすると、この状況が出ます。
grub.conf デフォルトのカーネルは Virtualization カーネルではなく、生のままのカーネルに戻ることになります。
/etc/sysconfig/kernel/ directory. You must ensure that kernel-xen parameter is set as the default option in your grub.conf file.
/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.el5com1=115200,8n1module /boot/vmlinuz-2.6.18-92.el5xen ro root=LABEL=VG_i386console=tty0console=ttyS0,115200module /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 など)に hypervisor がシリアルデータを出力します。
com2 ポートを使用している例では、パラメータ console=ttyS0 が vmlinuz 行上で使用されています。console=ttyS0 として 使用されている各ポートの動作は標準の Linux 動作ではありません。これは Xen 環境特有の 動作です。
virsh console" の 使用で取り込むか、あるいは virt-manager の "シリアル" ウィンドウ内に取り込めます。以下の手順を使用して仮想シリアルコンソールのセットアップを します:
/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
xend) を設定することで para-virtualized ゲストのシリアルコンソールからの出力をログすることができます。
xend を設定するには、/etc/sysconfig/xend を編集します。以下のようにエントリを変更します:
# Log all guest console output (cf xm console) #XENCONSOLED_LOG_GUESTS=no
# Log all guest console output (cf xm console) XENCONSOLED_LOG_GUESTS=yes
/var/log/xen/console ファイルに格納されています。
virsh console" コマンドを使用して見ることができます。
ttyS0、又は Windows で COM1 と呼ばれます。
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 にはログされていません。
virt-manager or virt-install tools on Red Hat Enterprise Linux 5, the guests configuration files are created automatically in the /etc/xen directory.
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'
virsh dumpxml と virsh create (又は virsh edit) を使用して libvirt 設定ファイル (xml ベース) を編集して 下さい。これらはエラーチェックとセイフティチェック機能も持っています。
failed domain creation due to memory shortage, unable to balloon 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 が使用しているメモリーの量をチェックできます。domain0 が縮小しなければ、コマンド virsh setmem dom0 NewMemSize を使用してメモリーをチェックできます。
wrong kernel image: non-PAE kernel on a PAE
# 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)
Unable to open a connection to the Xen hypervisor or daemon
/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
xen-xend.logfile 内で) :
Bridge xenbr1 does not exist!
# 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
/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',]
# 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)
/etc/xen/ ディレクトリは以下を含みますxend デーモンで使用される 設定ファイル
scripts ディレクトリ
/var/log/xen/ /var/lib/libvirt/images/ /proc/xen/ cat /proc/partitions" を実行することで達成できます。
# cat /proc/partitions major minor #blocks name 202 16 104857600 xvdb 3 0 8175688 hda
/etc/inittab ファイルに 追加します:
1:12345:respawn:/sbin/mingetty xvc0
Xen Virtual Ethernet ネットワーキングを識別できません。これは以下を実行することにより 確証できます(Red Hat Enterprise Linux 4 及び Red Hat Enterprise Linux 5 用):
cat /etc/modprobe.conf
cat /etc/modules.conf
alias eth0 xen-vnif
alias eth0 xen-vnif)を ゲストの各 para-virtualized インターフェイスに追加する必要があります。
/etc/modprobe.conf で 調節できます。/etc/modprobe.conf を編集して、以下の行を追加します:
options loop max_loop=64
phy: block device か tap:aio コマンドを使用します。完全仮想化システム用にループデバイス支持のゲストを使用するには、phy: device か file: file コマンドを使用します。
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 failedYou 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.
# 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”.
/etc/grub.conf 設定ファイル内で デフォルトカーネルになっていることを確認することです。
kernel-xen をインストールしている場合は、 以下のようにしてゲストを開始できます:
xm create -c GuestName
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”.
# 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:
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.
virt-manager アプリケーションが起動を失敗して、 “Unable to open a connection to the Xen hypervisor/daemon” と言うようなエラーメッセージを 表示する可能性があります。これは、通常 /etc/hosts ファイル内に localhost エントリが欠如していることが 原因です。実際に localhost エントリが あることを確認して、それが /etc/hosts 内に存在しない場合は、 新規のエントリを挿入します。不正な /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
Applying Intel CPU microcode update: FATAL: Module microcode not found. ERROR: Module microcode does not exist in /proc/modulesAs 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
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)
Enabling the virtualization extensions in BIOS
cat /proc/cpuinfo | grep vmx svm を実行します。 このコマンドが出力を出せば、仮想化拡張はこれで有効になっています。出力が ない場合は、そのシステムに仮想化拡張が存在しない、又は正しい BIOS 設定が 有効でないことになります。
virsh command (where GUEST is the guest's name):
# virsh edit GUESTvirsh edit コマンドは $EDITOR シェル変数を使用して使用するエディタを決定します。
<interface type='network'>
[output truncated]
<model type='rtl8139' />
</interface>
'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>
# virsh dumpxml GUEST > /tmp/guest.xml
# cp /tmp/guest.xml /tmp/new-guest.xml # vi /tmp/new-guest.xml
<interface type='network'>
[output truncated]
<model type='e1000' />
</interface>
# virsh define /tmp/new-guest.xml # virsh start new-guest
/var/log/xen/xend デーモンと qemu-dm プロセスで生成される 全てのログファイルを保持するディレクトリです。
xend.logxend-debug.logxen-hotplug.logqemu-dm.PID.logqemu-dm プロセスによって作成されます。
PID は、関連した qemu-dm プロセスの プロセス PID で入れ替えるべきものです。
qemu-dm プロセスの PID を 取り込むには、ps コマンドを使用して、qemu-dm が 所属する仮想マシンを識別できるプロセスの引数を見ることで達成できます。
.virt-manager in the user's home directory whom ran virt-manager. This directory will usually be ~/.virt-manager/virt-manager.
/var/lib/libvirt/images//var/lib/xen/xend-db//etc/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
# 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.
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
# cd /lib/modules/`uname -r`/ # find . -name 'xen_*.ko' -print
# 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
/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]
type=ioemu' part of 'vif=' line in your guest's configuration file.
domU refers to the guest operating systems which run on the host system (the dom0 domain).
/dev/VolGroup00/LogVol02),
/dev/sda5), and
/dev/sda).
tap:aiotap: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.
ext2 と ext3 のファイルシステムの識別子、 RAID デバイス識別子、iSCSI と LUN の識別子、MAC アドレスと仮想マシンの識別子が あります。


libvirt 仮想化 API の為の正式ウェブサイトです。
/usr/share/doc/xen-<version-number>/ このディレクトリには、Xen para-virtualization hypervisor と設定の参考例、ハードウェア特有の情報、現在の 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 バインディングについての詳細を提供します。libvirt-python パッケージにより、Python の開発者は libvirt virtualization 管理ライブラリを持つインターフェイスのプログラムを作成することが出来るようになります。
/usr/share/doc/python-virtinst-<version-number> — virt-install コマンドに関するドキュメントを提供します。このコマンドは仮想マシン内の Fedora と Red Hat Enterprise Linux 関連のディストリビューションのインストール開始を援助するものです。
/usr/share/doc/virt-manager-<version-number> — 仮想マシンマネージャに関するドキュメントを提供します。仮想マシンマネージャは仮想マシン管理用のグラフィカルツールです。