mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
bug 9192: fixes the caches that are gone due to configuration server uses the same dao without cache
This commit is contained in:
parent
8e727230ce
commit
f2e692099e
@ -172,6 +172,7 @@ import com.cloud.network.ovs.OvsDestroyTunnelCommand;
|
||||
import com.cloud.network.ovs.OvsSetTagAndFlowAnswer;
|
||||
import com.cloud.network.ovs.OvsSetTagAndFlowCommand;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.resource.hypervisor.HypervisorResource;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
@ -221,7 +222,7 @@ import com.xensource.xenapi.XenAPIObject;
|
||||
*
|
||||
*/
|
||||
@Local(value = ServerResource.class)
|
||||
public abstract class CitrixResourceBase implements ServerResource {
|
||||
public abstract class CitrixResourceBase implements ServerResource, HypervisorResource {
|
||||
private static final Logger s_logger = Logger.getLogger(CitrixResourceBase.class);
|
||||
protected static final XenServerConnectionPool _connPool = XenServerConnectionPool.getInstance();
|
||||
protected static final int MB = 1024 * 1024;
|
||||
@ -376,7 +377,6 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
|
||||
@Override
|
||||
public Answer executeRequest(Command cmd) {
|
||||
|
||||
if (cmd instanceof CreateCommand) {
|
||||
return execute((CreateCommand) cmd);
|
||||
} else if (cmd instanceof SetPortForwardingRulesCommand) {
|
||||
@ -1006,7 +1006,8 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
}
|
||||
}
|
||||
|
||||
protected StartAnswer execute(StartCommand cmd) {
|
||||
@Override
|
||||
public StartAnswer execute(StartCommand cmd) {
|
||||
Connection conn = getConnection();
|
||||
VirtualMachineTO vmSpec = cmd.getVirtualMachine();
|
||||
String vmName = vmSpec.getName();
|
||||
@ -2575,7 +2576,8 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
return NumbersUtil.parseInt(vncport, -1);
|
||||
}
|
||||
|
||||
protected Answer execute(final RebootCommand cmd) {
|
||||
@Override
|
||||
public RebootAnswer execute(RebootCommand cmd) {
|
||||
Connection conn = getConnection();
|
||||
synchronized (_vms) {
|
||||
_vms.put(cmd.getVmName(), State.Starting);
|
||||
@ -2617,7 +2619,7 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
bytesSent = stats[0];
|
||||
bytesRcvd = stats[1];
|
||||
}
|
||||
RebootAnswer answer = (RebootAnswer) execute((RebootCommand) cmd);
|
||||
RebootAnswer answer = execute((RebootCommand) cmd);
|
||||
answer.setBytesSent(bytesSent);
|
||||
answer.setBytesReceived(bytesRcvd);
|
||||
if (answer.getResult()) {
|
||||
@ -2952,8 +2954,9 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected StopAnswer execute(final StopCommand cmd) {
|
||||
|
||||
@Override
|
||||
public StopAnswer execute(StopCommand cmd) {
|
||||
Connection conn = getConnection();
|
||||
String vmName = cmd.getVmName();
|
||||
try {
|
||||
@ -3082,7 +3085,7 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
}
|
||||
return new StopAnswer(cmd, "Stop VM failed");
|
||||
}
|
||||
|
||||
|
||||
private List<VDI> getVdis(Connection conn, VM vm) {
|
||||
List<VDI> vdis = new ArrayList<VDI>();
|
||||
try {
|
||||
|
||||
@ -40,35 +40,33 @@ public interface ServerResource extends Manager {
|
||||
* Generate a startup command containing information regarding the resource.
|
||||
* @return StartupCommand ready to be sent to the management server.
|
||||
*/
|
||||
public StartupCommand[] initialize();
|
||||
StartupCommand[] initialize();
|
||||
|
||||
/**
|
||||
* @param id id of the server to put in the PingCommand
|
||||
* @return PingCommand
|
||||
*/
|
||||
public PingCommand getCurrentStatus(long id);
|
||||
PingCommand getCurrentStatus(long id);
|
||||
|
||||
/**
|
||||
* Execute the request coming from the computing server.
|
||||
* @param cmd Command to execute.
|
||||
* @return Answer
|
||||
*/
|
||||
public Answer executeRequest(Command cmd);
|
||||
|
||||
// public void revertRequest(Command cmd, Answer answer);
|
||||
Answer executeRequest(Command cmd);
|
||||
|
||||
/**
|
||||
* disconnected() is called when the connection is down between the
|
||||
* agent and the management server. If there are any cleanups, this
|
||||
* is the time to do it.
|
||||
*/
|
||||
public void disconnected();
|
||||
void disconnected();
|
||||
|
||||
/**
|
||||
* This is added to allow calling agent control service from within the resource
|
||||
* @return
|
||||
*/
|
||||
public IAgentControl getAgentControl();
|
||||
IAgentControl getAgentControl();
|
||||
|
||||
public void setAgentControl(IAgentControl agentControl);
|
||||
void setAgentControl(IAgentControl agentControl);
|
||||
}
|
||||
|
||||
@ -189,7 +189,8 @@ CREATE TABLE `cloud`.`networks` (
|
||||
CONSTRAINT `fk_networks__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`),
|
||||
CONSTRAINT `fk_networks__related` FOREIGN KEY(`related`) REFERENCES `networks`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_networks__account_id` FOREIGN KEY(`account_id`) REFERENCES `account`(`id`),
|
||||
CONSTRAINT `fk_networks__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain`(`id`)
|
||||
CONSTRAINT `fk_networks__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain`(`id`),
|
||||
INDEX `i_networks__removed`(`removed`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`account_network_ref` (
|
||||
@ -237,7 +238,8 @@ CREATE TABLE `cloud`.`nics` (
|
||||
`removed` datetime COMMENT 'date removed if not null',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_nics__instance_id` FOREIGN KEY `fk_nics__instance_id`(`instance_id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_nics__networks_id` FOREIGN KEY `fk_nics__networks_id`(`network_id`) REFERENCES `networks`(`id`)
|
||||
CONSTRAINT `fk_nics__networks_id` FOREIGN KEY `fk_nics__networks_id`(`network_id`) REFERENCES `networks`(`id`),
|
||||
INDEX `i_nics__removed`(`removed`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`network_offerings` (
|
||||
@ -264,7 +266,8 @@ CREATE TABLE `cloud`.`network_offerings` (
|
||||
`vpn_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if network offering provides vpn service',
|
||||
`dhcp_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if network offering provides dhcp service',
|
||||
`guest_type` char(32) COMMENT 'guest ip type of network offering',
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `i_network_offerings__removed`(`removed`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`cluster` (
|
||||
@ -435,7 +438,7 @@ CREATE TABLE `cloud`.`vlan` (
|
||||
`data_center_id` bigint unsigned NOT NULL,
|
||||
`network_id` bigint unsigned NOT NULL COMMENT 'id of corresponding network offering',
|
||||
PRIMARY KEY (`id`),
|
||||
# CONSTRAINT `fk_vlan__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`),
|
||||
CONSTRAINT `fk_vlan__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`),
|
||||
CONSTRAINT `fk_vlan__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
@ -856,7 +856,6 @@ public class ComponentLocator implements ComponentLocatorMBean {
|
||||
if (info.name == null) {
|
||||
throw new CloudRuntimeException("Missing name attribute for " + interphace.getName());
|
||||
}
|
||||
info.name = info.name;
|
||||
s_logger.debug("Looking for class " + clazzName);
|
||||
try {
|
||||
info.clazz = Class.forName(clazzName);
|
||||
@ -869,6 +868,10 @@ public class ComponentLocator implements ComponentLocatorMBean {
|
||||
if (!interphace.isAssignableFrom(info.clazz)) {
|
||||
throw new CloudRuntimeException("Class " + info.clazz.toString() + " does not implment " + interphace);
|
||||
}
|
||||
String singleton = getAttribute(atts, "singleton");
|
||||
if (singleton != null) {
|
||||
info.singleton = Boolean.parseBoolean(singleton);
|
||||
}
|
||||
|
||||
info.fillInfo();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user