<commit_before># Getting started with pkgcloud & Openstack

The Openstack node.js SDK is available as part of `pkgcloud`, a multi-provider cloud provisioning package

Pkgcloud currently supports Openstack Nova (compute) and Openstack Swift (storage).

To install `pkgcloud` from the command line:

```
npm install pkgcloud
```

Don't have `npm` or `node` yet? [Get it now](http://nodejs.org/download).

## Using pkgcloud

In this example, we're going to create a Openstack compute client, create two servers, and then output their details to the command line.

*Note: We're going to use [underscore.js](http://underscorejs.org) for some convenience functions.*
*Note: For DevStack, change AuthUrl to http://*

```Javascript
var pkgcloud = require('pkgcloud'),
    _ = require('underscore');

// create our client with your openstack credentials
var client = pkgcloud.compute.createClient({
  provider: 'openstack',
  username: 'your-user-name',
  password: '<PASSWORD>',
  region: 'RegionOne'
  authUrl: 'https://your-identity-service'
});

// first we're going to get our flavors
client.getFlavors(function (err, flavors) {
    if (err) {
        console.dir(err);
        return;
    }

    // then get our base images
    client.getImages(function (err, images) {
        if (err) {
            console.dir(err);
            return;
        }

        // Pick a 512MB instance flavor
        var flavor = _.findWhere(flavors, { name: 'm1.tiny' });

        // Pick an image based on Ubuntu 12.04
        var image = _.findWhere(images, { name: 'cirros-0.3.2-x86_64-uec' });

        // Create our first server
        client.createServer({
            name: 'server1',
            image: image,
            flavor: flavor
        }, handleServerResponse);

        // Create our second server
        client.createServer({
            name: 'server2',
            image: image,
            flavor: flavor
        }, handleServerResponse);
    });
});

// This function will handle our server creation,
// as well as waiting for the server to come online after we've
// created it.
function handleServerResponse(err, server) {
    if (err) {
        console.dir(err);
        return;
    }

    console.log('SERVER CREATED: ' + server.name + ', waiting for active status');

    // Wait for status: ACTIVE on our server, and then callback
    server.setWait({ status: 'ACTIVE' }, 5000, function (err) {
        if (err) {
            console.dir(err);
            return;
        }
<commit_msg>Update getting-started-compute.md<commit_after># Getting started with pkgcloud & Openstack

The Openstack node.js SDK is available as part of `pkgcloud`, a multi-provider cloud provisioning package

Pkgcloud currently supports Openstack Nova (compute) and Openstack Swift (storage).

To install `pkgcloud` from the command line:

```
npm install pkgcloud
```

Don't have `npm` or `node` yet? [Get it now](http://nodejs.org/download).

## Using pkgcloud

In this example, we're going to create a Openstack compute client, create two servers, and then output their details to the command line.

*Note: We're going to use [underscore.js](http://underscorejs.org) for some convenience functions.*
*Note: For DevStack, change AuthUrl to http://*

```Javascript
var pkgcloud = require('pkgcloud'),
    _ = require('underscore');

// create our client with your openstack credentials
var client = pkgcloud.compute.createClient({
  provider: 'openstack',
  username: 'your-user-name',
  password: '<PASSWORD>',
  region: 'RegionOne'
  authUrl: 'https://your-identity-service'
});

// first we're going to get our flavors
client.getFlavors(function (err, flavors) {
    if (err) {
        console.dir(err);
        return;
    }

    // then get our base images
    client.getImages(function (err, images) {
        if (err) {
            console.dir(err);
            return;
        }

        // Pick a 512MB instance flavor
        var flavor = _.findWhere(flavors, { name: 'm1.tiny' });

        // Pick an image based on Ubuntu 12.04
        var image = _.findWhere(images, { name: 'cirros-0.3.2-x86_64-uec' });

        // Create our first server
        client.createServer({
            name: 'server1',
            image: image,
            flavor: flavor
        }, handleServerResponse);

        // Create our second server
        client.createServer({
            name: 'server2',
            image: image,
            flavor: flavor
        }, handleServerResponse);
    });
});

// This function will handle our server creation,
// as well as waiting for the server to come online after we've
// created it.
function handleServerResponse(err, server) {
    if (err) {
        console.dir(err);
        return;
    }

    console.log('SERVER CREATED: ' + server.name + ', waiting for active status');

    // Wait for status: RUNNING on our server, and then callback
    server.setWait({ status: 'RUNNING' }, 5000, function (err) {
        if (err) {
            console.dir(err);
            return;
        }

{'fraction_non_alphanumeric': 0.11467889908256881, 'fraction_numerical': 0.008376545672118069, 'mean_word_length': 2.5949820788530467, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1210979', 'n_tokens_mistral': 1487, 'n_tokens_neox': 1401, 'n_words': 489}