OpenStack 安装和使用(六)
# openstack-config –set /etc/nova/nova.conf DEFAULT novncproxy_port 6080
这四行放在compute节点:
# openstack-config –set /etc/nova/nova.conf DEFAULT vnc_enabled true
# openstack-config –set /etc/nova/nova.conf DEFAULT vncserver_listen 10.24.1.47 这个地址为compute节点地址
# openstack-config –set /etc/nova/nova.conf DEFAULT vncserver_proxyclient_address 10.24.1.47 这个地址为compute节点地址
…
+——-+———————————————————————————+
| Type | Url |
+——-+———————————————————————————+
| novnc | http://10.24.1.47:6080/vnc_auto.html?token=d5de2212-1102-413c-a0e3-36063a2ff464 |
+——-+———————————————————————————+
# nova volume-list
+—-+——–+————–+——+————-+————————————–+
| ID | Status | Display Name | Size | Volume Type | Attached to |
+—-+——–+————–+——+————-+————————————–+
| 4 | in-use | vol_1 | 10 | None | c2cbfc4b-a45d-4685-ba97-9c4e6e454981 | 这里的in-use状态是VM启动之后的状态,没有启动前应该是available的才行。
+—-+——–+————–+——+————-+————————————–+
Block device mapping in the format <dev_name=<id>:<typ
e>:<size(GB)>:<delete_on_terminate>.
The command arguments are:
dev_name
A device name where the volume will be attached in the system at /dev/dev_name. This value is typically vda.
id
The ID of the volume to boot from, as shown in the output of nova volume-list.
type
This is either snap, which means that the volume was created from a snapshot, or anything other than snap (a blank string is valid). In the example above, the volume was not created from a snapshot, so we will leave this field blank in our example below.
size (GB)
The size of the volume, in GB. It is safe to leave this blank and have the Compute service infer the size.
delete_on_terminate
A boolean to indicate whether the volume should be deleted when the instance is terminated. True can be specified as True or 1. False can be specified as False or 0.
+————————————–+——————-+——–+——–+
| ID | Name | Status | Server |
+————————————–+——————-+——–+——–+
| a4966894-debd-4788-bd1a-4b6e27cc5dd2 | f17 | ACTIVE | |
+————————————–+——————-+——–+——–+
默认有flavor是有10GB硬盘空间的,安装时可以选择安装到这个10GB的vda里面。
before : #listen_tls = 0
after : listen_tls = 0
before : #listen_tcp = 1
after : listen_tcp = 1
add: auth_tcp = “none”
# vi /etc/init/libvirt-bin.conf
before : SERVICE=libvirtd
使用nova show <ID>看看VM当前跑在哪个host上:
+————————————-+———————————————————-+
| Property | Value |
+————————————-+———————————————————-+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-SRV-ATTR:host | compute1 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| OS-EXT-SRV-ATTR:instance_name | instance-00000018 |
cc (total) 8 16108 99
cc (used_now) 1 3029 74
cc (used_max) 4 8192 120
cc 94d38db32a7d4107beeed36d9e98bf06 4 8192 120
Exit code: 255
Stdout: ”
-rw——-. 1 nova nova 1675 Jul 20 14:26 id_rsa
-rw-r–r–. 1 nova nova 402 Jul 20 14:26 id_rsa.pub
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
GSSAPIAuthentication yes
Resize操作
Command: sudo nova-rootwrap guestmount –rw -a /var/lib/nova/instances/instance-0000001b/disk -i /tmp/tmpEB8ILz
Exit code: 1
Stdout: ”
Stderr: “/usr/bin/guestmount: multi-boot operating systems are not supported
EFI images isolinux LiveOS Packages repodata TRANS.TBL
# ls /mnt/tmp1
EFI
# ls /mnt/tmp2
EFI mach_kernel System
查看memcached的配置:
# vi /etc/sysconfig/memcached
PORT=”11211″
USER=”memcached”
MAXCONN=”1024″
CACHESIZE=”64″
OPTIONS=””
修改dashboard配置文件:
# vi /etc/openstack-dashboard/local_settings
匹配memcached为:
CACHE_BACKEND = ‘memcached://127.0.0.1:11211/’
修改数据库连接为:
DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: ‘dash’,
‘USER’: ‘dash’,
‘PASSWORD’: ‘dash’,
‘HOST’: ‘localhost’,
‘default-character-set’: ‘utf8’
},
}
建立mysql数据库:
mysql> CREATE DATABASE dash;
mysql> GRANT ALL ON dash.* TO ‘dash’@’%’ IDENTIFIED BY ‘dash’;
mysql> GRANT ALL ON dash.* TO ‘dash’@’localhost’ IDENTIFIED BY ‘dash’;
mysql> flush privileges;
同步数据库:
# /usr/share/openstack-dashboard/manage.py syncdb
启动:
# service memcached restart
# service httpd restart
这个dashboard几乎可以替代所有nova命令。包含虚拟机的管理,image的管理,vloume的管理,flavor的管理,tenant(project)的管理,user的管理。