python-glanceclient doesn't support $HOME while uploading image

Bug #1574512 reported by Eli Qiao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Invalid
Undecided
Pankaj Mishra

Bug Description

~/devstack$ glance --debug image-create --name ubuntu-16 --visibility public --disk-format=qcow2 --container-format=bare \--os-distro=ubuntu --file=~/Downloads/xenial-server-cloudimg-amd64-disk1.img
File ~/Downloads/xenial-server-cloudimg-amd64-disk1.img does not exist or user does not have read privileges to it

~/devstack$ glance image-create --name ubuntu-16 --visibility public --disk-format=qcow2 --container-format=bare \--os-distro=ubuntu --file=/home/user/Downloads/xenial-server-cloudimg-amd64-disk1.img
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | b27130a877734d9ec938a63ca63c4ee7 |
| container_format | bare |
| created_at | 2016-04-25T08:38:29Z |
| disk_format | qcow2 |
| id | 22bc8d04-c77b-4780-b6bb-1a37f11d6deb |
| min_disk | 0 |
| min_ram | 0 |
| name | ubuntu-16 |
| os_distro | ubuntu |
| owner | 959eedbf87534e28a64f94c250b785ac |
| protected | False |
| size | 303235072 |
| status | active |
| tags | [] |
| updated_at | 2016-04-25T08:38:32Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------+

Eli Qiao (taget-9)
affects: glance → python-glanceclient
Changed in python-glanceclient:
assignee: nobody → Pankaj Mishra (pankaj-mishra)
Revision history for this message
Pankaj Mishra (pankaj-mishra) wrote :

I am not able to reproduce this issue. Working fine for me by using $HOME(~). So this is not an issue.

Revision history for this message
Eli Qiao (taget-9) wrote :

@Pankaj Mishra

can you paste what your glance CLI command line looks like?

BTW, the glance CLI I am using is 2.0.0

Revision history for this message
Pankaj Mishra (pankaj-mishra) wrote :

I used this command
1. With $HOME(~)

pankaj@pankaj-VirtualBox:~/devstack$ glance image-create --name cirros2 --disk-format qcow2 --container-format bare --file ~/devstack/files/images/cirros-0.3.4-x86_64-uec/cirros-0.3.4-x86_64-blank.img

2. With whole path

pankaj@pankaj-VirtualBox:~/devstack$ glance image-create --name cirros2 --disk-format qcow2 --container-format bare --file /home/pankaj/devstack/files/images/cirros-0.3.4-x86_64-uec/cirros-0.3.4-x86_64-blank.img

Revision history for this message
Eli Qiao (taget-9) wrote :

I tried your command, it works for me.

The difference with my CLI command is:

I use --file=~/img

can you try this style?

glance --debug image-create --name ubuntu-16 --visibility public --disk-format=qcow2 --container-format=bare \--os-distro=ubuntu --file=~/Downloads/xenial-server-cloudimg-amd64-disk1.img

Revision history for this message
Pankaj Mishra (pankaj-mishra) wrote :

Yes, I am able to reproduce this issue with file option --file=~/

Eli Qiao (taget-9)
Changed in python-glanceclient:
status: New → Confirmed
Changed in python-glanceclient:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/310397

Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

The cli documentation provides the following help on the '--file' parameter:

 $ glance help image-create | grep file
                           [--property <key=value>] [--file <FILE>]
  --file <FILE> Local file that contains disk image to be uploaded

And the documented format works as expected, ie:

 --file ~/somefile

works.

We do not document using an '=' sign:

 --file=~/somefile

so is probably not currently supported.

I think we need to reach a consensus as to whether this undocumented form of the command is supported or not.

For reference the openstack client behaves the same way:

 $ openstack image create --file=~/homefile x1
 [Errno 2] No such file or directory: '~/homefile'

as does swift

 $ swift download container1 homefile --output=~/x
 Error downloading object 'container1/homefile': [Errno 2] No such file or directory: u'~/x'

Ian Cordasco (icordasc)
Changed in python-glanceclient:
status: In Progress → Invalid
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-glanceclient (master)

Change abandoned by Brian Rosmaita (<email address hidden>) on branch: master
Review: https://review.openstack.org/310397
Reason: Abandoned due to activity, plus the bug it fixes was declared invalid in January 2017.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.