jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Turli <notificati...@github.com>
Subject Re: [jclouds/jclouds-labs] JCLOUDS-1274: Delete managed disks when cleaning up VM resources (#387)
Date Wed, 26 Apr 2017 21:29:54 GMT
andreaturli commented on this pull request.



> +      deleteJobs.add(deleteManagedDisk(osDisk.managedDiskParameters()));
+
+      for (DataDisk dataDisk : virtualMachine.properties().storageProfile().dataDisks())
{
+         deleteJobs.add(deleteManagedDisk(dataDisk.managedDiskParameters()));
+      }
+
+      return all(filter(deleteJobs, notNull()), resourceDeleted);
+   }
+   
+   @Nullable
+   private URI deleteManagedDisk(@Nullable ManagedDiskParameters managedDisk) {
+      if (managedDisk != null) {
+         IdReference diskRef = IdReference.create(managedDisk.id());
+         logger.debug(">> deleting managed disk %s...", diskRef.name());
+         return api.getDiskApi(diskRef.resourceGroup()).delete(diskRef.name());
+      }

maybe we can `log.warn` that the disk didn't get deleted?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/387#pullrequestreview-34968139
Mime
View raw message