株式会社コーソル

コーソルDatabaseエンジニアのブログ

技術ブログ

Oracle VM 3 Serverにvirt-installをインストールする

Oracle VM 2.x では、標準で virt-installコマンドが導入されており、Dom-0のCUIで新規VMを作成できました。

virt-installコマンドは、GPLライセンスで配布される Virtual Machine Managerプロジェクト http://virt-manager.org/ の一部であり、内部的にlibvirtライブラリを使用しています。

しかし、Oracle VM 3.xでは、標準でvirt-installコマンドが導入されていません。

もちろん、Oracle VM Managerを使用すれば新規VMを作成できますが、作業の効率化、テンプレート化の ためにCUIでの新規VM作成を行いたい。ということで、virt-install をインストールしてみます。 (virt-installを使用しない方法もありそうですが・・・とりあえず使ったことがあるvirt-installを使用する方向としてます)

注意! 本エントリでは、サポートされない手順について記載しています!KROWN:158258 OracleVM 3 での Oracle VM Server コマンドラインから許可されている操作(※:参照にはサポート契約が必要)

[root@csov3s99 ~]# yum install virt-install
el5_latest                                               | 1.4 kB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-virtinst.noarch 0:0.400.3-13.0.1.el5 set to be updated
--> Processing Dependency: libvirt-python >= 0.2.1 for package: python-virtinst
--> Running transaction check
---> Package libvirt-python.x86_64 0:0.8.2-25.0.1.el5 set to be updated
--> Processing Dependency: libvirt = 0.8.2-25.0.1.el5 for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.7.7)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.0.3)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.2.0)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.1.4)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.7.1)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.6.3)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.3.3)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.2.3)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.3.2)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.6.1)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.7.2)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.1.5)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.5.0)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.7.0)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.0.5)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.1.9)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.7.5)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.6.4)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.8.2)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.3.0)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.6.0)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.8.1)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.4.0)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.1.0)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.4.5)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.2.1)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.1.1)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.8.0)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.7.3)(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0(LIBVIRT_0.4.1)(64bit) for package: libvirt-python
--> Processing Dependency: libgnutls.so.13()(64bit) for package: libvirt-python
--> Processing Dependency: libvirt.so.0()(64bit) for package: libvirt-python
--> Running transaction check
---> Package gnutls.x86_64 0:1.4.1-7.el5_8.2 set to be updated
---> Package libvirt.x86_64 0:0.8.2-25.0.1.el5 set to be updated
--> Processing Dependency: libselinux >= 1.33.4-5.6 for package: libvirt
--> Processing Dependency: xz for package: libvirt
--> Processing Dependency: cyrus-sasl-md5 for package: libvirt
--> Processing Dependency: ebtables for package: libvirt
--> Processing Dependency: dnsmasq for package: libvirt
--> Processing Dependency: libavahi-common.so.3()(64bit) for package: libvirt
--> Processing Dependency: libavahi-client.so.3()(64bit) for package: libvirt
--> Running transaction check
---> Package avahi.x86_64 0:0.6.16-10.el5_6 set to be updated
--> Processing Dependency: dbus-python for package: avahi
--> Processing Dependency: libdaemon for package: avahi
--> Processing Dependency: libdaemon.so.0()(64bit) for package: avahi
---> Package cyrus-sasl-md5.x86_64 0:2.1.22-7.el5_8.1 set to be updated
--> Processing Dependency: cyrus-sasl-lib = 2.1.22-7.el5_8.1 for package: cyrus-sasl-md5
---> Package dnsmasq.x86_64 0:2.45-1.1.el5_3 set to be updated
---> Package ebtables.x86_64 0:2.0.9-5.el5 set to be updated
--> Processing Dependency: libselinux = 1.33.4-5.5.el5 for package: libselinux-utils
--> Processing Dependency: libselinux = 1.33.4-5.5.el5 for package: libselinux-python
---> Package libselinux.x86_64 0:1.33.4-5.7.el5 set to be updated
---> Package xz.x86_64 0:4.999.9-0.3.beta.20091007git.el5 set to be updated
--> Processing Dependency: xz-libs = 4.999.9-0.3.beta.20091007git.el5 for package: xz
--> Processing Dependency: liblzma.so.0()(64bit) for package: xz
--> Running transaction check
--> Processing Dependency: cyrus-sasl-lib = 2.1.22-5.el5_4.3 for package: cyrus-sasl
---> Package cyrus-sasl-lib.x86_64 0:2.1.22-7.el5_8.1 set to be updated
---> Package dbus-python.x86_64 0:0.70-9.el5_4 set to be updated
---> Package libdaemon.x86_64 0:0.10-5.el5 set to be updated
---> Package libselinux-python.x86_64 0:1.33.4-5.7.el5 set to be updated
---> Package libselinux-utils.x86_64 0:1.33.4-5.7.el5 set to be updated
---> Package xz-libs.x86_64 0:4.999.9-0.3.beta.20091007git.el5 set to be updated
--> Running transaction check
---> Package cyrus-sasl.x86_64 0:2.1.22-7.el5_8.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package            Arch    Version                           Repository   Size
================================================================================
Installing:
 python-virtinst    noarch  0.400.3-13.0.1.el5                el5_latest  384 k
Installing for dependencies:
 avahi              x86_64  0.6.16-10.el5_6                   el5_latest  258 k
 cyrus-sasl-md5     x86_64  2.1.22-7.el5_8.1                  el5_latest   47 k
 dbus-python        x86_64  0.70-9.el5_4                      el5_latest  188 k
 dnsmasq            x86_64  2.45-1.1.el5_3                    el5_latest  168 k
 ebtables           x86_64  2.0.9-5.el5                       el5_latest  104 k
 gnutls             x86_64  1.4.1-7.el5_8.2                   el5_latest  365 k
 libdaemon          x86_64  0.10-5.el5                        el5_latest   24 k
 libvirt            x86_64  0.8.2-25.0.1.el5                  el5_latest  3.2 M
 libvirt-python     x86_64  0.8.2-25.0.1.el5                  el5_latest  238 k
 xz                 x86_64  4.999.9-0.3.beta.20091007git.el5  el5_latest  148 k
 xz-libs            x86_64  4.999.9-0.3.beta.20091007git.el5  el5_latest   95 k
Updating for dependencies:
 cyrus-sasl         x86_64  2.1.22-7.el5_8.1                  el5_latest  1.2 M
 cyrus-sasl-lib     x86_64  2.1.22-7.el5_8.1                  el5_latest  130 k
 libselinux         x86_64  1.33.4-5.7.el5                    el5_latest   78 k
 libselinux-python  x86_64  1.33.4-5.7.el5                    el5_latest   74 k
 libselinux-utils   x86_64  1.33.4-5.7.el5                    el5_latest   56 k

Transaction Summary
================================================================================
Install      12 Package(s)
Upgrade       5 Package(s)

Total download size: 6.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/17): libdaemon-0.10-5.el5.x86_64.rpm                  |  24 kB     00:00
(2/17): cyrus-sasl-md5-2.1.22-7.el5_8.1.x86_64.rpm       |  47 kB     00:00
(3/17): libselinux-utils-1.33.4-5.7.el5.x86_64.rpm       |  56 kB     00:00
(4/17): libselinux-python-1.33.4-5.7.el5.x86_64.rpm      |  74 kB     00:00
(5/17): libselinux-1.33.4-5.7.el5.x86_64.rpm             |  78 kB     00:00
(6/17): xz-libs-4.999.9-0.3.beta.20091007git.el5.x86_64. |  95 kB     00:00
(7/17): ebtables-2.0.9-5.el5.x86_64.rpm                  | 104 kB     00:00
(8/17): cyrus-sasl-lib-2.1.22-7.el5_8.1.x86_64.rpm       | 130 kB     00:00
(9/17): xz-4.999.9-0.3.beta.20091007git.el5.x86_64.rpm   | 148 kB     00:00
(10/17): dnsmasq-2.45-1.1.el5_3.x86_64.rpm               | 168 kB     00:00
(11/17): dbus-python-0.70-9.el5_4.x86_64.rpm             | 188 kB     00:00
(12/17): libvirt-python-0.8.2-25.0.1.el5.x86_64.rpm      | 238 kB     00:00
(13/17): avahi-0.6.16-10.el5_6.x86_64.rpm                | 258 kB     00:00
(14/17): gnutls-1.4.1-7.el5_8.2.x86_64.rpm               | 365 kB     00:00
(15/17): python-virtinst-0.400.3-13.0.1.el5.noarch.rpm   | 384 kB     00:01
(16/17): cyrus-sasl-2.1.22-7.el5_8.1.x86_64.rpm          | 1.2 MB     00:03
(17/17): libvirt-0.8.2-25.0.1.el5.x86_64.rpm             | 3.2 MB     00:07
--------------------------------------------------------------------------------
Total                                           276 kB/s | 6.7 MB     00:24
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : libselinux                                              1/22
  Updating       : cyrus-sasl-lib                                          2/22
  Updating       : cyrus-sasl                                              3/22
  Installing     : gnutls                                                  4/22
  Installing     : cyrus-sasl-md5                                          5/22
  Installing     : xz-libs                                                 6/22
  Installing     : xz                                                      7/22
  Installing     : libdaemon                                               8/22
  Installing     : dnsmasq                                                 9/22
  Installing     : ebtables                                               10/22
  Installing     : dbus-python                                            11/22
  Installing     : avahi                                                  12/22
  Installing     : libvirt                                                13/22
  Installing     : libvirt-python                                         14/22
  Updating       : libselinux-python                                      15/22
  Installing     : python-virtinst                                        16/22
  Updating       : libselinux-utils                                       17/22
  Cleanup        : cyrus-sasl                                             18/22
  Cleanup        : libselinux-python                                      19/22
  Cleanup        : libselinux                                             20/22
  Cleanup        : libselinux-utils                                       21/22
  Cleanup        : cyrus-sasl-lib                                         22/22

Installed:
  python-virtinst.noarch 0:0.400.3-13.0.1.el5

Dependency Installed:
  avahi.x86_64 0:0.6.16-10.el5_6
  cyrus-sasl-md5.x86_64 0:2.1.22-7.el5_8.1
  dbus-python.x86_64 0:0.70-9.el5_4
  dnsmasq.x86_64 0:2.45-1.1.el5_3
  ebtables.x86_64 0:2.0.9-5.el5
  gnutls.x86_64 0:1.4.1-7.el5_8.2
  libdaemon.x86_64 0:0.10-5.el5
  libvirt.x86_64 0:0.8.2-25.0.1.el5
  libvirt-python.x86_64 0:0.8.2-25.0.1.el5
  xz.x86_64 0:4.999.9-0.3.beta.20091007git.el5
  xz-libs.x86_64 0:4.999.9-0.3.beta.20091007git.el5

Dependency Updated:
  cyrus-sasl.x86_64 0:2.1.22-7.el5_8.1
  cyrus-sasl-lib.x86_64 0:2.1.22-7.el5_8.1
  libselinux.x86_64 0:1.33.4-5.7.el5
  libselinux-python.x86_64 0:1.33.4-5.7.el5
  libselinux-utils.x86_64 0:1.33.4-5.7.el5

Complete!
[root@csov3s99 ~]# which virt-install
/usr/sbin/virt-install

しかし、インストールしただけではvirt-installは使用できないようです。

[root@csov3s99 ~]# virt-install
ERROR    unable to connect to 'localhost:8000': Connection refused
Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 895, in ?
    main()
  File "/usr/sbin/virt-install", line 631, in main
    conn = cli.getConnection(options.connect)
  File "/usr/lib/python2.4/site-packages/virtinst/cli.py", line 126, in getConnection
    conn = libvirt.open(connect)
  File "/usr/lib64/python2.4/site-packages/libvirt.py", line 169, in open
    if ret is None:raise libvirtError('virConnectOpen() failed')
libvirtError: unable to connect to 'localhost:8000': Connection refused

メカニズムは調べ切れていませんが、Xenデーモンの xend-unix-server 機能を有効にする必要があるようです。

[root@csov3s99 ~]# cd /etc/xen/
[root@csov3s99 xen]# cp xend-config.sxp{,.BK}
[root@csov3s99 xen]# vi xend-config.sxp

#(xend-http-server no)
#(xend-unix-server no)
(xend-unix-server yes) ←★

[root@csov3s99 xen]# service xend restart
Restarting xend...
xend daemon (pid 25343) is running...
[root@csov3s99 xen]# virt-install
ERROR    A name is required for the virtual machine. (use --prompt to run interactively)

不要と思われるサービスの停止

また、デフォルトでは libvirt-guests、libvirtd というサービスが実行されますが、 不要なようななので、停止しておきます。
service libvirt-guests  stop
service libvirtd        stop
chkconfig libvirt-guests  off
chkconfig libvirtd        off
上記サービスの詳細は調べていません。

vm listに停止したVMが残る

virt-installでインストールしたVMをxm shutdownしたところ、xm list にエントリが残る現象が確認できました。

[root@csov3s01 ~]# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
dummy_vmname                                    4096     2                 0.0←★ドメインIDがないエントリが残ります
Domain-0                                     0   644     4     r-----     43.9
[root@csov3s01 ~]# xm destroy dummy_vmname
[root@csov3s01 ~]# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
dummy_vmname                                    4096     2                 0.0←★xm destroyを実行しても消えません
Domain-0                                     0   644     4     r-----     46.0

残る場合と残らない場合があるようで、明確なところはわかっていませんが、 virsh undefine dummy_vmname を実行するとエントリが消えました。 おそらくlibvirtd側の管理情報が残っている状態なのだと思われます。

プロフィール

On7tWW6m1Ul4

渡部 亮太

・Oracle ACE
・AWS Certified Solutions Architect - Associate
・ORACLE MASTER Platinum Oracle Database 11g, 12c 他多数

カテゴリー

アーカイブ