Skip to content

Commit fa9c882

Browse files
author
Kelven Yang
committed
Add VMWare hypervisor guru
1 parent 32185d2 commit fa9c882

3 files changed

Lines changed: 56 additions & 1 deletion

File tree

‎client/tomcatconf/components.xml.in‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<adapters key="com.cloud.hypervisor.HypervisorGuru">
6565
<adapter name="XenServerGuru" class="com.cloud.hypervisor.XenServerGuru"/>
6666
<adapter name="KVMGuru" class="com.cloud.hypervisor.KVMGuru"/>
67+
<adapter name="VMwareGuru" class="com.cloud.hypervisor.VMwareGuru"/>
6768
</adapters>
6869
<adapters key="com.cloud.resource.Discoverer">
6970
<adapter name="XCP Agent" class="com.cloud.hypervisor.xen.discoverer.XcpServerDiscoverer"/>

‎server/src/com/cloud/hypervisor/KVMGuru.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
@Local(value=HypervisorGuru.class)
1414
public class KVMGuru extends HypervisorGuruBase implements HypervisorGuru {
1515
@Inject GuestOSDao _guestOsDao;
16+
1617
@Override
1718
public HypervisorType getHypervisorType() {
1819
return HypervisorType.KVM;
@@ -33,5 +34,4 @@ public <T extends VirtualMachine> VirtualMachineTO implement(
3334

3435
return to;
3536
}
36-
3737
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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

Comments
 (0)