libvirt仮想マシンに適したドライバを作成するには?

libvirt仮想マシンに適したドライバを作成するには?

virt-installCentOS 7ホストでCentOS 7仮想マシンを作成しようとしています。このために私は読んだ。RHELウェブサイトのvirt-installマニュアル、私も読んman virt-installでいますvirt-install --help。ドキュメントでパラメータの構文の種類がいくつか見られ--diskたので、1つを選択して以下の構文を考えましたが、これはエラーが発生しました。 このコマンドで使用できる適切な仮想ドライブをどのように作成しますかvirt-install

これが私が今まで持っているものです:

[root@localhost home]# virt-install --name=public-centos7 --disk path=/home/publicvm --graphics none --vcpus=2 --memory=2048 --cdrom /media/usb/CentOS-7-x86_64-DVD-1503-01.iso --network bridge=br0 --os-type=linux --os-variant=rhel7.0
WARNING  CDROM media does not print to the text console by default, so you likely will not see text install output. You might want to use --location.See the man page for examples of using --location with CDROM media

Starting install...
ERROR    internal error: process exited while connecting to monitor: 2015-10-08T19:53:08.694875Z qemu-kvm: -drive file=/home/publicvm,if=none,id=drive-virtio-disk0,format=dir: 'dir' invalid format

Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///system start public-centos7
otherwise, please restart your installation.
[root@localhost home]# 

これは/home/publicvmインストールされたパーティション内のディレクトリにすぎません/homeext4ファイルシステムを使用してください。

注:このisoファイルはUSB形式ですntfs。 CentOS 7を端末からUSBに有効にするためのライブラリをダウンロードし、上記のコマンドを実行する前に内容を読み取ることができることを確認しましたmount。ドライブ関連のエラーメッセージとは無関係のようですが、上記のコマンドに対する警告のためにこのメッセージを追加しました。ntfs/media/usbcdrom

ベストアンサー1

チャットによると、解決策は次のとおりです。

.ISOイメージをコピーし/var/lib/libvirt/images、次のように実行しますvirt-install

virt-install --name=public-centos7 \
    --disk path=/home/publicvm/some.img,size=10 \
    --graphics none \
    --vcpus=2 \
    --memory=2048 \
    --location /var/lib/libvirt/images/CentOS-7-x86_64-DVD-1503-01.iso \
    --network bridge=br0 \
    --os-type=linux \
    --os-variant=rhel7.0 \
    --extra-args console=ttyS0

以前に失敗した試みがまだ実行されている場合は、まずvirshを使用してそれらを削除して定義を取り消す必要があります。

virsh destroy public-centos7
virsh undefine public-centos7

おすすめ記事