bug 8022: fix attaching multiple disks, after restart/rebooting

status 8022: resolved fixed
This commit is contained in:
Edison Su 2011-01-19 04:53:04 -05:00
parent b55e7a5bf4
commit 0c9500e815
2 changed files with 9 additions and 6 deletions

View File

@ -2257,12 +2257,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
disk.defISODisk(volPath);
}
} else {
int devId = 0;
if (volume.getType() == VolumeType.ROOT) {
devId = 0;
} else {
devId = 1;
}
int devId = (int)volume.getDeviceId();
disk.defFileBasedDisk(volume.getPath(), devId, diskBusType, DiskDef.diskFmtType.QCOW2);
}

View File

@ -303,7 +303,12 @@ public class LibvirtVMDef {
_bus = bus;
}
/*device id starting from 0, but iso is 3*/
private String getDevLabel(int devId, diskBus bus) {
if ( devId >= 2 ) {
devId++;
}
char suffix = (char)('a' + devId);
if (bus == diskBus.SCSI) {
return "sd" + suffix;
@ -311,7 +316,9 @@ public class LibvirtVMDef {
return "vd" + suffix;
}
return "hd" + suffix;
}
public void defFileBasedDisk(String filePath, int devId, diskBus bus, diskFmtType diskFmtType) {
_diskType = diskType.FILE;