标签: virt-install

在 Lucid KVM 服务器上自动安装 Lucid 来宾

我们有一个运行 KVM 的 Ubuntu 10.04 服务器非常好,但是在找出最干净(和最快)的方式来执行 10.04 来宾的无人值守安装时遇到了麻烦。

要求:

  • 必须将 LVM 卷用于来宾的存储(没有一些 qemu-img 转换或类似的转换)

  • 必须使用 virtio 进行网络和磁盘存储(最好不要在 XML 文件中进行黑客攻击)

  • 必须使用本地镜像 - 所以它很快(例如 <5 分钟)

  • 真的很希望它是完全自动化和非交互式的。(即启动并在几分钟后运行一个功能系统)

  • 希望能够在开始到指定的IP地址,所以很容易去不看DHCP服务器。

  • 希望能够指定不同的味道/发行版/版本等。

选项 1: 我们不喜欢从 virt-manager UI 执行此操作——因为您必须在物理服务器上(不远程使用 virt-manager)才能安装到 LVM 分区。这确实有效,但您必须在服务器上运行 VNC 和 Gnome,这并不酷。此外,它是交互式的,您必须单击许多选项,而且我们仍然希望编写包装脚本来执行此操作。

选项 2: 来自 python-vm-builder 包的 vmbuilder 似乎正是我们想要的——因为你可以指定一个本地镜像(为此使用 apt-proxy)但无法让它使用 LVM 卷,也不将 virtio 用于磁盘。

vmbuilder kvm ubuntu --suite=lucid --flavour=virtual --arch=amd64 --mirror= http://192.168.1.1:9999/ubuntu -o --libvirt=qemu:///system --ip=192.168 .1.94 --part=vmbuilder.partition --raw=/dev/VG0/LVtest --templates=mytemplates --firstboot=/root/vm/boot.sh --user=linuxadmin --name=linuxadmin --pass= secretpass …

ubuntu ubuntu-10.04 virt-install kvm-virtualization

5
推荐指数
1
解决办法
2150
查看次数

virt-install 不能使用 ISO 文件作为位置

我正在使用以下脚本安装新的 Fedora Server 虚拟机

virt-install \
--name theta-1 \
--ram 8000 \
--disk path=/dev/vg/t1.img \
--vcpus 8 \
--os-type linux \
--os-variant fedora25 \
--network bridge=br0 \
--graphics none \
--console pty,target_type=serial \
--location=/home/user/Fedora-Server-dvd-x86_64-25-1.3.iso \
--extra-args 'console=ttyS0,115200n8 serial'
Run Code Online (Sandbox Code Playgroud)

但是当我运行它时(作为 root 用户)

Installation starts...
Getting file .treeinfo...                                                                                                                    | 1.5 kB  00:00:00     
Getting file vmlinuz...                                                                                                                      | 6.5 MB  00:00:00     
Getting file initrd.img...                                                                                                                   |  49 MB  00:00:00     
ERROR    internal error: qemu unexpectedly closed the monitor: 2017-02-17T08:58:23.976542Z qemu-system-x86_64: -drive file=/home/user/Fedora-Server-dvd-x86_64-25-1.3.iso,format=raw,if=none,id=drive-ide0-0-0,readonly=on: Could not open '/home/user/Fedora-Server-dvd-x86_64-25-1.3.iso': …
Run Code Online (Sandbox Code Playgroud)

libvirt virt-install kvm-virtualization

5
推荐指数
2
解决办法
2万
查看次数

Centos6 带有 cloud-init 需要更长的启动时间

Centos-6.6 虚拟机镜像在使用virsh. 我使用捕获日志virsh console。看起来像这样,

ci-info: +-------+---------------+---------------+---------------+-----------+-------+
ci-info: | Route |  Destination  |    Gateway    |    Genmask    | Interface | Flags |
ci-info: +-------+---------------+---------------+---------------+-----------+-------+
ci-info: |   0   | 192.168.122.0 |    0.0.0.0    | 255.255.255.0 |    eth0   |   U   |
ci-info: |   1   |    0.0.0.0    | 192.168.122.1 |    0.0.0.0    |    eth0   |   UG  |
ci-info: +-------+---------------+---------------+---------------+-----------+-------+
2015-04-25 05:13:41,222 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [50/120s]: unexpected error ['Timeout' object has no attribute 'response']
2015-04-25 05:14:32,278 - url_helper.py[WARNING]: Calling 'http://169.254.169.254/2009-04-04/meta-data/instance-id' failed [101/120s]: …
Run Code Online (Sandbox Code Playgroud)

virt-install centos6 cloud-init

4
推荐指数
1
解决办法
4004
查看次数

virt-install 后不要启动 guest 虚拟机

我喜欢设置一个新来宾,但不想立即开始。我使用virt-install这些选项:

virt-install \
    --connect qemu:///system \
    --import \
    --virt-type kvm \
    --name somevm \
    --os-variant win7 \
    --memory 2048 \
    --vcpus 1 \
    --disk /home/bla/VirtualMachines/somevm.qcow2,format=qcow2,device=disk \
    --network network=default \
    --noautoconsole \
    --sound default
Run Code Online (Sandbox Code Playgroud)

virt-install总是会启动VM。我在手册页中找不到任何禁用自动启动的选项。我不想virsh destroy somevm在安装后立即调用,尽管虚拟机可能还没有启动...是否可以使用 virt-install 来阻止来宾启动,或者是否有其他工具可以执行相同的操作但不启动启动客人?

我还找到了某种解决方法:--import您可以使用 来安装虚拟机,而不是使用--pxe。如果没有可用的 PXE 服务器,那么这应该有足够的时间来使用 销毁来宾virsh

libvirt virt-install

2
推荐指数
2
解决办法
6890
查看次数