always attach a data disk to vm using virtio, no matter what kind of guest os it is.

This commit is contained in:
Edison Su 2012-01-13 13:36:30 -08:00
parent 139a9d88e2
commit 88991af7e7
1 changed files with 7 additions and 17 deletions

View File

@ -2299,13 +2299,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
}
}
// Attach each data volume to the VM, if there is a deferred attached disk
for (DiskDef disk : vm.getDevices().getDisks()) {
if (disk.isAttachDeferred()) {
attachOrDetachDisk(conn, true, vmName, disk.getDiskPath(), disk.getDiskSeq());
}
}
state = State.Running;
return new StartAnswer(cmd);
@ -2350,18 +2343,15 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
}
} else {
int devId = (int)volume.getDeviceId();
disk.defFileBasedDisk(volume.getPath(), devId, diskBusType, DiskDef.diskFmtType.QCOW2);
}
//Centos doesn't support scsi hotplug. For other host OSes, we attach the disk after the vm is running, so that we can hotplug it.
if (volume.getType() == Volume.Type.DATADISK && diskBusType != DiskDef.diskBus.VIRTIO) {
disk.setAttachDeferred(true);
}
if (!disk.isAttachDeferred()) {
vm.getDevices().addDevice(disk);
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);
}
}
vm.getDevices().addDevice(disk);
}
if (vmSpec.getType() != VirtualMachine.Type.User) {