Search in sources :

Example 1 with ClusterVMMetaDataSyncAnswer

use of com.cloud.legacymodel.communication.answer.ClusterVMMetaDataSyncAnswer in project cosmic by MissionCriticalCloud.

the class CitrixClusterVMMetaDataSyncCommandWrapper method execute.

@Override
public Answer execute(final ClusterVMMetaDataSyncCommand command, final CitrixResourceBase citrixResourceBase) {
    final Connection conn = citrixResourceBase.getConnection();
    // check if this is master
    try {
        final Pool pool = Pool.getByUuid(conn, citrixResourceBase.getHost().getPool());
        final Pool.Record poolr = pool.getRecord(conn);
        final Host.Record hostr = poolr.master.getRecord(conn);
        if (!citrixResourceBase.getHost().getUuid().equals(hostr.uuid)) {
            return new ClusterVMMetaDataSyncAnswer(command.getClusterId(), null);
        }
    } catch (final XmlRpcException | XenAPIException e) {
        s_logger.warn("Check for master failed, failing the Cluster sync VMMetaData command");
        return new ClusterVMMetaDataSyncAnswer(command.getClusterId(), null);
    }
    final HashMap<String, String> vmMetadatum = citrixResourceBase.clusterVMMetaDataSync(conn);
    return new ClusterVMMetaDataSyncAnswer(command.getClusterId(), vmMetadatum);
}
Also used : ClusterVMMetaDataSyncAnswer(com.cloud.legacymodel.communication.answer.ClusterVMMetaDataSyncAnswer) Connection(com.xensource.xenapi.Connection) XenAPIException(com.xensource.xenapi.Types.XenAPIException) Pool(com.xensource.xenapi.Pool) Host(com.xensource.xenapi.Host) XmlRpcException(org.apache.xmlrpc.XmlRpcException)

Example 2 with ClusterVMMetaDataSyncAnswer

use of com.cloud.legacymodel.communication.answer.ClusterVMMetaDataSyncAnswer in project cosmic by MissionCriticalCloud.

the class VirtualMachineManagerImpl method processAnswers.

@Override
public boolean processAnswers(final long agentId, final long seq, final Answer[] answers) {
    for (final Answer answer : answers) {
        if (answer instanceof ClusterVMMetaDataSyncAnswer) {
            final ClusterVMMetaDataSyncAnswer cvms = (ClusterVMMetaDataSyncAnswer) answer;
            if (!cvms.isExecuted()) {
                syncVMMetaData(cvms.getVMMetaDatum());
                cvms.setExecuted();
            }
        }
    }
    return true;
}
Also used : UnPlugNicAnswer(com.cloud.legacymodel.communication.answer.UnPlugNicAnswer) AgentControlAnswer(com.cloud.legacymodel.communication.answer.AgentControlAnswer) ClusterVMMetaDataSyncAnswer(com.cloud.legacymodel.communication.answer.ClusterVMMetaDataSyncAnswer) RestoreVMSnapshotAnswer(com.cloud.legacymodel.communication.answer.RestoreVMSnapshotAnswer) RebootAnswer(com.cloud.legacymodel.communication.answer.RebootAnswer) StartAnswer(com.cloud.legacymodel.communication.answer.StartAnswer) PlugNicAnswer(com.cloud.legacymodel.communication.answer.PlugNicAnswer) CheckVirtualMachineAnswer(com.cloud.legacymodel.communication.answer.CheckVirtualMachineAnswer) StopAnswer(com.cloud.legacymodel.communication.answer.StopAnswer) Answer(com.cloud.legacymodel.communication.answer.Answer) ClusterVMMetaDataSyncAnswer(com.cloud.legacymodel.communication.answer.ClusterVMMetaDataSyncAnswer)

Aggregations

ClusterVMMetaDataSyncAnswer (com.cloud.legacymodel.communication.answer.ClusterVMMetaDataSyncAnswer)2 AgentControlAnswer (com.cloud.legacymodel.communication.answer.AgentControlAnswer)1 Answer (com.cloud.legacymodel.communication.answer.Answer)1 CheckVirtualMachineAnswer (com.cloud.legacymodel.communication.answer.CheckVirtualMachineAnswer)1 PlugNicAnswer (com.cloud.legacymodel.communication.answer.PlugNicAnswer)1 RebootAnswer (com.cloud.legacymodel.communication.answer.RebootAnswer)1 RestoreVMSnapshotAnswer (com.cloud.legacymodel.communication.answer.RestoreVMSnapshotAnswer)1 StartAnswer (com.cloud.legacymodel.communication.answer.StartAnswer)1 StopAnswer (com.cloud.legacymodel.communication.answer.StopAnswer)1 UnPlugNicAnswer (com.cloud.legacymodel.communication.answer.UnPlugNicAnswer)1 Connection (com.xensource.xenapi.Connection)1 Host (com.xensource.xenapi.Host)1 Pool (com.xensource.xenapi.Pool)1 XenAPIException (com.xensource.xenapi.Types.XenAPIException)1 XmlRpcException (org.apache.xmlrpc.XmlRpcException)1