Openstack for container deployment enters the database process, views the install directory process, and container deployment uses the virsh command process [View virtual machine information on the computing node]

Article directory

  • illustrate
  • Enter database method [control node]
    • Get nova password
    • View database container
    • Enter the container
    • Log in to the database in the container
    • View test
  • View the install directory process [compute node]
    • View container
    • Enter the container
  • Using virsh command process [compute node]
    • View container
    • Enter the container to execute the command to view the virtual machine and its uuid
    • Execute commands without entering the container to view the virtual machine and its uuid

Description

  • What is container deployment? Needless to say, right?
    The container of the computing node is as follows

Enter database method [control node]

Get nova password

First get the password of the nova database
Control node execution: grep mysql /etc/kolla/nova-api/nova.conf [The directory is not fixed, you can use the find command to find the nova.conf file to view], as follows, 1Gr2qFT0LmZ46v0GrFUJmXEFTTBHWVWzofxkxLAn is the password

[root@controller01 ~]# grep mysql /etc/kolla/nova-api/nova.conf
connection = mysql + pymysql://nova:[email protected]:3306/nova
connection = mysql + pymysql://nova_api:[email protected]:3306/nova_api
[root@controller01 ~]#

View database container

There will definitely be a database container, for example, this is mariadb

[root@controller01 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES openvswitch_vswitchd
...
0e12fe84c1d1 1.2.101.32:9980/kolla/centos-binary-iscsid:5.0.6.6 "kolla_start" 2 years ago Up 2 years iscsid
fcaf8d58d941 1.2.101.32:9980/kolla/centos-binary-mariadb:5.0.6.6 "kolla_start" 2 years ago Up 23 months mariadb
85cb175184b1 1.2.101.32:9980/kolla/centos-binary-memcached:5.0.6.6 "kolla_start" 2 years ago Up 23 months memcached
...
[root@controller01 ~]#

Enter the container

[root@controller01 ~]# docker exec -it mariadb /bin/bash
(mariadb)[mysql@controller01 /]$ mysql -unova -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 170661721
Server version: 10.0.38-MariaDB-wsrep MariaDB Server, wsrep_25.25.rc3fc46e

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Login database in container

(mariadb)[mysql@controller01 /]$ mysql -unova -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 170666994
Server version: 10.0.38-MariaDB-wsrep MariaDB Server, wsrep_25.25.rc3fc46e

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

View tests

MariaDB [(none)]>
MariaDB [(none)]> use nova;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [nova]>
MariaDB [nova]> select * from instances where uuid= '19ec09a5-151b-4111-a4bd-636d10794912' \G
*************************** 1. row ********************* *******
              created_at: 2022-01-18 14:15:33
              updated_at: 2023-10-12 01:33:59
              deleted_at: NULL
                      ID: 3237
             internal_id: NULL
                 user_id: cd7e88be84f14196a468f443b345288c
              project_id: 22fce3ac5d094a32a652555584dd47fb
               image_ref:
               kernel_id:
              ramdisk_id:
            launch_index: 0
                key_name: NULL
                key_data: NULL
             power_state: 0
                vm_state: active
               memory_mb: 65536
                   vcpus: 16
                hostname: rms-database2
                    host:compute30
               user_data: I2Nsb3VkLWNvbmZpZw0KZGlzYWJsZV9yb290OiBGYWxzZQ0KcGFzc3dvcmQ6IGlSbVNEYXRhQmFzZTNKIyEha2UmaiheXikNCmNocGFzc3dkOg0KICAgIGxpc3Q6IHwNCiAgICAgICAgICByb 290OmlSbVNEYXRhQmFzZTNKIyEha2UmaiheXikNCiAgICBleHBpcmU6IEZhbHNlDQpzc2hfcHdhdXRoOiBUcnVl
          reservation_id: r-zvgjpx0l
             launched_at: 2022-01-18 14:16:02
           terminated_at: NULL
            display_name: rms-database2
     display_description: rms-database2
       availability_zone: core
                  locked: 0
                 os_type: NULL
             launched_on: compute30
        instance_type_id: 70
                 vm_mode: NULL
                    uuid: 19ec09a5-151b-4111-a4bd-636d10794912
            architecture: NULL
        root_device_name: /dev/vda
            access_ip_v4: NULL
            access_ip_v6: NULL
            config_drive: True
              task_state: NULL
default_ephemeral_device: NULL
     default_swap_device: NULL
                Progress: 0
        auto_disk_config: 0
      shutdown_terminate: 0
       disable_terminate: 0
                 root_gb: 200
            ephemeral_gb: 0
               cell_name: NULL
                    node:compute30
                 deleted: 0
               locked_by: NULL
                 cleaned: 0
      ephemeral_key_uuid: NULL
1 row in set (0.00 sec)

MariaDB [nova]>

View the install directory process [Compute Node]

View container

  • Both nova_compute and nova_libvirt containers can view the instance directory. You can enter either one.
[root@compute30 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0f14cdcf6f90 1.2.101.32:9980/kolla/centos-binary-neutron-openvswitch-agent:5.0.6.6 "kolla_start" 2 years ago Up 2 years neutron_openvswitch_agent
733b936d9a69 1.2.101.32:9980/kolla/centos-binary-openvswitch-vswitchd:5.0.6.6 "kolla_start" 2 years ago Up 2 years openvswitch_vswitchd
d3dfc7bd9741 1.2.101.32:9980/kolla/centos-binary-openvswitch-db-server:5.0.6.6 "kolla_start" 2 years ago Up 2 years openvswitch_db
cc979a6d2dc3 1.2.101.32:9980/kolla/centos-binary-nova-compute:5.0.6.6 "kolla_start" 2 years ago Up 4 months nova_compute
2fd8430c10fc 1.2.101.32:9980/kolla/centos-binary-nova-libvirt:5.0.6.6 "kolla_start" 2 years ago Up 2 years nova_libvirt
5317fd6f9dc4 1.2.101.32:9980/kolla/centos-binary-nova-ssh:5.0.6.6 "kolla_start" 2 years ago Up 2 years nova_ssh
63dc84cd0a08 1.2.101.32:9980/kolla/centos-binary-chrony:5.0.6.6 "kolla_start" 2 years ago Up 13 months chrony
c502dcb7f5d1 1.2.101.32:9980/kolla/centos-binary-cron:5.0.6.6 "kolla_start" 2 years ago Up 2 years cron
37f17293ad92 1.2.101.32:9980/kolla/centos-binary-kolla-toolbox:5.0.6.6 "kolla_start" 2 years ago Up 2 years kolla_toolbox
aa0a7798f731 1.2.101.32:9980/kolla/centos-binary-fluentd:5.0.6.6 "dumb-init --single-…" 2 years ago Up 2 years fluentd
[root@compute30 ~]#

Enter the container

  • Enter nova_libvirt to view
    My instance directory is /var/lib/nova/instances/ [If yours is not the same, just use find to search for instances]
[root@compute30 ~]# docker exec -it nova_libvirt bash
(nova-libvirt)[root@compute30 /]# cd /var/lib/nova/instances/
(nova-libvirt)[root@compute30 instances]# ls
19ec09a5-151b-4111-a4bd-636d10794912 b0cc2a24-1c9c-46d3-bd3b-ef90b78c871c b7a9b013-d364-4588-b8ae-f6cbd4ba704f _base daaf62bf-ed53-4a16-8 92a-798ac427254b f8a41b8e-c989-4645-9f18-fdeee075c8d9
4fad6565-b24b-4617-bb8e-4110ebd43026 b3b091ee-fcbc-4a2a-8a09-7250ee144f3c b99dc9e3-0d6b-4b3b-965a-d4e10791c4f0 compute_nodes f76744d4-afbc-4d9 2-80e0-cbdb7b30be15 locks
(nova-libvirt)[root@compute30 instances]# cd 19ec09a5-151b-4111-a4bd-636d10794912/
(nova-libvirt)[root@compute30 19ec09a5-151b-4111-a4bd-636d10794912]# ls
console.log
(nova-libvirt)[root@compute30 19ec09a5-151b-4111-a4bd-636d10794912]#
  • Enter nova_compute to view
    You can see that the display content is the same as nova_libvrit
[root@compute30 ~]# docker exec -it nova_compute bash
(nova-compute)[nova@compute30 /]$ cd /var/lib/nova/instances/
(nova-compute)[nova@compute30 /var/lib/nova/instances]$ ls
19ec09a5-151b-4111-a4bd-636d10794912 _base b3b091ee-fcbc-4a2a-8a09-7250ee144f3c b99dc9e3-0d6b-4b3b-965a-d4e10791c4f0 daaf62bf-ed53-4a16 -892a-798ac427254b f8a41b8e-c989-4645-9f18-fdeee075c8d9
4fad6565-b24b-4617-bb8e-4110ebd43026 b0cc2a24-1c9c-46d3-bd3b-ef90b78c871c b7a9b013-d364-4588-b8ae-f6cbd4ba704f compute_nodes f76744d4-afbc-4d92- 80e0-cbdb7b30be15 locks
(nova-compute)[nova@compute30 /var/lib/nova/instances]$ cd 19ec09a5-151b-4111-a4bd-636d10794912/
(nova-compute)[nova@compute30 /var/lib/nova/instances/19ec09a5-151b-4111-a4bd-636d10794912]$ ls
console.log
(nova-compute)[nova@compute30

Use virsh command process [compute node]

View container

  • The virsh command is based on the libvirt service, so we need to enter the nova_libvirt container
[root@compute30 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0f14cdcf6f90 1.2.101.32:9980/kolla/centos-binary-neutron-openvswitch-agent:5.0.6.6 "kolla_start" 2 years ago Up 2 years neutron_openvswitch_agent
733b936d9a69 1.2.101.32:9980/kolla/centos-binary-openvswitch-vswitchd:5.0.6.6 "kolla_start" 2 years ago Up 2 years openvswitch_vswitchd
d3dfc7bd9741 1.2.101.32:9980/kolla/centos-binary-openvswitch-db-server:5.0.6.6 "kolla_start" 2 years ago Up 2 years openvswitch_db
cc979a6d2dc3 1.2.101.32:9980/kolla/centos-binary-nova-compute:5.0.6.6 "kolla_start" 2 years ago Up 4 months nova_compute
2fd8430c10fc 1.2.101.32:9980/kolla/centos-binary-nova-libvirt:5.0.6.6 "kolla_start" 2 years ago Up 2 years nova_libvirt
5317fd6f9dc4 1.2.101.32:9980/kolla/centos-binary-nova-ssh:5.0.6.6 "kolla_start" 2 years ago Up 2 years nova_ssh
63dc84cd0a08 1.2.101.32:9980/kolla/centos-binary-chrony:5.0.6.6 "kolla_start" 2 years ago Up 13 months chrony
c502dcb7f5d1 1.2.101.32:9980/kolla/centos-binary-cron:5.0.6.6 "kolla_start" 2 years ago Up 2 years cron
37f17293ad92 1.2.101.32:9980/kolla/centos-binary-kolla-toolbox:5.0.6.6 "kolla_start" 2 years ago Up 2 years kolla_toolbox
aa0a7798f731 1.2.101.32:9980/kolla/centos-binary-fluentd:5.0.6.6 "dumb-init --single-…" 2 years ago Up 2 years fluentd
[root@compute30 ~]#

Enter the container to execute the command to view the virtual machine and its uuid

[root@compute30 ~]# docker exec -it nova_libvirt bash
(nova-libvirt)[root@compute30 /]#
(nova-libvirt)[root@compute30 /]# virsh list --all
 Id Name State
-------------------------------------------------- --
 27 instance-00000c37 running
 33 instance-00000cf0 running
 41 instance-00000e08 running
 45 instance-0000144d running
 52 instance-00000c5a running
 54 instance-00000c0a running
 60 instance-00000d0e running

(nova-libvirt)[root@compute30 /]#
(nova-libvirt)[root@compute30 /]# virsh domuuid 27
b99dc9e3-0d6b-4b3b-965a-d4e10791c4f0

(nova-libvirt)[root@compute30 /]#
(nova-libvirt)[root@compute30 /]# virsh domuuid 33
b0cc2a24-1c9c-46d3-bd3b-ef90b78c871c

(nova-libvirt)[root@compute30 /]#

Execute commands without entering the container to view the virtual machine and its uuid

  • Command: docker exec NAMES command [docker ps view NAMES]
[root@compute30 ~]# docker exec nova_libvirt virsh list --all
 Id Name State
-------------------------------------------------- --
 27 instance-00000c37 running
 33 instance-00000cf0 running
 41 instance-00000e08 running
 45 instance-0000144d running
 54 instance-00000c0a running
 79 instance-00000ca5 running

[root@compute30 ~]#
[root@compute30 ~]# docker exec nova_libvirt virsh domuuid 27
b99dc9e3-0d6b-4b3b-965a-d4e10791c4f0

[root@compute30 ~]#
  • Change a container to check the time and continue testing
[root@compute30 ~]# docker exec nova_compute date
Thu Oct 12 17:40:38 CST 2023
[root@compute30 ~]#