mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-7211: Add Guest OS mapping before returning VirtualMachineTO object
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
b371356abc
commit
89fabe82b9
|
|
@ -20,15 +20,23 @@ import javax.ejb.Local;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.storage.GuestOSHypervisorVO;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.dao.GuestOSDao;
|
||||
import com.cloud.storage.dao.GuestOSHypervisorDao;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
@Local(value = HypervisorGuru.class)
|
||||
public class LXCGuru extends HypervisorGuruBase implements HypervisorGuru {
|
||||
@Inject
|
||||
GuestOSDao _guestOsDao;
|
||||
@Inject
|
||||
GuestOSHypervisorDao _guestOsHypervisorDao;
|
||||
@Inject
|
||||
HostDao _hostDao;
|
||||
|
||||
@Override
|
||||
public HypervisorType getHypervisorType() {
|
||||
|
|
@ -47,6 +55,14 @@ public class LXCGuru extends HypervisorGuruBase implements HypervisorGuru {
|
|||
GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId());
|
||||
to.setOs(guestOS.getDisplayName());
|
||||
|
||||
HostVO host = _hostDao.findById(vm.getVirtualMachine().getHostId());
|
||||
GuestOSHypervisorVO guestOsMapping = _guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), getHypervisorType().toString(), host.getHypervisorVersion());
|
||||
if (guestOsMapping == null) {
|
||||
to.setPlatformEmulator("Other");
|
||||
} else {
|
||||
to.setPlatformEmulator(guestOsMapping.getGuestOsName());
|
||||
}
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue