Removed a bunch of missing files and useless imports

This commit is contained in:
Alex Huang 2013-02-13 15:41:06 -08:00
parent d346f632c3
commit f542c320d3
7 changed files with 13 additions and 312 deletions

View File

@ -1,42 +0,0 @@
// 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.resource;
import com.cloud.storage.VolumeVO;
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
import com.cloud.utils.component.Adapter;
/**
* DiskMounter mounts and unmounts disk for VMs
* to consume.
*
*/
public interface DiskPreparer extends Adapter {
/**
* Mounts a volumeVO and returns a path.
*
* @param vol
* @return
*/
public String mount(String vmName, VolumeVO vol, BootloaderType type);
/**
* Unmounts
*/
public boolean unmount(String path);
}

View File

@ -1,29 +0,0 @@
// 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.resource;
import com.cloud.utils.component.Adapter;
/**
* Prepares the network for VM.
*/
public interface NetworkPreparer extends Adapter {
String setup(String vnet);
void cleanup(String vnet);
}

View File

@ -1,52 +0,0 @@
// 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.resource.storage;
import com.cloud.agent.api.storage.CreateAnswer;
import com.cloud.agent.api.storage.CreateCommand;
import com.cloud.agent.api.storage.DestroyAnswer;
import com.cloud.agent.api.storage.DestroyCommand;
import com.cloud.agent.api.storage.DownloadAnswer;
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
import com.cloud.resource.ServerResource;
/**
* a primary storage.
*
*/
public interface PrimaryStorageHeadResource extends ServerResource {
/**
* Downloads the template to the primary storage.
* @param cmd
* @return
*/
DownloadAnswer execute(PrimaryStorageDownloadCommand cmd);
/**
* Creates volumes for the VM.
* @param cmd
* @return
*/
CreateAnswer execute(CreateCommand cmd);
/**
* Destroys volumes for the VM.
* @param cmd
* @return
*/
DestroyAnswer execute(DestroyCommand cmd);
}

View File

@ -1,46 +0,0 @@
// 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.vm;
import java.util.List;
/**
*
* be an information carrier within one thread only.
*
*/
public class VirtualEnvironment {
/**
* The actual machine
*/
public VirtualMachine machine;
/**
* Disks to assign to the machine in order.
*/
public List<VirtualDisk> disks;
/**
* Networks to assign to the machine.
*/
public List<VirtualNetwork> networks;
/**
* Boot options to assign to the machine.
*/
public String bootOptions;
}

View File

@ -1,72 +0,0 @@
// 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.vm;
import com.cloud.network.Networks.IsolationType;
import com.cloud.network.Networks.Mode;
/**
* VirtualNetwork describes from a management level the
* machine.
*/
public class VirtualNetwork {
/**
* The gateway for this network.
*/
public String gateway;
/**
* Netmask
*/
public String netmask;
/**
* ip address. null if mode is DHCP.
*/
public String ip;
/**
* Mac Address.
*/
public String mac;
/**
* rate limit on this network. -1 if no limit.
*/
public long rate;
/**
* tag for virtualization.
*/
public String tag;
/**
* mode to acquire ip address.
*/
public Mode mode;
/**
* Isolation method for networking.
*/
public IsolationType method;
public boolean firewalled;
public int[] openPorts;
public int[] closedPorts;
}

View File

@ -1,42 +0,0 @@
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-plugin-parent</artifactId>
<name>Apache CloudStack Plugin POM</name>
<packaging>pom</packaging>
<parent>
<groupId>com.cloud</groupId>
<artifactId>cloud-parent</artifactId>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>com.cloud</groupId>
<artifactId>cloud-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<sourceDirectory>src</sourceDirectory>
</build>
</project>

View File

@ -37,7 +37,6 @@ import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.agent.AgentManager;
import com.cloud.agent.AgentManager.OnError;
@ -69,12 +68,10 @@ import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.agent.manager.Commands;
import com.cloud.agent.manager.allocator.HostAllocator;
import com.cloud.alert.AlertManager;
import com.cloud.capacity.CapacityManager;
import com.cloud.cluster.ClusterManager;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.consoleproxy.ConsoleProxyManager;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.HostPodVO;
@ -152,10 +149,7 @@ import com.cloud.utils.fsm.StateMachine2;
import com.cloud.vm.ItWorkVO.Step;
import com.cloud.vm.VirtualMachine.Event;
import com.cloud.vm.VirtualMachine.State;
import com.cloud.vm.dao.ConsoleProxyDao;
import com.cloud.vm.dao.DomainRouterDao;
import com.cloud.vm.dao.NicDao;
import com.cloud.vm.dao.SecondaryStorageVmDao;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.VMInstanceDao;
import com.cloud.vm.snapshot.VMSnapshot;
@ -194,12 +188,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
@Inject
protected UserVmDao _userVmDao;
@Inject
protected DomainRouterDao _routerDao;
@Inject
protected ConsoleProxyDao _consoleDao;
@Inject
protected SecondaryStorageVmDao _secondaryDao;
@Inject
protected NicDao _nicsDao;
@Inject
protected AccountManager _accountMgr;
@ -214,12 +202,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
@Inject
protected VolumeDao _volsDao;
@Inject
protected ConsoleProxyManager _consoleProxyMgr;
@Inject
protected ConfigurationManager _configMgr;
@Inject
protected CapacityManager _capacityMgr;
@Inject
protected HighAvailabilityManager _haMgr;
@Inject
protected HostPodDao _podDao;
@ -2591,7 +2575,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
_networkModel.getNetworkRate(network.getId(), vm.getId()),
_networkModel.isSecurityGroupSupportedInNetwork(network),
_networkModel.getNetworkTag(vmProfile.getVirtualMachine().getHypervisorType(), network));
//1) Unplug the nic
if (vm.getState() == State.Running) {
NicTO nicTO = toNicTO(nicProfile, vmProfile.getVirtualMachine().getHypervisorType());
@ -2608,11 +2592,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
throw new ResourceUnavailableException("Unable to remove vm " + vm + " from network, is not in the right state",
DataCenter.class, vm.getDataCenterId());
}
//2) Release the nic
_networkMgr.releaseNic(vmProfile, nic);
s_logger.debug("Successfully released nic " + nic + "for vm " + vm);
//3) Remove the nic
_networkMgr.removeNic(vmProfile, nic);
_nicsDao.expunge(nic.getId());
@ -2647,7 +2631,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
s_logger.warn("Could not get a nic with " + network);
return false;
}
// don't delete default NIC on a user VM
if (nic.isDefaultNic() && vm.getType() == VirtualMachine.Type.User ) {
s_logger.warn("Failed to remove nic from " + vm + " in " + network + ", nic is default.");
@ -2661,15 +2645,15 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
//1) Unplug the nic
if (vm.getState() == State.Running) {
NicTO nicTO = toNicTO(nicProfile, vmProfile.getVirtualMachine().getHypervisorType());
s_logger.debug("Un-plugging nic for vm " + vm + " from network " + network);
boolean result = vmGuru.unplugNic(network, nicTO, vmTO, context, dest);
if (result) {
s_logger.debug("Nic is unplugged successfully for vm " + vm + " in network " + network );
} else {
s_logger.warn("Failed to unplug nic for the vm " + vm + " from network " + network);
return false;
}
NicTO nicTO = toNicTO(nicProfile, vmProfile.getVirtualMachine().getHypervisorType());
s_logger.debug("Un-plugging nic for vm " + vm + " from network " + network);
boolean result = vmGuru.unplugNic(network, nicTO, vmTO, context, dest);
if (result) {
s_logger.debug("Nic is unplugged successfully for vm " + vm + " in network " + network );
} else {
s_logger.warn("Failed to unplug nic for the vm " + vm + " from network " + network);
return false;
}
} else if (vm.getState() != State.Stopped) {
s_logger.warn("Unable to remove vm " + vm + " from network " + network);
throw new ResourceUnavailableException("Unable to remove vm " + vm + " from network, is not in the right state",