Search in sources :

Example 1 with Agent

use of org.ovirt.engine.api.model.Agent in project ovirt-engine by oVirt.

the class V3AgentInAdapter method adapt.

@Override
public Agent adapt(V3Agent from) {
    Agent to = new Agent();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAddress()) {
        to.setAddress(from.getAddress());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetConcurrent()) {
        to.setConcurrent(from.isConcurrent());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetEncryptOptions()) {
        to.setEncryptOptions(from.isEncryptOptions());
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetOptions()) {
        to.setOptions(new Options());
        to.getOptions().getOptions().addAll(adaptIn(from.getOptions().getOptions()));
    }
    if (from.isSetOrder()) {
        to.setOrder(from.getOrder());
    }
    if (from.isSetPassword()) {
        to.setPassword(from.getPassword());
    }
    if (from.isSetPort()) {
        to.setPort(from.getPort());
    }
    if (from.isSetType()) {
        to.setType(from.getType());
    }
    if (from.isSetUsername()) {
        to.setUsername(from.getUsername());
    }
    return to;
}
Also used : Agent(org.ovirt.engine.api.model.Agent) V3Agent(org.ovirt.engine.api.v3.types.V3Agent) Options(org.ovirt.engine.api.model.Options)

Example 2 with Agent

use of org.ovirt.engine.api.model.Agent in project ovirt-engine by oVirt.

the class FenceOptionsParser method parse.

/* Format of @str is <agent>;<agent>;...
     * Format of @typeStr is <name>=<type>,<name=type>,...
     */
public static List<Agent> parse(String str, String typeStr, boolean ignoreValues) {
    List<Agent> ret = new ArrayList<>();
    Map<String, String> types = parseTypes(typeStr);
    for (String agent : str.split(";", -1)) {
        if (!agent.isEmpty()) {
            Agent parsedAgent = parseAgent(agent, types, ignoreValues);
            if (parsedAgent != null) {
                ret.add(parsedAgent);
            }
        }
    }
    return ret;
}
Also used : Agent(org.ovirt.engine.api.model.Agent) ArrayList(java.util.ArrayList)

Example 3 with Agent

use of org.ovirt.engine.api.model.Agent in project ovirt-engine by oVirt.

the class FenceOptionsParser method parseAgent.

/* Format is <agent>:<name=value>,<name=value>,...
     *
     * e.g. alom:secure=secure,port=ipport
     */
private static Agent parseAgent(String str, Map<String, String> types, boolean ignoreValues) {
    String[] parts = str.split(":", -1);
    if (parts.length != 2) {
        log.error("Invalid fencing agent description \"{}\".", str);
        return null;
    }
    Agent ret = new Agent();
    ret.setType(parts[0]);
    ret.setOptions(parseOptions(parts[1], types, ignoreValues));
    return ret;
}
Also used : Agent(org.ovirt.engine.api.model.Agent)

Example 4 with Agent

use of org.ovirt.engine.api.model.Agent in project ovirt-engine by oVirt.

the class BackendFenceAgentsResource method mapCollection.

private Agents mapCollection(List<FenceAgent> fenceAgents) {
    Agents agents = new Agents();
    for (FenceAgent fenceAgent : fenceAgents) {
        Agent agent = map(fenceAgent, null);
        agents.getAgents().add(addLinks(populate(agent, fenceAgent)));
    }
    return agents;
}
Also used : Agent(org.ovirt.engine.api.model.Agent) FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent) Agents(org.ovirt.engine.api.model.Agents) FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent)

Aggregations

Agent (org.ovirt.engine.api.model.Agent)4 ArrayList (java.util.ArrayList)1 Agents (org.ovirt.engine.api.model.Agents)1 Options (org.ovirt.engine.api.model.Options)1 V3Agent (org.ovirt.engine.api.v3.types.V3Agent)1 FenceAgent (org.ovirt.engine.core.common.businessentities.pm.FenceAgent)1