Pages

Showing posts with label openstack. Show all posts
Showing posts with label openstack. Show all posts

Friday, 19 May 2017

OpenStack - Launch your First VM

Some notes on how to get started with a freshly baked OpenStack (Liberty)


  • First, an image needs to be uploaded:


wget -qO - http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img | openstack image create cirros --public --container-format=bare --disk-format=qcow2


  • Then we need to create a network:


openstack network create testnetwork


  • Within the network, a subnet needs to be created:


neutron subnet-create --name testsubnet testnetwork 192.168.37.0/24


  • Please note that a more recent version of OpenStack might support the openstack subnet create command as well.



  • Let's create a router now:


neutron router-create testrouter


  • Now set the router's default gateway by connecting it to a network:


neutron router-gateway-set testrouter floating


  • And link the router to the subnet:


neutron router-interface-add testrouter testsubnet


  • Now launch your instance:


nova boot --flavor m1.tiny --image cirros --nic net-id=a6a6c271-a391-4bff-9eda-79a97a8e1154 i1


  • Create a floating IP:


neutron floatingip-create floating
nova floating-ip-associate i1 192.168.122.131


  • Add rules to security group for icmp and ssh


openstack security group rule create --proto icmp default
openstack security group rule create --proto tcp --dst-port 22:22 default

Friday, 10 March 2017

Running Cinder Migration Unit Tests

Cinder has some unit tests for migration. If you want to run them on your computer, you'll need to set up database administrator accounts for your backends, and export an environment variable before running the test:
One-liner:
for backend in \
    mysql+pymysql://root:secret@localhost/mysql \
    postgresql://postgres:secret@localhost/cinder \
    sqlite:///somefile.db \
; do
    OS_TEST_DBAPI_ADMIN_CONNECTION=$backend \
        python -m subunit.run cinder.tests.unit.test_migrations |
            subunit2pyunit
done


MySQL
OS_TEST_DBAPI_ADMIN_CONNECTION='mysql+pymysql://root:secret@localhost/mysql'\
 python -m subunit.run cinder.tests.unit.test_migrations | subunit2pyunit

PostgreSQL
OS_TEST_DBAPI_ADMIN_CONNECTION='postgresql://postgres:secret@localhost/cinder'\
 python -m subunit.run cinder.tests.unit.test_migrations | subunit2pyunit

SQLite
OS_TEST_DBAPI_ADMIN_CONNECTION='sqlite:///somefile.db'\
 python -m subunit.run cinder.tests.unit.test_migrations | subunit2pyunit