Chinaunix首页 | 论坛 | 博客
  • 博客访问: 9169249
  • 博文数量: 1669
  • 博客积分: 16831
  • 博客等级: 上将
  • 技术积分: 12594
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-25 07:23
个人简介

柔中带刚,刚中带柔,淫荡中富含柔和,刚猛中荡漾风骚,无坚不摧,无孔不入!

文章分类

全部博文(1669)

文章存档

2023年(4)

2022年(1)

2021年(10)

2020年(24)

2019年(4)

2018年(19)

2017年(66)

2016年(60)

2015年(49)

2014年(201)

2013年(221)

2012年(638)

2011年(372)

分类: 虚拟化

2015-04-08 11:03:55

CloudStack武功秘笈之数据库篇

发表于1年前(2013-12-18 10:48)   阅读(689) | 评论(0) 2人收藏此文章, 
0

摘要 虽然CloudStack提供了许多的功能,可以直接通过web界面进行管理,但依然有许多功能有心无力! 这时我们必须要使出我们的杀手锏 - 直接改库!通过这个大招,可以直接解决许多棘手的问题。

虽然CloudStack提供了许多的功能,可以直接通过web界面进行管理,但依然有许多东西使操作者有心无力!

比如说:

  • 修改虚拟机名称;

  • 指定虚拟机IP;

  • 将虚拟机挂到其它用户名下;

  • 找出虚拟机对应的硬盘文件;

  • 随意调整虚拟机CPU、内存大小;

  • 不通过http,直接手工上传模板;

  • 当资源不足无法启动虚拟机时,临时欺骗下它,先将虚机启来;

这时我们必须要使出我们的杀手锏 - 直接改库!通过这个大招,可以直接解决许多棘手的问题。

安装CloudStack时,会创建3个库cloud、cloud_usage、cloudbridge。但分析后发现只有cloud库是我们需要的。

下面我们逐一分析下CloudStack中常用库表:

1、vm_instance 虚拟机实例表

id

bigint(20)

虚机ID

name

varchar(255)

虚机自定义名称

host_name

varchar(255)

同name,貌似有冗余

display_name

varchar(255)

虚机显示名称

uuid

varchar(40)

虚机唯一串

instance_name

varchar(255)

实例的实际名称,自行创建的虚机命名规则为: i-2-虚机ID-VM

state

varchar(32)

当前状态,Running运行 Stopped停机  Expunging删除

vm_template_id

bigint(20)

模板ID

guest_os_id

bigint(20)

操作系统ID

private_mac_address

varchar(17)

私有网络mac地址

private_ip_address

char(40)

私有网络ip地址

pod_id

bigint(20)

提供点ID

data_center_id

bigint(20)

区域ID

host_id

bigint(20)

主机ID

last_host_id

bigint(20)

proxy_id

bigint(20)

网关虚机ID

proxy_assign_time

datetime

vnc_password

varchar(255)

ha_enabled

tinyint(1)

是否开启高可用

limit_cpu_use

tinyint(1)

update_count

bigint(20)

update_time

datetime

created

datetime

removed

datetime

type

varchar(32)

vm_type

varchar(32)

account_id

bigint(20)

虚机所属账户ID

domain_id

bigint(20)

service_offering_id

bigint(20)

reservation_id

char(40)

hypervisor_type

char(32)

hypervisor类型

disk_offering_id

bigint(20)

cpu

int(10)

ram

bigint(20)

owner

varchar(255)

speed

int(10)

cpu上限

desired_state

varchar(32)

通过修改这张表中的记录,我们可以随意调整虚拟机的名称及各项参数。


2、nics 网卡表

id

bigint(20)

网卡ID

uuid

varchar(40)

网卡唯一串

instance_id

bigint(20)

虚机ID,同vm_instance.id对应

mac_address

varchar(17)

mac地址

ip4_address

char(40)

IP4地址

netmask

varchar(15)

子码

gateway

varchar(15)

网关

ip_type

varchar(32)

类型 Ip4

broadcast_uri

varchar(255)

vlan隔离

network_id

bigint(20)

mode

varchar(32)

模式 Static、Dhcp

state

varchar(32)

状态

strategy

varchar(32)

reserver_name

varchar(255)

reservation_id

varchar(64)

device_id

int(10)

update_time

timestamp

isolation_uri

varchar(255)

孤岛隔离

ip6_address

char(40)

default_nic

tinyint(4)

vm_type

varchar(32)

虚拟机类型

created

datetime

removed

datetime

ip6_gateway

varchar(50)

ip6_cidr

varchar(50)

通过修改这张表中的记录,我们可以随意指定虚拟机的IP地址。

想让虚拟机IP固定?那就拿这张表开刀吧!


3、volumes 硬盘表


id

bigint(20)

卷ID

account_id

bigint(20)

账户ID

domain_id

bigint(20)

pool_id

bigint(20)

last_pool_id

bigint(20)

instance_id

bigint(20)

虚机ID,同vm_instance.id对应

device_id

bigint(20)

name

varchar(255)

卷名称

uuid

varchar(40)

卷唯一串

size

bigint(20)

卷实际大小

folder

varchar(255)

卷所在目录

path

varchar(255)

卷实际文件名

pod_id

bigint(20)

提供点ID

data_center_id

bigint(20)

区域ID

iscsi_name

varchar(255)

host_ip

char(40)

volume_type

varchar(64)

卷类型,根盘为ROOT 附加盘为DATADISK

pool_type

varchar(64)

disk_offering_id

bigint(20)

template_id

bigint(20)

first_snapshot_backup_uuid

varchar(255)

recreatable

tinyint(1)

created

datetime

attached

datetime

updated

datetime

removed

datetime

state

varchar(32)

chain_info

text

update_count

bigint(20)

disk_type

varchar(255)

这张表比较重要,它记录了虚拟机对应的硬盘文件在什么位置。就算有一天cloudstack坏掉了,只要你有这张表,就能找回你的虚机硬盘文件,将损失降到最低!

你可以修改这张表,将虚拟机硬盘随意挂载到任意虚机上。


4、vm_template 模板表

id

bigint(20)

unique_name

varchar(255)

name

varchar(255)

uuid

varchar(40)

public

int(1)

featured

int(1)

type

varchar(32)

hvm

int(1)

requires HVM

bits

int(6)

32 bit or 64 bit

url

varchar(255)

the url where the template exists externally

format

varchar(32)

format for the template

created

datetime

Date created

removed

datetime

Date removed if not null

account_id

bigint(20)

id of the account that created this template

checksum

varchar(255)

checksum for the template root disk

display_text

varchar(4096)

Description text set by the admin for display purpose only

enable_password

int(1)

true if this template supports password reset

enable_sshkey

int(1)

true if this template supports sshkey reset

guest_os_id

bigint(20)

the OS of the template

bootable

int(1)

true if this template represents a bootable ISO

prepopulate

int(1)

prepopulate this template to primary storage

cross_zones

int(1)

Make this template available in all zones

extractable

int(1)

Is this template extractable

hypervisor_type

varchar(32)

hypervisor that the template belongs to

source_template_id

bigint(20)

Id of the original template, if this template is created from snapshot

template_tag

varchar(255)

template tag

sort_key

int(32)

sort key used for customising sort method

size

bigint(20)

state

varchar(255)

update_count

bigint(20)

updated

datetime

觉得通过http上传模板麻烦吗?那就直接在这张表中添加记录吧,以后手工上传模板就成了。


5、configuration 参数配置表

category

varchar(255)

类别

instance

varchar(255)

component

varchar(255)

management-server

name

varchar(255)

参数名

value

varchar(4095)

参数值

description

varchar(1024)

描述

CloudStack参数的值有许多限制,直接改库的话就可以突破它的限制。从此你就是上帝。

注意,修改参数后,需要重启CloudStack才能生效哈。

阅读(1031) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~