[GitHub] cloudstack pull request #1913: CLOUDSTACK-9752: [Vmware] Optimization of vol...
Github user asfgit closed the pull request at: https://github.com/apache/cloudstack/pull/1913 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] cloudstack pull request #1913: CLOUDSTACK-9752: [Vmware] Optimization of vol...
Github user karuturi commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1913#discussion_r101452884 --- Diff: plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java --- @@ -1577,11 +1577,15 @@ public Answer createVolume(CreateObjectCommand cmd) { } synchronized (this) { -// s_logger.info("Delete file if exists in datastore to clear the way for creating the volume. file: " + volumeDatastorePath); -VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, volumeUuid.toString(), dcMo); - -vmMo.createDisk(volumeDatastorePath, (int)(volume.getSize() / (1024L * 1024L)), morDatastore, vmMo.getScsiDeviceControllerKey()); -vmMo.detachDisk(volumeDatastorePath, false); +try { +vmMo.createDisk(volumeDatastorePath, (int)(volume.getSize() / (1024L * 1024L)), morDatastore, vmMo.getScsiDeviceControllerKey()); +vmMo.detachDisk(volumeDatastorePath, false); +} +catch (Exception e) { +s_logger.error("Deleting file " + volumeDatastorePath + " due to error: " + e.getMessage()); + VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, volumeUuid.toString(), dcMo); --- End diff -- This Looks good. Thanks for the update @nvazquez --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] cloudstack pull request #1913: CLOUDSTACK-9752: [Vmware] Optimization of vol...
Github user nvazquez commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1913#discussion_r100543231 --- Diff: plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java --- @@ -1577,11 +1577,15 @@ public Answer createVolume(CreateObjectCommand cmd) { } synchronized (this) { -// s_logger.info("Delete file if exists in datastore to clear the way for creating the volume. file: " + volumeDatastorePath); -VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, volumeUuid.toString(), dcMo); - -vmMo.createDisk(volumeDatastorePath, (int)(volume.getSize() / (1024L * 1024L)), morDatastore, vmMo.getScsiDeviceControllerKey()); -vmMo.detachDisk(volumeDatastorePath, false); +try { +vmMo.createDisk(volumeDatastorePath, (int)(volume.getSize() / (1024L * 1024L)), morDatastore, vmMo.getScsiDeviceControllerKey()); +vmMo.detachDisk(volumeDatastorePath, false); +} +catch (Exception e) { +s_logger.error("Deleting file " + volumeDatastorePath + " due to error: " + e.getMessage()); + VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, volumeUuid.toString(), dcMo); --- End diff -- Hi @syed @karuturi @SudharmaJain, What do you think about this approach? We will delete vmdk file if either createDisk or detachDisk fails, this way we make sure file doesn't exist in case that CloudStack retries operation. By the way, in VolumeOrchestrator lines 556-588 there's the retry logic, to retry only if failure contains "request template reload": for (int i = 0; i < 2; i++) { // retry one more time in case of template reload is required for Vmware case AsyncCallFuture future = null; boolean isNotCreatedFromTemplate = volume.getTemplateId() == null ? true : false; if (isNotCreatedFromTemplate) { future = volService.createVolumeAsync(volume, store); } else { TemplateInfo templ = tmplFactory.getTemplate(template.getId(), DataStoreRole.Image); future = volService.createVolumeFromTemplateAsync(volume, store.getId(), templ); } try { VolumeApiResult result = future.get(); if (result.isFailed()) { if (result.getResult().contains("request template reload") && (i == 0)) { s_logger.debug("Retry template re-deploy for vmware"); continue; } else { s_logger.debug("create volume failed: " + result.getResult()); throw new CloudRuntimeException("create volume failed:" + result.getResult()); } } return result.getVolume(); } catch (InterruptedException e) { s_logger.error("create volume failed", e); throw new CloudRuntimeException("create volume failed", e); } catch (ExecutionException e) { s_logger.error("create volume failed", e); throw new CloudRuntimeException("create volume failed", e); } } throw new CloudRuntimeException("create volume failed even after template re-deploy"); } To preserve this logic is that I've passed caught exception message on thrown exception in line 1587. Do you agree with this solution? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] cloudstack pull request #1913: CLOUDSTACK-9752: [Vmware] Optimization of vol...
Github user syed commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1913#discussion_r98365757 --- Diff: plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java --- @@ -1577,9 +1577,6 @@ public Answer createVolume(CreateObjectCommand cmd) { } synchronized (this) { -// s_logger.info("Delete file if exists in datastore to clear the way for creating the volume. file: " + volumeDatastorePath); -VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, volumeUuid.toString(), dcMo); - vmMo.createDisk(volumeDatastorePath, (int)(volume.getSize() / (1024L * 1024L)), morDatastore, vmMo.getScsiDeviceControllerKey()); vmMo.detachDisk(volumeDatastorePath, false); --- End diff -- Is there a possibility that `detachDisk` might fail? In that case, we would require the above check to be performed as Cloudstack would retry the operation. Same in the `finally` clause --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] cloudstack pull request #1913: CLOUDSTACK-9752: [Vmware] Optimization of vol...
GitHub user nvazquez opened a pull request: https://github.com/apache/cloudstack/pull/1913 CLOUDSTACK-9752: [Vmware] Optimization of volume attachness to vm ## Description This optimization aims to reduce volume attach slowness due to vmdk files search on datastore before creating the volume (search for `.vmdk`, `-flat.vmdk` and `-delta.vmdk` files to delete them if they exist). This search is not necessary when attaching a volume in Allocated state, due to volume files don't exist on datastore. On large datastores, this search can cause volume attachness to be really slow, as we can see in this log lines: 13-mgmt.log:2016-11-02 10:16:33,136 INFO [vmware.mo.DatastoreMO] (DirectAgent-931:ctx-5687d68e uscrlpdcsesx240.ads.autodesk.com, job-8675314/job-8675315, cmd: CreateObjectCommand) Searching file 9ce7731fd38b4045afbb7ce9754abbc1.vmdk in [b5ebda046d613e079b5874b169cd848f] 13-mgmt.log:2016-11-02 10:19:42,567 WARN [storage.resource.VmwareStorageLayoutHelper] (DirectAgent-931:ctx-5687d68e uscrlpdcsesx240.ads.autodesk.com, job-8675314/job-8675315, cmd: CreateObjectCommand) Unable to locate VMDK file: 9ce7731fd38b4045afbb7ce9754abbc1.vmdk 13-mgmt.log:2016-11-02 10:19:42,719 INFO [vmware.mo.DatastoreMO] (DirectAgent-931:ctx-5687d68e uscrlpdcsesx240.ads.autodesk.com, job-8675314/job-8675315, cmd: CreateObjectCommand) Search file 9ce7731fd38b4045afbb7ce9754abbc1-flat.vmdk on [b5ebda046d613e079b5874b169cd848f] ⦠13-mgmt.log:2016-11-02 10:19:44,399 INFO [vmware.mo.DatastoreMO] (DirectAgent-931:ctx-5687d68e uscrlpdcsesx240.ads.autodesk.com, job-8675314/job-8675315, cmd: CreateObjectCommand) Searching file 9ce7731fd38b4045afbb7ce9754abbc1-flat.vmdk in [b5ebda046d613e079b5874b169cd848f] 13-mgmt.log:2016-11-02 10:22:07,581 WARN [storage.resource.VmwareStorageLayoutHelper] (DirectAgent-931:ctx-5687d68e uscrlpdcsesx240.ads.autodesk.com, job-8675314/job-8675315, cmd: CreateObjectCommand) Unable to locate VMDK file: 9ce7731fd38b4045afbb7ce9754abbc1-flat.vmdk 13-mgmt.log:2016-11-02 10:22:07,731 INFO [vmware.mo.DatastoreMO] (DirectAgent-931:ctx-5687d68e uscrlpdcsesx240.ads.autodesk.com, job-8675314/job-8675315, cmd: CreateObjectCommand) Search file 9ce7731fd38b4045afbb7ce9754abbc1-delta.vmdk on [b5ebda046d613e079b5874b169cd848f] 13-mgmt.log:2016-11-02 10:22:09,745 INFO [vmware.mo.DatastoreMO] (DirectAgent-931:ctx-5687d68e uscrlpdcsesx240.ads.autodesk.com, job-8675314/job-8675315, cmd: CreateObjectCommand) Searching file 9ce7731fd38b4045afbb7ce9754abbc1-delta.vmdk in [b5ebda046d613e079b5874b169cd848f] 13-mgmt.log:2016-11-02 10:25:06,362 WARN [storage.resource.VmwareStorageLayoutHelper] (DirectAgent-931:ctx-5687d68e uscrlpdcsesx240.ads.autodesk.com, job-8675314/job-8675315, cmd: CreateObjectCommand) Unable to locate VMDK file: 9ce7731fd38b4045afbb7ce9754abbc1-delta.vmdk You can merge this pull request into a Git repository by running: $ git pull https://github.com/nvazquez/cloudstack createVolumeOptimization Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cloudstack/pull/1913.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1913 commit 29308f0c53af1550b52bc0cb5a7558482c6da452 Author: nvazquez Date: 2017-01-20T16:20:37Z CLOUDSTACK-9752: [Vmware] Optimization of volume attachness to vm --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---