bug CS-14833: if iso is xen/vmware tools, attach it to vm; status CS-14833: resolved fixed

This commit is contained in:
Edison Su 2012-05-15 13:04:10 -07:00
parent d39e4dc611
commit 403addc59d
2 changed files with 27 additions and 8 deletions

View File

@ -821,11 +821,26 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
protected VDI mount(Connection conn, String vmName, VolumeTO volume) throws XmlRpcException, XenAPIException {
if (volume.getType() == Volume.Type.ISO) {
String isopath = volume.getPath();
if (isopath == null) {
return null;
}
if (isopath.startsWith("xs-tools")) {
try {
Set<VDI> vdis = VDI.getByNameLabel(conn, isopath);
if (vdis.isEmpty()) {
throw new CloudRuntimeException("Could not find ISO with URL: " + isopath);
}
return vdis.iterator().next();
String isopath = volume.getPath();
if (isopath == null) {
return null;
}
} catch (XenAPIException e) {
throw new CloudRuntimeException("Unable to get pv iso: " + isopath + " due to " + e.toString());
} catch (Exception e) {
throw new CloudRuntimeException("Unable to get pv iso: " + isopath + " due to " + e.toString());
}
}
int index = isopath.lastIndexOf("/");
String mountpoint = isopath.substring(0, index);

View File

@ -2549,11 +2549,15 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
Pair<String, String> isoPathPair = _storageMgr.getAbsoluteIsoPath(template.getId(), vm.getDataCenterIdToDeployIn());
if (isoPathPair == null) {
s_logger.warn("Couldn't get absolute iso path");
return false;
if (template.getTemplateType() == TemplateType.PERHOST) {
isoPath = template.getName();
} else {
isoPath = isoPathPair.first();
if (isoPathPair == null) {
s_logger.warn("Couldn't get absolute iso path");
return false;
} else {
isoPath = isoPathPair.first();
}
}
if (template.isBootable()) {