Search in sources :

Example 1 with SavePasswordCommand

use of com.cloud.legacymodel.communication.command.SavePasswordCommand in project cosmic by MissionCriticalCloud.

the class SavePasswordConfigItem method generateConfig.

@Override
public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) {
    final SavePasswordCommand command = (SavePasswordCommand) cmd;
    final VmPassword vmPassword = new VmPassword(command.getVmIpAddress(), command.getPassword());
    return generateConfigItems(vmPassword);
}
Also used : VmPassword(com.cloud.legacymodel.network.rules.VmPassword) SavePasswordCommand(com.cloud.legacymodel.communication.command.SavePasswordCommand)

Example 2 with SavePasswordCommand

use of com.cloud.legacymodel.communication.command.SavePasswordCommand in project cosmic by MissionCriticalCloud.

the class CommandSetupHelper method createPasswordCommand.

public void createPasswordCommand(final VirtualRouter router, final VirtualMachineProfile profile, final NicVO nic, final Commands cmds) {
    final String password = (String) profile.getParameter(VirtualMachineProfile.Param.VmPassword);
    final Zone zone = zoneRepository.findById(router.getDataCenterId()).orElse(null);
    // password should be set only on default network element
    if (password != null && nic.isDefaultNic()) {
        final SavePasswordCommand cmd = new SavePasswordCommand(password, nic.getIPv4Address(), profile.getVirtualMachine().getHostName(), _networkModel.getExecuteInSeqNtwkElmtCmd());
        cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
        cmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
        cmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, zone.getNetworkType().toString());
        cmds.addCommand("password", cmd);
    }
}
Also used : Zone(com.cloud.db.model.Zone) SavePasswordCommand(com.cloud.legacymodel.communication.command.SavePasswordCommand)

Aggregations

SavePasswordCommand (com.cloud.legacymodel.communication.command.SavePasswordCommand)2 Zone (com.cloud.db.model.Zone)1 VmPassword (com.cloud.legacymodel.network.rules.VmPassword)1