QA:Testcase add SSH keypair to OpenStack

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
(add instructions for creating a novarc file)
Line 4: Line 4:
 
# Follow [[QA:Testcase_create_OpenStack_user_project_and_network]]
 
# Follow [[QA:Testcase_create_OpenStack_user_project_and_network]]
 
# If you started with a minimal installation for testing, you will need to install the <code>unzip</code> package.
 
# If you started with a minimal installation for testing, you will need to install the <code>unzip</code> package.
# Download an unpack your credentials:
+
# Set up a novarc file with the EC2 credentials of the admin user in keystone:
$> mkdir ~/novacreds
+
$> cd ~/novacreds
+
$> sudo nova-manage project zipfile testproject admin
+
$> sudo chown $USER: nova.zip
+
$> unzip nova.zip
+
$> chmod 600 nova*
+
$> . ./novarc
+
|actions=
+
Ensure the AWS access and secret keys associated with the keystone admin user are available:
+
 
<pre>
 
<pre>
$> USER_ID=$(keystone user-list | grep 'admin ' | cut -f2 -d'|')
+
$> USER_ID=$(keystone user-list | awk '/admin / {print $2}')
$> ACCESS_KEY=$(keystone ec2-credentials-list --user $USER_ID | grep admin | cut -f3 -d'|')
+
$> ACCESS_KEY=$(keystone ec2-credentials-list --user $USER_ID | awk '/admin / {print $4}')
$> SECRET_KEY=$(keystone ec2-credentials-list --user $USER_ID | grep admin | cut -f4 -d'|')
+
$> SECRET_KEY=$(keystone ec2-credentials-list --user $USER_ID | awk '/admin / {print $6}')
 +
$> cat > novarc <<EOF
 +
export EC2_URL=http://localhost:8773/services/Cloud
 +
export EC2_ACCESS_KEY=$ACCESS_KEY
 +
export EC2_SECRET_KEY=$SECRET_KEY
 +
EOF
 +
$> . ./novarc
 
</pre>
 
</pre>
 
+
|actions=
 
Add the key pair:
 
Add the key pair:
  $> euca-add-keypair nova_key -a $ACCESS_KEY -s $SECRET_KEY > nova_key.priv
+
  $> euca-add-keypair nova_key > nova_key.priv
 
Change its permissions:
 
Change its permissions:
 
  $> chmod 600 nova_key.priv
 
  $> chmod 600 nova_key.priv
 
|results=
 
|results=
 
* Check that the key is registered:
 
* Check that the key is registered:
  $> euca-describe-keypairs -a $ACCESS_KEY -s $SECRET_KEY
+
  $> euca-describe-keypairs
 
* Check that <code>nova_key.priv</code> actually contains a key
 
* Check that <code>nova_key.priv</code> actually contains a key
 
* Check for errors in <code>/var/log/nova/*.log</code>
 
* Check for errors in <code>/var/log/nova/*.log</code>

Revision as of 11:44, 8 March 2012

Contents

Description

Test adding an SSH key pair to an account.

Setup

  1. Follow QA:Testcase_create_OpenStack_user_project_and_network
  2. If you started with a minimal installation for testing, you will need to install the unzip package.
  3. Set up a novarc file with the EC2 credentials of the admin user in keystone:
$> USER_ID=$(keystone user-list | awk '/admin / {print $2}')
$> ACCESS_KEY=$(keystone ec2-credentials-list --user $USER_ID | awk '/admin / {print $4}')
$> SECRET_KEY=$(keystone ec2-credentials-list --user $USER_ID | awk '/admin / {print $6}')
$> cat > novarc <<EOF
export EC2_URL=http://localhost:8773/services/Cloud
export EC2_ACCESS_KEY=$ACCESS_KEY
export EC2_SECRET_KEY=$SECRET_KEY
EOF
$> . ./novarc

How to test

Add the key pair:

$> euca-add-keypair nova_key > nova_key.priv

Change its permissions:

$> chmod 600 nova_key.priv

Expected Results

  • Check that the key is registered:
$> euca-describe-keypairs
  • Check that nova_key.priv actually contains a key
  • Check for errors in /var/log/nova/*.log