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);
}
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;
}
Aggregations