fix(host): arm vm virtio-net-pci without addr

This commit is contained in:
Zexi Li
2021-03-31 18:51:55 +08:00
parent c34d6984d5
commit c7b85ca303
2 changed files with 8 additions and 4 deletions
+3 -1
View File
@@ -270,7 +270,9 @@ func (s *SKVMGuestInstance) generateArmStartScript(data *jsonutils.JSONDict) (st
} else {
cmd += nicCmd
}
cmd += s.getVnicDesc(nics[i])
// aarch64 with addr lead to:
// virtio_net: probe of virtioN failed with error -22
cmd += s.getVnicDesc(nics[i], false)
}
if isolatedDevsParams != nil {
+5 -3
View File
@@ -276,7 +276,7 @@ func (s *SKVMGuestInstance) getNicAddr(index int) int {
return s.GetDiskAddr(pciBase + index)
}
func (s *SKVMGuestInstance) getVnicDesc(nic jsonutils.JSONObject) string {
func (s *SKVMGuestInstance) getVnicDesc(nic jsonutils.JSONObject, withAddr bool) string {
bridge, _ := nic.GetString("bridge")
ifname, _ := nic.GetString("ifname")
driver, _ := nic.GetString("driver")
@@ -290,7 +290,9 @@ func (s *SKVMGuestInstance) getVnicDesc(nic jsonutils.JSONObject) string {
cmd += fmt.Sprintf(",netdev=%s", ifname)
cmd += fmt.Sprintf(",mac=%s", mac)
cmd += fmt.Sprintf(",addr=0x%x", s.getNicAddr(int(index)))
if withAddr {
cmd += fmt.Sprintf(",addr=0x%x", s.getNicAddr(int(index)))
}
if driver == "virtio" {
if nic.Contains("vectors") {
cmd += fmt.Sprintf(",vectors=%d", vectors)
@@ -617,7 +619,7 @@ function nic_mtu() {
} else {
cmd += nicCmd
}
cmd += s.getVnicDesc(nics[i])
cmd += s.getVnicDesc(nics[i], true)
}
if isolatedDevsParams != nil {