|
| 1 | +/** |
| 2 | + * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. |
| 3 | + * |
| 4 | + * This software is licensed under the GNU General Public License v3 or later. |
| 5 | + * |
| 6 | + * It is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or any later version. |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | + * |
| 17 | + */ |
| 18 | +package com.cloud.hypervisor; |
| 19 | + |
| 20 | +import javax.ejb.Local; |
| 21 | + |
| 22 | +import com.cloud.agent.api.to.VirtualMachineTO; |
| 23 | +import com.cloud.hypervisor.Hypervisor.HypervisorType; |
| 24 | +import com.cloud.storage.GuestOSVO; |
| 25 | +import com.cloud.storage.dao.GuestOSDao; |
| 26 | +import com.cloud.template.VirtualMachineTemplate.BootloaderType; |
| 27 | +import com.cloud.utils.component.Inject; |
| 28 | +import com.cloud.vm.VirtualMachine; |
| 29 | +import com.cloud.vm.VirtualMachineProfile; |
| 30 | + |
| 31 | +@Local(value=HypervisorGuru.class) |
| 32 | +public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru { |
| 33 | + @Inject GuestOSDao _guestOsDao; |
| 34 | + |
| 35 | + protected VMwareGuru() { |
| 36 | + super(); |
| 37 | + } |
| 38 | + |
| 39 | + @Override |
| 40 | + public HypervisorType getHypervisorType() { |
| 41 | + return HypervisorType.VmWare; |
| 42 | + } |
| 43 | + |
| 44 | + @Override |
| 45 | + public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) { |
| 46 | + VirtualMachineTO to = toVirtualMachineTO(vm); |
| 47 | + to.setBootloader(BootloaderType.HVM); |
| 48 | + |
| 49 | + // Determine the VM's OS description |
| 50 | + GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId()); |
| 51 | + to.setOs(guestOS.getDisplayName()); |
| 52 | + return to; |
| 53 | + } |
| 54 | +} |
0 commit comments