VMware Cloud Director数据库操作

VMware Cloud Director 是一个云服务平台,以自助服务模式提供安全、隔离、弹性的虚拟数据中心计算、网络、存储和安全。在NFV整个架构中属于VIM层,与NFVI层(对VMware来说即vSphere虚拟化环境)对接获取虚拟化资源并提供给租户。

图片[1]-VMware Cloud Director数据库操作-不念博客
NFV架构
图片[2]-VMware Cloud Director数据库操作-不念博客
VCD架构

VCD内部集成了postgres数据库,可通过以下命令登录数据库:

ssh root@[vcd ip]
su postgres
psql
\c vcloud

登录成功如下所示:

图片[3]-VMware Cloud Director数据库操作-不念博客
数据库

1、查看所有postgre表

select tablename from pg_tables where tablename not like 'pg%' and tablename not like 'sql_%' order by tablename;

2、查看某个子网的底层已分配IP

2.1查找子网的ID

select * from ip_scope where gateway = 'x.x.x.x';

2.2 使用ID查找已分配IP

select * from allocated_ip_address where scope_id='2cbdb3e5-ee69-4162-8dc8-2884be707d9b';

3、删除残留的IP

delete from network_interface where address_id='7f3fa8be-8cdd-4e6c-8ce3-475f72cbaec1';
delete from allocated_ip_address where id='7f3fa8be-8cdd-4e6c-8ce3-475f72cbaec1';

4、其他常用

查看VAPP:

select name,sg_id from vm_container where name like'%xx%';

查看VAPP的VM:

select id from vapp_vm where vapp_id='31db62d1-5785-47cb-892b-7dfe6ab93501';

查看VM:

select * from vm;

查看目录:

select * from catalog;

查看独立磁盘:

select * from logical_disk;

删除VAPP中VM资源:

delete from vapp_vm_disk_storage_class where vapp_vm_id ='c50a1de9-2aef-4934-87d5-b52461ad899c';

delete from vapp_vm_sclass_metrics where vapp_vm_id ='c50a1de9-2aef-4934-87d5-b52461ad899c';

delete from guest_personalization_info where vapp_vm_id ='c50a1de9-2aef-4934-87d5-b52461ad899c';

删除VAPP:

delete from vapp_vm where vapp_id='31db62d1-5785-47cb-892b-7dfe6ab93501';

delete from vapp_logical_resource where vapp_id='31db62d1-5785-47cb-892b-7dfe6ab93501';

delete from vm_container where sg_id='31db62d1-5785-47cb-892b-7dfe6ab93501';
© 版权声明
THE END