aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-07-15 09:52:33 +0200
committerMartin Polden <mpolden@mpolden.no>2021-07-16 09:02:31 +0200
commit6a558ebb82bb58b42990ff7dad8af35c70812424 (patch)
tree95d0bf6ea0b319333b388b5d8ce32072f6cf3ab6 /controller-api
parent073c5be0df2970bd4e6d926a56d14657965992d3 (diff)
Stop using NodeRepositoryNode in patch operations
Diffstat (limited to 'controller-api')
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java20
-rw-r--r--controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/vcmr/VCMRReport.java11
2 files changed, 19 insertions, 12 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java
index 3c16eac06c7..69a34ba46ce 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java
@@ -8,7 +8,6 @@ import com.yahoo.config.provision.NodeType;
import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeRepositoryNode;
-import com.yahoo.vespa.hosted.controller.api.integration.noderepository.NodeState;
import java.net.URI;
import java.time.Duration;
@@ -30,7 +29,7 @@ public interface NodeRepository {
void deleteNode(ZoneId zone, String hostname);
- void setState(ZoneId zone, NodeState nodeState, String hostname);
+ void setState(ZoneId zone, Node.State nodeState, String hostname);
Node getNode(ZoneId zone, String hostname);
@@ -78,13 +77,22 @@ public interface NodeRepository {
/** Cancels firmware checks on all hosts in the given zone. */
void cancelFirmwareCheck(ZoneId zone);
- void retireAndDeprovision(ZoneId zoneId, String hostName);
+ /** Retire given node */
+ void retire(ZoneId zone, String hostname, boolean wantToRetire, boolean wantToDeprovision);
- void patchNode(ZoneId zoneId, String hostName, NodeRepositoryNode node);
+ /** Update reports for given node. A key with null value clears that report */
+ void updateReports(ZoneId zone, String hostname, Map<String, String> reports);
- void reboot(ZoneId zoneId, String hostName);
+ /** Update hardware model */
+ void updateModel(ZoneId zone, String hostname, String modelName);
+
+ /** Update switch hostname */
+ void updateSwitchHostname(ZoneId zone, String hostname, String switchHostname);
+
+ /** Schedule reboot of given node */
+ void reboot(ZoneId zone, String hostname);
/** Checks whether the zone has the spare capacity to remove the given hosts */
- boolean isReplaceable(ZoneId zoneId, List<HostName> hostNames);
+ boolean isReplaceable(ZoneId zone, List<HostName> hostnames);
}
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/vcmr/VCMRReport.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/vcmr/VCMRReport.java
index 8ebfde9f475..3597c7eb009 100644
--- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/vcmr/VCMRReport.java
+++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/vcmr/VCMRReport.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.controller.api.integration.vcmr;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.yahoo.vespa.hosted.controller.api.integration.configserver.Node;
@@ -80,11 +79,11 @@ public class VCMRReport {
* Set report to 'null' if list is empty - clearing the report
* See NodePatcher in node-repository
*/
- public Map<String, JsonNode> toNodeReports() {
- Map<String, JsonNode> reports = new HashMap<>();
- JsonNode jsonNode = vcmrs.isEmpty() ?
- null : uncheck(() -> objectMapper.valueToTree(this));
- reports.put(REPORT_ID, jsonNode);
+ public Map<String, String> toNodeReports() {
+ Map<String, String> reports = new HashMap<>();
+ String json = vcmrs.isEmpty() ?
+ null : uncheck(() -> objectMapper.valueToTree(this).toString());
+ reports.put(REPORT_ID, json);
return reports;
}