Commit 37f88dc6 authored by Guido Trotter's avatar Guido Trotter
Browse files

KVM: actually support different nic types

When executing the KVM runtime we load the nic type from the runtime
hvparams and use it to specify the nic model type. As for the disk we
translate the DEV_PARAVIRTUAL type to 'virtio'.

Reviewed-by: iustinp
parent c2672466
......@@ -393,8 +393,14 @@ class KVMHypervisor(hv_base.BaseHypervisor):
if not kvm_nics:
kvm_cmd.extend(['-net', 'none'])
else:
nic_type = hvparams[constants.HV_NIC_TYPE]
if nic_type == constants.HT_NIC_PARAVIRTUAL:
nic_model = "model=virtio"
else:
nic_model = "model=%s" % nic_type
for nic_seq, nic in enumerate(kvm_nics):
nic_val = "nic,macaddr=%s,model=virtio" % nic.mac
nic_val = "nic,macaddr=%s,%s" % (nic.mac, nic_model)
script = self._WriteNetScript(instance, nic_seq, nic)
kvm_cmd.extend(['-net', nic_val])
kvm_cmd.extend(['-net', 'tap,script=%s' % script])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment