13.8. GlusterFS ストレージプール

このセクションでは、GlusterFS ベースのストレージプールを有効にする方法について記載しています。Red Hat Enterprise Linux 6.5 には、GlusterFS を使った仮想マシン作成のネイティブサポートがあります。GlusterFS は FUSE を使用するユーザー領域のファイルシステムです。これがゲスト仮想マシンで有効にされると、KVM ホスト物理マシンは 1 つ以上の GlusterFS ストレージボリュームからゲスト仮想マシンのイメージを起動し、GlusterFS ストレージボリュームのイメージをゲスト仮想マシンのデータディスクとして使用できます。

13.8.1. virsh を使用した GlusterFS ストレージプールの作成

このセクションでは、Gluster サーバーとアクティブな Gluster ボリュームを準備する方法について説明します。

手順13.10 Gluster サーバーとアクティブな Gluster ボリュームの準備

  1. 次のコマンドを使って、状態を一覧表示し、Gluster サーバーの IP アドレスを取得します。
    # gluster volume status
    Status of volume: gluster-vol1
    Gluster process						Port	Online	Pid
    ------------------------------------------------------------------------------
    Brick 222.111.222.111:/gluster-vol1 			49155	Y	18634
    
    Task Status of Volume gluster-vol1
    ------------------------------------------------------------------------------
    There are no active volume tasks
  2. まだこれを実行していない場合は、glusterfs-fuse をインストールしてから virt_use_fusefs を有効にします。次に、以下のコマンドを実行して、Gluster サーバーに接続する 1 つのホストを用意します。
    # setsebool virt_use_fusefs on
    # getsebool virt_use_fusefs
    virt_use_fusefs --> on
  3. pool typegluster に指定し、Gluster ストレージプール (以下の例では glusterfs-pool.xml) を設定するために新しい XML ファイルを作成し、以下のデータを追加します。
    			
    <pool type='gluster'>
    	<name>glusterfs-pool</name>
    	<source>
    		<host name='111.222.111.222'/>
    		<dir path='/'/>
    		<name>gluster-vol1</name>
    	</source>
    </pool>
    			

    図13.24 GlusterFS XML ファイルの内容

  4. 次のコマンドを使って、Gluster プールを定義し、これを開始します。
    # virsh pool-define glusterfs-pool.xml
    Pool gluster-pool defined from glusterfs-pool.xml
    
    # virsh pool-list --all
    Name                 State      Autostart
    -----------------------------------------
    gluster-pool         inactive   no
    
    # virsh pool-start gluster-pool
    Pool gluster-pool started
    
    # virsh pool-list --all
    Name                 State      Autostart
    -----------------------------------------
    gluster-pool         active     no
    
    # virsh vol-list gluster-pool
    Name                 Path
    -----------------------------------------
    qcow2.img            gluster://111.222.111.222/gluster-vol1/qcow2.img
    raw.img              gluster://111.222.111.222/gluster-vol1/raw.img

13.8.2. virsh を使用した GlusterFS ストレージプールの削除

このセクションでは、virsh を使ってストレージプールを削除する方法について詳しく説明します。

手順13.11 GlusterFS ストレージプールの削除

  1. 次のコマンドを使って、ストレージプールの状態を非アクティブに設定します。
    # virsh pool-destroy gluster-pool
    Pool gluster-pool destroyed
  2. 次のコマンドを使って、プールが非アクティブの状態であることを確認します。
    # virsh pool-list --all
    Name                 State      Autostart
    -----------------------------------------
    gluster-pool         inactive   no
  3. 次のコマンドを使って GlusterFS ストレージプールの定義を解除します。
    # virsh pool-undefine gluster-pool
    Pool gluster-pool has been undefined
  4. 次のコマンドを使ってプールの定義が解除されていることを確認します。
    # virsh pool-list --all
    Name                 State      Autostart
    -----------------------------------------