From notifications-return-17042-archive-asf-public=cust-asf.ponee.io@libcloud.apache.org Sat Apr 4 20:45:07 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4B7481806C7 for ; Sat, 4 Apr 2020 22:45:05 +0200 (CEST) Received: (qmail 13629 invoked by uid 500); 4 Apr 2020 20:45:04 -0000 Mailing-List: contact notifications-help@libcloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@libcloud.apache.org Delivered-To: mailing list notifications@libcloud.apache.org Received: (qmail 13300 invoked by uid 500); 4 Apr 2020 20:45:04 -0000 Delivered-To: apmail-libcloud-commits@libcloud.apache.org Received: (qmail 13253 invoked by uid 99); 4 Apr 2020 20:45:03 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 04 Apr 2020 20:45:03 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 8D49D81A3F; Sat, 4 Apr 2020 20:45:03 +0000 (UTC) Date: Sat, 04 Apr 2020 20:45:17 +0000 To: "commits@libcloud.apache.org" Subject: [libcloud] 15/21: Fix auto assigning of volume device in OpenStack MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: tomaz@apache.org In-Reply-To: <158603310248.4363.10829666639514420518@gitbox.apache.org> References: <158603310248.4363.10829666639514420518@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: libcloud X-Git-Refname: refs/heads/2.8.x X-Git-Reftype: branch X-Git-Rev: cd263c67d58f6556738e311a93796cf60ce56189 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20200404204503.8D49D81A3F@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. tomaz pushed a commit to branch 2.8.x in repository https://gitbox.apache.org/repos/asf/libcloud.git commit cd263c67d58f6556738e311a93796cf60ce56189 Author: Joshua Hesketh AuthorDate: Thu Mar 26 22:49:24 2020 +1100 Fix auto assigning of volume device in OpenStack When trying to attach a volume to a node with the OpenStack driver, using the 'auto' device name fails with: libcloud.common.exceptions.BaseHTTPError: 400 Bad Request Invalid input for field/attribute device. Value: auto. u'auto' does not match '(^/dev/x{0,1}[a-z]{0,1}d{0,1})([a-z]+)[0-9]*$' OpenStack expects a device, or a null/None value[0] https://docs.openstack.org/api-ref/compute/?expanded=#attach-a-volume-to-an-instance --- libcloud/compute/drivers/openstack.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libcloud/compute/drivers/openstack.py b/libcloud/compute/drivers/openstack.py index e250b91..343fe50 100644 --- a/libcloud/compute/drivers/openstack.py +++ b/libcloud/compute/drivers/openstack.py @@ -321,6 +321,8 @@ class OpenStackNodeDriver(NodeDriver, OpenStackDriverMixin): def attach_volume(self, node, volume, device="auto"): # when "auto" or None is provided for device, openstack will let # the guest OS pick the next available device (fi. /dev/vdb) + if device == "auto": + device = None return self.connection.request( '/servers/%s/os-volume_attachments' % node.id, method='POST',