Jakkins
Jakkins

Reputation: 175

virt-install failing to create vm with network (ERROR XML error: Invalid value for attribute 'type' in element 'interface': 'vb1')

Without the --network option the vm is created successfully.

This is the network XML

<network>
  <name>vnet001</name>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='vb1' stp='on' delay='0' />
  <port isolated='no'/>
  <mac address='22:e4:b7:e4:66:a1'/>
  <ip address='10.0.0.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='10.0.0.2' end='10.0.0.254' />
    </dhcp>
  </ip>
</network>

Then I go forward with these commands:

sudo virsh net-define vnet001.xml
sudo virsh net-start vnet001

And then I try to create the vm with:

virt-install \
--name vm1 \
--ram=1024 \
--disk path=/opt/disks/vm1.qcow2,size=10,format=qcow2  \
--cdrom /opt/isos/alpine-virt-3.14.0-x86_64.iso \
--os-variant=alpinelinux3.14 \
--noautoconsole \
--network vb1

The error is the one in the title:

Starting install...
ERROR    XML error: Invalid value for attribute 'type' in element 'interface': 'vb1'.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///session start vm1
otherwise, please restart your installation.

EDIT: SOLVED

use sudo and --network network=<vnet_name>

sudo virsh net-list --all
 Name      State      Autostart   Persistent
----------------------------------------------
 default   inactive   no          yes
 vnet001   active     no          yes

sudo virt-install \
--name vm1 \
--ram=1024 \
--disk path=/opt/disks/vm1.qcow2,size=10,format=qcow2  \
--cdrom /opt/isos/alpine-virt-3.14.0-x86_64.iso \
--os-variant=alpinelinux3.14 \
--noautoconsole \
--network network=vnet001 

Upvotes: 1

Views: 2295

Answers (0)

Related Questions