gpt4 book ai didi

xml - 如何使用 virt-install 将 VLAN 信息添加到 VM xml 文件?

转载 作者:行者123 更新时间:2023-12-05 07:32:55 25 4
gpt4 key购买 nike

我正在尝试自动创建虚拟机,但我无法通过 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'/>

提前致谢。

最佳答案

似乎没有办法直接使用 virt-install 来做到这一点,但是为什么不使用 Open vSwitch 配置 VLAN 标记呢?

# after running virt-install:
ovs-vsctl set port ext01 tag=100

关于xml - 如何使用 virt-install 将 VLAN 信息添加到 VM xml 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50928582/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com