diff --git a/awsapi-setup/db/mysql/cloudbridge_bucketpolicy.sql b/awsapi-setup/db/mysql/cloudbridge_bucketpolicy.sql index 9d6a650b09e..44019f1315b 100644 --- a/awsapi-setup/db/mysql/cloudbridge_bucketpolicy.sql +++ b/awsapi-setup/db/mysql/cloudbridge_bucketpolicy.sql @@ -1,3 +1,21 @@ +-- 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. + + USE cloudbridge; -- This file (and cloudbridge_policy_alter.sql) can be applied to an existing cloudbridge diff --git a/awsapi-setup/db/mysql/cloudbridge_db.sql b/awsapi-setup/db/mysql/cloudbridge_db.sql index 04ea41a75b9..952a34d9fb8 100644 --- a/awsapi-setup/db/mysql/cloudbridge_db.sql +++ b/awsapi-setup/db/mysql/cloudbridge_db.sql @@ -1,3 +1,21 @@ +-- 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. + + SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI'; DROP DATABASE IF EXISTS cloudbridge; diff --git a/awsapi-setup/db/mysql/cloudbridge_index.sql b/awsapi-setup/db/mysql/cloudbridge_index.sql index d00e5d87acb..e099b658a4d 100644 --- a/awsapi-setup/db/mysql/cloudbridge_index.sql +++ b/awsapi-setup/db/mysql/cloudbridge_index.sql @@ -1,47 +1,64 @@ -USE cloudbridge; - -ALTER TABLE shost ADD UNIQUE shost_uq_host(Host, HostType, ExportRoot); -ALTER TABLE shost ADD CONSTRAINT FOREIGN KEY shost_fk_mhost_id(MHostID) REFERENCES mhost(ID); -ALTER TABLE shost ADD INDEX shost_idx_mhost_id(MHostID); - -ALTER TABLE sbucket ADD UNIQUE sbucket_uq_name(Name); -ALTER TABLE sbucket ADD CONSTRAINT FOREIGN KEY sbucket_fk_shost_id(SHostID) REFERENCES shost(ID); -ALTER TABLE sbucket ADD INDEX sbucket_idx_shost_id(SHostID); -ALTER TABLE sbucket ADD INDEX sbucket_idx_owner_cid(OwnerCanonicalID); -ALTER TABLE sbucket ADD INDEX sbucket_idx_create_time(CreateTime); - -ALTER TABLE sobject ADD CONSTRAINT FOREIGN KEY sobject_fk_sbuckt_id(SBucketID) REFERENCES sbucket(ID) ON DELETE CASCADE; -ALTER TABLE sobject ADD INDEX sobject_idx_bucket_id(SBucketID); -ALTER TABLE sobject ADD INDEX sobject_idx_owner_cid(OwnerCanonicalID); -ALTER TABLE sobject ADD UNIQUE sobject_uq_sbucket_id_name_key(SBucketID, NameKey); -ALTER TABLE sobject ADD INDEX sobject_idx_create_time(CreateTime); - -ALTER TABLE sobject_item ADD CONSTRAINT FOREIGN KEY sobject_item_fk_object_id(SObjectID) REFERENCES sobject(ID) ON DELETE CASCADE; -ALTER TABLE sobject_item ADD INDEX sobject_item_idx_object_id(SObjectID); -ALTER TABLE sobject_item ADD UNIQUE sobject_item_uq_sobject_id_version(SObjectID, Version); -ALTER TABLE sobject_item ADD INDEX sobject_item_idx_create_time(CreateTime); -ALTER TABLE sobject_item ADD INDEX sobject_item_idx_modify_time(LastModifiedTime); -ALTER TABLE sobject_item ADD INDEX sobject_item_idx_access_time(LastAccessTime); -ALTER TABLE sobject_item ADD INDEX sobject_item_idx_stored_size(StoredSize); - -ALTER TABLE meta ADD UNIQUE meta_uq_target_name(Target, TargetID, Name); -ALTER TABLE meta ADD INDEX meta_idx_target(Target, TargetID); - -ALTER TABLE usercredentials ADD UNIQUE usercredentials_mappings1(AccessKey); -ALTER TABLE usercredentials ADD UNIQUE usercredentials_mappings2(CertUniqueId); -ALTER TABLE usercredentials ADD INDEX usercredentials_idx_access(AccessKey); -ALTER TABLE usercredentials ADD INDEX usercredentials_idx_cert(CertUniqueId); - -ALTER TABLE acl ADD INDEX acl_idx_target(Target, TargetID); -ALTER TABLE acl ADD INDEX acl_idx_modify_time(LastModifiedTime); - -ALTER TABLE mhost ADD UNIQUE mhost_uq_host(Host); -ALTER TABLE mhost ADD INDEX mhost_idx_mhost_key(MHostKey); -ALTER TABLE mhost ADD INDEX mhost_idx_heartbeat_time(LastHeartbeatTime); - -ALTER TABLE mhost_mount ADD UNIQUE mhost_mnt_uq_mhost_shost(MHostID, SHostID); -ALTER TABLE mhost_mount ADD CONSTRAINT FOREIGN KEY mhost_mnt_fk_mhost_id(MHostID) REFERENCES mhost(ID) ON DELETE CASCADE; -ALTER TABLE mhost_mount ADD CONSTRAINT FOREIGN KEY mhost_mnt_fk_shost_id(SHostID) REFERENCES shost(ID) ON DELETE CASCADE; -ALTER TABLE mhost_mount ADD INDEX mhost_mnt_idx_mhost_id(MHostID); -ALTER TABLE mhost_mount ADD INDEX mhost_mnt_idx_shost_id(SHostID); -ALTER TABLE mhost_mount ADD INDEX mhost_mnt_idx_mount_time(LastMountTime); +-- 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. + +USE cloudbridge; + +ALTER TABLE shost ADD UNIQUE shost_uq_host(Host, HostType, ExportRoot); +ALTER TABLE shost ADD CONSTRAINT FOREIGN KEY shost_fk_mhost_id(MHostID) REFERENCES mhost(ID); +ALTER TABLE shost ADD INDEX shost_idx_mhost_id(MHostID); + +ALTER TABLE sbucket ADD UNIQUE sbucket_uq_name(Name); +ALTER TABLE sbucket ADD CONSTRAINT FOREIGN KEY sbucket_fk_shost_id(SHostID) REFERENCES shost(ID); +ALTER TABLE sbucket ADD INDEX sbucket_idx_shost_id(SHostID); +ALTER TABLE sbucket ADD INDEX sbucket_idx_owner_cid(OwnerCanonicalID); +ALTER TABLE sbucket ADD INDEX sbucket_idx_create_time(CreateTime); + +ALTER TABLE sobject ADD CONSTRAINT FOREIGN KEY sobject_fk_sbuckt_id(SBucketID) REFERENCES sbucket(ID) ON DELETE CASCADE; +ALTER TABLE sobject ADD INDEX sobject_idx_bucket_id(SBucketID); +ALTER TABLE sobject ADD INDEX sobject_idx_owner_cid(OwnerCanonicalID); +ALTER TABLE sobject ADD UNIQUE sobject_uq_sbucket_id_name_key(SBucketID, NameKey); +ALTER TABLE sobject ADD INDEX sobject_idx_create_time(CreateTime); + +ALTER TABLE sobject_item ADD CONSTRAINT FOREIGN KEY sobject_item_fk_object_id(SObjectID) REFERENCES sobject(ID) ON DELETE CASCADE; +ALTER TABLE sobject_item ADD INDEX sobject_item_idx_object_id(SObjectID); +ALTER TABLE sobject_item ADD UNIQUE sobject_item_uq_sobject_id_version(SObjectID, Version); +ALTER TABLE sobject_item ADD INDEX sobject_item_idx_create_time(CreateTime); +ALTER TABLE sobject_item ADD INDEX sobject_item_idx_modify_time(LastModifiedTime); +ALTER TABLE sobject_item ADD INDEX sobject_item_idx_access_time(LastAccessTime); +ALTER TABLE sobject_item ADD INDEX sobject_item_idx_stored_size(StoredSize); + +ALTER TABLE meta ADD UNIQUE meta_uq_target_name(Target, TargetID, Name); +ALTER TABLE meta ADD INDEX meta_idx_target(Target, TargetID); + +ALTER TABLE usercredentials ADD UNIQUE usercredentials_mappings1(AccessKey); +ALTER TABLE usercredentials ADD UNIQUE usercredentials_mappings2(CertUniqueId); +ALTER TABLE usercredentials ADD INDEX usercredentials_idx_access(AccessKey); +ALTER TABLE usercredentials ADD INDEX usercredentials_idx_cert(CertUniqueId); + +ALTER TABLE acl ADD INDEX acl_idx_target(Target, TargetID); +ALTER TABLE acl ADD INDEX acl_idx_modify_time(LastModifiedTime); + +ALTER TABLE mhost ADD UNIQUE mhost_uq_host(Host); +ALTER TABLE mhost ADD INDEX mhost_idx_mhost_key(MHostKey); +ALTER TABLE mhost ADD INDEX mhost_idx_heartbeat_time(LastHeartbeatTime); + +ALTER TABLE mhost_mount ADD UNIQUE mhost_mnt_uq_mhost_shost(MHostID, SHostID); +ALTER TABLE mhost_mount ADD CONSTRAINT FOREIGN KEY mhost_mnt_fk_mhost_id(MHostID) REFERENCES mhost(ID) ON DELETE CASCADE; +ALTER TABLE mhost_mount ADD CONSTRAINT FOREIGN KEY mhost_mnt_fk_shost_id(SHostID) REFERENCES shost(ID) ON DELETE CASCADE; +ALTER TABLE mhost_mount ADD INDEX mhost_mnt_idx_mhost_id(MHostID); +ALTER TABLE mhost_mount ADD INDEX mhost_mnt_idx_shost_id(SHostID); +ALTER TABLE mhost_mount ADD INDEX mhost_mnt_idx_mount_time(LastMountTime); diff --git a/awsapi-setup/db/mysql/cloudbridge_multipart.sql b/awsapi-setup/db/mysql/cloudbridge_multipart.sql index 27456c4f41b..e30c0ce4dee 100644 --- a/awsapi-setup/db/mysql/cloudbridge_multipart.sql +++ b/awsapi-setup/db/mysql/cloudbridge_multipart.sql @@ -1,3 +1,20 @@ +-- 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. + USE cloudbridge; -- This file can be applied to an existing cloudbridge database. It is used diff --git a/awsapi-setup/db/mysql/cloudbridge_multipart_alter.sql b/awsapi-setup/db/mysql/cloudbridge_multipart_alter.sql index 203bf3aa9c8..2614aaff459 100644 --- a/awsapi-setup/db/mysql/cloudbridge_multipart_alter.sql +++ b/awsapi-setup/db/mysql/cloudbridge_multipart_alter.sql @@ -1,3 +1,21 @@ +-- 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. + + USE cloudbridge; ALTER TABLE multipart_meta ADD CONSTRAINT FOREIGN KEY meta_uploads_id(UploadID) REFERENCES multipart_uploads(ID) ON DELETE CASCADE; diff --git a/awsapi-setup/db/mysql/cloudbridge_offering.sql b/awsapi-setup/db/mysql/cloudbridge_offering.sql index 064fd93fe7f..f21af5aff32 100644 --- a/awsapi-setup/db/mysql/cloudbridge_offering.sql +++ b/awsapi-setup/db/mysql/cloudbridge_offering.sql @@ -1,3 +1,21 @@ +-- 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. + + USE cloudbridge; -- This file (and cloudbridge_offering_alter.sql) can be applied to an existing cloudbridge diff --git a/awsapi-setup/db/mysql/cloudbridge_offering_alter.sql b/awsapi-setup/db/mysql/cloudbridge_offering_alter.sql index c44df79f479..bffb34d1d24 100644 --- a/awsapi-setup/db/mysql/cloudbridge_offering_alter.sql +++ b/awsapi-setup/db/mysql/cloudbridge_offering_alter.sql @@ -1,3 +1,21 @@ +-- 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. + + USE cloudbridge; ALTER TABLE offering_bundle ADD UNIQUE one_offering (AmazonEC2Offering); diff --git a/awsapi-setup/db/mysql/cloudbridge_policy_alter.sql b/awsapi-setup/db/mysql/cloudbridge_policy_alter.sql index 311a86528e7..53ab40bae39 100644 --- a/awsapi-setup/db/mysql/cloudbridge_policy_alter.sql +++ b/awsapi-setup/db/mysql/cloudbridge_policy_alter.sql @@ -1,3 +1,21 @@ +-- 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. + + USE cloudbridge; ALTER TABLE bucket_policies ADD UNIQUE one_policy_per_bucket(BucketName); diff --git a/awsapi-setup/db/mysql/cloudbridge_schema.sql b/awsapi-setup/db/mysql/cloudbridge_schema.sql index f4b21a04376..de22f113086 100644 --- a/awsapi-setup/db/mysql/cloudbridge_schema.sql +++ b/awsapi-setup/db/mysql/cloudbridge_schema.sql @@ -1,144 +1,162 @@ -USE cloudbridge; - -SET foreign_key_checks = 0; - -DROP TABLE IF EXISTS shost; -DROP TABLE IF EXISTS mhost; -DROP TABLE IF EXISTS mhost_mount; -DROP TABLE IF EXISTS sbucket; -DROP TABLE IF EXISTS sobject; -DROP TABLE IF EXISTS sobject_item; -DROP TABLE IF EXISTS meta; -DROP TABLE IF EXISTS acl; -DROP TABLE IF EXISTS usercredentials; - --- storage host -CREATE TABLE shost ( - ID BIGINT NOT NULL AUTO_INCREMENT, - - Host VARCHAR(128) NOT NULL, - HostType INT NOT NULL DEFAULT 0, -- 0 : local, 1 : nfs - ExportRoot VARCHAR(128) NOT NULL, - - MHostID BIGINT, -- when host type is local, MHostID points to its owner management host - - UserOnHost VARCHAR(64), - UserPassword VARCHAR(128), - PRIMARY KEY(ID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- management host -CREATE TABLE mhost ( - ID BIGINT NOT NULL AUTO_INCREMENT, - - MHostKey VARCHAR(128) NOT NULL, -- host key could be derived from MAC address or named configuration value - Host VARCHAR(128), -- public host address for redirecting request from/to - - Version VARCHAR(64), - LastHeartbeatTime DATETIME, - - PRIMARY KEY(ID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE mhost_mount ( - ID BIGINT NOT NULL AUTO_INCREMENT, - MHostID BIGINT NOT NULL, - SHostID BIGINT NOT NULL, - - MountPath VARCHAR(256), -- local mount path - LastMountTime DATETIME, -- null : unmounted, otherwise the mount location - - PRIMARY KEY(ID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE sbucket ( - ID BIGINT NOT NULL AUTO_INCREMENT, - - Name VARCHAR(64) NOT NULL, - OwnerCanonicalID VARCHAR(150) NOT NULL, - - SHostID BIGINT, - - CreateTime DATETIME, - - VersioningStatus INT NOT NULL DEFAULT 0, -- 0 : initial not set, 1 : enabled, 2 : suspended - - PRIMARY KEY(ID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE sobject ( - ID BIGINT NOT NULL AUTO_INCREMENT, - - SBucketID BIGINT NOT NULL, - NameKey VARCHAR(255) NOT NULL, - - OwnerCanonicalID VARCHAR(150) NOT NULL, - NextSequence INT NOT NULL DEFAULT 1, - DeletionMark VARCHAR (150), - - CreateTime DATETIME, - - PRIMARY KEY(ID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE sobject_item ( - ID BIGINT NOT NULL AUTO_INCREMENT, - - SObjectID BIGINT NOT NULL, - Version VARCHAR(64), - - MD5 VARCHAR(128), - StoredPath VARCHAR(256), -- relative to mount point of the root - StoredSize BIGINT NOT NULL DEFAULT 0, - - CreateTime DATETIME, - LastModifiedTime DATETIME, - LastAccessTime DATETIME, - - PRIMARY KEY(ID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE meta ( - ID BIGINT NOT NULL AUTO_INCREMENT, - - Target VARCHAR(64) NOT NULL, - TargetID BIGINT NOT NULL, - - Name VARCHAR(64) NOT NULL, - Value VARCHAR(256), - - PRIMARY KEY(ID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE acl ( - ID BIGINT NOT NULL AUTO_INCREMENT, - - Target VARCHAR(64) NOT NULL, - TargetID BIGINT NOT NULL, - - GranteeType INT NOT NULL DEFAULT 0, -- 0 : Cloud service user, 1 : Cloud user community, 2: Public user community - GranteeCanonicalID VARCHAR(150), -- make it big enought to hold a Cloud API access key - - Permission INT NOT NULL DEFAULT 0, -- 0 : no permission, 1 : read, 2 : write, 4 : read_acl, 8 : write_acl - GrantOrder INT NOT NULL DEFAULT 0, - - CreateTime DATETIME, - LastModifiedTime DATETIME, - - PRIMARY KEY(ID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- each account has to have a separate --- each account has to have a separate mappings -CREATE TABLE usercredentials ( - ID BIGINT NOT NULL AUTO_INCREMENT, - - AccessKey VARCHAR(150) NOT NULL, - SecretKey VARCHAR(150) NOT NULL, - CertUniqueId VARCHAR(200), - - PRIMARY KEY(ID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -SET foreign_key_checks = 1; - +-- 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. + + +USE cloudbridge; + +SET foreign_key_checks = 0; + +DROP TABLE IF EXISTS shost; +DROP TABLE IF EXISTS mhost; +DROP TABLE IF EXISTS mhost_mount; +DROP TABLE IF EXISTS sbucket; +DROP TABLE IF EXISTS sobject; +DROP TABLE IF EXISTS sobject_item; +DROP TABLE IF EXISTS meta; +DROP TABLE IF EXISTS acl; +DROP TABLE IF EXISTS usercredentials; + +-- storage host +CREATE TABLE shost ( + ID BIGINT NOT NULL AUTO_INCREMENT, + + Host VARCHAR(128) NOT NULL, + HostType INT NOT NULL DEFAULT 0, -- 0 : local, 1 : nfs + ExportRoot VARCHAR(128) NOT NULL, + + MHostID BIGINT, -- when host type is local, MHostID points to its owner management host + + UserOnHost VARCHAR(64), + UserPassword VARCHAR(128), + PRIMARY KEY(ID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- management host +CREATE TABLE mhost ( + ID BIGINT NOT NULL AUTO_INCREMENT, + + MHostKey VARCHAR(128) NOT NULL, -- host key could be derived from MAC address or named configuration value + Host VARCHAR(128), -- public host address for redirecting request from/to + + Version VARCHAR(64), + LastHeartbeatTime DATETIME, + + PRIMARY KEY(ID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE mhost_mount ( + ID BIGINT NOT NULL AUTO_INCREMENT, + MHostID BIGINT NOT NULL, + SHostID BIGINT NOT NULL, + + MountPath VARCHAR(256), -- local mount path + LastMountTime DATETIME, -- null : unmounted, otherwise the mount location + + PRIMARY KEY(ID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE sbucket ( + ID BIGINT NOT NULL AUTO_INCREMENT, + + Name VARCHAR(64) NOT NULL, + OwnerCanonicalID VARCHAR(150) NOT NULL, + + SHostID BIGINT, + + CreateTime DATETIME, + + VersioningStatus INT NOT NULL DEFAULT 0, -- 0 : initial not set, 1 : enabled, 2 : suspended + + PRIMARY KEY(ID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE sobject ( + ID BIGINT NOT NULL AUTO_INCREMENT, + + SBucketID BIGINT NOT NULL, + NameKey VARCHAR(255) NOT NULL, + + OwnerCanonicalID VARCHAR(150) NOT NULL, + NextSequence INT NOT NULL DEFAULT 1, + DeletionMark VARCHAR (150), + + CreateTime DATETIME, + + PRIMARY KEY(ID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE sobject_item ( + ID BIGINT NOT NULL AUTO_INCREMENT, + + SObjectID BIGINT NOT NULL, + Version VARCHAR(64), + + MD5 VARCHAR(128), + StoredPath VARCHAR(256), -- relative to mount point of the root + StoredSize BIGINT NOT NULL DEFAULT 0, + + CreateTime DATETIME, + LastModifiedTime DATETIME, + LastAccessTime DATETIME, + + PRIMARY KEY(ID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE meta ( + ID BIGINT NOT NULL AUTO_INCREMENT, + + Target VARCHAR(64) NOT NULL, + TargetID BIGINT NOT NULL, + + Name VARCHAR(64) NOT NULL, + Value VARCHAR(256), + + PRIMARY KEY(ID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE acl ( + ID BIGINT NOT NULL AUTO_INCREMENT, + + Target VARCHAR(64) NOT NULL, + TargetID BIGINT NOT NULL, + + GranteeType INT NOT NULL DEFAULT 0, -- 0 : Cloud service user, 1 : Cloud user community, 2: Public user community + GranteeCanonicalID VARCHAR(150), -- make it big enought to hold a Cloud API access key + + Permission INT NOT NULL DEFAULT 0, -- 0 : no permission, 1 : read, 2 : write, 4 : read_acl, 8 : write_acl + GrantOrder INT NOT NULL DEFAULT 0, + + CreateTime DATETIME, + LastModifiedTime DATETIME, + + PRIMARY KEY(ID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- each account has to have a separate +-- each account has to have a separate mappings +CREATE TABLE usercredentials ( + ID BIGINT NOT NULL AUTO_INCREMENT, + + AccessKey VARCHAR(150) NOT NULL, + SecretKey VARCHAR(150) NOT NULL, + CertUniqueId VARCHAR(200), + + PRIMARY KEY(ID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +SET foreign_key_checks = 1; + diff --git a/awsapi-setup/db/mysql/deploy-db-bridge.sh b/awsapi-setup/db/mysql/deploy-db-bridge.sh index abaa19b9a0a..2e8ceee24eb 100644 --- a/awsapi-setup/db/mysql/deploy-db-bridge.sh +++ b/awsapi-setup/db/mysql/deploy-db-bridge.sh @@ -1,7 +1,20 @@ #!/usr/bin/env bash -# deploy-db-bridge.sh -- deploys the cloudbridge database configuration. -# -# set -x +# 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. if [ ! -f cloudbridge_db.sql ]; then printf "Error: Unable to find cloudbridge_db.sql\n" diff --git a/awsapi-setup/init/debian/cloud-bridge b/awsapi-setup/init/debian/cloud-bridge index 8fb0fbf659c..c1bf90b4d93 100644 --- a/awsapi-setup/init/debian/cloud-bridge +++ b/awsapi-setup/init/debian/cloud-bridge @@ -1,4 +1,20 @@ #!/bin/sh +# 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. # # /etc/init.d/tomcat6 -- startup script for the Tomcat 6 servlet engine # diff --git a/awsapi-setup/init/rpm/cloud-bridge b/awsapi-setup/init/rpm/cloud-bridge index ee9bd5138ee..444b771cb4b 100644 --- a/awsapi-setup/init/rpm/cloud-bridge +++ b/awsapi-setup/init/rpm/cloud-bridge @@ -1,5 +1,22 @@ #!/bin/bash # +# 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. +# # tomcat6 This shell script takes care of starting and stopping Tomcat # # chkconfig: - 80 20 diff --git a/awsapi-setup/setup/cloud-setup-bridge b/awsapi-setup/setup/cloud-setup-bridge index ea3fa1faf22..d25072da1eb 100644 --- a/awsapi-setup/setup/cloud-setup-bridge +++ b/awsapi-setup/setup/cloud-setup-bridge @@ -1,5 +1,22 @@ #!/bin/bash # +# 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. +# # Cloud.com Bridge setup script. # diff --git a/awsapi-setup/setup/cloudstack-aws-api-register b/awsapi-setup/setup/cloudstack-aws-api-register index 859a57188fc..19b53fd26c5 100644 --- a/awsapi-setup/setup/cloudstack-aws-api-register +++ b/awsapi-setup/setup/cloudstack-aws-api-register @@ -1,4 +1,21 @@ #!/cygdrive/c/python26/python +# +# 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. import base64 import hmac