mirror of https://github.com/apache/cloudstack.git
Fix checkstyle and license issues
This commit is contained in:
parent
15fa2ef8df
commit
97bad4f9b3
|
|
@ -40,6 +40,8 @@ import javax.ejb.Local;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
|
|
@ -67,7 +69,6 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
|||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.Listener;
|
||||
|
|
@ -938,8 +939,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
//storing the value of overcommit in the vm_details table for doing a capacity check in case the cluster overcommit ratio is changed.
|
||||
if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") == null &&
|
||||
((Float.parseFloat(cluster_detail_cpu.getValue()) > 1f || Float.parseFloat(cluster_detail_ram.getValue()) > 1f))) {
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue());
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue());
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true);
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true);
|
||||
} else if (_uservmDetailsDao.findDetail(vm.getId(), "cpuOvercommitRatio") != null) {
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "cpuOvercommitRatio", cluster_detail_cpu.getValue(), true);
|
||||
_uservmDetailsDao.addDetail(vm.getId(), "memoryOvercommitRatio", cluster_detail_ram.getValue(), true);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,28 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
//
|
||||
|
||||
package com.cloud.utils.db;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.db.SearchCriteria.Func;
|
||||
|
|
|
|||
|
|
@ -1956,7 +1956,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
|
||||
protected ExecutionResult prepareNetworkElementCommand(IpAssocCommand cmd) {
|
||||
Connection conn = getConnection();
|
||||
int i = 0;
|
||||
String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
|
||||
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
|
||||
|
||||
|
|
@ -2029,8 +2028,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
|
||||
protected ExecutionResult cleanupNetworkElementCommand(IpAssocCommand cmd) {
|
||||
Connection conn = getConnection();
|
||||
String[] results = new String[cmd.getIpAddresses().length];
|
||||
int i = 0;
|
||||
String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
|
||||
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
|
||||
try {
|
||||
|
|
@ -7307,19 +7304,18 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
return new ExecutionResult(true, null);
|
||||
}
|
||||
|
||||
protected void setNicDevIdIfCorrectVifIsNotNull(Connection conn,
|
||||
IpAddressTO ip, VIF correctVif) throws InternalErrorException,
|
||||
BadServerResponse, XenAPIException, XmlRpcException {
|
||||
if (correctVif == null) {
|
||||
if (ip.isAdd()) {
|
||||
throw new InternalErrorException("Failed to find DomR VIF to associate IP with.");
|
||||
} else {
|
||||
s_logger.debug("VIF to deassociate IP with does not exist, return success");
|
||||
}
|
||||
} else {
|
||||
ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
|
||||
}
|
||||
}
|
||||
protected void setNicDevIdIfCorrectVifIsNotNull(Connection conn, IpAddressTO ip, VIF correctVif) throws InternalErrorException, BadServerResponse, XenAPIException,
|
||||
XmlRpcException {
|
||||
if (correctVif == null) {
|
||||
if (ip.isAdd()) {
|
||||
throw new InternalErrorException("Failed to find DomR VIF to associate IP with.");
|
||||
} else {
|
||||
s_logger.debug("VIF to deassociate IP with does not exist, return success");
|
||||
}
|
||||
} else {
|
||||
ip.setNicDevId(Integer.valueOf(correctVif.getDevice(conn)));
|
||||
}
|
||||
}
|
||||
|
||||
protected ExecutionResult prepareNetworkElementCommand(SetSourceNatCommand cmd) {
|
||||
Connection conn = getConnection();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import static org.mockito.Mockito.mock;
|
|||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.Matchers.any;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -46,6 +45,7 @@ import com.xensource.xenapi.Types;
|
|||
import com.xensource.xenapi.VIF;
|
||||
import com.xensource.xenapi.VM;
|
||||
import com.xensource.xenapi.XenAPIObject;
|
||||
|
||||
import com.cloud.agent.api.ScaleVmAnswer;
|
||||
import com.cloud.agent.api.ScaleVmCommand;
|
||||
import com.cloud.agent.api.to.IpAddressTO;
|
||||
|
|
@ -176,17 +176,15 @@ public class CitrixResourceBaseTest {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSetNicDevIdIfCorrectVifIsNotNull() throws Exception {
|
||||
IpAddressTO ip = mock (IpAddressTO.class);
|
||||
when (ip.isAdd()).thenReturn(false);
|
||||
VIF correctVif = null;
|
||||
try {
|
||||
_resource.setNicDevIdIfCorrectVifIsNotNull(conn, ip, correctVif);
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
fail("this test is meant to show that null pointer is not thrown");
|
||||
}
|
||||
}
|
||||
@Test
|
||||
public void testSetNicDevIdIfCorrectVifIsNotNull() throws Exception {
|
||||
IpAddressTO ip = mock(IpAddressTO.class);
|
||||
when(ip.isAdd()).thenReturn(false);
|
||||
VIF correctVif = null;
|
||||
try {
|
||||
_resource.setNicDevIdIfCorrectVifIsNotNull(conn, ip, correctVif);
|
||||
} catch (NullPointerException e) {
|
||||
fail("this test is meant to show that null pointer is not thrown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,21 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
//
|
||||
|
||||
package com.cloud.template;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
package streamer;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
//
|
||||
package com.cloud.consoleproxy;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,20 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
//
|
||||
package com.cloud.utils;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
|
|
|||
Loading…
Reference in New Issue