openstack 运维

openstack 运维

Acha
2021-05-29 / 0 评论 / 148 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年05月29日,已超过1060天没有更新,若内容或图片失效,请留言反馈。

Glance

创建镜像

glance image-create --name "cirros-0.3.2" --disk-format qcow2 \
    --container-format bare --progress < cirros-0.3.2-x86_64-disk.img

查看镜像列表

glance image-list

查看镜像详细信息

glance image-show <ID>

删除镜像

glance image-delete <ID>

更新镜像

glance image-update [opt] <ID>


Nova

  • Nova 对镜像进行管理

    • 通过快照创建镜像。

      nova image-create [--show] [--poll] <server> <name>
      :做快照的实例的 名字 / ID :快照名字
    • 查询镜像列表

      nova image-list
    • 查询镜像详细信息

      nova image-show <image>
      : ID / 镜像名字
  • Nova 管理安全组规则

    • 创建安全组

      nova secgroup-create <name> <description>
      : 安全组名字 : 安全组描述
    • 安全组添加规则

      nova secgroup-add-rule <secgroup> <ip-proto> <from-port> <to-port> <cidr>
      : 安全组名字戒者 ID

      : IP协议(icmp,tcp,udp)

      :起始端口 :结束端口 :网络地址
  • Nova 管理虚拟机类型

    • 创建一个虚拟机类型

      nova flavor-create
          [--ephemeral <ephemeral>]   临时磁盘大小,单位为 GB
          [--swap <swap>]             交换分区大小
          [--rxtx-factor <factor>]    传输因子,默认 1
          [--is-public<is-public>]    是否共享
          <name> <id> <ram> <disk> <vcpus>

      固定参数说明:

      • :虚拟机类型名字
      • :虚拟机类型 ID
      • :虚拟内存大小
      • :磁盘大小
      • :虚拟内核个数
  • Nova 实例管理

    • 启动实例

      nova boot
          [--flavor <flavor>]             虚拟机类型
          [--image <image>]               选用的镜像
          [--image-with <key=value>]      镜像的元数据属性
          [--boot-volume <volume_id>]     启动逻辑卷的 ID
          [--snapshot <snapshot_id>]      快照
          [--num-instances <number>]      实例数量
          [--meta<key=value>]             元数据
          [--file <dst-path=src-path>]    文件
          [--key-name <key-name>]         密钥名称
          [--user-data <user-data>]       注入的用户数据
          [--availability-zone <availability-zone>]        可用域
          [--security-groups <security-groups>]            安全组
          [--block-device-mapping <dev-name=mapping>]      块存储格式化
          [--block-device key1=value1[,key2=value2...]]   块设备参数
          [--swap <swap_size>]                             交换分区大小
          [--ephemeral size=<size>[,format=<format>]]     连接块存储大小
          [--hint <key=value>]                             自定义数据
          [--nic <net-id=net-uuid,v4-fixed-ip=ip-addr,port-id=port-uuid>]     配置 IP
          [--config-drive <value>]        驱动使能
          [--poll]                        显示创建进度
      
           <name>
      : 实例名称
    • 查看实例列表

      nova list
    • 查看实例具体的配置信息

      nova flavor-show m1.small
    • 查看该实例在机器的具体位置的命令如下

      nova show Cloud_test
  • Nova 对逻辑卷的管理

    • 通过 Nova 创建逻辑卷

      nova volume-create
          [--snapshot-id <snapshot-id>]       通过快照创建逻辑卷的快照ID
          [--image-id <image-id>]             通过快照创建逻辑卷的镜像ID
          [--display-name <display-name>]     逻辑卷名称
          [--display-description <display-description>]   逻辑卷描述
          [--volume-type <volume-type>]       逻辑卷类型
          [--availability-zone <availability-zone>]       逻辑卷可用域
      
          <size>
      :大小


Neutron

  • 列出系统扩展命令

    neutron ext-list -c alias -c name
  • 创建网络

    neutron net-create ext-net --shared --router:external=True
  • 创建子网

    neutron subnet-create ext-net \
      --name ext-subnet \
      --allocation-pool start=172.24.7.100,end=172.24.7.200 \
      --disable-dhcp \
      --gateway 172.24.7.254 \
      172.24.7.0/24
  • 创建用户网络

    neutron net-create demo-net
  • 创建用户子网

    neutron subnet-create demo-net --name demo-subnet \
      --gateway 10.0.0.1 \
      10.0.0.0/24
  • 创建路由

    neutron router-create router1
  • 创建路由网关接口

     neutron router-interface-add router1 demo-subnet \
      Added interface 70c3c2af-cc96-4e5c-80aa-d9797656e836 to router router1
    
    neutron router-gateway-set router1 ext-net \
      Set gateway for router router1


Cinder

  • 创建卷类型

    cinder type-create lvm
  • 查询 type 标识的卷类型

    cinder type-list
  • 创建 cinder 存储卷

    cinder create 
      [--consisgroup-id <consistencygroup-id>]
      [--snapshot-id <snapshot-id>]       从特定的快照来创建
      [--source-volid <source-volid>]     从已创建的Cinder卷来创建一张内容相同的卷
      [--source-replica <source-replica>] 
      [--image-id <image-id>]     从一个已创建的镜像来构建一个带镜像内容的Cinder卷
        [--image <image>]         
      [--name <name>]         Cinder卷的名字              
      [--description <description>]       描述信息
      [--volume-type <volume-type>]       指定卷类型
      [--availability-zone <availability-zone>]       指定可用域
      [--metadata [<key=value> [<key=value> ...]]]    指定属性信息
      [--hint <key=value>]    
        [--allow-multiattach]
    
      [<size>]
  • 删除指定的 Cinder 卷

     cinder delete <volume> [<volume> ...]
  • 创建 Cinder 卷快照

    cinder snapshot-create 
      [--force [<True|False>]]    强制创建
      [--name <name>]             
        [--description <description>]
      [--metadata [<key=value> [<key=value> ...]]]
    
      <volume>
  • 查看 Cinder 卷、快照信息

    • 查看卷列表

      cinder list
    • 查看指定于硬盘的详细信息

      cinder show 0643885c-1dc7-4f9f-9309-382c54cc6790


Swift

  • 显示账户、对象或容器的信息

    swift stat [container] [object]

    [container]:容器名称

    [object] :对象名称

  • 列出该账户的容器戒容器的对象

    Swift list [command-options] [container]

    [command-options]:选项

    [container]:容器名称

  • 创建 容器

    swift post [command-options] [container] [object]

    [command-options]:选项

    [container]:容器名称

    [object]:对象名称

  • 文件传到容器内

    swift upload [command-options] container file_or_directory [file_or_directory] [...]

    [command-options]:选项

    Container:容器名称,或者是容器内的目录

    file_or_directory:本地文件系统内的目录或者文件

    [file_or_directory] :本地文件系统内的目录或者文件,可同时上传多个目录或文件。

  • 下载容器中的对象

    swift download [command-options] [container] [object] [object] [...]

    [command-options]:选项

    [container]:容器名称

    [object]:对象名称(可同时下载多个对象)

  • 删除容器中的对象

    swift delete [command-options] [container] [object] [object] [...]

    [command-options]:选项

    [container]:容器名称

    [object]:对象名称(可同时下载多个对象)

0

评论

博主关闭了当前页面的评论