diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java index 67920e2cc63..b093ba3c91e 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java +++ b/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java @@ -2329,7 +2329,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } protected void createVbd(Connect conn, VirtualMachineTO vmSpec, String vmName, LibvirtVMDef vm) throws InternalErrorException, LibvirtException, URISyntaxException{ + List vols = new ArrayList(); for (VolumeTO volume : vmSpec.getDisks()) { + String volPath = getVolumePath(conn, volume); DiskDef.diskBus diskBusType = getGuestDiskModel(vmSpec.getOs()); @@ -2343,17 +2345,23 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } } else { int devId = (int)volume.getDeviceId(); - + if (volume.getType() == Volume.Type.DATADISK) { disk.defFileBasedDisk(volume.getPath(), devId, DiskDef.diskBus.VIRTIO, DiskDef.diskFmtType.QCOW2); } else { disk.defFileBasedDisk(volume.getPath(), devId, diskBusType, DiskDef.diskFmtType.QCOW2); } + vols.add(devId, disk); + continue; } - + vm.getDevices().addDevice(disk); } + for (DiskDef disk : vols) { + vm.getDevices().addDevice(disk); + } + if (vmSpec.getType() != VirtualMachine.Type.User) { if (_sysvmISOPath != null) { DiskDef iso = new DiskDef();