add storage network docks

This commit is contained in:
wanyaoqi
2019-06-28 20:10:29 +08:00
parent d5f4e5eecf
commit 270e0251b0
16 changed files with 1039 additions and 4 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ func init() {
StorageType string `help:"Storage type" choices:"local|nas|vsan|rbd|nfs|gpfs|baremetal"`
MonHost string `help:"Ceph mon_host config"`
Key string `help:"Ceph key config"`
Pool string `help:"Ceph Poll Name"`
Pool string `help:"Ceph Pool Name"`
NfsHost string `help:"NFS host"`
NfsSharedDir string `help:"NFS shared dir"`
}
+29
View File
@@ -0,0 +1,29 @@
get:
summary: 获取宿主机和存储的绑定关系详情信息
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/hoststorage.yaml#/HostStorageResponse'
tags:
- hoststorages
post:
summary: 宿主机和存储绑定
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/hoststorage.yaml#/HostStorageResponse'
tags:
- hoststorages
delete:
summary: 解除宿主机和存储的绑定关系
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/hoststorage.yaml#/HostStorageResponse'
tags:
- hoststorages
+17
View File
@@ -0,0 +1,17 @@
get:
summary: 按指定条件列出已经绑定的宿主机和存储
parameters:
- $ref: '../parameters/common.yaml#/limit'
- $ref: '../parameters/common.yaml#/offset'
- $ref: '../parameters/common.yaml#/zone'
- $ref: '../parameters/common.yaml#/region'
- $ref: '../parameters/common.yaml#/brand'
- $ref: '../parameters/hoststorage.yaml#/storage'
- $ref: '../parameters/hoststorage.yaml#/host'
responses:
200:
description: 存储列表信息
schema:
$ref: '../schemas/hoststorage.yaml#/HostStorageListResponse'
tags:
- hoststorages
+35
View File
@@ -32,6 +32,41 @@ tags:
- name: instance
paths:
/storages:
$ref: "./storage/storages.yaml"
/storages/{storageId}:
$ref: "./storage/storage.yaml"
/storages/{storageId}/enable:
$ref: "./storage/storage.yaml#/enable"
/storages/{storageId}/disable:
$ref: "./storage/storage.yaml#/disable"
/storages/{storageId}/online:
$ref: "./storage/storage.yaml#/online"
/storages/{storageId}/offline:
$ref: "./storage/storage.yaml#/offline"
/hoststorages:
$ref: "./hoststorage/hoststorage.yaml"
/hosts/{hostId}/storages/{storageId}:
$ref: "./hoststorage/hoststorages.yaml"
/networks:
$ref: "./network/networks.yaml"
/networks/{networkId}:
$ref: "./network/network.yaml"
/networks/{networkId}/private:
$ref: "./network/network.yaml#/private"
/networks/{networkId}/public:
$ref: "./network/network.yaml#/public"
/networks/{networkId}/split:
$ref: "./network/network.yaml#/split"
/networks/{networkId}/merge:
$ref: "./network/network.yaml#/merge"
/networks/{networkId}/reserve-ip:
$ref: "./network/network.yaml#/reserve-ip"
/networks/{networkId}/release-reserve-ip:
$ref: "./network/network.yaml#/release-reserve-ip"
/servers:
$ref: "./instance/instances.yaml"
/servers/{instanceId}/add-secgroup:
+1 -1
View File
@@ -11,7 +11,7 @@ get:
tags:
- instance
put:
summary: 更新实例信息
summary: 更新实例信息
parameters:
- $ref: '../parameters/instance.yaml#/instanceId'
- in: body
+137
View File
@@ -0,0 +1,137 @@
get:
summary: 获取指定网络详情信息
parameters:
- $ref: '../parameters/network.yaml#/networkId'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/network.yaml#/NetworkResponse'
tags:
- networks
delete:
summary: 删除指定网络
parameters:
- $ref: '../parameters/network.yaml#/networkId'
responses:
200:
schema:
$ref: '../schemas/network.yaml#/NetworkResponse'
tags:
- networks
put:
summary: 更新IP子网信息
parameters:
- $ref: '../parameters/network.yaml#/networkId'
- in: body
name: network
required: true
schema:
$ref: '../schemas/network.yaml#/NetworkUpdate'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/network.yaml#/NetworkResponse'
tags:
- networks
private:
post:
summary: 设置IP子网为私有
parameters:
- $ref: '../parameters/network.yaml#/networkId'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/network.yaml#/NetworkResponse'
tags:
- networks
public:
post:
summary: 设置IP子网为共享
parameters:
- $ref: '../parameters/network.yaml#/networkId'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/network.yaml#/NetworkResponse'
tags:
- networks
split:
post:
summary: 分割IP子网
parameters:
- $ref: '../parameters/network.yaml#/networkId'
- in: body
name: network
required: true
schema:
$ref: '../schemas/network.yaml#/NetworkSplit'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/network.yaml#/NetworkResponse'
tags:
- networks
merge:
post:
summary: 分割IP子网
parameters:
- $ref: '../parameters/network.yaml#/networkId'
- in: body
name: network
required: true
schema:
$ref: '../schemas/network.yaml#/NetworkMerge'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/network.yaml#/NetworkResponse'
tags:
- networks
reserve-ip:
post:
summary: 预留IP
parameters:
- $ref: '../parameters/network.yaml#/networkId'
- in: body
name: network
required: true
schema:
$ref: '../schemas/network.yaml#/NetworkReserveIp'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/network.yaml#/NetworkResponse'
tags:
- networks
release-reserve-ip:
post:
summary: 释放预留IP
parameters:
- $ref: '../parameters/network.yaml#/networkId'
- in: body
name: network
required: true
schema:
$ref: '../schemas/network.yaml#/NetworkReleaseReserveIp'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/network.yaml#/NetworkResponse'
tags:
- networks
+38
View File
@@ -0,0 +1,38 @@
post:
summary: 创建IP子网
parameters:
- in: body
name: network
required: true
schema:
$ref: '../schemas/network.yaml#/NetworkCreate'
response:
200:
description: 新建IP子网的信息
schema:
$ref: '../schemas/network.yaml#/NetworkResponse'
tags:
- networks
get:
summary: 按指定条件列出IP子网
parameters:
- $ref: '../parameters/common.yaml#/limit'
- $ref: '../parameters/common.yaml#/offset'
- $ref: '../parameters/common.yaml#/zone'
- $ref: '../parameters/common.yaml#/region'
- $ref: '../parameters/common.yaml#/brand'
- $ref: '../parameters/network.yaml#/ip'
- $ref: '../parameters/network.yaml#/zone'
- $ref: '../parameters/network.yaml#/wire'
- $ref: '../parameters/network.yaml#/vpc'
- $ref: '../parameters/network.yaml#/region'
- $ref: '../parameters/network.yaml#/city'
- $ref: '../parameters/network.yaml#/server_type'
responses:
200:
description: IP子网列表信息
schema:
$ref: '../schemas/network.yaml#/NetworkListResponse'
tags:
- networks
+12
View File
@@ -0,0 +1,12 @@
storage:
name: storage
required: true
in: path
type: string
description: 存储名称或者ID
host:
name: host
required: true
in: path
type: string
description: 宿主机名称或者ID
+41
View File
@@ -0,0 +1,41 @@
networkId:
name: networkId
required: true
in: path
type: string
description: IP子网名称或者ID
ip:
name: ip
in: query
type: string
description: 查询包含这个IP的网络
zone:
name: zone
in: query
type: string
description: 查询在这个zone中的网络
wire:
name: wire
in: query
type: string
description: 查询在这个wire中的网络
vpc:
name: vpc
in: query
type: string
description: 查询在这个VPC中的网络
region:
name: region
in: query
type: string
description: 查询在这个region中的网络
city:
name: city
in: query
type: string
description: 查询在这个city中的网络
server_type:
name: server_type
in: query
type: string
description: 查询指定server_type的网络
+24
View File
@@ -0,0 +1,24 @@
storageId:
name: storageId
required: true
in: path
type: string
description: 存储名称或者ID
share:
name: share
in: query
type: bool
default: false
description: 查询共享存储
local:
name: local
in: query
type: bool
default: false
description: 查询本地存储
usable:
name: usable
in: query
type: bool
default: false
description: 查询可用的存储
+78
View File
@@ -0,0 +1,78 @@
HostStorage:
type: object
description: 宿主机与存储关联表
properties:
host_id:
type: string
description: 宿主机ID
host:
type: string
description: 宿主机名称
baremetal:
type: string
description: 宿主机对应的物理机名称
storage_id:
type: string
description: 存储ID
mount_point:
type: string
example: /data
description: 挂载点
storagecache_id:
type: string
description: 缓存ID
imagecache_path:
type: string
example: /opt/cloud/workspace/disks/imagecache
description: 镜像缓存路径
can_delete:
type: boolean
description: 是否可删除
can_update:
type: boolean
description: 是否可以更新资源属性
created_at:
type: string
example: 2019-05-30T02:25:38.000000Z
description: 资源创建时间
capacity:
type: integer
example: 10240
description: 存储容量(单位MB)
storage_type:
type: string
example: local
description: 存储集群类型
free_capacity:
type: integer
example: 10240
description: 剩余存储容量(单位MB)
cmtbound:
type: float
example: 1.000000
description: 超售比
guest_disk_count:
type: integer
example: 10
description: 磁盘数量
HostStorageListResponse:
type: object
properties:
limit:
type: integer
example: 20
storages:
type: array
items:
$ref: '#/HostStorage'
total:
type: integer
example: 124
HostStorageResponse:
type: object
properties:
storage:
type: object
$ref: '#/HostStorage'
+2 -2
View File
@@ -641,8 +641,8 @@ InstanceCreate:
type: array
items:
$ref: '#/InstanceDisk'
InstanceDisk:
type: object
properties:
+287
View File
@@ -0,0 +1,287 @@
NetworkCreate:
type: object
properties:
name:
type: string
example: test-network
description: 子网名称
wire:
type: string
example: wire1
description: ID or Name of wire in which the network created
guest_ip_start:
type: string
example: 10.168.10.100
description: 子网起始IP
guest_ip_end:
type: string
example: 10.168.10.199
description: 子网结束IP
guest_ip_mask:
type: string
example: 255.255.255.0
description: 子网掩码
guest_gateway:
type: string
example: 10.168.10.1
description: 网关
alloc_policy:
type: string
example: none
enmu: [none,stepdown,stepup,random]
description: IP分配策略
server_type:
type: string
example: guest
enmu: [baremetal,guest,container,pxe,ipmi]
description: 子网分配机器类型
vlan_id:
type: integer
example: 1
description: vlan ID
desc:
type: string
example: this is test network
description: 子网描述信息
guest_dns:
type: string
example: 8.8.8.8
description: DNS server
guest_domain:
type: string
example: test
description: domain name
guest_dhcp:
type: string
example: 192.168.10.1
description: DHCP server
NetworkResponse:
type: object
properties:
network:
type: object
$ref: '#/Network'
Network:
type: object
description: 网络
properties:
id:
type: string
example: c427c4ce-6870-19f3-8257-f53e63f40361
description: 子网uuid
readOnly: true
name:
type: string
description: 子网名称
example: network-r4hilqks
readOnly: true
brand:
type: string
example: OneCloud
description: 虚拟化品牌
can_delete:
type: boolean
description: 是否可删除
can_update:
type: boolean
description: 是否可以更新资源属性
created_at:
type: string
example: 2019-05-30T02:25:38.000000Z
description: 资源创建时间
is_emulated:
type: boolean
example: false
description: 是否是虚拟出来的实例
provider:
type: string
example: OneCloud
description: 纳管云平台
region:
type: string
example: region1
description: 区域名称
region_id:
type: string
example: 13947bd8-569e-4094-8b03-4339c2a8e45b
description: 区域ID
zone:
type: string
example: zone1
description: 可用区名称
zone_id:
type: string
example: a16d3e0b-3fd6-45ec-8b2d-e51a51fa0efc
description: 可用区ID
update_version:
type: integer
example: 2
description: 资源被更新的次数
updated_at:
type: string
example: 2019-05-30T06:36:39.000000Z
description: 资源最近一次更新时间
status:
type: string
example: available
description: 子网状态
wire:
type: string
example: bcast0
description: wire 名称
wire_id:
type: string
example: 89bb9ccc-c753-432d-96ae-b4c94ca45398
guest_ip_start:
type: string
example: 10.168.10.100
description: 子网起始IP
guest_ip_end:
type: string
example: 10.168.10.199
description: 子网结束IP
guest_ip_mask:
type: string
example: 255.255.255.0
description: 子网掩码
guest_gateway:
type: string
example: 10.168.10.1
description: 网关
alloc_policy:
type: string
example: none
description: IP分配策略
server_type:
type: string
example: guest
description: 子网分配机器类型
vlan_id:
type: integer
example: 1
description: vlan ID
vpc:
type: string
example: Default
description: vpc Name
vpc_id:
type: string
example: default
description: vpc ID
vnics:
type: integer
example: 10
description: 网卡数量
ports:
type: integer
example: 200
description: 可用IP数量
used_ports:
type: integer
example: 10
description: 已经使用IP数量
NetworkListResponse:
type: object
properties:
limit:
type: integer
example: 20
storages:
type: array
items:
$ref: '#/Network'
total:
type: integer
example: 124
NetworkUpdate:
type: object
properties:
name:
type: string
example: test-network2
description: IP子网名称
guest_ip_end:
type: string
example: 10.168.10.199
description: 子网结束IP
guest_ip_mask:
type: string
example: 255.255.255.0
description: 子网掩码
guest_gateway:
type: string
example: 10.168.10.1
description: 网关
alloc_policy:
type: string
example: none
description: IP分配策略
server_type:
type: string
example: guest
description: 子网分配机器类型
vlan_id:
type: integer
example: 1
description: vlan ID
desc:
type: string
example: this is test network
description: 子网描述信息
guest_dns:
type: string
example: 8.8.8.8
description: DNS server
guest_domain:
type: string
example: test
description: domain name
guest_dhcp:
type: string
example: 192.168.10.1
description: DHCP server
NetworkSplit:
type: object
properties:
split_ip:
type: string
example: 10.168.1.100
description: 用于分割子网的IP
require: true
name:
type: string
example: new-network
description: new network name
NetworkMerge:
type: object
properties:
target:
type: string
example: network2
description: network merge target
NetworkReserveIp:
type: object
properties:
ips:
type: array
example: ["192.168.10.1","192.168.10.2"]
description: reserve ips
notes:
type: string
example: reserve for test
description: reserve ip notes
NetworkReleaseReserveIp:
type: object
properties:
ip:
type: string
example: 192.168.10.1
description: release reserve ip
+212
View File
@@ -0,0 +1,212 @@
StorageCreate:
type: object
properties:
name:
type: string
example: test-storage
description: 存储名称
zone:
type: string
example: zone1
description: 区域名称或ID
medium_type:
type: string
example: ssd
enum: [ssd,rotate]
description: 介质类型
capacity:
type: integer
example: 10240
description: 存储容量(单位MB)
storage_type:
type: string
example: local
enum: [local,nas,vsan,rbd,nfs,gpfs,baremetal]
description: 存储集群类型
mon_host:
type: string
description: Ceph mon_host config
key:
type: string
description: Ceph key config
pool:
type: string
description: Ceph pool name
nfs_host:
type: string
description: NFS host address
nfs_share_dir:
type: string
description: NFS shared dir
StorageResponse:
type: object
properties:
storage:
type: object
$ref: '#/Storage'
Storage:
type: object
description: 存储
properties:
id:
type: string
example: f227c4ce-6870-19f3-8257-f53e63f40361
description: 存储uuid
readOnly: true
name:
type: string
description: 存储名称
example: storage-r4hilqks
readOnly: true
brand:
type: string
example: OneCloud
description: 虚拟化品牌
can_delete:
type: boolean
description: 是否可删除
can_update:
type: boolean
description: 是否可以更新资源属性
created_at:
type: string
example: 2019-05-30T02:25:38.000000Z
description: 资源创建时间
is_emulated:
type: boolean
example: false
description: 是否是虚拟出来的实例
provider:
type: string
example: Qcloud
description: 纳管云平台
region:
type: string
example: region1
description: 区域名称
region_id:
type: string
example: 13947bd8-569e-4094-8b03-4339c2a8e45b
description: 区域ID
zone:
type: string
example: zone1
description: 可用区名称
zone_id:
type: string
example: a16d3e0b-3fd6-45ec-8b2d-e51a51fa0efc
description: 可用区ID
update_version:
type: integer
example: 2
description: 资源被更新的次数
updated_at:
type: string
example: 2019-05-30T06:36:39.000000Z
description: 资源最近一次更新时间
status:
type: string
example: offline
description: 存储状态
medium_type:
type: string
example: ssd
description: 介质类型
capacity:
type: integer
example: 10240
description: 存储容量(单位MB)
storage_type:
type: string
example: local
description: 存储集群类型
free_capacity:
type: integer
example: 10240
description: 剩余存储容量(单位MB)
cmtbound:
type: float
example: 1.000000
description: 超售比
commit_bound:
type: float
example: 1.000000
description: 超售比
commit_rate:
type: float
example: 0.000000
description: 已分配比率
is_sys_disk_store:
type: boolean
example: false
description: 系统盘存储
reserved:
type: integer
example: 1024
description: 预留存储大小
storagecache_id:
type: string
example: 7cf5c609-6435-4ef6-8845-882946aeb1a7
description: 缓存ID
virtual_capacity:
type: integer
example: 201456
description: 虚拟容量大小
waste_capacity:
type: integer
example: 12345
description: 已使用容量大小
enable:
type: boolean
example: true
description: 存储是否可用
desc:
type: string
example: this is test storage
description: 存储描述信息
StorageListResponse:
type: object
properties:
limit:
type: integer
example: 20
storages:
type: array
items:
$ref: '#/Storage'
total:
type: integer
example: 124
StorageUpdate:
type: object
properties:
name:
type: string
example: test-storage
description: 存储名称
storage_type:
type: string
example: local
enum: [local,nas,vsan,rbd,nfs,gpfs,baremetal]
description: 存储集群类型
medium_type:
type: string
example: ssd
description: 介质类型
commit_bound:
type: float
example: 1.000000
description: 超售比
reserved:
type: integer
example: 1024
description: 预留存储大小
desc:
type: string
example: this is test storage
description: 存储描述信息
+91
View File
@@ -0,0 +1,91 @@
get:
summary: 获取指定存储详情信息
parameters:
- $ref: '../parameters/storage.yaml#/storageId'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/storage.yaml#/StorageResponse'
tags:
- storages
delete:
summary: 删除指定存储
parameters:
- $ref: '../parameters/storage.yaml#/storageId'
responses:
200:
schema:
$ref: '../schemas/storage.yaml#/StorageResponse'
tags:
- storages
put:
summary: 更新存储信息
parameters:
- $ref: '../parameters/storage.yaml#/storageId'
- in: body
name: storage
required: true
schema:
$ref: '../schemas/storage.yaml#/StorageUpdate'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/storage.yaml#/StorageResponse'
tags:
- storages
enable:
post:
summary: 使存储可用
parameters:
- $ref: '../parameters/storage.yaml#/storageId'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/storage.yaml#/StorageResponse'
tags:
- storages
disable:
post:
summary: 使存储不可用
parameters:
- $ref: '../parameters/storage.yaml#/storageId'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/storage.yaml#/StorageResponse'
tags:
- storages
online:
post:
summary: 使存储在线
parameters:
- $ref: '../parameters/storage.yaml#/storageId'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/storage.yaml#/StorageResponse'
tags:
- storages
offline:
post:
summary: 使存储离线
parameters:
- $ref: '../parameters/storage.yaml#/storageId'
responses:
200:
description: 实例信息
schema:
$ref: '../schemas/storage.yaml#/StorageResponse'
tags:
- storages
+34
View File
@@ -0,0 +1,34 @@
post:
summary: 创建存储集群
parameters:
- in: body
name: storage
required: true
schema:
$ref: '../schemas/storage.yaml#StorageCreate'
response:
200:
description: 新建存储的信息
schema:
$ref: '../schemas/storage.yaml#StorageResponse'
tags:
- storages
get:
summary: 按指定条件列出存储集群
parameters:
- $ref: '../parameters/common.yaml#/limit'
- $ref: '../parameters/common.yaml#/offset'
- $ref: '../parameters/common.yaml#/zone'
- $ref: '../parameters/common.yaml#/region'
- $ref: '../parameters/common.yaml#/brand'
- $ref: '../parameters/storage.yaml#/share'
- $ref: '../parameters/storage.yaml#/local'
- $ref: '../parameters/storage.yaml#/usable'
responses:
200:
description: 存储列表信息
schema:
$ref: '../schemas/storage.yaml#/StorageListResponse'
tags:
- storages