openstack controller ha测试环境搭建记录(十五)——创建实例

# source demo-openrc.sh

# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
53:fd:b1:1e:28:c5:2e:d7:e8:ef:54:a8:0e:70:38:4a [email protected]
The key‘s randomart image is:
+--[ RSA 2048]----+
|                 |
|           o     |
|          . + .  |
|         o o = + |
|      E S + = * .|
|     . . = = o o |
|      .   . o o  |
|           o o   |
|            ..o  |
+-----------------+

# nova keypair-add --pub-key ~/.ssh/id_rsa.pub demo-key

# nova keypair-list
+----------+-------------------------------------------------+
| Name     | Fingerprint                                     |
+----------+-------------------------------------------------+
| demo-key | 53:fd:b1:1e:28:c5:2e:d7:e8:ef:54:a8:0e:70:38:4a |
+----------+-------------------------------------------------+

# nova flavor-list
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name      | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1  | m1.tiny   | 512       | 1    | 0         |      | 1     | 1.0         | True      |
| 2  | m1.small  | 2048      | 20   | 0         |      | 1     | 1.0         | True      |
| 3  | m1.medium | 4096      | 40   | 0         |      | 2     | 1.0         | True      |
| 4  | m1.large  | 8192      | 80   | 0         |      | 4     | 1.0         | True      |
| 5  | m1.xlarge | 16384     | 160  | 0         |      | 8     | 1.0         | True      |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+

# nova image-list
+--------------------------------------+--------------------------+--------+--------+
| ID                                   | Name                     | Status | Server |
+--------------------------------------+--------------------------+--------+--------+
| 89e7fa04-dc3c-426f-9752-75f4c603bcc2 | cirros-0.3.0-x86_64-disk | ACTIVE |        |
+--------------------------------------+--------------------------+--------+--------+

# neutron net-list
+--------------------------------------+----------+-----------------------------------------------------+
| id                                   | name     | subnets                                             |
+--------------------------------------+----------+-----------------------------------------------------+
| 6484c200-a3ff-437c-8749-cf83147cb0d3 | demo-net | 2b4bf426-5e0b-44da-8772-1a306f127793 192.168.1.0/24 |
+--------------------------------------+----------+-----------------------------------------------------+

# nova secgroup-list
+--------------------------------------+---------+-------------+
| Id                                   | Name    | Description |
+--------------------------------------+---------+-------------+
| 65e1f270-1073-4254-945e-86d1db4f0a30 | default | default     |
+--------------------------------------+---------+-------------+

# nova boot --flavor m1.tiny --image cirros-0.3.0-x86_64-disk --nic net-id=6484c200-a3ff-437c-8749-cf83147cb0d3 \
  --security-group default --key-name demo-key demo-instance1
+--------------------------------------+-----------------------------------------------------------------+
| Property                             | Value                                                           |
+--------------------------------------+-----------------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                          |
| OS-EXT-AZ:availability_zone          | nova                                                            |
| OS-EXT-STS:power_state               | 0                                                               |
| OS-EXT-STS:task_state                | scheduling                                                      |
| OS-EXT-STS:vm_state                  | building                                                        |
| OS-SRV-USG:launched_at               | -                                                               |
| OS-SRV-USG:terminated_at             | -                                                               |
| accessIPv4                           |                                                                 |
| accessIPv6                           |                                                                 |
| adminPass                            | 4rXi2w2radYo                                                    |
| config_drive                         |                                                                 |
| created                              | 2015-12-17T17:31:32Z                                            |
| flavor                               | m1.tiny (1)                                                     |
| hostId                               |                                                                 |
| id                                   | ddec8d7b-e829-4760-a1bf-bf1dd2995dd2                            |
| image                                | cirros-0.3.0-x86_64-disk (89e7fa04-dc3c-426f-9752-75f4c603bcc2) |
| key_name                             | demo-key                                                        |
| metadata                             | {}                                                              |
| name                                 | demo-instance1                                                  |
| os-extended-volumes:volumes_attached | []                                                              |
| progress                             | 0                                                               |
| security_groups                      | default                                                         |
| status                               | BUILD                                                           |
| tenant_id                            | 33c0fa01b2724184bc8def11443a3caa                                |
| updated                              | 2015-12-17T17:31:32Z                                            |
| user_id                              | cbdb8af1c8e9444dbd9974ad3aca66fe                                |
+--------------------------------------+-----------------------------------------------------------------+

# nova list
+--------------------------------------+----------------+--------+------------+-------------+----------------------+
| ID                                   | Name           | Status | Task State | Power State | Networks             |
+--------------------------------------+----------------+--------+------------+-------------+----------------------+
| ddec8d7b-e829-4760-a1bf-bf1dd2995dd2 | demo-instance1 | ERROR  | -          | NOSTATE     | demo-net=192.168.1.2 |
+--------------------------------------+----------------+--------+------------+-------------+----------------------+

# nova show ddec8d7b-e829-4760-a1bf-bf1dd2995dd2
+--------------------------------------+------------------------------------------------------------------------------------------+
| Property                             | Value                                                                                    |
+--------------------------------------+------------------------------------------------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                                                                   |
| OS-EXT-AZ:availability_zone          | nova                                                                                     |
| OS-EXT-STS:power_state               | 0                                                                                        |
| OS-EXT-STS:task_state                | -                                                                                        |
| OS-EXT-STS:vm_state                  | error                                                                                    |
| OS-SRV-USG:launched_at               | -                                                                                        |
| OS-SRV-USG:terminated_at             | -                                                                                        |
| accessIPv4                           |                                                                                          |
| accessIPv6                           |                                                                                          |
| config_drive                         |                                                                                          |
| created                              | 2015-12-17T17:31:32Z                                                                     |
| demo-net network                     | 192.168.1.2                                                                              |
| fault                                | {"message": "No valid host was found. ", "code": 500, "created": "2015-12-17T17:31:35Z"} |
| flavor                               | m1.tiny (1)                                                                              |
| hostId                               | 7788431710acba448fac373e02d6a8ce8c71d41f1355210071b2699e                                 |
| id                                   | ddec8d7b-e829-4760-a1bf-bf1dd2995dd2                                                     |
| image                                | cirros-0.3.0-x86_64-disk (89e7fa04-dc3c-426f-9752-75f4c603bcc2)                          |
| key_name                             | demo-key                                                                                 |
| metadata                             | {}                                                                                       |
| name                                 | demo-instance1                                                                           |
| os-extended-volumes:volumes_attached | []                                                                                       |
| security_groups                      | default                                                                                  |
| status                               | ERROR                                                                                    |
| tenant_id                            | 33c0fa01b2724184bc8def11443a3caa                                                         |
| updated                              | 2015-12-17T17:31:34Z                                                                     |
| user_id                              | cbdb8af1c8e9444dbd9974ad3aca66fe                                                         |
+--------------------------------------+------------------------------------------------------------------------------------------+
发现报错“No valid host was found”没有可用的主机。

查看comput1的服务状态:
# systemctl status libvirtd.service openstack-nova-compute.service
libvirtd.service - Virtualization daemon
   Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled)
   Active: active (running) since Wed 2015-12-16 23:18:19 CST; 1 day 2h ago
     Docs: man:libvirtd(8)
           http://libvirt.org
 Main PID: 2710 (libvirtd)
   CGroup: /system.slice/libvirtd.service
           └─2710 /usr/sbin/libvirtd

Dec 16 23:20:05 compute1 libvirtd[2710]: End of file while reading data: Input/output error
Dec 16 23:20:06 compute1 libvirtd[2710]: End of file while reading data: Input/output error
Dec 16 23:20:08 compute1 libvirtd[2710]: End of file while reading data: Input/output error
Dec 16 23:21:59 compute1 libvirtd[2710]: End of file while reading data: Input/output error
Dec 16 23:22:01 compute1 libvirtd[2710]: End of file while reading data: Input/output error
Dec 16 23:22:02 compute1 libvirtd[2710]: End of file while reading data: Input/output error
Dec 16 23:22:04 compute1 libvirtd[2710]: End of file while reading data: Input/output error
Dec 16 23:22:05 compute1 libvirtd[2710]: End of file while reading data: Input/output error
Dec 17 22:22:58 compute1 libvirtd[2710]: End of file while reading data: Input/output error
Dec 18 01:43:27 compute1 systemd[1]: Started Virtualization daemon.

# nova delete ddec8d7b-e829-4760-a1bf-bf1dd2995dd2

# nova get-vnc-console demo-instance1 novnc

# ping -c 4 192.168.1.1

时间: 2024-12-15 22:22:35

openstack controller ha测试环境搭建记录(十五)——创建实例的相关文章

openstack controller ha测试环境搭建记录(一)——操作系统准备篇

为了初步了解openstack controller ha的工作原理,搭建测试环境进行学习. 在学习该方面知识时,当前采用的操作系统版本是centos 7.1 x64.首先在ESXi中建立2台用于测试的虚机,最小化安装完成centos,配置IP分别为10.0.0.12.10.0.0.13,主机名分别为controller2.controller3. 关闭防火墙:# systemctl stop firewalld# systemctl disable firewalld 修改主机名:# host

openstack controller ha测试环境搭建记录(二)——配置corosync和pacemaker

corosync.conf请备份再编辑:# vi /etc/corosync/corosync.conf totem {        version: 2 token: 10000        token_retransmits_before_loss_const: 10        secauth: off        rrp_mode: active interface {                ringnumber: 0                bindnetaddr

openstack controller ha测试环境搭建记录(十二)——配置neutron(计算节点)

在计算节点配置内核参数:vi /etc/sysctl.confnet.ipv4.conf.all.rp_filter=0net.ipv4.conf.default.rp_filter=0 在计算节点使内核参数立即生效:sysctl -p 在计算节点安装软件:yum install -y openstack-neutron-ml2 openstack-neutron-openvswitch 在计算节点修改配置文件:openstack-config --set /etc/neutron/neutro

openstack controller ha测试环境搭建记录(十四)——配置cinder(存储节点)

先简述cinder存储节点的配置:  1.IP地址是10.0.0.41:  2.主机名被设置为block1:  3.所有节点的hosts文件已添加相应条目:  4.已经配置了ntp时间同步:  5.已安装lvm2,并设置为开机自动启动:  6.已经挂载了新的存储设备/dev/sdb. 在存储节点执行下列命令:pvcreate /dev/sdb1vgcreate cinder-volumes /dev/sdb1 在存储节点和计算节点执行df命令:# df -hFilesystem         

openstack controller ha测试环境搭建记录(六)——配置keystone

在所有节点的hosts文件添加:10.0.0.10 myvip 在所有节点安装# yum install -y openstack-keystone python-keystoneclient# yum install -y openstack-utils 在所有节点设置keystone.conf文件使用mysql集群地址:# openstack-config --set /etc/keystone/keystone.conf database connection mysql://keysto

openstack controller ha测试环境搭建记录(十三)——配置cinder(控制节点)

在任一控制节点创建用户:mysql -u root -pCREATE DATABASE cinder;GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY '123456';GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY '123456'; 在任一控制节点创建相关用户:source admin-openrc.shkeystone u

openstack controller ha测试环境搭建记录(三)——配置haproxy

haproxy.cfg请备份再编辑:# /etc/haproxy/haproxy.cfg global    chroot /var/lib/haproxy    daemon    group haproxy    maxconn 4000    pidfile /var/run/haproxy.pid    user haproxy defaults    log global    maxconn 4000    option redispatch    retries 3    time

openstack controller ha测试环境搭建记录(四)——配置mysql数据库集群

内容正式开始前,我已经在集群中添加了新的节点controller1(IP地址为10.0.0.14). 安装软件:# yum install -y mariadb-galera-server xinetd rsync 创建用于健康检查的用户:# systemctl start mysqld.service# mysql -e "CREATE USER 'clustercheck'@'localhost' IDENTIFIED BY '123456';"# systemctl stop m

openstack controller ha测试环境搭建记录(十一)——配置neutron(网络节点)

在网络节点配置内核参数:vi /etc/sysctl.confnet.ipv4.ip_forward=1net.ipv4.conf.all.rp_filter=0net.ipv4.conf.default.rp_filter=0 在网络节点使内核参数立即生效:sysctl -p 在网络节点安装软件:yum install -y openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch 在网络节点修改配置文件:ope