Cloud

Commande line client

Note: CC-IN2P3 SPS access will be allowed from a VM.

Key pair management

$ ssh-keygen -t rsa -f ~/.novacreds/cloudkey
$ nova keypair-add --pub-key=$HOME/.novacreds/cloudkey.pub cloudkey
$ nova keypair-list

Virtual machine management

To use the Nova end-user client:

$ nova ...

Virtual machine instanciation:

$ nova quota-show
$ nova image-list 
$ nova flavor-list
  • OpenStack@LAL and @CC-IN2P3:
$ nova boot --key-name=cloudkey --image=CentOS-7-x86_64-GenericCloud \
  --flavor=m1.medium server_name

With a script of customisation:

$ chmod u+x myfile.sh
$ nova boot --key-name=cloudkey --image=CentOS-7-x86_64-GenericCloud \
  --flavor=m1.medium --user-data ./myfile.sh server_name

Script execution is available in /var/log/cloud-init.log.

  • OpenStack@IPHC:
$ nova boot --insecure --key-name=cloudkey --image="CentOS-6.5-x86_64-base-4.0" \
  --flavor=m1.medium --nic net-id=16ddcf0e-05c7-4023-8fc6-9cb49fd93aa4 \
  server_name
$ nova list

IP adress management:

  • OpenStack@LAL:

Automatic public IP adress allocation.

  • OpenStack@CC-IN2P3 and @IPHC:
$ nova floating-ip-create 
$ nova floating-ip-list
$ nova add-floating-ip server_name 134.158.246.XX

Virtual machine lifecycle:

  • OpenStack@LAL and @IPHC:
$ nova show server_name
$ ssh -i ~/.novacreds/cloudkey root@IP
$ nova reboot server_name 
$ nova delete server_name 
  • OpenStack@CC-IN2P3:

Note: the virtual machines of the CC-IN2P3 Cloud are not reachable from a local computer but only from the Cloud frontale (ssh tunnel needed).
=> Connexion to the virtual machine from the local computer:

$ vi .ssh/config 
Host mv_cloud_cc
 IdentityFile ~/.novacreds/cloudkey
 HostName 134.158.246.XX
 ProxyCommand ssh user@ccage.in2p3.fr nc %h %p
$ ssh root@mv_cloud_cc

Disk management

Disk creation:

$ cinder create --display-name data_server 5
$ cinder list

Disk attachement:

$ nova volume-attach server_name UUID /dev/vdb
$ nova volume-detach server_name UUID
$ nova volume-delete UUID
$ cinder delete UUID
$ cinder force-delete
$ cinder show

Disk image management

Image from scratch:

$ glance image-create --name CentOS7 --protected True --min-disk=15 \
--disk-format qcow2  —visibility private --property comment=" Based CentOS7 
image. Allows cloud-init contextualization mechanisms." --property version=1.0 \
--container-format bare --file  Centos7_cloud.qcow2

$ glance  image-list
$ glance image-delete id

Customized image:

$ nova boot --user-data ./custom.sh ... server_name
$ nova image-create server_name server_name_custom
$ glance image-download id > CentOS7_custom.qcow2

Update image state

$ glance image-update --public True ID
$ glance image-update --protected False ID 
$ glance image-update --name new_name id