mirror of https://github.com/apache/cloudstack.git
188 lines
9.5 KiB
SQL
188 lines
9.5 KiB
SQL
-- Licensed to the Apache Software Foundation (ASF) under one
|
|
-- or more contributor license agreements. See the NOTICE file
|
|
-- distributed with this work for additional information
|
|
-- regarding copyright ownership. The ASF licenses this file
|
|
-- to you under the Apache License, Version 2.0 (the
|
|
-- "License"); you may not use this file except in compliance
|
|
-- with the License. You may obtain a copy of the License at
|
|
--
|
|
-- http://www.apache.org/licenses/LICENSE-2.0
|
|
--
|
|
-- Unless required by applicable law or agreed to in writing,
|
|
-- software distributed under the License is distributed on an
|
|
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
-- KIND, either express or implied. See the License for the
|
|
-- specific language governing permissions and limitations
|
|
-- under the License.
|
|
|
|
--;
|
|
-- Schema upgrade from 4.1.0 to 4.2.0;
|
|
--;
|
|
|
|
-- Disable foreign key checking
|
|
SET foreign_key_checks = 0;
|
|
|
|
ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `max_hosts_per_cluster` int unsigned DEFAULT NULL COMMENT 'Max. hosts in cluster supported by hypervisor';
|
|
UPDATE `cloud`.`hypervisor_capabilities` SET `max_hosts_per_cluster`=32 WHERE `hypervisor_type`='VMware';
|
|
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_hosts_per_cluster) VALUES ('VMware', '5.1', 128, 0, 32);
|
|
DELETE FROM `cloud`.`configuration` where name='vmware.percluster.host.max';
|
|
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'AgentManager', 'xen.nics.max', '7', 'Maximum allowed nics for Vms created on Xen');
|
|
|
|
alter table template_host_ref add state varchar(255);
|
|
alter table template_host_ref add update_count bigint unsigned;
|
|
alter table template_host_ref add updated datetime;
|
|
alter table volume_host_ref add state varchar(255);
|
|
alter table volume_host_ref add update_count bigint unsigned;
|
|
alter table volume_host_ref add updated datetime;
|
|
alter table template_spool_ref add updated datetime;
|
|
CREATE TABLE `cloud`.`object_datastore_ref` (
|
|
`id` bigint unsigned NOT NULL auto_increment,
|
|
`datastore_uuid` varchar(255) NOT NULL,
|
|
`datastore_role` varchar(255) NOT NULL,
|
|
`object_uuid` varchar(255) NOT NULL,
|
|
`object_type` varchar(255) NOT NULL,
|
|
`created` DATETIME NOT NULL,
|
|
`last_updated` DATETIME,
|
|
`job_id` varchar(255),
|
|
`download_pct` int(10) unsigned,
|
|
`download_state` varchar(255),
|
|
`url` varchar(255),
|
|
`format` varchar(255),
|
|
`checksum` varchar(255),
|
|
`error_str` varchar(255),
|
|
`local_path` varchar(255),
|
|
`install_path` varchar(255),
|
|
`size` bigint unsigned COMMENT 'the size of the template on the pool',
|
|
`state` varchar(255) NOT NULL,
|
|
`update_count` bigint unsigned NOT NULL,
|
|
`updated` DATETIME,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE `cloud`.`data_store_provider` (
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
`name` varchar(255) NOT NULL COMMENT 'name of primary data store provider',
|
|
`uuid` varchar(255) NOT NULL COMMENT 'uuid of primary data store provider',
|
|
PRIMARY KEY(`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
CREATE TABLE `cloud`.`image_data_store` (
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
`name` varchar(255) NOT NULL COMMENT 'name of data store',
|
|
`image_provider_id` bigint unsigned NOT NULL COMMENT 'id of image_data_store_provider',
|
|
`protocol` varchar(255) NOT NULL COMMENT 'protocol of data store',
|
|
`data_center_id` bigint unsigned COMMENT 'datacenter id of data store',
|
|
`scope` varchar(255) COMMENT 'scope of data store',
|
|
`uuid` varchar(255) COMMENT 'uuid of data store',
|
|
PRIMARY KEY(`id`),
|
|
CONSTRAINT `fk_tags__image_data_store_provider_id` FOREIGN KEY(`image_provider_id`) REFERENCES `data_store_provider`(`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
ALTER TABLE `cloud`.`vm_template` ADD COLUMN `image_data_store_id` bigint unsigned;
|
|
|
|
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `is_volatile` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the vm needs to be volatile, i.e., on every reboot of vm from API root disk is discarded and creates a new root disk';
|
|
|
|
ALTER TABLE `cloud`.`networks` ADD COLUMN `network_cidr` VARCHAR(18) COMMENT 'The network cidr for the isolated guest network which uses IP Reservation facility.For networks not using IP reservation, network_cidr is always null.';
|
|
ALTER TABLE `cloud`.`networks` CHANGE `cidr` `cidr` varchar(18) COMMENT 'CloudStack managed vms get IP address from cidr.In general this cidr also serves as the network CIDR. But in case IP reservation feature is being used by a Guest network, networkcidr is the Effective network CIDR for that network';
|
|
|
|
|
|
CREATE TABLE `vpc_service_map` (
|
|
`id` bigint unsigned NOT NULL auto_increment,
|
|
`vpc_id` bigint unsigned NOT NULL COMMENT 'vpc_id',
|
|
`service` varchar(255) NOT NULL COMMENT 'service',
|
|
`provider` varchar(255) COMMENT 'service provider',
|
|
`created` datetime COMMENT 'date created',
|
|
PRIMARY KEY (`id`),
|
|
CONSTRAINT `fk_vpc_service_map__vpc_id` FOREIGN KEY(`vpc_id`) REFERENCES `vpc`(`id`) ON DELETE CASCADE,
|
|
UNIQUE (`vpc_id`, `service`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
|
|
|
|
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vm.instancename.flag', 'false', 'Append guest VM display Name (if set) to the internal name of the VM');
|
|
|
|
INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (208, UUID(), 6, 'Windows 8');
|
|
INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (209, UUID(), 6, 'Windows 8 (64 bit)');
|
|
INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (210, UUID(), 6, 'Windows 8 Server (64 bit)');
|
|
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Windows 8', 208);
|
|
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Windows 8 (64 bit)', 209);
|
|
INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Windows 8 Server (64 bit)', 210);
|
|
|
|
CREATE TABLE `cloud`.`user_vm_clone_setting` (
|
|
`vm_id` bigint unsigned NOT NULL COMMENT 'guest VM id',
|
|
`clone_type` varchar(10) NOT NULL COMMENT 'Full or Linked Clone (applicable to VMs on ESX)',
|
|
PRIMARY KEY (`vm_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
|
|
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'UserVmManager', 'vmware.create.full.clone' , 'false', 'If set to true, creates VMs as full clones on ESX hypervisor');
|
|
|
|
-- Re-enable foreign key checking, at the end of the upgrade path
|
|
SET foreign_key_checks = 1;
|
|
|
|
|
|
CREATE TABLE nic_secondary_ips (
|
|
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT,
|
|
`uuid` varchar(40),
|
|
`vmId` bigint unsigned COMMENT 'vm instance id',
|
|
`nicId` bigint unsigned NOT NULL,
|
|
`ip4_address` char(40) COMMENT 'ip4 address',
|
|
`ip6_address` char(40) COMMENT 'ip6 address',
|
|
`network_id` bigint unsigned NOT NULL COMMENT 'network configuration id',
|
|
`created` datetime NOT NULL COMMENT 'date created',
|
|
`account_id` bigint unsigned NOT NULL COMMENT 'owner. foreign key to account table',
|
|
`domain_id` bigint unsigned NOT NULL COMMENT 'the domain that the owner belongs to',
|
|
PRIMARY KEY (`id`),
|
|
CONSTRAINT `fk_nic_secondary_ip__vmId` FOREIGN KEY `fk_nic_secondary_ip__vmId`(`vmId`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE,
|
|
CONSTRAINT `fk_nic_secondary_ip__networks_id` FOREIGN KEY `fk_nic_secondary_ip__networks_id`(`network_id`) REFERENCES `networks`(`id`),
|
|
CONSTRAINT `uc_nic_secondary_ip__uuid` UNIQUE (`uuid`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
ALTER TABLE `cloud`.`nics` ADD COLUMN secondary_ip SMALLINT DEFAULT '0' COMMENT 'secondary ips configured for the nic';
|
|
ALTER TABLE `cloud`.`user_ip_address` ADD COLUMN dnat_vmip VARCHAR(40);
|
|
|
|
ALTER TABLE `cloud`.`alert` ADD COLUMN `archived` tinyint(1) unsigned NOT NULL DEFAULT 0;
|
|
ALTER TABLE `cloud`.`event` ADD COLUMN `archived` tinyint(1) unsigned NOT NULL DEFAULT 0;
|
|
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'alert.purge.interval', '86400', 'The interval (in seconds) to wait before running the alert purge thread');
|
|
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'alert.purge.delay', '0', 'Alerts older than specified number days will be purged. Set this value to 0 to never delete alerts');
|
|
|
|
DROP VIEW IF EXISTS `cloud`.`event_view`;
|
|
CREATE VIEW `cloud`.`event_view` AS
|
|
select
|
|
event.id,
|
|
event.uuid,
|
|
event.type,
|
|
event.state,
|
|
event.description,
|
|
event.created,
|
|
event.level,
|
|
event.parameters,
|
|
event.start_id,
|
|
eve.uuid start_uuid,
|
|
event.user_id,
|
|
event.archived,
|
|
user.username user_name,
|
|
account.id account_id,
|
|
account.uuid account_uuid,
|
|
account.account_name account_name,
|
|
account.type account_type,
|
|
domain.id domain_id,
|
|
domain.uuid domain_uuid,
|
|
domain.name domain_name,
|
|
domain.path domain_path,
|
|
projects.id project_id,
|
|
projects.uuid project_uuid,
|
|
projects.name project_name
|
|
from
|
|
`cloud`.`event`
|
|
inner join
|
|
`cloud`.`account` ON event.account_id = account.id
|
|
inner join
|
|
`cloud`.`domain` ON event.domain_id = domain.id
|
|
inner join
|
|
`cloud`.`user` ON event.user_id = user.id
|
|
left join
|
|
`cloud`.`projects` ON projects.project_account_id = event.account_id
|
|
left join
|
|
`cloud`.`event` eve ON event.start_id = eve.id;
|