You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by GitBox <gi...@apache.org> on 2020/11/30 15:40:41 UTC

[GitHub] [brooklyn-server] grkvlt commented on a change in pull request #1128: add interfaces to MachineManagementMixins for shutdown/startup/reboot…

grkvlt commented on a change in pull request #1128:
URL: https://github.com/apache/brooklyn-server/pull/1128#discussion_r532688887



##########
File path: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
##########
@@ -20,6 +20,7 @@
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
+import org.apache.brooklyn.api.location.MachineManagementMixins.MachineMetadata;

Review comment:
       Reorg imports?

##########
File path: locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
##########
@@ -1256,6 +1257,39 @@ public JcloudsMachineLocation resumeMachine(Map<?, ?> flags) {
         return registered;
     }
 
+    @Override
+    public void shutdownMachine(MachineLocation l) {
+        // jclouds doesn't expose shutdown so just do a suspend
+        suspendMachine(l);
+    }
+
+    @Override
+    public MachineLocation startupMachine(MachineLocation l) {
+        if (!(l instanceof JcloudsSshMachineLocation)) {
+            throw new IllegalStateException("Cannot startup machine "+l+"; wrong type");
+        }
+        return resumeMachine(ImmutableMap.of("id", ((JcloudsSshMachineLocation)l).getJcloudsId()));
+    }
+
+    @Override
+    public MachineLocation rebootMachine(MachineLocation l) {
+        if (!(l instanceof JcloudsSshMachineLocation)) {
+            throw new IllegalStateException("Cannot startup machine "+l+"; wrong type");
+        }
+        getComputeService().rebootNode(((JcloudsSshMachineLocation)l).getJcloudsId());
+        return l;
+    }
+
+    @Override
+    public Map<String, Object> getMachineMetrics(MachineLocation l) {
+        return MutableMap.of();

Review comment:
       Why mutable? I would assume there is no expectation the recipient can modify this?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org