创建一个云主机

创建云主机(续上一张)

创建云主机要先把镜像传上去
一、上传镜像
使用glance命令
可以先试用帮助命令找一下使用的参数

[root@controller ~]# glance help image-create 
usage: glance image-create [--architecture <ARCHITECTURE>]
                           [--protected [True|False]] [--name <NAME>]
                           [--instance-uuid <INSTANCE_UUID>]
                           [--min-disk <MIN_DISK>] [--visibility <VISIBILITY>]
                           [--kernel-id <KERNEL_ID>]
                           [--tags <TAGS> [<TAGS> ...]]
                           [--os-version <OS_VERSION>]
                           [--disk-format <DISK_FORMAT>]
                           [--os-distro <OS_DISTRO>] [--id <ID>]
                           [--owner <OWNER>] [--ramdisk-id <RAMDISK_ID>]
                           [--min-ram <MIN_RAM>]
                           [--container-format <CONTAINER_FORMAT>]
                           [--property <key=value>] [--file <FILE>]
                           [--progress]

Create a new image.

Optional arguments:
  --architecture <ARCHITECTURE>
                        Operating system architecture as specified in
                        http://docs.openstack.org/trunk/openstack-
                        compute/admin/content/adding-images.html
  --protected [True|False]
                        If true, image will not be deletable.
  --name <NAME>         Descriptive name for the image
  --instance-uuid <INSTANCE_UUID>
                        Metadata which can be used to record which instance
                        this image is associated with. (Informational only,
                        does not create an instance snapshot.)
  --min-disk <MIN_DISK>
                        Amount of disk space (in GB) required to boot image.
  --visibility <VISIBILITY>
                        Scope of image accessibility Valid values: public,
                        private
  --kernel-id <KERNEL_ID>
                        ID of image stored in Glance that should be used as
                        the kernel when booting an AMI-style image.
  --tags <TAGS> [<TAGS> ...]
                        List of strings related to the image
  --os-version <OS_VERSION>
                        Operating system version as specified by the
                        distributor
  --disk-format <DISK_FORMAT>
                        Format of the disk Valid values: ami, ari, aki, vhd,
                        vmdk, raw, qcow2, vdi, iso
  --os-distro <OS_DISTRO>
                        Common name of operating system distribution as
                        specified in http://docs.openstack.org/trunk
                        /openstack-compute/admin/content/adding-images.html
  --id <ID>             An identifier for the image
  --owner <OWNER>       Owner of the image
  --ramdisk-id <RAMDISK_ID>
                        ID of image stored in Glance that should be used as
                        the ramdisk when booting an AMI-style image.
  --min-ram <MIN_RAM>   Amount of ram (in MB) required to boot image.
  --container-format <CONTAINER_FORMAT>
                        Format of the container Valid values: ami, ari, aki,
                        bare, ovf, ova, docker
  --property <key=value>
                        Arbitrary property to associate with image. May be
                        used multiple times.
  --file <FILE>         Local file that contains disk image to be uploaded
                        during creation. Alternatively, the image data can be
                        passed to the client via stdin.
  --progress            Show upload progress bar.

Run `glance --os-image-api-version 1 help image-create` for v1 help

然后根据选择需要使用的参数,添加镜像
先看一下镜像

[root@controller ~]# cp /opt/iaas/images/* ./
[root@controller ~]# ll
total 8259588
-rw-r--r--. 1 root root          4 Dec 11 11:34 1.txt
-rw-------. 1 root root       1121 Dec  7 11:59 anaconda-ks.cfg
-rw-r--r--. 1 root root  283181056 Dec 11 21:15 CentOS_6.5_x86_64_XD.qcow2
-rw-r--r--. 1 root root  400752640 Dec 11 21:15 CentOS_7.2_x86_64_XD.qcow2
-rw-r--r--. 1 root root 4329570304 Jun  7  2019 CentOS-7-x86_64-DVD-1511.iso
-rw-r--r--. 1 root root  592800256 Dec 11 21:16 MySQL_5.6_XD.qcow2
-rw-r--r--. 1 root root 2851502080 Nov  5  2017 XianDian-IaaS-v2.2.iso

我们上传centos7的镜像

[root@controller ~]# glance  image-create   --name centos7 --disk-format qcow2 --container-format bare  --progress<CentOS_7.2_x86_64_XD.qcow2
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | ea197f4c679b8e1ce34c0aa70ae2a94a     |
| container_format | bare                                 |
| created_at       | 2019-12-12T02:32:35Z                 |
| disk_format      | qcow2                                |
| id               | 6babbb04-da4b-4197-a34f-7a39026bf1d8 |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | centos7                              |
| owner            | 5cb6243755824171b7e0873b18847545     |
| protected        | False                                |
| size             | 400752640                            |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2019-12-12T02:32:52Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+
[root@controller ~]# 

上传完成后,在web页面会有一个显示
在这里插入图片描述
有了镜像就可以创建云主机了
根据下图顺序创建云主机
在这里插入图片描述
给云主机创建用户名
在这里插入图片描述
选择镜像
在这里插入图片描述
选一个规则
在这里插入图片描述
选择网络
在这里插入图片描述
然后启动实例
在这里插入图片描述
等待云主机创建完成后,绑定浮动ip即可
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值