@Override public void destroyNode(String id) { ServerInfo server = getNode(id); if (server != null) { client.stopServer(id); client.destroyServer(id); for (Device dev : server.getDevices().values()) client.destroyDrive(dev.getDriveUuid()); } }
@Override public Volume apply(Device input) { VolumeBuilder builder = new VolumeBuilder(); builder.id(input.getId()); DriveInfo drive = cache.get(input.getDriveUuid()); if (drive != null) { builder.size(drive.getSize() / 1024 / 1024f); } return new VolumeBuilder().durable(true).type(Volume.Type.NAS).build(); }
@Override public String apply(Server from) { String imageId = null; String bootDeviceId = Iterables.get(from.getBootDeviceIds(), 0); Device bootDevice = from.getDevices().get(bootDeviceId); if (bootDevice != null) { try { imageId = cache.get(bootDevice.getDriveUuid()).getName(); } catch (NullPointerException e) { } } return imageId; }