TAGS

There are no tags associated with this article.

OpenStack instance migration - command line

Downloading an instance

The instance should be checked if it is not created from image or volume. It will not create a proper image for migration in such cases.

 List your instances.

openstack server list

Shut off the instance.

openstack server stop 6dd809ce-2c1a-44a1-b4b6-9a505a9b2685

Check if it is turned off.

openstack server show 638b6900-6aac-4f1c-8c8b-f0bb902ada39 | grep power_state

Create an image for migration.

openstack server image create --name "Migration image" c1f3602d-3b83-4c59-995c-168dd77a2242

Shelve option also creates a proper image and changes instance status to "Shelved Offloaded".

openstack server shelve c1f3602d-3b83-4c59-995c-168dd77a2242

Check if the new image was created properly. The size can not be 0 bytes. Should have a similar size as the instance itself.

openstack image list --private
+--------------------------------------+-----------------------------------+---------+
| ID                                   | Name                              | Status  |
+--------------------------------------+-----------------------------------+---------+
| 1fc30884-b35e-4eaf-8afc-e0a6b488e8b4 | Migration image                   | active  |
+--------------------------------------+-----------------------------------+---------+
 
openstack image show 1fc30884-b35e-4eaf-8afc-e0a6b488e8b4 | grep min_disk
| min_disk         | 8

Download new created image to local disk.

openstack image save --file ./image.raw 1fc30884-b35e-4eaf-8afc-e0a6b488e8b4

The image is ready. We need to move to different cloud and load proper credentials again. When new credentials are ready, check your cloud.

Uploading an instance

Load your image. There should be a table at the end of upload with detailed information about the newly uploaded image

openstack image create --file ./image.raw "Migration image"
 
+------------------+----------------------------------------------------+
| Field            | Value                                              |
+------------------+----------------------------------------------------+
| checksum         | 5049307eb2652778c00a645150db4e57                   |
| container_format | bare                                               |
| created_at       | 2020-02-07T13:36:23Z                               |
| disk_format      | raw
(...)

The new image should also be presented in the images list

openstack image list
+--------------------------------------+-----------------------------+--------+
| ID                                   | Name                        | Status |
+--------------------------------------+-----------------------------+--------+
| 6b28930c-e493-4b8b-ab85-3718269dde46 | Migration image             | active |
| 5ef3c17a-f9e6-4e2c-bc06-80508a443635 | Ubuntu 16.04 LTS            | active |
| 602485f6-7dc1-4796-b3f2-71847e48f67b | Ubuntu 18.04 LTS            | active |
+--------------------------------------+-----------------------------+--------+

Now you can use it in new instance creation.

There is no difference when migrating Windows instance that way

How to mount object storage in Linux?

First, check if you have s3cmd installed by typing s3cmd. If not install it according to instructions:

Command 's3cmd' not found, but can be installed with:
sudo apt install s3cmd

If you do not have OpenStack client installed yet to install it with (sudo apt install python3-openstackclient)

Then load your cloud credentials with the command:

source ~/cloud_XXXXX\ project_with_eo-openrc.sh

Check your credentials:

openstack ec2 credentials list

where Access token and Secret token will be used in s3fs configuration:

echo Access_token:Secret_token > ~/.passwd-s3fs

Change permissions of the new created file

chmod 600 .passwd-s3fs

Uncomment "user_allow_other" in fuse.conf file as root

sudo nano /etc/fuse.conf

Now you are ready to mount your object storage to your Linux system.

s3fs w-container-1 /local/mount/point -o passwd_file=~/.passwd-s3fs -o url=https://cf2.cloudferro.com:8080 -o use_path_request_style -o umask=0002 -o allow_other

More information about s3 protocol can be found:

https://creodias.eu/-/how-to-access-eo-data-using-s3cmd-linux-v2

https://creodias.eu/-/how-to-access-private-object-storage-using-s3cmd-or-boto3-

How to use GUI in VM with Linux?

Desktop environments for Linux allow you to perform any action related to your operating system in visible way. Its purpose is to deliver a proper suite in terms of look, functionnalities, and usability.

In our Glance repository we possess two Linux distributions in the full version(with GUI):

  • CentOS 7 + Sen4Cap
  • OSGeo

In order to install GUI for CentOS and basic Ubuntu images we have to consider some apt-get and yum installations. We have prepared four environments that interact correctly with the recommended visual remote desktop application -x2GO.

(Use ssh connection to easily parse copy-paste actions)

Tutorial has been prepared on machine with preinstalled Ubuntu 16.04.


1. MATE:

Project created by the Arch Linux community. It’s the fork of GNOME 2.32

 

$ sudo apt update
$ sudo tasksel install ubuntu-mate-desktop

 

 

 Theme for Mate:

2.XFCE:

Its aim is based on being fast and light-weight.

 

$ sudo apt update
$ sudo apt-get install xfce4

 

 

First look on the fresh environment:

3.LXDE:

LXDE has been created for less efficient machines.

 

$ sudo apt update
$ sudo apt install lxde

 

 

LXDE appearance (x2go session):

4. Cinammon:

Desktop environment corelated with the GTK+3 library.

 

$ sudo apt update
$ sudo add-apt-repository ppa:embrosyn/cinnamon
$ sudo apt update && sudo apt install cinnamon-desktop-environment lightdm

 

 

Cinammon appearance (x2go session):

 

What is X2GO?

Simply, X2GO is one of the many solutions for Remote Desktop that works well over either low or high bandwith.

For more informations, I reffer to the documentation:

https://wiki.x2go.org/doku.php/doc:newtox2go

 

X2GO configuration

Using SPICE console within the Horizon panel may effect in worse optimalization and non-synchronized cursor. To improve the whole setup we may install X2GO server on the virtual machine and X2GO client on our computer which is being used to connect to our instance.

 

Operations on the virtual machine:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:x2go/stable
sudo apt-get update
sudo apt-get install x2goserver x2goserver-xsession

Operations on the client side:

apt-get install x2goclient

Ok, we are equipped to initialize our first session. Launch X2GO application and look on the prompt window:

Fill in necessary blanks:

  • host: IP of the virtual machine
  • Login: eouser ( account allowed for ssh connection)
  • SSH port 22 (by default)

 


Optionally: Use RSA/DSA key for ssh connection: Put your ssh private key in the case of not using basic id_rsa file.

 

Take a brief and short look at another bookmarks:

In Input/Output you are able to set a useful Clipboard mode.

In Shared folders you might set up a folder shared between machines.

Press “OK”

Notice a rectangle with curved edges on your right side. Click on it.

 

If every value in the step before was typed in correctly, you should encounter a window with information: Established X server connection

 

Few seconds after that you obtain a visible access to your virtual machine:

 

Congratulations, you installed your desktop environment and established a connection through remote desktop application.

 


How to access Sen4CAP

1. Register your account

To register a new account on the CREODIAS platform, please follow the linked FAQ below.

https://creodias.eu/-/a-9-38

2. Switch to OpenStack Dashboard

To create a new instance you need to go to the OpenStack Dashboard.

After logging in to the newly created account, in the right corner select the "My Account" button and select "Your Cloud Environment"

After selecting this option, you should see monit with choice of authentication. Leave the "Open ID Connect" option and press the "Connect" button.

After logging in correctly, you should see the OpenStack Dashboard.

3. Instance creation

To access Sen4CAP you must first create an instance that supports Sen4CAP in project with access to EOData.

To do this, go to Project → Compute → Instances and press the "Launch Instance" button.

In the window for creating a new instance in the "Source" tab, select the image "CentOS 7 + Sen4CAP" by pressing the arrow button.

We recommend select the "No" option when choosing "Create New Volume".

Due to the large image size, the minimum available flavor to run the machine is "eo2.2xlarge". Choose this flavor or higher in the "Flavor" tab by pressing the arrow button.

Triangular warning signs mean that the flavor is too small to start the machine with the selected image.

In the "Networks" tab, select your private network and "eodata".

In the "Security Groups" tab, select "allow_ping_ssh_rdp" and the group that will allow ingress trafic on port 443 (HTTPS) e.g. "allow_https".

If you do not have such a security group, you can create one by following this FAQ: https://creodias.eu/-/how-to-use-security-groups-in-horizon-

In the rule you can specify which IP address should have HTTPS access.

We suggest that you create rules for trusted IP addresses.

Remember to add your public key in the "Key Pair" tab or create a new one after clicking the "Create Key Pair" button.

After entering the necessary data, press the "Launch Instance" button.

The newly created instance should be visible in Project → Compute → Instances.

Select the "Associate Floating IP" option from the "Action" column. A window with the option of adding FIP should be visible.

Select the already assigned FIP or add a new one from the pool by pressing the plus button. Remember to assign the FIP address to your private network address.

Finally press the "Associate" button

You can check the attached FIP address in Project → Compute → Instances. An FIP address is required to access Sen4CAP.

4. Post-creation operations

After the instance creation process is completed, you must perform the following steps necessary for proper operation. Connect to the newly created instance after SSH. By executing the following command:

ssh -i <ssh_private_key> eouser@<fip_adress>

After accessing the VM, execute the following commands:

sudo mount /eodata
sudo systemctl restart sen2agri-services

This operation is to mount an EOData resource.

5. Access to Sen4CAP

Sen4CAP is available from the browser level, and you can access it in two ways.

5.1 Directly from your browser

Open your browser and enter the address below. You can copy your machine address from Project → Compute → Instances.

https://<fip_adress>

If you're using a Chrome browser, you'll need to install the appropriate certificate.

5.2 With GUI access

You can get graphical access to your instance go to Project → Compute → Instances and expand the "Actions" menu on the right and select "Console".

At the beginning you will be asked to provide the password for the default user "eoconsole"

If the cursor doesn't respond, go to Project → Compute → Instances again and select "Console" from the "Actions" menu.

After logging in correctly you should see the GUI. In the upper left corner click on "Applications", from where you can choose the default browser (e.g. Firefox).

In the browser, enter the address below to access Sen4CAP.

https://<fip_adress>

6. First login

After loading the page, you should see the Sen4CAP page.

You will be redirected to the login page. The default user is:

  • Username: sen4cap
  • Password: sen4cap

After logging in to the default user "sen4cap", go to the user tab.

Press the "Add new user" button to create a new user.

Create a new user with administrator rights, and press "Save" button.

After creating a new user, press the "logout" button on the bar. You will be redirected back to the login window, but now click on the "Set a password" link. It is necessary to create a password for the newly created user.

Enter a new password and press "save".

After successfully logging in, go to the "users" tab and remove the user "sen4cap" by pressing the trash can button next to that user.

From now on you can use Sen4CAP freely.

If you need information and support how to use Sen4CAP, please contact with sales@creodias.eu.


How to mount object storage container as a file system in Linux using s3fs?

If you want to create new Object Storage container you may check following guide: LINK
To mount your Object Storage container as file system do following steps:

Check if the s3fs is preinstalled on your virtual machine:

eouser@vm1:~$ whereis s3fs
s3fs: /usr/local/bin/s3fs

Provide access and secret key to the .passwd-s3fs file in your home directory:

eouser@vm1:~$ echo access_key:secret_key>~/.passwd-s3fs

For obtaining ec2 credentials please follow this FAQ: How to generate ec2 credentials? or send a request to the support by creating a new ticket in the https://creodias.eu.

Change the permissions for the file with stored credentials:

eouser@vm1:~$ chmod 600 ~/.passwd-s3fs

Make an folder which you would like to use as mount place of the bucket:

eouser@vm1:~$ mkdir directory

Mount a container using s3fs:

eouser@vm1:~$ /usr/local/bin/s3fs testjohn directory -o passwd_file=~/.passwd-s3fs -o url=https://cf2.cloudferro.com:8080 -o use_path_request_style -o umask=0002 -o allow_other

 

Parameters explanation:

- o passwd file = describe the path to the file with credentials

-o url = describe an endpoint address of your private object storage

-o use path_request style = parameter that already fix issues with special characters such as dots.

-o umask = describe permissions for accessing a container (read-write-execute)

-o allow_other = the rule that allow other users to gain access to the container

If you do not proceed an operation as a root user, you may encounter an error such as:

fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf

In this case, open /etc/fuse.conf file and search for the line:

# Allow non-root users to specify the allow_other or allow_root mount options.

#user_allow_other

Uncomment user_allow_other by deleting #:

user_allow_other

Save the file.

Now you might repeat a mount command. After that, go to the directory where your bucket is being mounted and list all the data inside:

eouser@vm1:~$ cd directory/

eouser@vm1:~/directory$ ls -al

total 8

drwxrwxr-x 1 eouser eouser 0 Jan 1 1970 .

drwx------ 8 eouser eouser 4096 Jan 8 13:51 ..

-rwxrwxr-x 1 root root 2589 Jan 7 10:57 tes1.txt

It have found a one file: tes1.txt. To make sure about its existence, log in to your Horizon Panel and click on the Object Store tab:

Choose “Containers”.

Click on the container. In this case it’s being called “testjohn”.

On your right are files, that are stored inside the bucket.