diff --git a/compute/disks/createComputeHyperdiskFromPool.js b/compute/disks/createComputeHyperdiskFromPool.js index 47fdbbb964d..342d854bad2 100644 --- a/compute/disks/createComputeHyperdiskFromPool.js +++ b/compute/disks/createComputeHyperdiskFromPool.js @@ -37,7 +37,7 @@ async function main() { // The name of the new disk const diskName = 'disk-name'; // The name of the storage pool - const storagePoolName = 'storage-pool-hyperdisk'; + const storagePoolName = 'storage-pool-name'; // Link to the storagePool you want to use. Use format: // https://www.googleapis.com/compute/v1/projects/{projectId}/zones/{zone}/storagePools/{storagePoolName} const storagePool = `https://www.googleapis.com/compute/v1/projects/${projectId}/zones/${zone}/storagePools/${storagePoolName}`; diff --git a/compute/test/createComputeHyperdiskFromPool.test.js b/compute/test/createComputeHyperdiskFromPool.test.js index 46a36f7652c..ccf83de9580 100644 --- a/compute/test/createComputeHyperdiskFromPool.test.js +++ b/compute/test/createComputeHyperdiskFromPool.test.js @@ -20,9 +20,8 @@ const path = require('path'); const {assert} = require('chai'); const {describe, it} = require('mocha'); const cp = require('child_process'); -const {StoragePoolsClient} = require('@google-cloud/compute'); const {DisksClient} = require('@google-cloud/compute').v1; -const {createStoragePool, deleteStoragePool, deleteDisk} = require('./util'); +const {deleteDisk} = require('./util'); const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const cwd = path.join(__dirname, '..'); @@ -30,29 +29,16 @@ const cwd = path.join(__dirname, '..'); describe('Create compute hyperdisk from pool', async () => { const diskName = 'disk-name'; const zone = 'europe-central2-b'; - const storagePoolName = 'storage-pool-hyperdisk'; + const storagePoolName = 'storage-pool-name'; const disksClient = new DisksClient(); - const storagePoolsClient = new StoragePoolsClient(); let projectId; before(async () => { projectId = await disksClient.getProjectId(); - await createStoragePool( - storagePoolsClient, - projectId, - zone, - storagePoolName - ); }); after(async () => { await deleteDisk(disksClient, projectId, zone, diskName); - await deleteStoragePool( - storagePoolsClient, - projectId, - zone, - storagePoolName - ); }); it('should create a new hyperdisk from pool', () => { diff --git a/compute/test/util.js b/compute/test/util.js index b8416f80cf9..9eb3e87f875 100644 --- a/compute/test/util.js +++ b/compute/test/util.js @@ -90,51 +90,7 @@ async function deleteDisk(disksClient, projectId, zone, diskName) { zone, }); } catch (err) { - console.error('Deleting job failed: ', err); - throw new Error(err); - } -} - -async function createStoragePool( - storagePoolsClient, - projectId, - zone, - storagePoolName -) { - try { - await storagePoolsClient.insert({ - project: projectId, - storagePoolResource: { - name: storagePoolName, - poolProvisionedCapacityGb: 10240, - poolProvisionedIops: 10000, - poolProvisionedThroughput: 1024, - storagePoolType: `projects/${projectId}/zones/${zone}/storagePoolTypes/hyperdisk-balanced`, - capacityProvisioningType: 'advanced', - zone, - }, - zone, - }); - } catch (err) { - console.error('Creating storage pool failed: ', err); - throw new Error(err); - } -} - -async function deleteStoragePool( - storagePoolsClient, - projectId, - zone, - storagePoolName -) { - try { - await storagePoolsClient.delete({ - project: projectId, - storagePool: storagePoolName, - zone, - }); - } catch (err) { - console.error('Deleting storage pool failed: ', err); + console.error('Deleting disk failed: ', err); throw new Error(err); } } @@ -144,6 +100,4 @@ module.exports = { getStaleVMInstances, deleteInstance, deleteDisk, - createStoragePool, - deleteStoragePool, };