Unable to upload volume data to image on Unified SDK
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack SDK |
New
|
Undecided
|
Unassigned |
Bug Description
This feature is available and works on old SDK (Cinder), but does not on Unified SDK. The image service have an "upload_image" method (on unified SDK) but I cannot get the data to upload it, as the data is stored as a volume in the block store service, and the only way to download it is through glance - which is what I am trying to achieve. Here follows some code sample:
---------------
UNIFIED SDK
---------------
from openstack import connection
import glanceclient.
from keystoneclient.
from keystoneauth1 import session
import cinderclient.
import sys
import os
import time
import getopt
import json
import subprocess
def get_connection_
conn = connection.
return conn
inputfile = 'credentials.json'
with open(inputfile) as json_file:
json_string = json_file.read()
json_obj = json.loads(
username = json_obj[
password = json_obj[
auth_url_sdk = json_obj[
user_domain_name = json_obj[
project_domain_name = json_obj[
project_name = json_obj[
conn = get_connection_
compute_service = conn.compute
network_service = conn.network
image_service = conn.image
block_service = conn.block_store
# id of desired volume to upload to glance.
id = 'e5b40f95-
# type of volume: openstack.
volume = block_service.
#cinder volume url
data = 'http://
# this throws an error
image_service.
# instead of volume, if we use data, it upload the url string bytes
image_service.
------------
Cinder SDK
------------
def get_session(
auth = v3.Password(
return session.
old_session = get_session(
cinder = cinder_
# type of volume2 = cinderclient.
volume2 = cinder.
body = {'force': 'false'
# works like a charm :D
volume2.
affects: | nova → cinder |
affects: | cinder → python-openstacksdk |
I'm not sure what the problem is. If you give it data to upload, it will upload it, as expected.
You'll also need to include actual error messages or logs if you think there's a problem.