我正在尝试自动创建虚拟机,但是在通过virt-install将VLAN标记添加到xml文件时遇到了麻烦。
sudo virt-install --name hosp10 --memory 16384 --vcpus 4 \
--disk /var/lib/libvirt/images/cloud-full.qcow2,format=qcow2,cache=none,target=vda \
--boot kernel=/var/lib/libvirt/images/full.vmlinuz,initrd=/var/lib/libvirt/images/full.initrd,kernel_args="root=/dev/vda" \
--network bridge=br-mgmt,model=virtio,virtualport_type=openvswitch,mac=XX:XX:XX:XX:XX:XX
我想在--network上添加类似vlan_id = 100之类的内容,但似乎不存在这种选项。有没有办法像下面这样生成xml?
<interface type="bridge">
<source bridge="ovs-internal"/>
<target dev='ext01'/>
<vlan>
<tag id='100'/>
</vlan>
<model type="virtio"/>
<virtualport type="openvswitch"/>
<mac address='vv:vv:vv:vv:vv:vv' />
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
谢谢。
答案 0 :(得分:0)
似乎没有一种方法可以直接使用virt-install
来实现,但是为什么不使用Open vSwitch配置VLAN标签呢?
# after running virt-install:
ovs-vsctl set port ext01 tag=100