Search in sources :

Example 1 with ClusterVMMetaDataSyncAnswer

use of com.cloud.agent.api.ClusterVMMetaDataSyncAnswer in project cloudstack by apache.

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 : MigrateVmToPoolAnswer(com.cloud.agent.api.MigrateVmToPoolAnswer) StopAnswer(com.cloud.agent.api.StopAnswer) Answer(com.cloud.agent.api.Answer) UnPlugNicAnswer(com.cloud.agent.api.UnPlugNicAnswer) AgentControlAnswer(com.cloud.agent.api.AgentControlAnswer) RebootAnswer(com.cloud.agent.api.RebootAnswer) StartAnswer(com.cloud.agent.api.StartAnswer) ReplugNicAnswer(com.cloud.agent.api.ReplugNicAnswer) RestoreVMSnapshotAnswer(com.cloud.agent.api.RestoreVMSnapshotAnswer) PlugNicAnswer(com.cloud.agent.api.PlugNicAnswer) ClusterVMMetaDataSyncAnswer(com.cloud.agent.api.ClusterVMMetaDataSyncAnswer) CheckVirtualMachineAnswer(com.cloud.agent.api.CheckVirtualMachineAnswer) PrepareForMigrationAnswer(com.cloud.agent.api.PrepareForMigrationAnswer) ClusterVMMetaDataSyncAnswer(com.cloud.agent.api.ClusterVMMetaDataSyncAnswer)

Example 2 with ClusterVMMetaDataSyncAnswer

use of com.cloud.agent.api.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 (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.agent.api.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 3 with ClusterVMMetaDataSyncAnswer

use of com.cloud.agent.api.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 : AgentControlAnswer(com.cloud.agent.api.AgentControlAnswer) RebootAnswer(com.cloud.agent.api.RebootAnswer) StartAnswer(com.cloud.agent.api.StartAnswer) RestoreVMSnapshotAnswer(com.cloud.agent.api.RestoreVMSnapshotAnswer) PlugNicAnswer(com.cloud.agent.api.PlugNicAnswer) StopAnswer(com.cloud.agent.api.StopAnswer) Answer(com.cloud.agent.api.Answer) UnPlugNicAnswer(com.cloud.agent.api.UnPlugNicAnswer) ClusterVMMetaDataSyncAnswer(com.cloud.agent.api.ClusterVMMetaDataSyncAnswer) CheckVirtualMachineAnswer(com.cloud.agent.api.CheckVirtualMachineAnswer) ClusterVMMetaDataSyncAnswer(com.cloud.agent.api.ClusterVMMetaDataSyncAnswer)

Example 4 with ClusterVMMetaDataSyncAnswer

use of com.cloud.agent.api.ClusterVMMetaDataSyncAnswer in project cloudstack by apache.

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 Throwable 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.agent.api.ClusterVMMetaDataSyncAnswer) Connection(com.xensource.xenapi.Connection) Pool(com.xensource.xenapi.Pool) Host(com.xensource.xenapi.Host)

Aggregations

ClusterVMMetaDataSyncAnswer (com.cloud.agent.api.ClusterVMMetaDataSyncAnswer)4 AgentControlAnswer (com.cloud.agent.api.AgentControlAnswer)2 Answer (com.cloud.agent.api.Answer)2 CheckVirtualMachineAnswer (com.cloud.agent.api.CheckVirtualMachineAnswer)2 PlugNicAnswer (com.cloud.agent.api.PlugNicAnswer)2 RebootAnswer (com.cloud.agent.api.RebootAnswer)2 RestoreVMSnapshotAnswer (com.cloud.agent.api.RestoreVMSnapshotAnswer)2 StartAnswer (com.cloud.agent.api.StartAnswer)2 StopAnswer (com.cloud.agent.api.StopAnswer)2 UnPlugNicAnswer (com.cloud.agent.api.UnPlugNicAnswer)2 Connection (com.xensource.xenapi.Connection)2 Host (com.xensource.xenapi.Host)2 Pool (com.xensource.xenapi.Pool)2 MigrateVmToPoolAnswer (com.cloud.agent.api.MigrateVmToPoolAnswer)1 PrepareForMigrationAnswer (com.cloud.agent.api.PrepareForMigrationAnswer)1 ReplugNicAnswer (com.cloud.agent.api.ReplugNicAnswer)1 XenAPIException (com.xensource.xenapi.Types.XenAPIException)1 XmlRpcException (org.apache.xmlrpc.XmlRpcException)1