private void generateDownloadManifests(final String imageId) {
   // lookup all reservations that reference the newly available image id
   final List<VmInstance> pendingInstances =
       VmInstances.list(
           new Predicate<VmInstance>() {
             @Override
             public boolean apply(VmInstance arg0) {
               return imageId.equals(arg0.getBootRecord().getMachineImageId())
                   && VmState.PENDING.equals(arg0.getState());
             }
           });
   for (final VmInstance instance : pendingInstances) {
     final String reservationId = instance.getReservationId();
     final String partitionName = instance.getPartition();
     final Partition partition = Partitions.lookupByName(partitionName);
     final MachineImageInfo machineImage = LookupMachine.INSTANCE.apply(imageId);
     try {
       final String manifestLocation =
           DownloadManifestFactory.generateDownloadManifest(
               new ImageManifestFile(
                   machineImage.getRunManifestLocation(), BundleImageManifest.INSTANCE),
               partition.getNodeCertificate().getPublicKey(),
               reservationId);
       LOG.debug(
           String.format(
               "Generated download manifest for instance %s", instance.getDisplayName()));
     } catch (final Exception ex) {
       LOG.error(
           String.format(
               "Failed to generate download manifest for instance %s", instance.getDisplayName()),
           ex);
     }
   }
 }
Exemplo n.º 2
0
 public void setRootDirective() {
   if (!bootSet.isBlockStorage()) {
     try {
       final MachineImageInfo emi = LookupMachine.INSTANCE.apply(this.getRequest().getImageId());
       rootDirective = emi.getRootDirective();
     } catch (Exception ex) {
     }
   }
 }