Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2FA0417CD4 for ; Sat, 24 Jan 2015 07:36:55 +0000 (UTC) Received: (qmail 86091 invoked by uid 500); 24 Jan 2015 07:36:55 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 86052 invoked by uid 500); 24 Jan 2015 07:36:55 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 86043 invoked by uid 99); 24 Jan 2015 07:36:55 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Jan 2015 07:36:55 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 00A1FE04A7; Sat, 24 Jan 2015 07:36:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mtutkowski@apache.org To: commits@cloudstack.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to e5ffcab Date: Sat, 24 Jan 2015 07:36:54 +0000 (UTC) Repository: cloudstack Updated Branches: refs/heads/master 7ef122dcc -> e5ffcab09 Moving the call to getDeviceId(long, long) avoids a race condition when two volumes are being attached to a VM at the same time Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e5ffcab0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e5ffcab0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e5ffcab0 Branch: refs/heads/master Commit: e5ffcab09dd4f70d2755f5378185862a387a4621 Parents: 7ef122d Author: Mike Tutkowski Authored: Sat Jan 24 00:06:37 2015 -0700 Committer: Mike Tutkowski Committed: Sat Jan 24 00:36:07 2015 -0700 ---------------------------------------------------------------------- server/src/com/cloud/storage/VolumeApiServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e5ffcab0/server/src/com/cloud/storage/VolumeApiServiceImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java index 0abb629..22c801f 100644 --- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java @@ -1303,7 +1303,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic throw new InvalidParameterValueException("The specified VM already has the maximum number of data disks (" + maxDataVolumesSupported + "). Please specify another VM."); } } - deviceId = getDeviceId(vmId, deviceId); // If local storage is disabled then attaching a volume with local disk // offering not allowed @@ -2300,6 +2299,9 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic } DataTO volTO = volFactory.getVolume(volumeToAttach.getId()).getTO(); + + deviceId = getDeviceId(vm.getId(), deviceId); + DiskTO disk = new DiskTO(volTO, deviceId, volumeToAttach.getPath(), volumeToAttach.getVolumeType()); AttachCommand cmd = new AttachCommand(disk, vm.getInstanceName());