|
18 | 18 |
|
19 | 19 | import java.util.ArrayList; |
20 | 20 | import java.util.List; |
21 | | -import java.util.Map; |
22 | 21 |
|
23 | 22 | import javax.inject.Inject; |
24 | 23 |
|
25 | | -import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; |
26 | | -import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector; |
27 | 24 | import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; |
28 | | -import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; |
| 25 | +import org.apache.cloudstack.framework.config.ConfigKey; |
29 | 26 | import org.apache.cloudstack.framework.config.Configurable; |
30 | 27 | import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs; |
31 | 28 | import org.apache.cloudstack.storage.command.CopyCommand; |
32 | 29 | import org.apache.cloudstack.storage.command.DettachCommand; |
33 | 30 | import org.apache.cloudstack.storage.command.StorageSubSystemCommand; |
34 | 31 | import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; |
35 | 32 | import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; |
36 | | -import org.apache.cloudstack.framework.config.ConfigKey; |
| 33 | +import org.apache.log4j.Logger; |
37 | 34 |
|
38 | 35 | import com.cloud.agent.api.Command; |
39 | 36 | import com.cloud.agent.api.to.DataObjectType; |
|
57 | 54 | import com.cloud.vm.VirtualMachine; |
58 | 55 | import com.cloud.vm.VirtualMachineProfile; |
59 | 56 | import com.cloud.vm.dao.UserVmDao; |
60 | | -import org.apache.log4j.Logger; |
61 | 57 |
|
62 | 58 | public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru, Configurable { |
63 | 59 | private final Logger LOGGER = Logger.getLogger(XenServerGuru.class); |
64 | 60 | @Inject |
65 | | - GuestOSDao _guestOsDao; |
66 | | - @Inject |
67 | | - GuestOSHypervisorDao _guestOsHypervisorDao; |
| 61 | + private GuestOSDao _guestOsDao; |
68 | 62 | @Inject |
69 | | - EndPointSelector endPointSelector; |
| 63 | + private GuestOSHypervisorDao _guestOsHypervisorDao; |
70 | 64 | @Inject |
71 | | - HostDao hostDao; |
| 65 | + private HostDao hostDao; |
72 | 66 | @Inject |
73 | | - VolumeDao _volumeDao; |
| 67 | + private VolumeDao _volumeDao; |
74 | 68 | @Inject |
75 | | - PrimaryDataStoreDao _storagePoolDao; |
| 69 | + private PrimaryDataStoreDao _storagePoolDao; |
76 | 70 | @Inject |
77 | | - VolumeDataFactory _volFactory; |
| 71 | + private VolumeDataFactory _volFactory; |
78 | 72 | @Inject |
79 | | - UserVmDao _userVmDao; |
| 73 | + private UserVmDao _userVmDao; |
80 | 74 |
|
81 | | - static final ConfigKey<Integer> MaxNumberOfVCPUSPerVM = new ConfigKey<Integer>("Advanced", Integer.class, "xen.vm.vcpu.max", "16", |
| 75 | + private static final ConfigKey<Integer> MaxNumberOfVCPUSPerVM = new ConfigKey<Integer>("Advanced", Integer.class, "xen.vm.vcpu.max", "16", |
82 | 76 | "Maximum number of VCPUs that VM can get in XenServer.", true, ConfigKey.Scope.Cluster); |
83 | 77 |
|
84 | | - protected XenServerGuru() { |
85 | | - super(); |
86 | | - } |
87 | | - |
88 | 78 | @Override |
89 | 79 | public HypervisorType getHypervisorType() { |
90 | 80 | return HypervisorType.XenServer; |
@@ -129,11 +119,6 @@ public boolean trackVmHostChange() { |
129 | 119 | return true; |
130 | 120 | } |
131 | 121 |
|
132 | | - @Override |
133 | | - public Map<String, String> getClusterSettings(long vmId) { |
134 | | - return null; |
135 | | - } |
136 | | - |
137 | 122 | @Override |
138 | 123 | public List<Command> finalizeExpungeVolumes(VirtualMachine vm) { |
139 | 124 | List<Command> commands = new ArrayList<Command>(); |
@@ -189,15 +174,13 @@ public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) { |
189 | 174 | DataStoreTO destStore = destData.getDataStore(); |
190 | 175 | if (srcStore instanceof NfsTO && destStore instanceof NfsTO) { |
191 | 176 | HostVO host = hostDao.findById(hostId); |
192 | | - EndPoint ep = endPointSelector.selectHypervisorHost(new ZoneScope(host.getDataCenterId())); |
193 | | - host = hostDao.findById(ep.getId()); |
194 | 177 | hostDao.loadDetails(host); |
195 | 178 | String hypervisorVersion = host.getHypervisorVersion(); |
196 | 179 | String snapshotHotFixVersion = host.getDetail(XenserverConfigs.XS620HotFix); |
197 | 180 | if (hypervisorVersion != null && !hypervisorVersion.equalsIgnoreCase("6.1.0")) { |
198 | | - if (!(hypervisorVersion.equalsIgnoreCase("6.2.0") && |
199 | | - !(snapshotHotFixVersion != null && snapshotHotFixVersion.equalsIgnoreCase(XenserverConfigs.XSHotFix62ESP1004)))) { |
200 | | - return new Pair<Boolean, Long>(Boolean.TRUE, new Long(ep.getId())); |
| 181 | + if (!(hypervisorVersion.equalsIgnoreCase("6.2.0") |
| 182 | + && !(snapshotHotFixVersion != null && snapshotHotFixVersion.equalsIgnoreCase(XenserverConfigs.XSHotFix62ESP1004)))) { |
| 183 | + return new Pair<Boolean, Long>(Boolean.TRUE, new Long(host.getId())); |
201 | 184 | } |
202 | 185 | } |
203 | 186 | } |
|
0 commit comments