2

I'm trying to use Pkgcloud in order to create a volume in OpenStack. I guess I have a problem with the API version that Pkgcloud is using.

This is my code:

var blockstorageClient = pkgcloud.blockstorage.createClient(config);
var volumeOptions =
{
    name: 'volume-node-test', // required
    description: 'a test for creating volume from node js',  // required
    size: 1
}
blockstorageClient.createVolume(volumeOptions, (error, blockstorage) => {
    if (!error) {
        console.log("Blockstorage Created")
    } else {
        console.log("Error Creating Blockstorage -", error)
    }
})

This is the response I get:

failCode: 'Item not found',
statusCode: 404,
href: 'http://192.168.99.225:8776/v1/<project ID>/volumes',
method: 'POST',
headers:{
    'content-length': '112',
    'content-type': 'application/json',
    date: 'Tue, 28 Jan 2020 12:10:42 GMT',
    connection: 'close' },
result:
{
    message: 'The resource could not be found.',
    code: '404 Not Found',
    title: 'Not Found'
}

I think there is a problem with the API version because when I tried to test the API in postman the link provided in the response didn't work:

The link that didn't work -> http://192.168.99.225:8776/v1/projectID/volumes

However, when I changed the v1 to v3 it worked ok.

The link that worked ok -> http://192.168.99.225:8776/v3/projectID/volumes

Is there a way I can change the code in order to make the function use v3 instead of v1?

Update: I have the same problem with createSnapshot.

0 Answers0