Can't find my Rackspace cloud server via openstacknetsdk

322 views Asked by At

I'm attempting to write a simple proof-of-concept for manipulating cloud servers in my Rackspace Cloud account via the C# openstacknetsdk library, v1.3.0.0.

The problem I'm having is although I appear to be able to authenticate successfully using my Rackspace username and API key, the API is behaving as though I don't have any servers. My code:

using net.openstack.Providers.Rackspace;
using net.openstack.Core.Providers;
using net.openstack.Core.Exceptions.Response;
using net.openstack.Providers.Rackspace.Objects;
using net.openstack.Core.Domain;

...

const string USERNAME = "[my rackspace username]";
const string API_KEY = "[my rackspace API key]";

static void Main(string[] args)
{
    CloudIdentity cloudIdentity = new CloudIdentity() { APIKey = API_KEY, Username = USERNAME };
    CloudServersProvider provider = new CloudServersProvider(cloudIdentity);

    IEnumerable<SimpleServer> servers = provider.ListServers();
    foreach (SimpleServer server in servers)
    {
        Console.Out.WriteLine(server.Id);
    }
}

When I step through this code in the debugger, I can see that servers ends up having size 0, and nothing ends up getting written out.

This is unexpected, because I do have one server created, which I can see on the Rackspace cloud control panel website. The server is in Active status.

If I try to get information on my specific server, using the server ID from the Cloud Servers > Server Details page on the Rackspace cloud control panel site:

Server server = provider.GetDetails("[my cloud server ID]");
Console.Out.WriteLine(server.Image.Name);

I get a net.openstack.Core.Exceptions.Response.ItemNotFoundException.

The authentication seems to be working because if I intentionally change my API_KEY value to something incorrect (like "test"), I get a UserNotAuthorizedException instead.

What am I missing here? Why is the openstacknetsdk acting like I don't have any servers?

1

There are 1 answers

2
Don Schenck On BEST ANSWER

Is the server you have created in your default region?

To be safe, try specifying the region in the .ListServers() method call.

Also; you can download sample data via NuGet; search for "openstack sample".