> + > Template template) { > + CloudSigma2TemplateOptions options = > template.getOptions().as(CloudSigma2TemplateOptions.class); > + Image image = template.getImage(); > + Hardware hardware = template.getHardware(); > + > + DriveInfo drive = api.getLibraryDrive(image.getProviderId()); > + > + if (!drive.getMedia().equals(MediaType.CDROM)) { > + logger.debug(">> cloning library drive %s...", > image.getProviderId()); > + > + drive = api.cloneLibraryDrive(image.getProviderId(), null); > + driveCloned.apply(drive); > + > + // Refresh the drive object and verify the clone operation didn't > time out > + drive = api.getDriveInfo(drive.getUuid()); > + checkState(drive.getStatus() == DriveStatus.UNMOUNTED, "Resource is > in invalid status: %s", drive.getStatus());
You're right @demobox. Instead of directly using `checkState` which will throw an exception, the state should be checked and the cloned drive deleted before failing, to avoid leaving "orphan" drives there. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds-labs/pull/70/files#r18021320