diff --git a/salt/modules/virt.py b/salt/modules/virt.py index 5a105c73f80e..e422eea202cf 100644 --- a/salt/modules/virt.py +++ b/salt/modules/virt.py @@ -615,16 +615,17 @@ def _gen_xml(name, context['console'] = True context['disks'] = {} + disk_bus_map = {'virtio': 'vd', 'xen': 'xvd', 'fdc': 'fd', 'ide': 'hd'} for i, disk in enumerate(diskp): context['disks'][disk['name']] = {} context['disks'][disk['name']]['file_name'] = disk['filename'] context['disks'][disk['name']]['source_file'] = disk['source_file'] - if hypervisor in ['qemu', 'kvm', 'bhyve']: - context['disks'][disk['name']]['target_dev'] = 'vd{0}'.format(string.ascii_lowercase[i]) + prefix = disk_bus_map.get(disk['model'], 'sd') + context['disks'][disk['name']]['target_dev'] = '{0}{1}'.format(prefix, string.ascii_lowercase[i]) + if hypervisor in ['qemu', 'kvm', 'bhyve', 'xen']: context['disks'][disk['name']]['address'] = False context['disks'][disk['name']]['driver'] = True elif hypervisor in ['esxi', 'vmware']: - context['disks'][disk['name']]['target_dev'] = 'sd{0}'.format(string.ascii_lowercase[i]) context['disks'][disk['name']]['address'] = True context['disks'][disk['name']]['driver'] = False context['disks'][disk['name']]['disk_bus'] = disk['model']