Mailing List Archive

Glance image definition using V2 API
Looking for some help with defining glance images. I'm running a new Queens installation and do not have the V1 API enabled in Glance.

So the Glance V1 API has been deprecated for some time now (I believe) and best I can tell there is no support in the V2 API for defining an existing image into glance.
I.E, I have some volumes in my Ceph pool that I'd like to expose to Glance, but the old method of using "glance image-create --disk-format raw --id $IMAGE_ID --location rbd://$CLUSTER_ID/$POOL/$IMAGE_ID/snap" no longer works because this is a V1 command with the V2 API having no support for the --location flag.

I'm primarily dealing with large(ish) windows images around 100GB mark, so exporting them to a file then importing them using the --file command is very sub optimal.

Without an outright database hack, is there any way to define an existing Ceph based volume to be used by Glance?
If there is not a way to do this then can I safely enable the V1 API in Queens? How long until V1 support is removed and I'm back to square 1

Thanks in advance
Cory

_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Re: Glance image definition using V2 API [ In reply to ]
Did you look at the Openstack commas api options? I am traveling now but I could check it later.

Inviato da iPhone

> Il giorno 19 apr 2018, alle ore 06:15, Cory Hawkless <Cory@Hawkless.id.au> ha scritto:
>
> Looking for some help with defining glance images. I'm running a new Queens installation and do not have the V1 API enabled in Glance.
>
> So the Glance V1 API has been deprecated for some time now (I believe) and best I can tell there is no support in the V2 API for defining an existing image into glance.
> I.E, I have some volumes in my Ceph pool that I'd like to expose to Glance, but the old method of using "glance image-create --disk-format raw --id $IMAGE_ID --location rbd://$CLUSTER_ID/$POOL/$IMAGE_ID/snap" no longer works because this is a V1 command with the V2 API having no support for the --location flag.
>
> I'm primarily dealing with large(ish) windows images around 100GB mark, so exporting them to a file then importing them using the --file command is very sub optimal.
>
> Without an outright database hack, is there any way to define an existing Ceph based volume to be used by Glance?
> If there is not a way to do this then can I safely enable the V1 API in Queens? How long until V1 support is removed and I'm back to square 1
>
> Thanks in advance
> Cory
>
> _______________________________________________
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to : openstack@lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Re: Glance image definition using V2 API [ In reply to ]
Are you referring to https://developer.openstack.org/api-ref/image/v2/#create-an-image ?
There seems to be no support for specifying a location in the API V2 create-image call (POST /v2/images)
Perhaps the location attribute could be updated after creation using the update-image call (PATCH /v2/images) but I couldn't find a definitive answer on that


-----Original Message-----
From: Remo Mattei [mailto:Remo@Italy1.com]
Sent: Thursday, 19 April 2018 5:00 PM
To: Cory Hawkless <Cory@Hawkless.id.au>
Cc: openstack@lists.openstack.org
Subject: Re: [Openstack] Glance image definition using V2 API

Did you look at the Openstack commas api options? I am traveling now but I could check it later.

Inviato da iPhone

> Il giorno 19 apr 2018, alle ore 06:15, Cory Hawkless <Cory@Hawkless.id.au> ha scritto:
>
> Looking for some help with defining glance images. I'm running a new Queens installation and do not have the V1 API enabled in Glance.
>
> So the Glance V1 API has been deprecated for some time now (I believe) and best I can tell there is no support in the V2 API for defining an existing image into glance.
> I.E, I have some volumes in my Ceph pool that I'd like to expose to Glance, but the old method of using "glance image-create --disk-format raw --id $IMAGE_ID --location rbd://$CLUSTER_ID/$POOL/$IMAGE_ID/snap" no longer works because this is a V1 command with the V2 API having no support for the --location flag.
>
> I'm primarily dealing with large(ish) windows images around 100GB mark, so exporting them to a file then importing them using the --file command is very sub optimal.
>
> Without an outright database hack, is there any way to define an existing Ceph based volume to be used by Glance?
> If there is not a way to do this then can I safely enable the V1 API in Queens? How long until V1 support is removed and I'm back to square 1
>
> Thanks in advance
> Cory
>
> _______________________________________________
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to : openstack@lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Re: Glance image definition using V2 API [ In reply to ]
Here is a script I use on the fly..


for i in $(ls -l *.img |awk -F " " '{print $9}'); do openstack image create --disk-format qcow2 --container-format bare --public --file $i $i; done



> On Apr 20, 2018, at 02:04, Cory Hawkless <Cory@Hawkless.id.au> wrote:
>
> Are you referring to https://developer.openstack.org/api-ref/image/v2/#create-an-image <https://developer.openstack.org/api-ref/image/v2/#create-an-image> ?
> There seems to be no support for specifying a location in the API V2 create-image call (POST /v2/images)
> Perhaps the location attribute could be updated after creation using the update-image call (PATCH /v2/images) but I couldn't find a definitive answer on that
>
>
> -----Original Message-----
> From: Remo Mattei [mailto:Remo@Italy1.com]
> Sent: Thursday, 19 April 2018 5:00 PM
> To: Cory Hawkless <Cory@Hawkless.id.au>
> Cc: openstack@lists.openstack.org
> Subject: Re: [Openstack] Glance image definition using V2 API
>
> Did you look at the Openstack commas api options? I am traveling now but I could check it later.
>
> Inviato da iPhone
>
>> Il giorno 19 apr 2018, alle ore 06:15, Cory Hawkless <Cory@Hawkless.id.au> ha scritto:
>>
>> Looking for some help with defining glance images. I'm running a new Queens installation and do not have the V1 API enabled in Glance.
>>
>> So the Glance V1 API has been deprecated for some time now (I believe) and best I can tell there is no support in the V2 API for defining an existing image into glance.
>> I.E, I have some volumes in my Ceph pool that I'd like to expose to Glance, but the old method of using "glance image-create --disk-format raw --id $IMAGE_ID --location rbd://$CLUSTER_ID/$POOL/$IMAGE_ID/snap" no longer works because this is a V1 command with the V2 API having no support for the --location flag.
>>
>> I'm primarily dealing with large(ish) windows images around 100GB mark, so exporting them to a file then importing them using the --file command is very sub optimal.
>>
>> Without an outright database hack, is there any way to define an existing Ceph based volume to be used by Glance?
>> If there is not a way to do this then can I safely enable the V1 API in Queens? How long until V1 support is removed and I'm back to square 1
>>
>> Thanks in advance
>> Cory
>>
>> _______________________________________________
>> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>> Post to : openstack@lists.openstack.org
>> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>
>
Re: Glance image definition using V2 API [ In reply to ]
Hi,

just create an empty image (Without file or location param), then use add-location to set your locations.

Fabian Zimmermann


Am 19. April 2018 06:15:33 MESZ schrieb Cory Hawkless <Cory@Hawkless.id.au>:
>Looking for some help with defining glance images. I'm running a new
>Queens installation and do not have the V1 API enabled in Glance.
>
>So the Glance V1 API has been deprecated for some time now (I believe)
>and best I can tell there is no support in the V2 API for defining an
>existing image into glance.
>I.E, I have some volumes in my Ceph pool that I'd like to expose to
>Glance, but the old method of using "glance image-create --disk-format
>raw --id $IMAGE_ID --location rbd://$CLUSTER_ID/$POOL/$IMAGE_ID/snap"
>no longer works because this is a V1 command with the V2 API having no
>support for the --location flag.
>
>I'm primarily dealing with large(ish) windows images around 100GB mark,
>so exporting them to a file then importing them using the --file
>command is very sub optimal.
>
>Without an outright database hack, is there any way to define an
>existing Ceph based volume to be used by Glance?
>If there is not a way to do this then can I safely enable the V1 API in
>Queens? How long until V1 support is removed and I'm back to square 1
>
>Thanks in advance
>Cory
>
>_______________________________________________
>Mailing list:
>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>Post to : openstack@lists.openstack.org
>Unsubscribe :
>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Re: Glance image definition using V2 API [ In reply to ]
Yep, spot on Fabian, thanks for the pointer

For future reference, the current process to create an image in Glance using a pre-existing volume in Ceph is as follows

Step1 – Create the empty image
glance image-create --container-format=bare --disk-format=raw --min-ram 2048 --name="Windows Server test"

+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | None |
| container_format | bare |
| created_at | 2018-04-26T04:08:37Z |
| disk_format | raw |
| id | 763a2ca2-e8f8-4bf9-974f-98d7020e200b |
| locations | [] |
| min_disk | 0 |
| min_ram | 0 |
| name | Windows Server test |
| owner | 40c2b46fb47c4ee7ac076b259c4e0814 |
| protected | False |
| size | None |
| status | queued |
| tags | [] |
| updated_at | 2018-04-26T04:08:37Z |
| virtual_size | None |
| visibility | shared |
+------------------+--------------------------------------+

Step 2 – Update the ‘location’ attribute
glance location-add --url "rbd://b42a82f3-f493-49f4-98e0-2d355bbe8ee3/saspool/image-Windows2016v1/snap" 763a2ca2-e8f8-4bf9-974f-98d7020e200b

You’ll obviously need to ensure you have a protected snapshow of your image like so
:~# rbd snap create saspool/image-Windows2016v1@snap
:~# rbd snap protect saspool/image-Windows2016v1@snap
:~# rbd snap ls saspool/image-Windows2016v1
SNAPID NAME SIZE TIMESTAMP
18 snap 150 GB Thu Apr 26 13:24:30 2018


You’ll also need to ensure that show_multiple_locations = true is set in glance-api.conf


From: Fabian Zimmermann [mailto:dev.faz@gmail.com]
Sent: Sunday, 22 April 2018 2:28 PM
To: Cory Hawkless <Cory@Hawkless.id.au>; openstack@lists.openstack.org
Subject: Re: [Openstack] Glance image definition using V2 API

Hi,

just create an empty image (Without file or location param), then use add-location to set your locations.

Fabian Zimmermann

Am 19. April 2018 06:15:33 MESZ schrieb Cory Hawkless <Cory@Hawkless.id.au>:

Looking for some help with defining glance images. I'm running a new Queens installation and do not have the V1 API enabled in Glance.

So the Glance V1 API has been deprecated for some time now (I believe) and best I can tell there is no support in the V2 API for defining an existing image into glance.
I.E, I have some volumes in my Ceph pool that I'd like to expose to Glance, but the old method of using "glance image-create --disk-format raw --id $IMAGE_ID --location rbd://$CLUSTER_ID/$POOL/$IMAGE_ID/snap" no longer works because this is a V1 command with the V2 API having no support for the --location flag.

I'm primarily dealing with large(ish) windows images around 100GB mark, so exporting them to a file then importing them using the --file command is very sub optimal.

Without an outright database hack, is there any way to define an existing Ceph based volume to be used by Glance?
If there is not a way to do this then can I safely enable the V1 API in Queens? How long until V1 support is removed and I'm back to square 1

Thanks in advance
Cory

________________________________

Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Re: Glance image definition using V2 API [ In reply to ]
On 04/22/2018 12:57 AM, Fabian Zimmermann wrote:
> Hi,
>
> just create an empty image (Without file or location param), then use
> add-location to set your locations.

I was under the impression that the V2 API didn't let you update the location
unless the "show_multiple_locations" config option was set to "True", which is
explicitly stated in the help text to be a Bad Idea.

Chris

_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack