diff --git a/developer/log4j.xml b/developer/log4j.xml new file mode 100644 index 000000000000..88aa738076d0 --- /dev/null +++ b/developer/log4j.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + diff --git a/developer/pom.xml b/developer/pom.xml index 3f6236fd6903..c258fe599aaa 100644 --- a/developer/pom.xml +++ b/developer/pom.xml @@ -1,12 +1,12 @@ - + + log4j.configuration + file:${basedir}/log4j.xml + catalina.home ${basedir}/../utils diff --git a/engine/schema/pom.xml b/engine/schema/pom.xml index ead2e01f367e..58d58acd0d18 100644 --- a/engine/schema/pom.xml +++ b/engine/schema/pom.xml @@ -48,5 +48,10 @@ cloud-framework-db ${project.version} + + org.flywaydb + flyway-core + ${cs.flyway.version} + diff --git a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java index 5115694c9ae2..448e1b0a8017 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java @@ -16,6 +16,29 @@ // under the License. package com.cloud.upgrade; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.inject.Inject; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.flywaydb.core.Flyway; +import org.flywaydb.core.api.FlywayException; + +import com.google.common.collect.ImmutableList; + +import org.apache.cloudstack.utils.CloudStackVersion; + import com.cloud.upgrade.dao.DbUpgrade; import com.cloud.upgrade.dao.Upgrade217to218; import com.cloud.upgrade.dao.Upgrade218to22; @@ -41,34 +64,6 @@ import com.cloud.upgrade.dao.Upgrade306to307; import com.cloud.upgrade.dao.Upgrade307to410; import com.cloud.upgrade.dao.Upgrade30to301; -import com.cloud.upgrade.dao.Upgrade40to41; -import com.cloud.upgrade.dao.Upgrade410to420; -import com.cloud.upgrade.dao.Upgrade41100to41200; -import com.cloud.upgrade.dao.Upgrade420to421; -import com.cloud.upgrade.dao.Upgrade421to430; -import com.cloud.upgrade.dao.Upgrade430to440; -import com.cloud.upgrade.dao.Upgrade431to440; -import com.cloud.upgrade.dao.Upgrade432to440; -import com.cloud.upgrade.dao.Upgrade440to441; -import com.cloud.upgrade.dao.Upgrade441to442; -import com.cloud.upgrade.dao.Upgrade442to450; -import com.cloud.upgrade.dao.Upgrade443to450; -import com.cloud.upgrade.dao.Upgrade444to450; -import com.cloud.upgrade.dao.Upgrade450to451; -import com.cloud.upgrade.dao.Upgrade451to452; -import com.cloud.upgrade.dao.Upgrade452to460; -import com.cloud.upgrade.dao.Upgrade453to460; -import com.cloud.upgrade.dao.Upgrade460to461; -import com.cloud.upgrade.dao.Upgrade461to470; -import com.cloud.upgrade.dao.Upgrade470to471; -import com.cloud.upgrade.dao.Upgrade471to480; -import com.cloud.upgrade.dao.Upgrade480to481; -import com.cloud.upgrade.dao.Upgrade481to490; -import com.cloud.upgrade.dao.Upgrade490to4910; -import com.cloud.upgrade.dao.Upgrade4910to4920; -import com.cloud.upgrade.dao.Upgrade4920to4930; -import com.cloud.upgrade.dao.Upgrade4930to41000; -import com.cloud.upgrade.dao.Upgrade41000to41100; import com.cloud.upgrade.dao.UpgradeSnapshot217to224; import com.cloud.upgrade.dao.UpgradeSnapshot223to224; import com.cloud.upgrade.dao.VersionDao; @@ -76,26 +71,11 @@ import com.cloud.upgrade.dao.VersionVO; import com.cloud.upgrade.dao.VersionVO.Step; import com.cloud.utils.component.SystemIntegrityChecker; +import com.cloud.utils.db.DbProperties; import com.cloud.utils.db.GlobalLock; import com.cloud.utils.db.ScriptRunner; import com.cloud.utils.db.TransactionLegacy; import com.cloud.utils.exception.CloudRuntimeException; -import com.google.common.collect.ImmutableList; -import org.apache.cloudstack.utils.CloudStackVersion; -import org.apache.commons.lang.StringUtils; -import org.apache.log4j.Logger; - -import javax.inject.Inject; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.Lists.newArrayList; @@ -117,335 +97,105 @@ public DatabaseUpgradeChecker() { _upgradeMap.put(CloudStackVersion.parse("2.1.7"), new DbUpgrade[] {new Upgrade217to218(), new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), - new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), - new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), - new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), - new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), - new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.1.8"), new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), - new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), - new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), - new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), - new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), - new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.1.9"), new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), - new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), - new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), - new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), - new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), - new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.1"), new DbUpgrade[] {new Upgrade221to222(), new UpgradeSnapshot223to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), - new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), - new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), - new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.2"), new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), - new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), - new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), - new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.3"), new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), - new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), - new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), - new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.4"), new DbUpgrade[] {new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), - new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), - new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), - new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), - new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), - new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.5"), new DbUpgrade[] {new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), - new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), - new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), - new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), - new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), - new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.6"), new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), - new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), - new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), - new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.7"), new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), - new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), - new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), - new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.8"), new DbUpgrade[] {new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), - new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), - new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), - new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.9"), new DbUpgrade[] {new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), - new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), - new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), - new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.10"), new DbUpgrade[] {new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), - new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), - new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.12"), - new DbUpgrade[] {new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), - new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), - new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), - new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), - new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.13"), - new DbUpgrade[] {new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), - new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), - new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), - new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), - new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("2.2.14"), - new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), - new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), - new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), - new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("3.0.0"), - new DbUpgrade[] {new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), - new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), - new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("3.0.1"), - new DbUpgrade[] {new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), - new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), - new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade301to302(), new Upgrade302to40()}); _upgradeMap.put(CloudStackVersion.parse("3.0.2"), - new DbUpgrade[] {new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), - new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.0.0"), - new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), - new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), - new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.0.1"), - new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), - new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), - new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.0.2"), - new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), - new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), - new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.1.0"), - new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), - new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), - new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), - new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.1.1"), - new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), - new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), - new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), - new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.2.0"), - new DbUpgrade[] {new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), - new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), - new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), - new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.2.1"), - new DbUpgrade[] {new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), - new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), - new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.3.0"), - new DbUpgrade[] {new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), - new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), - new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.3.1"), - new DbUpgrade[] {new Upgrade431to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), - new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), - new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.3.2"), - new DbUpgrade[] {new Upgrade432to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), - new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), - new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.4.0"), - new DbUpgrade[] {new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), - new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), - new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.4.1"), - new DbUpgrade[] {new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), - new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.4.2"), - new DbUpgrade[] {new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), - new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.4.3"), - new DbUpgrade[] {new Upgrade443to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), - new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.4.4"), - new DbUpgrade[] {new Upgrade444to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), - new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.5.0"), - new DbUpgrade[] {new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), - new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), - new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.5.1"), - new DbUpgrade[] {new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), - new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), - new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.5.2"), - new DbUpgrade[] {new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), - new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.5.3"), - new DbUpgrade[] {new Upgrade453to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), - new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.6.0"), - new DbUpgrade[] {new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), - new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.6.1"), - new DbUpgrade[] {new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), - new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.6.2"), - new DbUpgrade[] {new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), - new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.7.0"), - new DbUpgrade[] {new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.7.1"), - new DbUpgrade[] {new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), - new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.7.2"), - new DbUpgrade[] {new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), - new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.8.0"), - new DbUpgrade[] {new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), - new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.8.1"), - new DbUpgrade[] {new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.8.2.0"), - new DbUpgrade[] {new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.9.0"), - new DbUpgrade[] {new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.9.1.0"), - new DbUpgrade[] {new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.9.2.0"), - new DbUpgrade[] {new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.9.3.0"), - new DbUpgrade[] {new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); - - _upgradeMap.put(CloudStackVersion.parse("4.10.0.0"), - new DbUpgrade[] {new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade302to40()}); //CP Upgrades _upgradeMap.put(CloudStackVersion.parse("3.0.3"), - new DbUpgrade[] {new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), - new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), - new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), - new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410()}); _upgradeMap.put(CloudStackVersion.parse("3.0.4"), - new DbUpgrade[] {new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), - new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), - new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), - new Upgrade490to4910(), new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410()}); _upgradeMap.put(CloudStackVersion.parse("3.0.5"), - new DbUpgrade[] {new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), - new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), - new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), - new Upgrade4910to4920(), new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410()}); _upgradeMap.put(CloudStackVersion.parse("3.0.6"), - new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), - new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410()}); _upgradeMap.put(CloudStackVersion.parse("3.0.7"), - new DbUpgrade[] {new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), - new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), - new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new DbUpgrade[] {new Upgrade307to410()}); _upgradeMap.put(CloudStackVersion.parse("2.2.15"), new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), - new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), - new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410()}); _upgradeMap.put(CloudStackVersion.parse("2.2.16"), new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), - new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), - new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), - new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to490(), new Upgrade490to4910(), new Upgrade4910to4920(), - new Upgrade4920to4930(), new Upgrade4930to41000(), new Upgrade41000to41100(), new Upgrade41100to41200()}); + new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410()}); + + _upgradeMap.put(CloudStackVersion.parse("4.0.0"), new DbUpgrade[0]); + _upgradeMap.put(CloudStackVersion.parse("4.1.0"), new DbUpgrade[0]); final List sortedVersions = newArrayList(_upgradeMap.keySet()); sort(sortedVersions); @@ -497,30 +247,20 @@ private DbUpgrade[] findMostRecentUpgradePath(final CloudStackVersion dbVersion) } // Default visibility to support unit testing ... - DbUpgrade[] calculateUpgradePath(final CloudStackVersion dbVersion, final CloudStackVersion currentVersion) { + DbUpgrade[] calculateUpgradePath(final CloudStackVersion dbVersion) { checkArgument(dbVersion != null); - checkArgument(currentVersion != null); - checkArgument(currentVersion.compareTo(dbVersion) > 0); final DbUpgrade[] upgrades = _upgradeMap.containsKey(dbVersion) ? _upgradeMap.get(dbVersion) : findMostRecentUpgradePath(dbVersion); - // When there is no upgrade defined for the target version, we assume that there were no schema changes or - // data migrations required. Based on that assumption, we add a noop DbUpgrade to the end of the list ... - final CloudStackVersion tailVersion = upgrades.length > 0 ? CloudStackVersion.parse(upgrades[upgrades.length - 1].getUpgradedVersion()) : dbVersion; - - if (currentVersion.compareTo(tailVersion) != 0) { - return concat(upgrades, new NoopDbUpgrade(tailVersion, currentVersion)); - } - return upgrades; } - protected void upgrade(CloudStackVersion dbVersion, CloudStackVersion currentVersion) { - s_logger.info("Database upgrade must be performed from " + dbVersion + " to " + currentVersion); + protected void legacyUpgrade(CloudStackVersion dbVersion) { + s_logger.info("Database upgrade must be performed from " + dbVersion); - final DbUpgrade[] upgrades = calculateUpgradePath(dbVersion, currentVersion); + final DbUpgrade[] upgrades = calculateUpgradePath(dbVersion); for (DbUpgrade upgrade : upgrades) { VersionVO version; @@ -612,25 +352,44 @@ public void check() { return; } - final CloudStackVersion currentVersion = CloudStackVersion.parse(currentVersionValue); - s_logger.info("DB version = " + dbVersion + " Code Version = " + currentVersion); + s_logger.info("DB version = " + dbVersion); - if (dbVersion.compareTo(currentVersion) > 0) { - throw new CloudRuntimeException("Database version " + dbVersion + " is higher than management software version " + currentVersionValue); + if (dbVersion.getMajorRelease() < 4) { + legacyUpgrade(dbVersion); } - if (dbVersion.compareTo(currentVersion) == 0) { - s_logger.info("DB version and code version matches so no upgrade needed."); - return; - } - - upgrade(dbVersion, currentVersion); } finally { lock.unlock(); } } finally { lock.releaseRef(); } + + s_logger.info("Running Flyway migration on Cloudstack database"); + Properties dbProps = DbProperties.getDbProperties(); + final String cloudUsername = dbProps.getProperty("db.cloud.username"); + final String cloudPassword = dbProps.getProperty("db.cloud.password"); + final String cloudHost = dbProps.getProperty("db.cloud.host"); + final int cloudPort = Integer.parseInt(dbProps.getProperty("db.cloud.port")); + final String driver = dbProps.getProperty("db.cloud.driver", "jdbc:mysql"); + final String dbUrl = driver + "://" + cloudHost + ":" + cloudPort + "/cloud"; + + try { + Flyway flyway = new Flyway() + .configure() + .dataSource(dbUrl, cloudUsername, cloudPassword) + .table("cloudstack_schema_version") + .baselineOnMigrate(true) + .baselineVersion(_dao.getCurrentVersion()) + .placeholderReplacement(false) + .locations("META-INF/db/csmigration","com/cloud/upgrade/flyway") + .load(); + + flyway.migrate(); + } catch (FlywayException fwe) { + throw new CloudRuntimeException("Failed to run Flyway migration on Cloudstack database ", fwe); + } + } private static final class NoopDbUpgrade implements DbUpgrade { @@ -678,4 +437,4 @@ public InputStream[] getCleanupScripts() { } } -} \ No newline at end of file +} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41100to41200.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41100to41200.java deleted file mode 100644 index f44c2a0e5d66..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41100to41200.java +++ /dev/null @@ -1,68 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import java.io.InputStream; -import java.sql.Connection; - -import com.cloud.utils.exception.CloudRuntimeException; - -public class Upgrade41100to41200 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.11.0.0", "4.12.0.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.12.0.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-41100to41200.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-41100to41200-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade431to440.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade431to440.java deleted file mode 100644 index 98b52ac0aa96..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade431to440.java +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import org.apache.log4j.Logger; - -public class Upgrade431to440 extends Upgrade430to440 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade431to440.class); - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.3.1", "4.4.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.4.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade432to440.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade432to440.java deleted file mode 100644 index ded0db474d5e..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade432to440.java +++ /dev/null @@ -1,39 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import org.apache.log4j.Logger; - -public class Upgrade432to440 extends Upgrade431to440 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade432to440.class); - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.3.2", "4.4.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.4.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade440to441.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade440to441.java deleted file mode 100644 index a51f464a797f..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade440to441.java +++ /dev/null @@ -1,67 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import java.io.InputStream; -import java.sql.Connection; - -import com.cloud.utils.exception.CloudRuntimeException; - -public class Upgrade440to441 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.4.0", "4.4.1"}; - } - - @Override - public String getUpgradedVersion() { - return "4.4.1"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-440to441.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-440to441-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade441to442.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade441to442.java deleted file mode 100644 index 4234428f72b0..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade441to442.java +++ /dev/null @@ -1,62 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import java.io.InputStream; -import java.sql.Connection; - - -import com.cloud.utils.exception.CloudRuntimeException; - -public class Upgrade441to442 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.4.1", "4.4.2"}; - } - - @Override - public String getUpgradedVersion() { - return "4.4.2"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-441to442.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - return null; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade443to444.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade443to444.java deleted file mode 100644 index b8110546a13c..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade443to444.java +++ /dev/null @@ -1,61 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import java.io.InputStream; -import java.sql.Connection; - -import com.cloud.utils.exception.CloudRuntimeException; - -public class Upgrade443to444 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.4.3", "4.4.4"}; - } - - @Override - public String getUpgradedVersion() { - return "4.4.4"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-443to444.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - return null; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade443to450.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade443to450.java deleted file mode 100644 index 80b2c14e00c7..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade443to450.java +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -public class Upgrade443to450 extends Upgrade442to450 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.4.3", "4.5.0"}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade444to450.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade444to450.java deleted file mode 100644 index 52fc7299810a..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade444to450.java +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -public class Upgrade444to450 extends Upgrade442to450 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.4.4", "4.5.0"}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade451to452.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade451to452.java deleted file mode 100644 index 788b6f28ef1e..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade451to452.java +++ /dev/null @@ -1,67 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import com.cloud.utils.exception.CloudRuntimeException; - -import java.io.InputStream; -import java.sql.Connection; - -public class Upgrade451to452 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.5.1", "4.5.2"}; - } - - @Override - public String getUpgradedVersion() { - return "4.5.2"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-451to452.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-451to452-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade452to453.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade452to453.java deleted file mode 100644 index 3bc39ebc68fd..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade452to453.java +++ /dev/null @@ -1,67 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import com.cloud.utils.exception.CloudRuntimeException; - -import java.io.InputStream; -import java.sql.Connection; - -public class Upgrade452to453 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.5.2", "4.5.3"}; - } - - @Override - public String getUpgradedVersion() { - return "4.5.3"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-452to453.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-452to453-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade453to460.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade453to460.java deleted file mode 100644 index 2dd4b0aad27b..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade453to460.java +++ /dev/null @@ -1,26 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -public class Upgrade453to460 extends Upgrade452to460 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] { "4.5.3", "4.6.0" }; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade460to461.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade460to461.java deleted file mode 100644 index 88bda4616c80..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade460to461.java +++ /dev/null @@ -1,67 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import com.cloud.utils.exception.CloudRuntimeException; - -import java.io.InputStream; -import java.sql.Connection; - -public class Upgrade460to461 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.6.0", "4.6.1"}; - } - - @Override - public String getUpgradedVersion() { - return "4.6.1"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-460to461.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-460to461-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade470to471.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade470to471.java deleted file mode 100644 index 08cdfdd53f55..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade470to471.java +++ /dev/null @@ -1,67 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import com.cloud.utils.exception.CloudRuntimeException; - -import java.io.InputStream; -import java.sql.Connection; - -public class Upgrade470to471 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.7.0", "4.7.1"}; - } - - @Override - public String getUpgradedVersion() { - return "4.7.1"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-470to471.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-470to471-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade471to480.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade471to480.java deleted file mode 100644 index 3b3a0bba03ec..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade471to480.java +++ /dev/null @@ -1,67 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import com.cloud.utils.exception.CloudRuntimeException; - -import java.io.InputStream; -import java.sql.Connection; - -public class Upgrade471to480 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.7.1", "4.8.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.8.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-471to480.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-471to480-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade480to481.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade480to481.java deleted file mode 100644 index be33709dd921..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade480to481.java +++ /dev/null @@ -1,67 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import com.cloud.utils.exception.CloudRuntimeException; - -import java.io.InputStream; -import java.sql.Connection; - -public class Upgrade480to481 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.8.0", "4.8.1"}; - } - - @Override - public String getUpgradedVersion() { - return "4.8.1"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-480to481.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-480to481-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade490to4910.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade490to4910.java deleted file mode 100644 index 8757d7fa5395..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade490to4910.java +++ /dev/null @@ -1,67 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import com.cloud.utils.exception.CloudRuntimeException; - -import java.io.InputStream; -import java.sql.Connection; - -public class Upgrade490to4910 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.9.0", "4.9.1.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.9.1.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-490to4910.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-490to4910-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade4910to4920.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade4910to4920.java deleted file mode 100644 index 1950c8f28b88..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade4910to4920.java +++ /dev/null @@ -1,67 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import com.cloud.utils.exception.CloudRuntimeException; - -import java.io.InputStream; -import java.sql.Connection; - -public class Upgrade4910to4920 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.9.1.0", "4.9.2.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.9.2.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-4910to4920.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-4910to4920-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade4920to4930.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade4920to4930.java deleted file mode 100644 index bc02c95064c8..000000000000 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade4920to4930.java +++ /dev/null @@ -1,67 +0,0 @@ -// 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. - -package com.cloud.upgrade.dao; - -import com.cloud.utils.exception.CloudRuntimeException; - -import java.io.InputStream; -import java.sql.Connection; - -public class Upgrade4920to4930 implements DbUpgrade { - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.9.2.0", "4.9.3.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.9.3.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-4920to4930.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-4920to4930-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } -} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41000to41100.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/R__UpdateSystemVmTemplates.java similarity index 71% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41000to41100.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/R__UpdateSystemVmTemplates.java index 20294d16518a..04502fa78299 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41000to41100.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/R__UpdateSystemVmTemplates.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,10 +15,10 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; -import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -27,105 +28,25 @@ import java.util.Map; import java.util.Set; -import org.apache.commons.codec.binary.Base64; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; import com.cloud.hypervisor.Hypervisor; -import com.cloud.utils.PropertiesUtil; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade41000to41100 implements DbUpgrade { +public class R__UpdateSystemVmTemplates extends BaseJdbcMigration { - final static Logger LOG = Logger.getLogger(Upgrade41000to41100.class); + final static Logger LOG = Logger.getLogger(R__UpdateSystemVmTemplates.class); - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.10.0.0", "4.11.0.0"}; - } - - @Override public String getUpgradedVersion() { return "4.11.0.0"; } @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-41000to41100.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { - checkAndEnableDynamicRoles(conn); - validateUserDataInBase64(conn); + public void migrate(Connection conn) { updateSystemVmTemplates(conn); } - private void checkAndEnableDynamicRoles(final Connection conn) { - final Map apiMap = PropertiesUtil.processConfigFile(new String[] { "commands.properties" }); - if (apiMap == null || apiMap.isEmpty()) { - if (LOG.isDebugEnabled()) { - LOG.debug("No commands.properties file was found, enabling dynamic roles by setting dynamic.apichecker.enabled to true if not already enabled."); - } - try (final PreparedStatement updateStatement = conn.prepareStatement("INSERT INTO cloud.configuration (category, instance, name, default_value, value) VALUES ('Advanced', 'DEFAULT', 'dynamic.apichecker.enabled', 'false', 'true') ON DUPLICATE KEY UPDATE value='true'")) { - updateStatement.executeUpdate(); - } catch (SQLException e) { - LOG.error("Failed to set dynamic.apichecker.enabled to true, please run migrate-dynamicroles.py script to manually migrate to dynamic roles.", e); - } - } else { - LOG.warn("Old commands.properties static checker is deprecated, please use migrate-dynamicroles.py to migrate to dynamic roles. Refer http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/latest/accounts.html#using-dynamic-roles"); - } - } - - private void validateUserDataInBase64(Connection conn) { - try (final PreparedStatement selectStatement = conn.prepareStatement("SELECT `id`, `user_data` FROM `cloud`.`user_vm` WHERE `user_data` IS NOT NULL;"); - final ResultSet selectResultSet = selectStatement.executeQuery()) { - while (selectResultSet.next()) { - final Long userVmId = selectResultSet.getLong(1); - final String userData = selectResultSet.getString(2); - if (Base64.isBase64(userData)) { - final String newUserData = Base64.encodeBase64String(Base64.decodeBase64(userData.getBytes())); - if (!userData.equals(newUserData)) { - try (final PreparedStatement updateStatement = conn.prepareStatement("UPDATE `cloud`.`user_vm` SET `user_data` = ? WHERE `id` = ? ;")) { - updateStatement.setString(1, newUserData); - updateStatement.setLong(2, userVmId); - updateStatement.executeUpdate(); - } catch (SQLException e) { - LOG.error("Failed to update cloud.user_vm user_data for id:" + userVmId + " with exception: " + e.getMessage()); - throw new CloudRuntimeException("Exception while updating cloud.user_vm for id " + userVmId, e); - } - } - } else { - // Update to NULL since it's invalid - LOG.warn("Removing user_data for vm id " + userVmId + " because it's invalid"); - LOG.warn("Removed data was: " + userData); - try (final PreparedStatement updateStatement = conn.prepareStatement("UPDATE `cloud`.`user_vm` SET `user_data` = NULL WHERE `id` = ? ;")) { - updateStatement.setLong(1, userVmId); - updateStatement.executeUpdate(); - } catch (SQLException e) { - LOG.error("Failed to update cloud.user_vm user_data for id:" + userVmId + " to NULL with exception: " + e.getMessage()); - throw new CloudRuntimeException("Exception while updating cloud.user_vm for id " + userVmId + " to NULL", e); - } - } - } - } catch (SQLException e) { - throw new CloudRuntimeException("Exception while validating existing user_vm table's user_data column to be base64 valid with padding", e); - } - if (LOG.isDebugEnabled()) { - LOG.debug("Done validating base64 content of user data"); - } - } - @SuppressWarnings("serial") private void updateSystemVmTemplates(final Connection conn) { LOG.debug("Updating System Vm template IDs"); @@ -295,15 +216,4 @@ private void updateSystemVmTemplates(final Connection conn) { LOG.debug("Updating System Vm Template IDs Complete"); } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-41000to41100-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade4930to41000.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_10_0_0_1__update.java similarity index 94% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade4930to41000.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_10_0_0_1__update.java index 46abd44aa6a0..4e7f2e9f2dc1 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade4930to41000.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_10_0_0_1__update.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,21 +15,24 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; -import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.HashMap; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade4930to41000 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade4930to41000.class); +public class V4_10_0_0_1__update extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_10_0_0_1__update.class); public static class MemoryValues { long max; @@ -49,48 +53,12 @@ public long getMin() { } @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.9.3.0", "4.10.0.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.10.0.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-4930to41000.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); populateGuestOsDetails(conn); updateSourceCidrs(conn); } - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-4930to41000-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - private void populateGuestOsDetails(Connection conn){ final HashMap xenServerGuestOsMemoryMap = new HashMap(70); diff --git a/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_11_0_0_1__update.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_11_0_0_1__update.java new file mode 100644 index 000000000000..2315e7ffe55f --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_11_0_0_1__update.java @@ -0,0 +1,110 @@ +/// +// 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. +/// + +package com.cloud.upgrade.flyway; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.codec.binary.Base64; +import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; + +import com.cloud.hypervisor.Hypervisor; +import com.cloud.utils.PropertiesUtil; +import com.cloud.utils.exception.CloudRuntimeException; + +public class V4_11_0_0_1__update extends BaseJavaMigration { + + final static Logger LOG = Logger.getLogger(V4_11_0_0_1__update.class); + + public String getUpgradedVersion() { + return "4.11.0.0"; + } + + @Override + public void migrate(Context context) { + Connection conn = context.getConnection(); + checkAndEnableDynamicRoles(conn); + validateUserDataInBase64(conn); + } + + private void checkAndEnableDynamicRoles(final Connection conn) { + final Map apiMap = PropertiesUtil.processConfigFile(new String[] { "commands.properties" }); + if (apiMap == null || apiMap.isEmpty()) { + if (LOG.isDebugEnabled()) { + LOG.debug("No commands.properties file was found, enabling dynamic roles by setting dynamic.apichecker.enabled to true if not already enabled."); + } + try (final PreparedStatement updateStatement = conn.prepareStatement("INSERT INTO cloud.configuration (category, instance, name, default_value, value) VALUES ('Advanced', 'DEFAULT', 'dynamic.apichecker.enabled', 'false', 'true') ON DUPLICATE KEY UPDATE value='true'")) { + updateStatement.executeUpdate(); + } catch (SQLException e) { + LOG.error("Failed to set dynamic.apichecker.enabled to true, please run migrate-dynamicroles.py script to manually migrate to dynamic roles.", e); + } + } else { + LOG.warn("Old commands.properties static checker is deprecated, please use migrate-dynamicroles.py to migrate to dynamic roles. Refer http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/latest/accounts.html#using-dynamic-roles"); + } + } + + private void validateUserDataInBase64(Connection conn) { + try (final PreparedStatement selectStatement = conn.prepareStatement("SELECT `id`, `user_data` FROM `cloud`.`user_vm` WHERE `user_data` IS NOT NULL;"); + final ResultSet selectResultSet = selectStatement.executeQuery()) { + while (selectResultSet.next()) { + final Long userVmId = selectResultSet.getLong(1); + final String userData = selectResultSet.getString(2); + if (Base64.isBase64(userData)) { + final String newUserData = Base64.encodeBase64String(Base64.decodeBase64(userData.getBytes())); + if (!userData.equals(newUserData)) { + try (final PreparedStatement updateStatement = conn.prepareStatement("UPDATE `cloud`.`user_vm` SET `user_data` = ? WHERE `id` = ? ;")) { + updateStatement.setString(1, newUserData); + updateStatement.setLong(2, userVmId); + updateStatement.executeUpdate(); + } catch (SQLException e) { + LOG.error("Failed to update cloud.user_vm user_data for id:" + userVmId + " with exception: " + e.getMessage()); + throw new CloudRuntimeException("Exception while updating cloud.user_vm for id " + userVmId, e); + } + } + } else { + // Update to NULL since it's invalid + LOG.warn("Removing user_data for vm id " + userVmId + " because it's invalid"); + LOG.warn("Removed data was: " + userData); + try (final PreparedStatement updateStatement = conn.prepareStatement("UPDATE `cloud`.`user_vm` SET `user_data` = NULL WHERE `id` = ? ;")) { + updateStatement.setLong(1, userVmId); + updateStatement.executeUpdate(); + } catch (SQLException e) { + LOG.error("Failed to update cloud.user_vm user_data for id:" + userVmId + " to NULL with exception: " + e.getMessage()); + throw new CloudRuntimeException("Exception while updating cloud.user_vm for id " + userVmId + " to NULL", e); + } + } + } + } catch (SQLException e) { + throw new CloudRuntimeException("Exception while validating existing user_vm table's user_data column to be base64 valid with padding", e); + } + if (LOG.isDebugEnabled()) { + LOG.debug("Done validating base64 content of user data"); + } + } +} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade40to41.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_1_0_1__UpdateRegionsAndFirewallRules.java similarity index 84% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade40to41.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_1_0_1__UpdateRegionsAndFirewallRules.java index 5864e2410d04..a1cd0517db9c 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade40to41.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_1_0_1__UpdateRegionsAndFirewallRules.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,10 +15,10 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; -import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -26,56 +27,23 @@ import java.util.UUID; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; import com.cloud.utils.db.DbProperties; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade40to41 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade40to41.class); +public class V4_1_0_1__UpdateRegionsAndFirewallRules extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_1_0_1__UpdateRegionsAndFirewallRules.class); @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.0.0", "4.1.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.1.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-40to410.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); updateRegionEntries(conn); upgradeEgressFirewallRules(conn); } - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-40to410-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - private void updateRegionEntries(Connection conn) { final Properties dbProps = DbProperties.getDbProperties(); int region_id = 1; diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_2_0_1__update.java similarity index 99% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade410to420.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_2_0_1__update.java index 9551a5041923..92aa012b429c 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade410to420.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_2_0_1__update.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,11 +15,11 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; import java.io.File; -import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.sql.Connection; import java.sql.Date; @@ -34,47 +35,27 @@ import java.util.UUID; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; + import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; import com.cloud.deploy.DeploymentPlanner; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.vpc.NetworkACL; +import com.cloud.upgrade.dao.DbUpgradeUtils; import com.cloud.utils.Pair; import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade410to420 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade410to420.class); - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.1.0", "4.2.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.2.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-410to420.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } +public class V4_2_0_1__update extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_2_0_1__update.class); @Override - public void performDataMigration(Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); movePrivateZoneToDedicatedResource(conn); upgradeVmwareLabels(conn); persistLegacyZones(conn); @@ -607,17 +588,6 @@ private void updateOverCommitRatioClusterDetails(Connection conn) { } } - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-410to420-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - private String getNewLabel(ResultSet rs, String oldParamValue) { int separatorIndex; String oldGuestLabel; diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade420to421.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_2_1_1__update.java similarity index 92% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade420to421.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_2_1_1__update.java index d7ba2ed20da3..2e46037bba87 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade420to421.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_2_1_1__update.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,62 +15,33 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; -import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; import com.cloud.hypervisor.Hypervisor; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade420to421 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade420to421.class); +public class V4_2_1_1__update extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_2_1_1__update.class); @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.2.0", "4.2.1"}; - } - - @Override - public String getUpgradedVersion() { - return "4.2.1"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-420to421.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public InputStream[] getCleanupScripts() { - return null; - } - - @Override - public void performDataMigration(Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); upgradeResourceCount(conn); updateOverprovisioningPerVm(conn); } - - private void updateOverprovisioningPerVm(Connection conn) { // Get cpu overprovisioning factor from global setting and update user vm details table for all the vms if factor > 1 diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade421to430.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_3_0_1__encrypt.java similarity index 85% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade421to430.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_3_0_1__encrypt.java index cc4dda210ff0..82c9a2d00cbf 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade421to430.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_3_0_1__encrypt.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,10 +15,10 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; -import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.sql.Connection; import java.sql.PreparedStatement; @@ -27,41 +28,19 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade421to430 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade421to430.class); +public class V4_3_0_1__encrypt extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_3_0_1__encrypt.class); @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.2.1", "4.3.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.3.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-421to430.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); encryptLdapConfigParams(conn); encryptImageStoreDetails(conn); upgradeMemoryOfSsvmOffering(conn); @@ -191,16 +170,4 @@ private void encryptImageStoreDetails(Connection conn) { } s_logger.debug("Done encrypting image_store_details"); } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-421to430-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade430to440.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_4_0_1__update.java similarity index 88% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade430to440.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_4_0_1__update.java index 77070ae8f494..91361edbf528 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade430to440.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_4_0_1__update.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,52 +15,30 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; -import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; import com.cloud.network.Network; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade430to440 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade430to440.class); +public class V4_4_0_1__update extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_4_0_1__update.class); @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.3.0", "4.4.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.4.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-430to440.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); secondaryIpsAccountAndDomainIdsUpdate(conn); moveCidrsToTheirOwnTable(conn); addExtractTemplateAndVolumeColumns(conn); @@ -226,15 +205,4 @@ private void updateVlanUris(Connection conn) { } s_logger.debug("Done updateing vlan URIs"); } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-430to440-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade442to450.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_5_0_1__update.java similarity index 80% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade442to450.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_5_0_1__update.java index 54e8da5f6e9e..e1cbab4820ea 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade442to450.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_5_0_1__update.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,10 +15,10 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; -import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.sql.Connection; import java.sql.PreparedStatement; @@ -29,41 +30,20 @@ import java.util.Map; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; +import com.cloud.upgrade.dao.DbUpgradeUtils; import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade442to450 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade442to450.class); +public class V4_5_0_1__update extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_5_0_1__update.class); @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.4.2", "4.5.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.5.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-442to450.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); dropInvalidKeyFromStoragePoolTable(conn); dropDuplicatedForeignKeyFromAsyncJobTable(conn); updateMaxRouterSizeConfig(conn); @@ -137,17 +117,6 @@ private void upgradeMemoryOfInternalLoadBalancervmOffering(Connection conn) { s_logger.debug("Done upgrading RAM for service offering of internal loadbalancer vm to " + newRamSize); } - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-442to450-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - private void dropInvalidKeyFromStoragePoolTable(Connection conn) { HashMap> uniqueKeys = new HashMap>(); List keys = new ArrayList(); @@ -157,7 +126,7 @@ private void dropInvalidKeyFromStoragePoolTable(Connection conn) { s_logger.debug("Dropping id_2 key from storage_pool table"); for (Map.Entry> entry: uniqueKeys.entrySet()) { - DbUpgradeUtils.dropKeysIfExist(conn,entry.getKey(), entry.getValue(), false); + DbUpgradeUtils.dropKeysIfExist(conn, entry.getKey(), entry.getValue(), false); } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade450to451.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_5_1_1__update.java similarity index 84% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade450to451.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_5_1_1__update.java index 71476e7dd635..ab96fb94a797 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade450to451.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_5_1_1__update.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,10 +15,10 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; -import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.sql.Connection; import java.sql.PreparedStatement; @@ -27,53 +28,20 @@ import java.util.List; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; import org.jasypt.exceptions.EncryptionOperationNotPossibleException; import com.cloud.utils.crypt.DBEncryptionUtil; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade450to451 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade450to451.class); +public class V4_5_1_1__update extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_5_1_1__update.class); @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.5.0", "4.5.1"}; - } - - @Override - public String getUpgradedVersion() { - return "4.5.1"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-450to451.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-450to451-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); encryptKeyInKeyStore(conn); encryptIpSecPresharedKeysOfRemoteAccessVpn(conn); encryptStoragePoolUserInfo(conn); diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade452to460.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_6_0_1__update.java similarity index 82% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade452to460.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_6_0_1__update.java index 91fe345f4a12..52ae70d4210b 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade452to460.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_6_0_1__update.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,10 +15,10 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; -import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -26,40 +27,19 @@ import java.util.List; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; +import com.cloud.upgrade.dao.DbUpgradeUtils; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade452to460 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade452to460.class); +public class V4_6_0_1__update extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_6_0_1__update.class); @Override - public String[] getUpgradableVersionRange() { - return new String[] { "4.5.2", "4.6.0" }; - } - - @Override - public String getUpgradedVersion() { - return "4.6.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-452to460.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(final Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); updateVMInstanceUserId(conn); addIndexForVMInstance(conn); } @@ -154,15 +134,4 @@ private void addIndexForVMInstance(final Connection conn) { throw new CloudRuntimeException("Unable to add index i_vm_instance__instance_name to vm_instance table for the column instance_name", e); } } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-452to460-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade461to470.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_7_0_1__update.java similarity index 58% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade461to470.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_7_0_1__update.java index e7922cebf0ac..65d331cc44fb 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade461to470.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_7_0_1__update.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,45 +15,22 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; import com.cloud.utils.exception.CloudRuntimeException; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; -import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; -public class Upgrade461to470 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade461to470.class); - - @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.6.1", "4.7.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.7.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-461to470.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } +public class V4_7_0_1__update extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_7_0_1__update.class); public void alterAddColumnToCloudUsage(final Connection conn) { final String alterTableSql = "ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `quota_calculated` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'quota calculation status'"; @@ -69,18 +47,9 @@ public void alterAddColumnToCloudUsage(final Connection conn) { } @Override - public void performDataMigration(Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); alterAddColumnToCloudUsage(conn); } - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-461to470-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade481to490.java b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_9_0_0_1__update.java similarity index 80% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade481to490.java rename to engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_9_0_0_1__update.java index 1f9fb2f3f9f7..7b6609ad7c1b 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade481to490.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/flyway/V4_9_0_0_1__update.java @@ -1,3 +1,4 @@ +/// // 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 @@ -14,8 +15,9 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. +/// -package com.cloud.upgrade.dao; +package com.cloud.upgrade.flyway; import java.io.IOException; import java.io.InputStream; @@ -27,41 +29,19 @@ import org.apache.cloudstack.acl.RoleType; import org.apache.log4j.Logger; +import org.flywaydb.core.api.migration.BaseJavaMigration; +import org.flywaydb.core.api.migration.Context; +import org.flywaydb.core.api.migration.jdbc.BaseJdbcMigration; import com.cloud.utils.db.ScriptRunner; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade481to490 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade481to490.class); +public class V4_9_0_0_1__update extends BaseJavaMigration { + final static Logger s_logger = Logger.getLogger(V4_9_0_0_1__update.class); @Override - public String[] getUpgradableVersionRange() { - return new String[] {"4.8.1", "4.9.0"}; - } - - @Override - public String getUpgradedVersion() { - return "4.9.0"; - } - - @Override - public boolean supportsRollingUpgrade() { - return false; - } - - @Override - public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-481to490.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } - - @Override - public void performDataMigration(Connection conn) { + public void migrate(Context context) { + Connection conn = context.getConnection(); setupRolesAndPermissionsForDynamicChecker(conn); } @@ -131,15 +111,4 @@ private void setupRolesAndPermissionsForDynamicChecker(final Connection conn) { s_logger.error("Unable to insert default api-role mappings from file: " + script + ". Please configure api per role manually, giving up!", e); } } - - @Override - public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-481to490-cleanup.sql"; - final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); - if (script == null) { - throw new CloudRuntimeException("Unable to find " + scriptFile); - } - - return new InputStream[] {script}; - } } diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__01_free_ip_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__01_free_ip_view.sql new file mode 100644 index 000000000000..2a850af10d92 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__01_free_ip_view.sql @@ -0,0 +1,27 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`free_ip_view`; +CREATE VIEW `cloud`.`free_ip_view` AS + select + count(user_ip_address.id) free_ip + from + `cloud`.`user_ip_address` + inner join + `cloud`.`vlan` ON vlan.id = user_ip_address.vlan_db_id + and vlan.vlan_type = 'VirtualNetwork' + where + state = 'Free'; diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__02_account_netstats_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__02_account_netstats_view.sql new file mode 100644 index 000000000000..e74be2bdbfa1 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__02_account_netstats_view.sql @@ -0,0 +1,25 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`account_netstats_view`; +CREATE VIEW `cloud`.`account_netstats_view` AS + SELECT + account_id, + sum(net_bytes_received) + sum(current_bytes_received) as bytesReceived, + sum(net_bytes_sent) + sum(current_bytes_sent) as bytesSent + FROM + `cloud`.`user_statistics` + group by account_id; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__03_account_vmstats_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__03_account_vmstats_view.sql new file mode 100644 index 000000000000..736e441be631 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__03_account_vmstats_view.sql @@ -0,0 +1,25 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`account_vmstats_view`; +CREATE VIEW `cloud`.`account_vmstats_view` AS + SELECT + account_id, state, count(*) as vmcount + from + `cloud`.`vm_instance` + where + vm_type = 'User' + group by account_id , state; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__04_last_annotation_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__04_last_annotation_view.sql new file mode 100644 index 000000000000..af2e9ecfb2ee --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__04_last_annotation_view.sql @@ -0,0 +1,36 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`last_annotation_view`; +CREATE VIEW `last_annotation_view` AS + SELECT + `annotations`.`uuid` AS `uuid`, + `annotations`.`annotation` AS `annotation`, + `annotations`.`entity_uuid` AS `entity_uuid`, + `annotations`.`entity_type` AS `entity_type`, + `annotations`.`user_uuid` AS `user_uuid`, + `annotations`.`created` AS `created`, + `annotations`.`removed` AS `removed` + FROM + `annotations` + WHERE + `annotations`.`created` IN (SELECT + MAX(`annotations`.`created`) + FROM + `annotations` + WHERE + `annotations`.`removed` IS NULL + GROUP BY `annotations`.`entity_uuid`); \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/schema-481to490-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__account_view.sql similarity index 60% rename from engine/schema/src/main/resources/META-INF/db/schema-481to490-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/R__account_view.sql index adf566e07feb..16b8eca83f5b 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-481to490-cleanup.sql +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__account_view.sql @@ -14,75 +14,6 @@ -- KIND, either express or implied. See the License for the -- specific language governing permissions and limitations -- under the License. - ---; --- Schema cleanup from 4.8.1 to 4.9.0; ---; - --- Added in CLOUDSTACK-9340: General DB optimization, 4 cases: - ------ 1) Incorrect PRIMARY key -ALTER TABLE `cloud`.`ovs_tunnel_network` -DROP PRIMARY KEY, -ADD PRIMARY KEY (`id`), -DROP INDEX `id` , -ADD UNIQUE INDEX `i_to_from_network_id` (`to` ASC, `from` ASC, `network_id` ASC); - ------ 2) Duplicate PRIMARY KEY -ALTER TABLE `cloud`.`user_vm` DROP INDEX `id_2` ,DROP INDEX `id` ; -ALTER TABLE `cloud`.`domain_router` DROP INDEX `id_2` ,DROP INDEX `id` ; -ALTER TABLE `cloud`.`vm_instance` DROP INDEX `id_2` ,DROP INDEX `id` ; -ALTER TABLE `cloud`.`account_vlan_map` DROP INDEX `id` ; -ALTER TABLE `cloud`.`account_vnet_map` DROP INDEX `id` ; -ALTER TABLE `cloud`.`baremetal_rct` DROP INDEX `id` ; -ALTER TABLE `cloud`.`cluster` DROP INDEX `id` ; -ALTER TABLE `cloud`.`conditions` DROP INDEX `id` ; -ALTER TABLE `cloud`.`counter` DROP INDEX `id` ; -ALTER TABLE `cloud`.`data_center` DROP INDEX `id` ; -ALTER TABLE `cloud`.`dc_storage_network_ip_range` DROP INDEX `id` ; -ALTER TABLE `cloud`.`dedicated_resources` DROP INDEX `id` ; -ALTER TABLE `cloud`.`host_pod_ref` DROP INDEX `id` ; -ALTER TABLE `cloud`.`iam_group` DROP INDEX `id` ; -ALTER TABLE `cloud`.`iam_policy` DROP INDEX `id` ; -ALTER TABLE `cloud`.`iam_policy_permission` DROP INDEX `id` ; -ALTER TABLE `cloud`.`image_store_details` DROP INDEX `id` ; -ALTER TABLE `cloud`.`instance_group` DROP INDEX `id` ; -ALTER TABLE `cloud`.`netapp_lun` DROP INDEX `id` ; -ALTER TABLE `cloud`.`netapp_pool` DROP INDEX `id` ; -ALTER TABLE `cloud`.`netapp_volume` DROP INDEX `id` ; -ALTER TABLE `cloud`.`network_acl_item_cidrs` DROP INDEX `id` ; -ALTER TABLE `cloud`.`network_offerings` DROP INDEX `id` ; -ALTER TABLE `cloud`.`nic_secondary_ips` DROP INDEX `id` ; -ALTER TABLE `cloud`.`nics` DROP INDEX `id` ; -ALTER TABLE `cloud`.`op_ha_work` DROP INDEX `id` ; -ALTER TABLE `cloud`.`op_host` DROP INDEX `id` ; -ALTER TABLE `cloud`.`op_host_transfer` DROP INDEX `id` ; -ALTER TABLE `cloud`.`op_networks` DROP INDEX `id` ; -ALTER TABLE `cloud`.`op_nwgrp_work` DROP INDEX `id` ; -ALTER TABLE `cloud`.`op_vm_ruleset_log` DROP INDEX `id` ; -ALTER TABLE `cloud`.`op_vpc_distributed_router_sequence_no` DROP INDEX `id` ; -ALTER TABLE `cloud`.`pod_vlan_map` DROP INDEX `id` ; -ALTER TABLE `cloud`.`portable_ip_address` DROP INDEX `id` ; -ALTER TABLE `cloud`.`portable_ip_range` DROP INDEX `id` ; -ALTER TABLE `cloud`.`region` DROP INDEX `id` ; -ALTER TABLE `cloud`.`remote_access_vpn` DROP INDEX `id` ; -ALTER TABLE `cloud`.`snapshot_details` DROP INDEX `id` ; -ALTER TABLE `cloud`.`snapshots` DROP INDEX `id` ; -ALTER TABLE `cloud`.`storage_pool` DROP INDEX `id` ; -ALTER TABLE `cloud`.`storage_pool_details` DROP INDEX `id` ; -ALTER TABLE `cloud`.`storage_pool_work` DROP INDEX `id` ; -ALTER TABLE `cloud`.`user_ip_address` DROP INDEX `id` ; -ALTER TABLE `cloud`.`user_ipv6_address` DROP INDEX `id` ; -ALTER TABLE `cloud`.`user_statistics` DROP INDEX `id` ; -ALTER TABLE `cloud`.`version` DROP INDEX `id` ; -ALTER TABLE `cloud`.`vlan` DROP INDEX `id` ; -ALTER TABLE `cloud`.`vm_disk_statistics` DROP INDEX `id` ; -ALTER TABLE `cloud`.`vm_snapshot_details` DROP INDEX `id` ; -ALTER TABLE `cloud`.`vm_work_job` DROP INDEX `id` ; -ALTER TABLE `cloud`.`vpc_gateways` DROP INDEX `id` ; -ALTER TABLE `cloud`.`vpn_users` DROP INDEX `id` ; - --- Dynamic roles changes DROP VIEW IF EXISTS `cloud`.`account_view`; CREATE VIEW `cloud`.`account_view` AS select @@ -226,49 +157,4 @@ CREATE VIEW `cloud`.`account_view` AS left join `cloud`.`async_job` ON async_job.instance_id = account.id and async_job.instance_type = 'Account' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`user_view`; -CREATE VIEW `cloud`.`user_view` AS - select - user.id, - user.uuid, - user.username, - user.password, - user.firstname, - user.lastname, - user.email, - user.state, - user.api_key, - user.secret_key, - user.created, - user.removed, - user.timezone, - user.registration_token, - user.is_registered, - user.incorrect_login_attempts, - user.default, - account.id account_id, - account.uuid account_uuid, - account.account_name account_name, - account.type account_type, - account.role_id account_role_id, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`user` - inner join - `cloud`.`account` ON user.account_id = account.id - inner join - `cloud`.`domain` ON account.domain_id = domain.id - left join - `cloud`.`async_job` ON async_job.instance_id = user.id - and async_job.instance_type = 'User' - and async_job.job_status = 0; - + and async_job.job_status = 0; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/schema-460to461.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__affinity_group_view.sql similarity index 97% rename from engine/schema/src/main/resources/META-INF/db/schema-460to461.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/R__affinity_group_view.sql index 4e073442759f..7830a921dac4 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-460to461.sql +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__affinity_group_view.sql @@ -14,10 +14,6 @@ -- KIND, either express or implied. See the License for the -- specific language governing permissions and limitations -- under the License. - ---; --- Schema upgrade from 4.6.0 to 4.6.1; ---; DROP VIEW IF EXISTS `cloud`.`affinity_group_view`; CREATE VIEW `affinity_group_view` AS SELECT diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__async_job_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__async_job_view.sql new file mode 100644 index 000000000000..d478504fb837 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__async_job_view.sql @@ -0,0 +1,124 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`async_job_view`; +CREATE VIEW `cloud`.`async_job_view` AS + select + 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, + user.id user_id, + user.uuid user_uuid, + async_job.id, + async_job.uuid, + async_job.job_cmd, + async_job.job_status, + async_job.job_process_status, + async_job.job_result_code, + async_job.job_result, + async_job.created, + async_job.removed, + async_job.instance_type, + async_job.instance_id, + CASE + WHEN async_job.instance_type = 'Volume' THEN volumes.uuid + WHEN + async_job.instance_type = 'Template' + or async_job.instance_type = 'Iso' + THEN + vm_template.uuid + WHEN + async_job.instance_type = 'VirtualMachine' + or async_job.instance_type = 'ConsoleProxy' + or async_job.instance_type = 'SystemVm' + or async_job.instance_type = 'DomainRouter' + THEN + vm_instance.uuid + WHEN async_job.instance_type = 'Snapshot' THEN snapshots.uuid + WHEN async_job.instance_type = 'Host' THEN host.uuid + WHEN async_job.instance_type = 'StoragePool' THEN storage_pool.uuid + WHEN async_job.instance_type = 'IpAddress' THEN user_ip_address.uuid + WHEN async_job.instance_type = 'SecurityGroup' THEN security_group.uuid + WHEN async_job.instance_type = 'PhysicalNetwork' THEN physical_network.uuid + WHEN async_job.instance_type = 'TrafficType' THEN physical_network_traffic_types.uuid + WHEN async_job.instance_type = 'PhysicalNetworkServiceProvider' THEN physical_network_service_providers.uuid + WHEN async_job.instance_type = 'FirewallRule' THEN firewall_rules.uuid + WHEN async_job.instance_type = 'Account' THEN acct.uuid + WHEN async_job.instance_type = 'User' THEN us.uuid + WHEN async_job.instance_type = 'StaticRoute' THEN static_routes.uuid + WHEN async_job.instance_type = 'PrivateGateway' THEN vpc_gateways.uuid + WHEN async_job.instance_type = 'Counter' THEN counter.uuid + WHEN async_job.instance_type = 'Condition' THEN conditions.uuid + WHEN async_job.instance_type = 'AutoScalePolicy' THEN autoscale_policies.uuid + WHEN async_job.instance_type = 'AutoScaleVmProfile' THEN autoscale_vmprofiles.uuid + WHEN async_job.instance_type = 'AutoScaleVmGroup' THEN autoscale_vmgroups.uuid + ELSE null + END instance_uuid + from + `cloud`.`async_job` + left join + `cloud`.`account` ON async_job.account_id = account.id + left join + `cloud`.`domain` ON domain.id = account.domain_id + left join + `cloud`.`user` ON async_job.user_id = user.id + left join + `cloud`.`volumes` ON async_job.instance_id = volumes.id + left join + `cloud`.`vm_template` ON async_job.instance_id = vm_template.id + left join + `cloud`.`vm_instance` ON async_job.instance_id = vm_instance.id + left join + `cloud`.`snapshots` ON async_job.instance_id = snapshots.id + left join + `cloud`.`host` ON async_job.instance_id = host.id + left join + `cloud`.`storage_pool` ON async_job.instance_id = storage_pool.id + left join + `cloud`.`user_ip_address` ON async_job.instance_id = user_ip_address.id + left join + `cloud`.`security_group` ON async_job.instance_id = security_group.id + left join + `cloud`.`physical_network` ON async_job.instance_id = physical_network.id + left join + `cloud`.`physical_network_traffic_types` ON async_job.instance_id = physical_network_traffic_types.id + left join + `cloud`.`physical_network_service_providers` ON async_job.instance_id = physical_network_service_providers.id + left join + `cloud`.`firewall_rules` ON async_job.instance_id = firewall_rules.id + left join + `cloud`.`account` acct ON async_job.instance_id = acct.id + left join + `cloud`.`user` us ON async_job.instance_id = us.id + left join + `cloud`.`static_routes` ON async_job.instance_id = static_routes.id + left join + `cloud`.`vpc_gateways` ON async_job.instance_id = vpc_gateways.id + left join + `cloud`.`counter` ON async_job.instance_id = counter.id + left join + `cloud`.`conditions` ON async_job.instance_id = conditions.id + left join + `cloud`.`autoscale_policies` ON async_job.instance_id = autoscale_policies.id + left join + `cloud`.`autoscale_vmprofiles` ON async_job.instance_id = autoscale_vmprofiles.id + left join + `cloud`.`autoscale_vmgroups` ON async_job.instance_id = autoscale_vmgroups.id; diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__data_center_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__data_center_view.sql new file mode 100644 index 000000000000..eb5483562cb2 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__data_center_view.sql @@ -0,0 +1,53 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`data_center_view`; +CREATE VIEW `cloud`.`data_center_view` AS + select + data_center.id, + data_center.uuid, + data_center.name, + data_center.is_security_group_enabled, + data_center.is_local_storage_enabled, + data_center.description, + data_center.dns1, + data_center.dns2, + data_center.ip6_dns1, + data_center.ip6_dns2, + data_center.internal_dns1, + data_center.internal_dns2, + data_center.guest_network_cidr, + data_center.domain, + data_center.networktype, + data_center.allocation_state, + data_center.zone_token, + data_center.dhcp_provider, + data_center.removed, + domain.id domain_id, + domain.uuid domain_uuid, + domain.name domain_name, + domain.path domain_path, + dedicated_resources.affinity_group_id, + dedicated_resources.account_id, + affinity_group.uuid affinity_group_uuid + from + `cloud`.`data_center` + left join + `cloud`.`domain` ON data_center.domain_id = domain.id + left join + `cloud`.`dedicated_resources` ON data_center.id = dedicated_resources.data_center_id + left join + `cloud`.`affinity_group` ON dedicated_resources.affinity_group_id = affinity_group.id; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__disk_offering_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__disk_offering_view.sql new file mode 100644 index 000000000000..151fdbabb3d1 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__disk_offering_view.sql @@ -0,0 +1,53 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`disk_offering_view`; +CREATE VIEW `cloud`.`disk_offering_view` AS + select + disk_offering.id, + disk_offering.uuid, + disk_offering.name, + disk_offering.display_text, + disk_offering.provisioning_type, + disk_offering.disk_size, + disk_offering.min_iops, + disk_offering.max_iops, + disk_offering.created, + disk_offering.tags, + disk_offering.customized, + disk_offering.customized_iops, + disk_offering.removed, + disk_offering.use_local_storage, + disk_offering.system_use, + disk_offering.hv_ss_reserve, + disk_offering.bytes_read_rate, + disk_offering.bytes_write_rate, + disk_offering.iops_read_rate, + disk_offering.iops_write_rate, + disk_offering.cache_mode, + disk_offering.sort_key, + disk_offering.type, + disk_offering.display_offering, + domain.id domain_id, + domain.uuid domain_uuid, + domain.name domain_name, + domain.path domain_path + from + `cloud`.`disk_offering` + left join + `cloud`.`domain` ON disk_offering.domain_id = domain.id + where + disk_offering.state='ACTIVE'; diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__domain_router_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__domain_router_view.sql new file mode 100644 index 000000000000..e8e56ad31bbb --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__domain_router_view.sql @@ -0,0 +1,120 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`domain_router_view`; +CREATE VIEW `cloud`.`domain_router_view` AS + select + vm_instance.id id, + vm_instance.name 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, + vm_instance.uuid uuid, + vm_instance.created created, + vm_instance.state state, + vm_instance.removed removed, + vm_instance.pod_id pod_id, + vm_instance.instance_name instance_name, + host_pod_ref.uuid pod_uuid, + data_center.id data_center_id, + data_center.uuid data_center_uuid, + data_center.name data_center_name, + data_center.networktype data_center_type, + data_center.dns1 dns1, + data_center.dns2 dns2, + data_center.ip6_dns1 ip6_dns1, + data_center.ip6_dns2 ip6_dns2, + host.id host_id, + host.uuid host_uuid, + host.name host_name, + host.hypervisor_type, + host.cluster_id cluster_id, + vm_template.id template_id, + vm_template.uuid template_uuid, + service_offering.id service_offering_id, + disk_offering.uuid service_offering_uuid, + disk_offering.name service_offering_name, + nics.id nic_id, + nics.uuid nic_uuid, + nics.network_id network_id, + nics.ip4_address ip_address, + nics.ip6_address ip6_address, + nics.ip6_gateway ip6_gateway, + nics.ip6_cidr ip6_cidr, + nics.default_nic is_default_nic, + nics.gateway gateway, + nics.netmask netmask, + nics.mac_address mac_address, + nics.broadcast_uri broadcast_uri, + nics.isolation_uri isolation_uri, + vpc.id vpc_id, + vpc.uuid vpc_uuid, + vpc.name vpc_name, + networks.uuid network_uuid, + networks.name network_name, + networks.network_domain network_domain, + networks.traffic_type traffic_type, + networks.guest_type guest_type, + async_job.id job_id, + async_job.uuid job_uuid, + async_job.job_status job_status, + async_job.account_id job_account_id, + domain_router.template_version template_version, + domain_router.scripts_version scripts_version, + domain_router.is_redundant_router is_redundant_router, + domain_router.redundant_state redundant_state, + domain_router.stop_pending stop_pending, + domain_router.role role + from + `cloud`.`domain_router` + inner join + `cloud`.`vm_instance` ON vm_instance.id = domain_router.id + inner join + `cloud`.`account` ON vm_instance.account_id = account.id + inner join + `cloud`.`domain` ON vm_instance.domain_id = domain.id + left join + `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id + left join + `cloud`.`projects` ON projects.project_account_id = account.id + left join + `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id + left join + `cloud`.`host` ON vm_instance.host_id = host.id + left join + `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id + left join + `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id + left join + `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id + left join + `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null + left join + `cloud`.`networks` ON nics.network_id = networks.id + left join + `cloud`.`vpc` ON domain_router.vpc_id = vpc.id and vpc.removed is null + left join + `cloud`.`async_job` ON async_job.instance_id = vm_instance.id + and async_job.instance_type = 'DomainRouter' + and async_job.job_status = 0; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__domain_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__domain_view.sql new file mode 100644 index 000000000000..dff983e70721 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__domain_view.sql @@ -0,0 +1,130 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`domain_view`; +CREATE VIEW `cloud`.`domain_view` AS + select + domain.id id, + domain.parent parent, + domain.name name, + domain.uuid uuid, + domain.owner owner, + domain.path path, + domain.level level, + domain.child_count child_count, + domain.next_child_seq next_child_seq, + domain.removed removed, + domain.state state, + domain.network_domain network_domain, + domain.type type, + vmlimit.max vmLimit, + vmcount.count vmTotal, + iplimit.max ipLimit, + ipcount.count ipTotal, + volumelimit.max volumeLimit, + volumecount.count volumeTotal, + snapshotlimit.max snapshotLimit, + snapshotcount.count snapshotTotal, + templatelimit.max templateLimit, + templatecount.count templateTotal, + vpclimit.max vpcLimit, + vpccount.count vpcTotal, + projectlimit.max projectLimit, + projectcount.count projectTotal, + networklimit.max networkLimit, + networkcount.count networkTotal, + cpulimit.max cpuLimit, + cpucount.count cpuTotal, + memorylimit.max memoryLimit, + memorycount.count memoryTotal, + primary_storage_limit.max primaryStorageLimit, + primary_storage_count.count primaryStorageTotal, + secondary_storage_limit.max secondaryStorageLimit, + secondary_storage_count.count secondaryStorageTotal + from + `cloud`.`domain` + left join + `cloud`.`resource_limit` vmlimit ON domain.id = vmlimit.domain_id + and vmlimit.type = 'user_vm' + left join + `cloud`.`resource_count` vmcount ON domain.id = vmcount.domain_id + and vmcount.type = 'user_vm' + left join + `cloud`.`resource_limit` iplimit ON domain.id = iplimit.domain_id + and iplimit.type = 'public_ip' + left join + `cloud`.`resource_count` ipcount ON domain.id = ipcount.domain_id + and ipcount.type = 'public_ip' + left join + `cloud`.`resource_limit` volumelimit ON domain.id = volumelimit.domain_id + and volumelimit.type = 'volume' + left join + `cloud`.`resource_count` volumecount ON domain.id = volumecount.domain_id + and volumecount.type = 'volume' + left join + `cloud`.`resource_limit` snapshotlimit ON domain.id = snapshotlimit.domain_id + and snapshotlimit.type = 'snapshot' + left join + `cloud`.`resource_count` snapshotcount ON domain.id = snapshotcount.domain_id + and snapshotcount.type = 'snapshot' + left join + `cloud`.`resource_limit` templatelimit ON domain.id = templatelimit.domain_id + and templatelimit.type = 'template' + left join + `cloud`.`resource_count` templatecount ON domain.id = templatecount.domain_id + and templatecount.type = 'template' + left join + `cloud`.`resource_limit` vpclimit ON domain.id = vpclimit.domain_id + and vpclimit.type = 'vpc' + left join + `cloud`.`resource_count` vpccount ON domain.id = vpccount.domain_id + and vpccount.type = 'vpc' + left join + `cloud`.`resource_limit` projectlimit ON domain.id = projectlimit.domain_id + and projectlimit.type = 'project' + left join + `cloud`.`resource_count` projectcount ON domain.id = projectcount.domain_id + and projectcount.type = 'project' + left join + `cloud`.`resource_limit` networklimit ON domain.id = networklimit.domain_id + and networklimit.type = 'network' + left join + `cloud`.`resource_count` networkcount ON domain.id = networkcount.domain_id + and networkcount.type = 'network' + left join + `cloud`.`resource_limit` cpulimit ON domain.id = cpulimit.domain_id + and cpulimit.type = 'cpu' + left join + `cloud`.`resource_count` cpucount ON domain.id = cpucount.domain_id + and cpucount.type = 'cpu' + left join + `cloud`.`resource_limit` memorylimit ON domain.id = memorylimit.domain_id + and memorylimit.type = 'memory' + left join + `cloud`.`resource_count` memorycount ON domain.id = memorycount.domain_id + and memorycount.type = 'memory' + left join + `cloud`.`resource_limit` primary_storage_limit ON domain.id = primary_storage_limit.domain_id + and primary_storage_limit.type = 'primary_storage' + left join + `cloud`.`resource_count` primary_storage_count ON domain.id = primary_storage_count.domain_id + and primary_storage_count.type = 'primary_storage' + left join + `cloud`.`resource_limit` secondary_storage_limit ON domain.id = secondary_storage_limit.domain_id + and secondary_storage_limit.type = 'secondary_storage' + left join + `cloud`.`resource_count` secondary_storage_count ON domain.id = secondary_storage_count.domain_id + and secondary_storage_count.type = 'secondary_storage'; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__event_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__event_view.sql new file mode 100644 index 000000000000..16790937585d --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__event_view.sql @@ -0,0 +1,56 @@ +-- 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. +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, + event.display, + 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; diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__host_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__host_view.sql new file mode 100644 index 000000000000..09dbd48e0ba6 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__host_view.sql @@ -0,0 +1,104 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`host_view`; +CREATE VIEW `cloud`.`host_view` AS + SELECT + host.id, + host.uuid, + host.name, + host.status, + host.disconnected, + host.type, + host.private_ip_address, + host.version, + host.hypervisor_type, + host.hypervisor_version, + host.capabilities, + host.last_ping, + host.created, + host.removed, + host.resource_state, + host.mgmt_server_id, + host.cpu_sockets, + host.cpus, + host.speed, + host.ram, + cluster.id cluster_id, + cluster.uuid cluster_uuid, + cluster.name cluster_name, + cluster.cluster_type, + data_center.id data_center_id, + data_center.uuid data_center_uuid, + data_center.name data_center_name, + data_center.networktype data_center_type, + host_pod_ref.id pod_id, + host_pod_ref.uuid pod_uuid, + host_pod_ref.name pod_name, + host_tags.tag, + guest_os_category.id guest_os_category_id, + guest_os_category.uuid guest_os_category_uuid, + guest_os_category.name guest_os_category_name, + mem_caps.used_capacity memory_used_capacity, + mem_caps.reserved_capacity memory_reserved_capacity, + cpu_caps.used_capacity cpu_used_capacity, + cpu_caps.reserved_capacity cpu_reserved_capacity, + async_job.id job_id, + async_job.uuid job_uuid, + async_job.job_status job_status, + async_job.account_id job_account_id, + oobm.enabled AS `oobm_enabled`, + oobm.power_state AS `oobm_power_state`, + ha_config.enabled AS `ha_enabled`, + ha_config.ha_state AS `ha_state`, + ha_config.provider AS `ha_provider`, + `last_annotation_view`.`annotation` AS `annotation`, + `last_annotation_view`.`created` AS `last_annotated`, + `user`.`username` AS `username` + FROM + `cloud`.`host` + LEFT JOIN + `cloud`.`cluster` ON host.cluster_id = cluster.id + LEFT JOIN + `cloud`.`data_center` ON host.data_center_id = data_center.id + LEFT JOIN + `cloud`.`host_pod_ref` ON host.pod_id = host_pod_ref.id + LEFT JOIN + `cloud`.`host_details` ON host.id = host_details.host_id + AND host_details.name = 'guest.os.category.id' + LEFT JOIN + `cloud`.`guest_os_category` ON guest_os_category.id = CONVERT ( host_details.value, UNSIGNED ) + LEFT JOIN + `cloud`.`host_tags` ON host_tags.host_id = host.id + LEFT JOIN + `cloud`.`op_host_capacity` mem_caps ON host.id = mem_caps.host_id + AND mem_caps.capacity_type = 0 + LEFT JOIN + `cloud`.`op_host_capacity` cpu_caps ON host.id = cpu_caps.host_id + AND cpu_caps.capacity_type = 1 + LEFT JOIN + `cloud`.`async_job` ON async_job.instance_id = host.id + AND async_job.instance_type = 'Host' + AND async_job.job_status = 0 + LEFT JOIN + `cloud`.`oobm` ON oobm.host_id = host.id + left join + `cloud`.`ha_config` ON ha_config.resource_id=host.id + and ha_config.resource_type='Host' + LEFT JOIN + `cloud`.`last_annotation_view` ON `last_annotation_view`.`entity_uuid` = `host`.`uuid` + LEFT JOIN + `cloud`.`user` ON `user`.`uuid` = `last_annotation_view`.`user_uuid`; diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__image_store_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__image_store_view.sql new file mode 100644 index 000000000000..e05299ef9121 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__image_store_view.sql @@ -0,0 +1,39 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`image_store_view`; +CREATE VIEW `cloud`.`image_store_view` AS + select + image_store.id, + image_store.uuid, + image_store.name, + image_store.image_provider_name, + image_store.protocol, + image_store.url, + image_store.scope, + image_store.role, + image_store.removed, + data_center.id data_center_id, + data_center.uuid data_center_uuid, + data_center.name data_center_name, + image_store_details.name detail_name, + image_store_details.value detail_value + from + `cloud`.`image_store` + left join + `cloud`.`data_center` ON image_store.data_center_id = data_center.id + left join + `cloud`.`image_store_details` ON image_store_details.store_id = image_store.id; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__instance_group_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__instance_group_view.sql new file mode 100644 index 000000000000..7cdd5bf47f47 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__instance_group_view.sql @@ -0,0 +1,27 @@ +DROP VIEW IF EXISTS `cloud`.`instance_group_view`; +CREATE VIEW `cloud`.`instance_group_view` AS + select + instance_group.id, + instance_group.uuid, + instance_group.name, + instance_group.removed, + instance_group.created, + 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`.`instance_group` + inner join + `cloud`.`account` ON instance_group.account_id = account.id + inner join + `cloud`.`domain` ON account.domain_id = domain.id + left join + `cloud`.`projects` ON projects.project_account_id = instance_group.account_id; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__project_account_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__project_account_view.sql new file mode 100644 index 000000000000..a2cdf7b2c052 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__project_account_view.sql @@ -0,0 +1,40 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`project_account_view`; +CREATE VIEW `cloud`.`project_account_view` AS + select + project_account.id, + account.id account_id, + account.uuid account_uuid, + account.account_name, + account.type account_type, + project_account.account_role, + projects.id project_id, + projects.uuid project_uuid, + projects.name project_name, + domain.id domain_id, + domain.uuid domain_uuid, + domain.name domain_name, + domain.path domain_path + from + `cloud`.`project_account` + inner join + `cloud`.`account` ON project_account.account_id = account.id + inner join + `cloud`.`domain` ON account.domain_id = domain.id + inner join + `cloud`.`projects` ON projects.id = project_account.project_id; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__project_invitation_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__project_invitation_view.sql new file mode 100644 index 000000000000..172886562a21 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__project_invitation_view.sql @@ -0,0 +1,43 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`project_invitation_view`; +CREATE VIEW `cloud`.`project_invitation_view` AS + select + project_invitations.id, + project_invitations.uuid, + project_invitations.email, + project_invitations.created, + project_invitations.state, + projects.id project_id, + projects.uuid project_uuid, + projects.name project_name, + account.id account_id, + account.uuid account_uuid, + account.account_name, + account.type account_type, + domain.id domain_id, + domain.uuid domain_uuid, + domain.name domain_name, + domain.path domain_path + from + `cloud`.`project_invitations` + left join + `cloud`.`account` ON project_invitations.account_id = account.id + left join + `cloud`.`domain` ON project_invitations.domain_id = domain.id + left join + `cloud`.`projects` ON projects.id = project_invitations.project_id; diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__project_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__project_view.sql new file mode 100644 index 000000000000..fba5245a4cca --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__project_view.sql @@ -0,0 +1,57 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`project_view`; +CREATE VIEW `cloud`.`project_view` AS + select + projects.id, + projects.uuid, + projects.name, + projects.display_text, + projects.state, + projects.removed, + projects.created, + projects.project_account_id, + account.account_name owner, + pacct.account_id, + domain.id domain_id, + domain.uuid domain_uuid, + domain.name domain_name, + domain.path domain_path, + resource_tags.id tag_id, + resource_tags.uuid tag_uuid, + resource_tags.key tag_key, + resource_tags.value tag_value, + resource_tags.domain_id tag_domain_id, + resource_tags.account_id tag_account_id, + resource_tags.resource_id tag_resource_id, + resource_tags.resource_uuid tag_resource_uuid, + resource_tags.resource_type tag_resource_type, + resource_tags.customer tag_customer + from + `cloud`.`projects` + inner join + `cloud`.`domain` ON projects.domain_id = domain.id + inner join + `cloud`.`project_account` ON projects.id = project_account.project_id + and project_account.account_role = 'Admin' + inner join + `cloud`.`account` ON account.id = project_account.account_id + left join + `cloud`.`resource_tags` ON resource_tags.resource_id = projects.id + and resource_tags.resource_type = 'Project' + left join + `cloud`.`project_account` pacct ON projects.id = pacct.project_id; diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__resource_tag_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__resource_tag_view.sql new file mode 100644 index 000000000000..fb51160ae8f7 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__resource_tag_view.sql @@ -0,0 +1,46 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`resource_tag_view`; +CREATE VIEW `cloud`.`resource_tag_view` AS + select + resource_tags.id, + resource_tags.uuid, + resource_tags.key, + resource_tags.value, + resource_tags.resource_id, + resource_tags.resource_uuid, + resource_tags.resource_type, + resource_tags.customer, + 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`.`resource_tags` + inner join + `cloud`.`account` ON resource_tags.account_id = account.id + inner join + `cloud`.`domain` ON resource_tags.domain_id = domain.id + left join + `cloud`.`projects` ON projects.project_account_id = resource_tags.account_id; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__security_group_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__security_group_view.sql new file mode 100644 index 000000000000..8e8863bcde39 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__security_group_view.sql @@ -0,0 +1,74 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`security_group_view`; +CREATE VIEW `cloud`.`security_group_view` AS + select + security_group.id id, + security_group.name name, + security_group.description description, + security_group.uuid uuid, + 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, + security_group_rule.id rule_id, + security_group_rule.uuid rule_uuid, + security_group_rule.type rule_type, + security_group_rule.start_port rule_start_port, + security_group_rule.end_port rule_end_port, + security_group_rule.protocol rule_protocol, + security_group_rule.allowed_network_id rule_allowed_network_id, + security_group_rule.allowed_ip_cidr rule_allowed_ip_cidr, + security_group_rule.create_status rule_create_status, + resource_tags.id tag_id, + resource_tags.uuid tag_uuid, + resource_tags.key tag_key, + resource_tags.value tag_value, + resource_tags.domain_id tag_domain_id, + resource_tags.account_id tag_account_id, + resource_tags.resource_id tag_resource_id, + resource_tags.resource_uuid tag_resource_uuid, + resource_tags.resource_type tag_resource_type, + resource_tags.customer tag_customer, + async_job.id job_id, + async_job.uuid job_uuid, + async_job.job_status job_status, + async_job.account_id job_account_id + from + `cloud`.`security_group` + left join + `cloud`.`security_group_rule` ON security_group.id = security_group_rule.security_group_id + inner join + `cloud`.`account` ON security_group.account_id = account.id + inner join + `cloud`.`domain` ON security_group.domain_id = domain.id + left join + `cloud`.`projects` ON projects.project_account_id = security_group.account_id + left join + `cloud`.`resource_tags` ON resource_tags.resource_id = security_group.id + and resource_tags.resource_type = 'SecurityGroup' + left join + `cloud`.`async_job` ON async_job.instance_id = security_group.id + and async_job.instance_type = 'SecurityGroup' + and async_job.job_status = 0; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__service_offering_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__service_offering_view.sql new file mode 100644 index 000000000000..a1addaa6c6f7 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__service_offering_view.sql @@ -0,0 +1,63 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`service_offering_view`; +CREATE VIEW `cloud`.`service_offering_view` AS + select + service_offering.id, + disk_offering.uuid, + disk_offering.name, + disk_offering.display_text, + disk_offering.provisioning_type, + disk_offering.created, + disk_offering.tags, + disk_offering.removed, + disk_offering.use_local_storage, + disk_offering.system_use, + disk_offering.customized_iops, + disk_offering.min_iops, + disk_offering.max_iops, + disk_offering.hv_ss_reserve, + disk_offering.bytes_read_rate, + disk_offering.bytes_write_rate, + disk_offering.iops_read_rate, + disk_offering.iops_write_rate, + disk_offering.cache_mode, + service_offering.cpu, + service_offering.speed, + service_offering.ram_size, + service_offering.nw_rate, + service_offering.mc_rate, + service_offering.ha_enabled, + service_offering.limit_cpu_use, + service_offering.host_tag, + service_offering.default_use, + service_offering.vm_type, + service_offering.sort_key, + service_offering.is_volatile, + service_offering.deployment_planner, + domain.id domain_id, + domain.uuid domain_uuid, + domain.name domain_name, + domain.path domain_path + from + `cloud`.`service_offering` + inner join + `cloud`.`disk_offering` ON service_offering.id = disk_offering.id + left join + `cloud`.`domain` ON disk_offering.domain_id = domain.id + where + disk_offering.state='Active'; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__storage_pool_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__storage_pool_view.sql new file mode 100644 index 000000000000..c1de6063de01 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__storage_pool_view.sql @@ -0,0 +1,70 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`storage_pool_view`; +CREATE VIEW `cloud`.`storage_pool_view` AS + select + storage_pool.id, + storage_pool.uuid, + storage_pool.name, + storage_pool.status, + storage_pool.path, + storage_pool.pool_type, + storage_pool.host_address, + storage_pool.created, + storage_pool.removed, + storage_pool.capacity_bytes, + storage_pool.capacity_iops, + storage_pool.scope, + storage_pool.hypervisor, + storage_pool.storage_provider_name, + cluster.id cluster_id, + cluster.uuid cluster_uuid, + cluster.name cluster_name, + cluster.cluster_type, + data_center.id data_center_id, + data_center.uuid data_center_uuid, + data_center.name data_center_name, + data_center.networktype data_center_type, + host_pod_ref.id pod_id, + host_pod_ref.uuid pod_uuid, + host_pod_ref.name pod_name, + storage_pool_details.name tag, + op_host_capacity.used_capacity disk_used_capacity, + op_host_capacity.reserved_capacity disk_reserved_capacity, + async_job.id job_id, + async_job.uuid job_uuid, + async_job.job_status job_status, + async_job.account_id job_account_id + from + `cloud`.`storage_pool` + left join + `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id + left join + `cloud`.`data_center` ON storage_pool.data_center_id = data_center.id + left join + `cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id + left join + `cloud`.`storage_pool_details` ON storage_pool_details.pool_id = storage_pool.id + and storage_pool_details.value = 'true' + left join + `cloud`.`op_host_capacity` ON storage_pool.id = op_host_capacity.host_id + and op_host_capacity.capacity_type in (3,9) + left join + `cloud`.`async_job` ON async_job.instance_id = storage_pool.id + and async_job.instance_type = 'StoragePool' + and async_job.job_status = 0; + diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__template_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__template_view.sql new file mode 100644 index 000000000000..a19361af87e9 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__template_view.sql @@ -0,0 +1,120 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`template_view`; +CREATE VIEW `cloud`.`template_view` AS + SELECT + `vm_template`.`id` AS `id`, + `vm_template`.`uuid` AS `uuid`, + `vm_template`.`unique_name` AS `unique_name`, + `vm_template`.`name` AS `name`, + `vm_template`.`public` AS `public`, + `vm_template`.`featured` AS `featured`, + `vm_template`.`type` AS `type`, + `vm_template`.`hvm` AS `hvm`, + `vm_template`.`bits` AS `bits`, + `vm_template`.`url` AS `url`, + `vm_template`.`format` AS `format`, + `vm_template`.`created` AS `created`, + `vm_template`.`checksum` AS `checksum`, + `vm_template`.`display_text` AS `display_text`, + `vm_template`.`enable_password` AS `enable_password`, + `vm_template`.`dynamically_scalable` AS `dynamically_scalable`, + `vm_template`.`state` AS `template_state`, + `vm_template`.`guest_os_id` AS `guest_os_id`, + `guest_os`.`uuid` AS `guest_os_uuid`, + `guest_os`.`display_name` AS `guest_os_name`, + `vm_template`.`bootable` AS `bootable`, + `vm_template`.`prepopulate` AS `prepopulate`, + `vm_template`.`cross_zones` AS `cross_zones`, + `vm_template`.`hypervisor_type` AS `hypervisor_type`, + `vm_template`.`extractable` AS `extractable`, + `vm_template`.`template_tag` AS `template_tag`, + `vm_template`.`sort_key` AS `sort_key`, + `vm_template`.`removed` AS `removed`, + `vm_template`.`enable_sshkey` AS `enable_sshkey`, + `parent_template`.`id` AS `parent_template_id`, + `parent_template`.`uuid` AS `parent_template_uuid`, + `source_template`.`id` AS `source_template_id`, + `source_template`.`uuid` AS `source_template_uuid`, + `account`.`id` AS `account_id`, + `account`.`uuid` AS `account_uuid`, + `account`.`account_name` AS `account_name`, + `account`.`type` AS `account_type`, + `domain`.`id` AS `domain_id`, + `domain`.`uuid` AS `domain_uuid`, + `domain`.`name` AS `domain_name`, + `domain`.`path` AS `domain_path`, + `projects`.`id` AS `project_id`, + `projects`.`uuid` AS `project_uuid`, + `projects`.`name` AS `project_name`, + `data_center`.`id` AS `data_center_id`, + `data_center`.`uuid` AS `data_center_uuid`, + `data_center`.`name` AS `data_center_name`, + `launch_permission`.`account_id` AS `lp_account_id`, + `template_store_ref`.`store_id` AS `store_id`, + `image_store`.`scope` AS `store_scope`, + `template_store_ref`.`state` AS `state`, + `template_store_ref`.`download_state` AS `download_state`, + `template_store_ref`.`download_pct` AS `download_pct`, + `template_store_ref`.`error_str` AS `error_str`, + `template_store_ref`.`size` AS `size`, + `template_store_ref`.physical_size AS `physical_size`, + `template_store_ref`.`destroyed` AS `destroyed`, + `template_store_ref`.`created` AS `created_on_store`, + `vm_template_details`.`name` AS `detail_name`, + `vm_template_details`.`value` AS `detail_value`, + `resource_tags`.`id` AS `tag_id`, + `resource_tags`.`uuid` AS `tag_uuid`, + `resource_tags`.`key` AS `tag_key`, + `resource_tags`.`value` AS `tag_value`, + `resource_tags`.`domain_id` AS `tag_domain_id`, + `domain`.`uuid` AS `tag_domain_uuid`, + `domain`.`name` AS `tag_domain_name`, + `resource_tags`.`account_id` AS `tag_account_id`, + `account`.`account_name` AS `tag_account_name`, + `resource_tags`.`resource_id` AS `tag_resource_id`, + `resource_tags`.`resource_uuid` AS `tag_resource_uuid`, + `resource_tags`.`resource_type` AS `tag_resource_type`, + `resource_tags`.`customer` AS `tag_customer`, + CONCAT(`vm_template`.`id`, + '_', + IFNULL(`data_center`.`id`, 0)) AS `temp_zone_pair`, + `vm_template`.`direct_download` AS `direct_download` + FROM + (((((((((((((`vm_template` + JOIN `guest_os` ON ((`guest_os`.`id` = `vm_template`.`guest_os_id`))) + JOIN `account` ON ((`account`.`id` = `vm_template`.`account_id`))) + JOIN `domain` ON ((`domain`.`id` = `account`.`domain_id`))) + LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) + LEFT JOIN `vm_template_details` ON ((`vm_template_details`.`template_id` = `vm_template`.`id`))) + LEFT JOIN `vm_template` `source_template` ON ((`source_template`.`id` = `vm_template`.`source_template_id`))) + LEFT JOIN `template_store_ref` ON (((`template_store_ref`.`template_id` = `vm_template`.`id`) + AND (`template_store_ref`.`store_role` = 'Image') + AND (`template_store_ref`.`destroyed` = 0)))) + LEFT JOIN `vm_template` `parent_template` ON ((`parent_template`.`id` = `vm_template`.`parent_template_id`))) + LEFT JOIN `image_store` ON ((ISNULL(`image_store`.`removed`) + AND (`template_store_ref`.`store_id` IS NOT NULL) + AND (`image_store`.`id` = `template_store_ref`.`store_id`)))) + LEFT JOIN `template_zone_ref` ON (((`template_zone_ref`.`template_id` = `vm_template`.`id`) + AND ISNULL(`template_store_ref`.`store_id`) + AND ISNULL(`template_zone_ref`.`removed`)))) + LEFT JOIN `data_center` ON (((`image_store`.`data_center_id` = `data_center`.`id`) + OR (`template_zone_ref`.`zone_id` = `data_center`.`id`)))) + LEFT JOIN `launch_permission` ON ((`launch_permission`.`template_id` = `vm_template`.`id`))) + LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_template`.`id`) + AND ((`resource_tags`.`resource_type` = 'Template') + OR (`resource_tags`.`resource_type` = 'ISO'))))); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__user_view.sql similarity index 87% rename from engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/R__user_view.sql index d7a080efd166..d2b70d6196fe 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__user_view.sql @@ -14,15 +14,6 @@ -- KIND, either express or implied. See the License for the -- specific language governing permissions and limitations -- under the License. - ---; --- Schema upgrade cleanup from 4.10.0.0 to 4.11.0.0 ---; - -DELETE FROM `cloud`.`configuration` WHERE name='snapshot.backup.rightafter'; --- CLOUDSTACK-9914: Alter quota_tariff to support currency values up to 5 decimal places -ALTER TABLE `cloud_usage`.`quota_tariff` MODIFY `currency_value` DECIMAL(15,5) not null; - DROP VIEW IF EXISTS `cloud`.`user_view`; CREATE VIEW `cloud`.`user_view` AS select diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__user_vm_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__user_vm_view.sql new file mode 100644 index 000000000000..4cac7618715d --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__user_vm_view.sql @@ -0,0 +1,193 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`user_vm_view`; +CREATE +VIEW `user_vm_view` AS + SELECT + `vm_instance`.`id` AS `id`, + `vm_instance`.`name` AS `name`, + `user_vm`.`display_name` AS `display_name`, + `user_vm`.`user_data` AS `user_data`, + `account`.`id` AS `account_id`, + `account`.`uuid` AS `account_uuid`, + `account`.`account_name` AS `account_name`, + `account`.`type` AS `account_type`, + `domain`.`id` AS `domain_id`, + `domain`.`uuid` AS `domain_uuid`, + `domain`.`name` AS `domain_name`, + `domain`.`path` AS `domain_path`, + `projects`.`id` AS `project_id`, + `projects`.`uuid` AS `project_uuid`, + `projects`.`name` AS `project_name`, + `instance_group`.`id` AS `instance_group_id`, + `instance_group`.`uuid` AS `instance_group_uuid`, + `instance_group`.`name` AS `instance_group_name`, + `vm_instance`.`uuid` AS `uuid`, + `vm_instance`.`user_id` AS `user_id`, + `vm_instance`.`last_host_id` AS `last_host_id`, + `vm_instance`.`vm_type` AS `type`, + `vm_instance`.`limit_cpu_use` AS `limit_cpu_use`, + `vm_instance`.`created` AS `created`, + `vm_instance`.`state` AS `state`, + `vm_instance`.`removed` AS `removed`, + `vm_instance`.`ha_enabled` AS `ha_enabled`, + `vm_instance`.`hypervisor_type` AS `hypervisor_type`, + `vm_instance`.`instance_name` AS `instance_name`, + `vm_instance`.`guest_os_id` AS `guest_os_id`, + `vm_instance`.`display_vm` AS `display_vm`, + `guest_os`.`uuid` AS `guest_os_uuid`, + `vm_instance`.`pod_id` AS `pod_id`, + `host_pod_ref`.`uuid` AS `pod_uuid`, + `vm_instance`.`private_ip_address` AS `private_ip_address`, + `vm_instance`.`private_mac_address` AS `private_mac_address`, + `vm_instance`.`vm_type` AS `vm_type`, + `data_center`.`id` AS `data_center_id`, + `data_center`.`uuid` AS `data_center_uuid`, + `data_center`.`name` AS `data_center_name`, + `data_center`.`is_security_group_enabled` AS `security_group_enabled`, + `data_center`.`networktype` AS `data_center_type`, + `host`.`id` AS `host_id`, + `host`.`uuid` AS `host_uuid`, + `host`.`name` AS `host_name`, + `vm_template`.`id` AS `template_id`, + `vm_template`.`uuid` AS `template_uuid`, + `vm_template`.`name` AS `template_name`, + `vm_template`.`display_text` AS `template_display_text`, + `vm_template`.`enable_password` AS `password_enabled`, + `iso`.`id` AS `iso_id`, + `iso`.`uuid` AS `iso_uuid`, + `iso`.`name` AS `iso_name`, + `iso`.`display_text` AS `iso_display_text`, + `service_offering`.`id` AS `service_offering_id`, + `svc_disk_offering`.`uuid` AS `service_offering_uuid`, + `disk_offering`.`uuid` AS `disk_offering_uuid`, + `disk_offering`.`id` AS `disk_offering_id`, + (CASE + WHEN ISNULL(`service_offering`.`cpu`) THEN `custom_cpu`.`value` + ELSE `service_offering`.`cpu` + END) AS `cpu`, + (CASE + WHEN ISNULL(`service_offering`.`speed`) THEN `custom_speed`.`value` + ELSE `service_offering`.`speed` + END) AS `speed`, + (CASE + WHEN ISNULL(`service_offering`.`ram_size`) THEN `custom_ram_size`.`value` + ELSE `service_offering`.`ram_size` + END) AS `ram_size`, + `svc_disk_offering`.`name` AS `service_offering_name`, + `disk_offering`.`name` AS `disk_offering_name`, + `storage_pool`.`id` AS `pool_id`, + `storage_pool`.`uuid` AS `pool_uuid`, + `storage_pool`.`pool_type` AS `pool_type`, + `volumes`.`id` AS `volume_id`, + `volumes`.`uuid` AS `volume_uuid`, + `volumes`.`device_id` AS `volume_device_id`, + `volumes`.`volume_type` AS `volume_type`, + `security_group`.`id` AS `security_group_id`, + `security_group`.`uuid` AS `security_group_uuid`, + `security_group`.`name` AS `security_group_name`, + `security_group`.`description` AS `security_group_description`, + `nics`.`id` AS `nic_id`, + `nics`.`uuid` AS `nic_uuid`, + `nics`.`network_id` AS `network_id`, + `nics`.`ip4_address` AS `ip_address`, + `nics`.`ip6_address` AS `ip6_address`, + `nics`.`ip6_gateway` AS `ip6_gateway`, + `nics`.`ip6_cidr` AS `ip6_cidr`, + `nics`.`default_nic` AS `is_default_nic`, + `nics`.`gateway` AS `gateway`, + `nics`.`netmask` AS `netmask`, + `nics`.`mac_address` AS `mac_address`, + `nics`.`broadcast_uri` AS `broadcast_uri`, + `nics`.`isolation_uri` AS `isolation_uri`, + `vpc`.`id` AS `vpc_id`, + `vpc`.`uuid` AS `vpc_uuid`, + `networks`.`uuid` AS `network_uuid`, + `networks`.`name` AS `network_name`, + `networks`.`traffic_type` AS `traffic_type`, + `networks`.`guest_type` AS `guest_type`, + `user_ip_address`.`id` AS `public_ip_id`, + `user_ip_address`.`uuid` AS `public_ip_uuid`, + `user_ip_address`.`public_ip_address` AS `public_ip_address`, + `ssh_keypairs`.`keypair_name` AS `keypair_name`, + `resource_tags`.`id` AS `tag_id`, + `resource_tags`.`uuid` AS `tag_uuid`, + `resource_tags`.`key` AS `tag_key`, + `resource_tags`.`value` AS `tag_value`, + `resource_tags`.`domain_id` AS `tag_domain_id`, + `domain`.`uuid` AS `tag_domain_uuid`, + `domain`.`name` AS `tag_domain_name`, + `resource_tags`.`account_id` AS `tag_account_id`, + `account`.`account_name` AS `tag_account_name`, + `resource_tags`.`resource_id` AS `tag_resource_id`, + `resource_tags`.`resource_uuid` AS `tag_resource_uuid`, + `resource_tags`.`resource_type` AS `tag_resource_type`, + `resource_tags`.`customer` AS `tag_customer`, + `async_job`.`id` AS `job_id`, + `async_job`.`uuid` AS `job_uuid`, + `async_job`.`job_status` AS `job_status`, + `async_job`.`account_id` AS `job_account_id`, + `affinity_group`.`id` AS `affinity_group_id`, + `affinity_group`.`uuid` AS `affinity_group_uuid`, + `affinity_group`.`name` AS `affinity_group_name`, + `affinity_group`.`description` AS `affinity_group_description`, + `vm_instance`.`dynamically_scalable` AS `dynamically_scalable` + FROM + ((((((((((((((((((((((((((((((((`user_vm` + JOIN `vm_instance` ON (((`vm_instance`.`id` = `user_vm`.`id`) + AND ISNULL(`vm_instance`.`removed`)))) + JOIN `account` ON ((`vm_instance`.`account_id` = `account`.`id`))) + JOIN `domain` ON ((`vm_instance`.`domain_id` = `domain`.`id`))) + LEFT JOIN `guest_os` ON ((`vm_instance`.`guest_os_id` = `guest_os`.`id`))) + LEFT JOIN `host_pod_ref` ON ((`vm_instance`.`pod_id` = `host_pod_ref`.`id`))) + LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) + LEFT JOIN `instance_group_vm_map` ON ((`vm_instance`.`id` = `instance_group_vm_map`.`instance_id`))) + LEFT JOIN `instance_group` ON ((`instance_group_vm_map`.`group_id` = `instance_group`.`id`))) + LEFT JOIN `data_center` ON ((`vm_instance`.`data_center_id` = `data_center`.`id`))) + LEFT JOIN `host` ON ((`vm_instance`.`host_id` = `host`.`id`))) + LEFT JOIN `vm_template` ON ((`vm_instance`.`vm_template_id` = `vm_template`.`id`))) + LEFT JOIN `vm_template` `iso` ON ((`iso`.`id` = `user_vm`.`iso_id`))) + LEFT JOIN `service_offering` ON ((`vm_instance`.`service_offering_id` = `service_offering`.`id`))) + LEFT JOIN `disk_offering` `svc_disk_offering` ON ((`vm_instance`.`service_offering_id` = `svc_disk_offering`.`id`))) + LEFT JOIN `disk_offering` ON ((`vm_instance`.`disk_offering_id` = `disk_offering`.`id`))) + LEFT JOIN `volumes` ON ((`vm_instance`.`id` = `volumes`.`instance_id`))) + LEFT JOIN `storage_pool` ON ((`volumes`.`pool_id` = `storage_pool`.`id`))) + LEFT JOIN `security_group_vm_map` ON ((`vm_instance`.`id` = `security_group_vm_map`.`instance_id`))) + LEFT JOIN `security_group` ON ((`security_group_vm_map`.`security_group_id` = `security_group`.`id`))) + LEFT JOIN `nics` ON (((`vm_instance`.`id` = `nics`.`instance_id`) + AND ISNULL(`nics`.`removed`)))) + LEFT JOIN `networks` ON ((`nics`.`network_id` = `networks`.`id`))) + LEFT JOIN `vpc` ON (((`networks`.`vpc_id` = `vpc`.`id`) + AND ISNULL(`vpc`.`removed`)))) + LEFT JOIN `user_ip_address` ON ((`user_ip_address`.`vm_id` = `vm_instance`.`id`))) + LEFT JOIN `user_vm_details` `ssh_details` ON (((`ssh_details`.`vm_id` = `vm_instance`.`id`) + AND (`ssh_details`.`name` = 'SSH.PublicKey')))) + LEFT JOIN `ssh_keypairs` ON (((`ssh_keypairs`.`public_key` = `ssh_details`.`value`) + AND (`ssh_keypairs`.`account_id` = `account`.`id`)))) + LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_instance`.`id`) + AND (`resource_tags`.`resource_type` = 'UserVm')))) + LEFT JOIN `async_job` ON (((`async_job`.`instance_id` = `vm_instance`.`id`) + AND (`async_job`.`instance_type` = 'VirtualMachine') + AND (`async_job`.`job_status` = 0)))) + LEFT JOIN `affinity_group_vm_map` ON ((`vm_instance`.`id` = `affinity_group_vm_map`.`instance_id`))) + LEFT JOIN `affinity_group` ON ((`affinity_group_vm_map`.`affinity_group_id` = `affinity_group`.`id`))) + LEFT JOIN `user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `vm_instance`.`id`) + AND (`custom_cpu`.`name` = 'CpuNumber')))) + LEFT JOIN `user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `vm_instance`.`id`) + AND (`custom_speed`.`name` = 'CpuSpeed')))) + LEFT JOIN `user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `vm_instance`.`id`) + AND (`custom_ram_size`.`name` = 'memory')))); \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/R__volume_view.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/R__volume_view.sql new file mode 100644 index 000000000000..ac0db385ecd7 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/R__volume_view.sql @@ -0,0 +1,151 @@ +-- 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. +DROP VIEW IF EXISTS `cloud`.`volume_view`; +CREATE VIEW `cloud`.`volume_view` AS + SELECT + volumes.id, + volumes.uuid, + volumes.name, + volumes.device_id, + volumes.volume_type, + volumes.provisioning_type, + volumes.size, + volumes.min_iops, + volumes.max_iops, + volumes.created, + volumes.state, + volumes.attached, + volumes.removed, + volumes.display_volume, + volumes.format, + volumes.path, + volumes.chain_info, + 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, + data_center.id data_center_id, + data_center.uuid data_center_uuid, + data_center.name data_center_name, + data_center.networktype data_center_type, + vm_instance.id vm_id, + vm_instance.uuid vm_uuid, + vm_instance.name vm_name, + vm_instance.state vm_state, + vm_instance.vm_type, + user_vm.display_name vm_display_name, + volume_store_ref.size volume_store_size, + volume_store_ref.download_pct, + volume_store_ref.download_state, + volume_store_ref.error_str, + volume_store_ref.created created_on_store, + disk_offering.id disk_offering_id, + disk_offering.uuid disk_offering_uuid, + disk_offering.name disk_offering_name, + disk_offering.display_text disk_offering_display_text, + disk_offering.use_local_storage, + disk_offering.system_use, + disk_offering.bytes_read_rate, + disk_offering.bytes_write_rate, + disk_offering.iops_read_rate, + disk_offering.iops_write_rate, + disk_offering.cache_mode, + storage_pool.id pool_id, + storage_pool.uuid pool_uuid, + storage_pool.name pool_name, + cluster.id cluster_id, + cluster.name cluster_name, + cluster.uuid cluster_uuid, + cluster.hypervisor_type, + vm_template.id template_id, + vm_template.uuid template_uuid, + vm_template.extractable, + vm_template.type template_type, + vm_template.name template_name, + vm_template.display_text template_display_text, + iso.id iso_id, + iso.uuid iso_uuid, + iso.name iso_name, + iso.display_text iso_display_text, + resource_tags.id tag_id, + resource_tags.uuid tag_uuid, + resource_tags.key tag_key, + resource_tags.value tag_value, + resource_tags.domain_id tag_domain_id, + resource_tags.account_id tag_account_id, + resource_tags.resource_id tag_resource_id, + resource_tags.resource_uuid tag_resource_uuid, + resource_tags.resource_type tag_resource_type, + resource_tags.customer tag_customer, + async_job.id job_id, + async_job.uuid job_uuid, + async_job.job_status job_status, + async_job.account_id job_account_id, + host_pod_ref.id pod_id, + host_pod_ref.uuid pod_uuid, + host_pod_ref.name pod_name, + resource_tag_account.account_name tag_account_name, + resource_tag_domain.uuid tag_domain_uuid, + resource_tag_domain.name tag_domain_name + from + `cloud`.`volumes` + inner join + `cloud`.`account` ON volumes.account_id = account.id + inner join + `cloud`.`domain` ON volumes.domain_id = domain.id + left join + `cloud`.`projects` ON projects.project_account_id = account.id + left join + `cloud`.`data_center` ON volumes.data_center_id = data_center.id + left join + `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id + left join + `cloud`.`user_vm` ON user_vm.id = vm_instance.id + left join + `cloud`.`volume_store_ref` ON volumes.id = volume_store_ref.volume_id + left join + `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id + left join + `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id + left join + `cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id + left join + `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id + left join + `cloud`.`vm_template` ON volumes.template_id = vm_template.id + left join + `cloud`.`vm_template` iso ON iso.id = volumes.iso_id + left join + `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id + and resource_tags.resource_type = 'Volume' + left join + `cloud`.`async_job` ON async_job.instance_id = volumes.id + and async_job.instance_type = 'Volume' + and async_job.job_status = 0 + left join + `cloud`.`account` resource_tag_account ON resource_tag_account.id = resource_tags.account_id + left join + `cloud`.`domain` resource_tag_domain ON resource_tag_domain.id = resource_tags.domain_id; + + diff --git a/engine/schema/src/main/resources/META-INF/db/schema-4930to41000.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_10_0_0_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-4930to41000.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_10_0_0_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-4930to41000-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_10_0_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-4930to41000-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_10_0_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/V4_11_0_0_0__upgrade.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_11_0_0_0__upgrade.sql new file mode 100644 index 000000000000..2653b83758b0 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_11_0_0_0__upgrade.sql @@ -0,0 +1,218 @@ +-- 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.10.0.0 to 4.11.0.0 +--; + +-- Add For VPC flag +ALTER TABLE cloud.network_offerings ADD COLUMN for_vpc INT(1) NOT NULL DEFAULT 0; +UPDATE cloud.network_offerings o +SET for_vpc = 1 +where + o.conserve_mode = 0 + and o.guest_type = 'Isolated' + and exists( + SELECT id + from cloud.ntwk_offering_service_map + where network_offering_id = o.id and ( + provider in ('VpcVirtualRouter', 'InternalLbVm', 'JuniperContrailVpcRouter') + or service in ('NetworkACL') + ) + ); + +UPDATE `cloud`.`configuration` SET value = '600', default_value = '600' WHERE category = 'Advanced' AND name = 'router.aggregation.command.each.timeout'; + +-- CA framework changes +DELETE from `cloud`.`configuration` where name='ssl.keystore'; + +-- Certificate Revocation List +CREATE TABLE IF NOT EXISTS `cloud`.`crl` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `serial` varchar(255) UNIQUE NOT NULL COMMENT 'certificate\'s serial number as hex string', + `cn` varchar(255) COMMENT 'certificate\'s common name', + `revoker_uuid` varchar(40) COMMENT 'revoker user account uuid', + `revoked` datetime COMMENT 'date of revocation', + PRIMARY KEY (`id`), + KEY (`serial`), + UNIQUE KEY (`serial`, `cn`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Host HA feature +CREATE TABLE IF NOT EXISTS `cloud`.`ha_config` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `resource_id` bigint(20) unsigned DEFAULT NULL COMMENT 'id of the resource', + `resource_type` varchar(255) NOT NULL COMMENT 'the type of the resource', + `enabled` int(1) unsigned DEFAULT '0' COMMENT 'is HA enabled for the resource', + `ha_state` varchar(255) DEFAULT 'Disabled' COMMENT 'HA state', + `provider` varchar(255) DEFAULT NULL COMMENT 'HA provider', + `update_count` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'state based incr-only counter for atomic ha_state updates', + `update_time` datetime COMMENT 'last ha_state update datetime', + `mgmt_server_id` bigint(20) unsigned DEFAULT NULL COMMENT 'management server id that is responsible for the HA for the resource', + PRIMARY KEY (`id`), + KEY `i_ha_config__enabled` (`enabled`), + KEY `i_ha_config__ha_state` (`ha_state`), + KEY `i_ha_config__mgmt_server_id` (`mgmt_server_id`), + UNIQUE KEY (`resource_id`, `resource_type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DELETE from `cloud`.`configuration` where name='outofbandmanagement.sync.interval'; + +-- Annotations specifc changes following +CREATE TABLE IF NOT EXISTS `cloud`.`annotations` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(40) UNIQUE, + `annotation` text, + `entity_uuid` varchar(40), + `entity_type` varchar(32), + `user_uuid` varchar(40), + `created` datetime COMMENT 'date of creation', + `removed` datetime COMMENT 'date of removal', + PRIMARY KEY (`id`), + KEY (`uuid`), + KEY `i_entity` (`entity_uuid`, `entity_type`, `created`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +-- Out-of-band management driver for nested-cloudstack +ALTER TABLE `cloud`.`oobm` MODIFY COLUMN port VARCHAR(255); + +-- CLOUDSTACK-9902: Console proxy SSL toggle +INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `description`, `default_value`, `is_dynamic`) VALUES ('Console Proxy', 'DEFAULT', 'AgentManager', 'consoleproxy.sslEnabled', 'false', 'Enable SSL for console proxy', 'false', 0); + +-- CLOUDSTACK-9859: Retirement of midonet plugin (final removal) +delete from `cloud`.`configuration` where name in ('midonet.apiserver.address', 'midonet.providerrouter.id'); + +-- CLOUDSTACK-9972: Enhance listVolumes API +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Premium', 'DEFAULT', 'management-server', 'volume.stats.interval', '600000', 'Interval (in seconds) to report volume statistics', '600000', now(), NULL, NULL); + +-- Extra Dhcp Options +CREATE TABLE IF NOT EXISTS `cloud`.`nic_extra_dhcp_options` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(255) UNIQUE, + `nic_id` bigint unsigned NOT NULL COMMENT ' nic id where dhcp options are applied', + `code` int(32), + `value` text, + PRIMARY KEY (`id`), + CONSTRAINT `fk_nic_extra_dhcp_options_nic_id` FOREIGN KEY (`nic_id`) REFERENCES `nics`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Add new OS versions + +-- Add XenServer 7.1 and 7.2 hypervisor capabilities +INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, storage_motion_supported) values (UUID(), 'XenServer', '7.1.0', 500, 13, 1); +INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, storage_motion_supported) values (UUID(), 'XenServer', '7.2.0', 500, 13, 1); + +-- Add XenServer 7.0 support for windows 10 +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.0.0', 'Windows 10 (64-bit)', 258, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.0.0', 'Windows 10 (32-bit)', 257, now(), 0); + +-- Add XenServer 7.1 hypervisor guest OS mappings (copy 7.0.0) +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '7.1.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.0.0'; + +-- Add XenServer 7.1 hypervisor guest OS (see https://docs.citrix.com/content/dam/docs/en-us/xenserver/7-1/downloads/xenserver-7-1-release-notes.pdf) +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'Windows Server 2016 (64-bit)', 259, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'SUSE Linux Enterprise Server 11 SP4', 187, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'Red Hat Enterprise Linux 6 (64-bit)', 240, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'Red Hat Enterprise Linux 7', 245, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'Oracle Enterprise Linux 6 (64-bit)', 251, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'Oracle Linux 7', 247, now(), 0); + +-- Add XenServer 7.2 hypervisor guest OS mappings (copy 7.1.0 & remove Windows Vista, Windows XP, Windows 2003, CentOS 4.x, RHEL 4.xS, LES 10 (all versions) as per XenServer 7.2 Release Notes) +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '7.2.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.1.0' AND guest_os_id not in (1,2,3,4,56,101,56,58,93,94,50,51,87,88,89,90,91,92,26,27,28,29,40,41,42,43,44,45,96,97,107,108,109,110,151,152,153); + +-- Add table to track primary storage in use for snapshots +DROP TABLE IF EXISTS `cloud_usage`.`usage_snapshot_on_primary`; +CREATE TABLE `cloud_usage`.`usage_snapshot_on_primary` ( + `id` bigint(20) unsigned NOT NULL, + `zone_id` bigint(20) unsigned NOT NULL, + `account_id` bigint(20) unsigned NOT NULL, + `domain_id` bigint(20) unsigned NOT NULL, + `vm_id` bigint(20) unsigned NOT NULL, + `name` varchar(128), + `type` int(1) unsigned NOT NULL, + `physicalsize` bigint(20), + `virtualsize` bigint(20), + `created` datetime NOT NULL, + `deleted` datetime, + INDEX `i_usage_snapshot_on_primary` (`account_id`,`id`,`vm_id`,`created`) +) ENGINE=InnoDB CHARSET=utf8; + +-- Change monitor patch for apache2 in systemvm +UPDATE `cloud`.`monitoring_services` SET pidfile="/var/run/apache2/apache2.pid" WHERE process_name="apache2" AND service_name="apache2"; + +-- Use 'Other Linux 64-bit' as guest os for the default systemvmtemplate for VMware +-- This fixes a memory allocation issue to systemvms on VMware/ESXi +UPDATE `cloud`.`vm_template` SET guest_os_id=99 WHERE id=8; + +-- Network External Ids +ALTER TABLE `cloud`.`networks` ADD `external_id` varchar(255); + +-- Separate Subnet for CPVM and SSVM (system vms) +ALTER TABLE `cloud`.`op_dc_ip_address_alloc` +ADD COLUMN `forsystemvms` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if IP is dedicated for CPVM or SSVM'; + +ALTER TABLE `cloud`.`op_dc_ip_address_alloc` +ADD COLUMN `vlan` INT(10) UNSIGNED NULL COMMENT 'Vlan the management network range is on'; + +-- CLOUDSTACK-4757: Support multidisk OVA +ALTER TABLE `cloud`.`vm_template` ADD COLUMN `parent_template_id` bigint(20) unsigned DEFAULT NULL COMMENT 'If datadisk template, then id of the root template this template belongs to'; + +-- CLOUDSTACK-10146: Bypass Secondary Storage for KVM templates +ALTER TABLE `cloud`.`vm_template` +ADD COLUMN `direct_download` TINYINT(1) DEFAULT '0' COMMENT 'Indicates if Secondary Storage is bypassed and template is downloaded to Primary Storage'; + +-- CLOUDSTACK-10109: Enable dedication of public IPs to SSVM and CPVM +ALTER TABLE `cloud`.`user_ip_address` +ADD COLUMN `forsystemvms` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'true if IP is set to system vms, false if not'; + +-- ldap binding on domain level +CREATE TABLE IF NOT EXISTS `cloud`.`domain_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `domain_id` bigint unsigned NOT NULL COMMENT 'account id', + `name` varchar(255) NOT NULL, + `value` varchar(255) NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_domain_details__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE +)ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE cloud.ldap_configuration ADD COLUMN domain_id BIGINT(20) DEFAULT NULL; +ALTER TABLE cloud.ldap_trust_map ADD COLUMN account_id BIGINT(20) DEFAULT 0; +ALTER TABLE cloud.ldap_trust_map DROP FOREIGN KEY fk_ldap_trust_map__domain_id; +DROP INDEX uk_ldap_trust_map__domain_id ON cloud.ldap_trust_map; +CREATE UNIQUE INDEX uk_ldap_trust_map__bind_location ON ldap_trust_map (domain_id, account_id); + +CREATE TABLE IF NOT EXISTS `cloud`.`netscaler_servicepackages` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(255) UNIQUE, + `name` varchar(255) UNIQUE COMMENT 'name of the service package', + `description` varchar(255) COMMENT 'description of the service package', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `cloud`.`external_netscaler_controlcenter` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(255) UNIQUE, + `username` varchar(255) COMMENT 'username of the NCC', + `password` varchar(255) COMMENT 'password of NCC', + `ncc_ip` varchar(255) COMMENT 'IP of NCC Manager', + `num_retries` bigint unsigned NOT NULL default 2 COMMENT 'Number of retries in ncc for command failure', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE `cloud`.`sslcerts` ADD COLUMN `name` varchar(255) NULL default NULL COMMENT 'Name of the Certificate'; +ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `service_package_id` varchar(255) NULL default NULL COMMENT 'Netscaler ControlCenter Service Package'; diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/V4_11_0_0_2__cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_11_0_0_2__cleanup.sql new file mode 100644 index 000000000000..e3e20e2148f7 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_11_0_0_2__cleanup.sql @@ -0,0 +1,25 @@ +-- 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 cleanup from 4.10.0.0 to 4.11.0.0 +--; + +DELETE FROM `cloud`.`configuration` WHERE name='snapshot.backup.rightafter'; +-- CLOUDSTACK-9914: Alter quota_tariff to support currency values up to 5 decimal places +ALTER TABLE `cloud_usage`.`quota_tariff` MODIFY `currency_value` DECIMAL(15,5) not null; + diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41100to41200.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_12_0_0_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-41100to41200.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_12_0_0_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41100to41200-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_12_0_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-41100to41200-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_12_0_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/V4_1_0_0__upgrade.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_1_0_0__upgrade.sql new file mode 100644 index 000000000000..9a3adf8b3028 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_1_0_0__upgrade.sql @@ -0,0 +1,536 @@ +-- 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.0.0 to 4.1.0; +--; + +use cloud; +SET foreign_key_checks = 0; + +alter table vm_template add size bigint unsigned; +alter table vm_template add state varchar(255); +alter table vm_template add update_count bigint unsigned; +alter table vm_template add updated datetime; +alter table storage_pool add storage_provider_id bigint unsigned; +alter table storage_pool add scope varchar(255); +alter table storage_pool modify id bigint unsigned AUTO_INCREMENT UNIQUE NOT NULL; +alter table template_spool_ref add state varchar(255); +alter table template_spool_ref add update_count bigint unsigned; +alter table volumes add disk_type varchar(255); +alter table volumes drop foreign key `fk_volumes__account_id`; +alter table vm_instance add column disk_offering_id bigint unsigned; +alter table vm_instance add column cpu int(10) unsigned; +alter table vm_instance add column ram bigint unsigned; +alter table vm_instance add column owner varchar(255); +alter table vm_instance add column speed int(10) unsigned; +alter table vm_instance add column host_name varchar(255); +alter table vm_instance add column display_name varchar(255); +alter table vm_instance add column `desired_state` varchar(32) NULL; + +alter table data_center add column owner varchar(255); +alter table data_center add column created datetime COMMENT 'date created'; +alter table data_center add column lastUpdated datetime COMMENT 'last updated'; +alter table data_center add column engine_state varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'the engine state of the zone'; +alter table host_pod_ref add column owner varchar(255); +alter table host_pod_ref add column created datetime COMMENT 'date created'; +alter table host_pod_ref add column lastUpdated datetime COMMENT 'last updated'; +alter table host_pod_ref add column engine_state varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'the engine state of the zone'; +alter table host add column owner varchar(255); +alter table host add column lastUpdated datetime COMMENT 'last updated'; +alter table host add column engine_state varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'the engine state of the zone'; + +alter table cluster add column owner varchar(255); +alter table cluster add column created datetime COMMENT 'date created'; +alter table cluster add column lastUpdated datetime COMMENT 'last updated'; +alter table cluster add column engine_state varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'the engine state of the zone'; + +CREATE TABLE `cloud`.`vm_compute_tags` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `vm_id` bigint unsigned NOT NULL COMMENT 'vm id', + `compute_tag` varchar(255) NOT NULL COMMENT 'name of tag', + PRIMARY KEY(`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`vm_root_disk_tags` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `vm_id` bigint unsigned NOT NULL COMMENT 'vm id', + `root_disk_tag` varchar(255) NOT NULL COMMENT 'name of tag', + PRIMARY KEY(`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `cloud`.`vm_network_map` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `vm_id` bigint unsigned NOT NULL COMMENT 'vm id', + `network_id` bigint unsigned NOT NULL COMMENT 'network id', + PRIMARY KEY(`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `cloud`.`vm_reservation` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40) NOT NULL COMMENT 'reservation id', + `vm_id` bigint unsigned NOT NULL COMMENT 'vm id', + `data_center_id` bigint unsigned NOT NULL COMMENT 'zone id', + `pod_id` bigint unsigned NOT NULL COMMENT 'pod id', + `cluster_id` bigint unsigned NOT NULL COMMENT 'cluster id', + `host_id` bigint unsigned NOT NULL COMMENT 'host id', + `created` datetime COMMENT 'date created', + `removed` datetime COMMENT 'date removed if not null', + CONSTRAINT `uc_vm_reservation__uuid` UNIQUE (`uuid`), + PRIMARY KEY(`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`volume_reservation` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `vm_reservation_id` bigint unsigned NOT NULL COMMENT 'id of the vm reservation', + `vm_id` bigint unsigned NOT NULL COMMENT 'vm id', + `volume_id` bigint unsigned NOT NULL COMMENT 'volume id', + `pool_id` bigint unsigned NOT NULL COMMENT 'pool assigned to the volume', + CONSTRAINT `fk_vm_pool_reservation__vm_reservation_id` FOREIGN KEY (`vm_reservation_id`) REFERENCES `vm_reservation`(`id`) ON DELETE CASCADE, + PRIMARY KEY(`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`s3` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40), + `access_key` varchar(20) NOT NULL COMMENT ' The S3 access key', + `secret_key` varchar(40) NOT NULL COMMENT ' The S3 secret key', + `end_point` varchar(1024) COMMENT ' The S3 host', + `bucket` varchar(63) NOT NULL COMMENT ' The S3 host', + `https` tinyint unsigned DEFAULT NULL COMMENT ' Flag indicating whether or not to connect over HTTPS', + `connection_timeout` integer COMMENT ' The amount of time to wait (in milliseconds) when initially establishing a connection before giving up and timing out.', + `max_error_retry` integer COMMENT ' The maximum number of retry attempts for failed retryable requests (ex: 5xx error responses from services).', + `socket_timeout` integer COMMENT ' The amount of time to wait (in milliseconds) for data to be transfered over an established, open connection before the connection times out and is closed.', + `created` datetime COMMENT 'date the s3 first signed on', + PRIMARY KEY (`id`), + CONSTRAINT `uc_s3__uuid` UNIQUE (`uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`template_s3_ref` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `s3_id` bigint unsigned NOT NULL COMMENT ' Associated S3 instance id', + `template_id` bigint unsigned NOT NULL COMMENT ' Associated template id', + `created` DATETIME NOT NULL COMMENT ' The creation timestamp', + `size` bigint unsigned COMMENT ' The size of the object', + `physical_size` bigint unsigned DEFAULT 0 COMMENT ' The physical size of the object', + PRIMARY KEY (`id`), + CONSTRAINT `uc_template_s3_ref__template_id` UNIQUE (`template_id`), + CONSTRAINT `fk_template_s3_ref__s3_id` FOREIGN KEY `fk_template_s3_ref__s3_id` (`s3_id`) REFERENCES `s3` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_template_s3_ref__template_id` FOREIGN KEY `fk_template_s3_ref__template_id` (`template_id`) REFERENCES `vm_template` (`id`), + INDEX `i_template_s3_ref__s3_id`(`s3_id`), + INDEX `i_template_s3_ref__template_id`(`template_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 's3.enable', 'false', 'enable s3'); + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'NetworkManager', 'router.check.poolsize' , '10', 'Numbers of threads using to check redundant router status.'); + +ALTER TABLE `cloud`.`snapshots` ADD COLUMN `s3_id` bigint unsigned COMMENT 'S3 to which this snapshot will be stored'; + +ALTER TABLE `cloud`.`snapshots` ADD CONSTRAINT `fk_snapshots__s3_id` FOREIGN KEY `fk_snapshots__s3_id` (`s3_id`) REFERENCES `s3` (`id`); + +ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `inline` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Is this network offering LB provider is in inline mode'; + +ALTER TABLE `cloud`.`external_load_balancer_devices` DROP COLUMN `is_inline`; + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network','DEFAULT','NetworkManager','network.dhcp.nondefaultnetwork.setgateway.guestos','Windows','The guest OS\'s name start with this fields would result in DHCP server response gateway information even when the network it\'s on is not default network. Names are separated by comma.'); + +ALTER TABLE `cloud`.`sync_queue` ADD `queue_size` SMALLINT NOT NULL DEFAULT '0' COMMENT 'number of items being processed by the queue'; + +ALTER TABLE `cloud`.`sync_queue` ADD `queue_size_limit` SMALLINT NOT NULL DEFAULT '1' COMMENT 'max number of items the queue can process concurrently'; + +ALTER TABLE `cloud`.`sync_queue` DROP INDEX `i_sync_queue__queue_proc_time`; + +ALTER TABLE `cloud`.`sync_queue` DROP COLUMN `queue_proc_time`; + +ALTER TABLE `cloud`.`sync_queue` DROP COLUMN `queue_proc_msid`; + +ALTER TABLE `cloud`.`sync_queue_item` ADD `queue_proc_time` DATETIME COMMENT 'when processing started for the item' AFTER `queue_proc_number`; + +ALTER TABLE `cloud`.`sync_queue_item` ADD INDEX `i_sync_queue__queue_proc_time`(`queue_proc_time`); + +ALTER TABLE `cloud`.`inline_load_balancer_nic_map` DROP FOREIGN KEY fk_inline_load_balancer_nic_map__load_balancer_id; + +ALTER TABLE `cloud`.`inline_load_balancer_nic_map` DROP COLUMN load_balancer_id; + +ALTER TABLE upload ADD uuid VARCHAR(40); +ALTER TABLE async_job modify job_cmd VARCHAR(255); + + +ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `is_persistent` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides an ability to create persistent networks'; + + +-- populate uuid column with db id if uuid is null +UPDATE `cloud`.`account` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`alert` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`async_job` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`cluster` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`data_center` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`dc_storage_network_ip_range` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`disk_offering` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`domain` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`event` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`external_firewall_devices` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`external_load_balancer_devices` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`external_nicira_nvp_devices` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`firewall_rules` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`guest_os` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`guest_os_category` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`host` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`host_pod_ref` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`hypervisor_capabilities` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`instance_group` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`load_balancer_stickiness_policies` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`network_external_firewall_device_map` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`network_external_lb_device_map` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`network_offerings` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`networks` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`nics` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`physical_network` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`physical_network_service_providers` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`physical_network_traffic_types` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`port_profile` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`project_invitations` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`projects` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`resource_tags` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`s2s_customer_gateway` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`s2s_vpn_connection` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`s2s_vpn_gateway` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`security_group` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`security_group_rule` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`snapshot_schedule` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`snapshots` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`snapshot_policy` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`static_routes` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`storage_pool` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`swift` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`upload` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`user` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`user_ip_address` set uuid=id WHERE uuid is NULL; +-- UPDATE `cloud`.`user_vm_temp` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`virtual_router_providers` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`virtual_supervisor_module` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`vlan` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`vm_instance` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`vm_template` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`vpc` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`vpc_gateways` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`vpc_offerings` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`vpn_users` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`volumes` set uuid=id WHERE uuid is NULL; +UPDATE `cloud`.`configuration` set value = '/var/cloudstack/mnt' where name = 'mount.parent'; +-- UPDATE `cloud`.`autoscale_vmgroups` set uuid=id WHERE uuid is NULL; +-- UPDATE `cloud`.`autoscale_vmprofiles` set uuid=id WHERE uuid is NULL; +-- UPDATE `cloud`.`autoscale_policies` set uuid=id WHERE uuid is NULL; +-- UPDATE `cloud`.`counter` set uuid=id WHERE uuid is NULL; +-- UPDATE `cloud`.`conditions` set uuid=id WHERE uuid is NULL; + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'detail.batch.query.size', '2000', 'Default entity detail batch query size for listing'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'api.throttling.enabled', 'false', 'Enable/Disable Api rate limit'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'api.throttling.interval', '1', 'Time interval (in seconds) to reset API count'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'api.throttling.max', '25', 'Max allowed number of APIs within fixed interval'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'api.throttling.cachesize', '50000', 'Account based API count cache size'); + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'direct.agent.pool.size', '500', 'Default size for DirectAgentPool'); + +ALTER TABLE `cloud`.`op_dc_vnet_alloc` DROP INDEX i_op_dc_vnet_alloc__vnet__data_center_id; + +ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD CONSTRAINT UNIQUE `i_op_dc_vnet_alloc__vnet__data_center_id`(`vnet`, `physical_network_id`, `data_center_id`); + +ALTER TABLE `cloud`.`op_dc_vnet_alloc` DROP INDEX i_op_dc_vnet_alloc__vnet__data_center_id__account_id; + +CREATE TABLE `cloud`.`region` ( + `id` int unsigned NOT NULL UNIQUE, + `name` varchar(255) NOT NULL UNIQUE, + `end_point` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `cloud`.`region` values ('1','Local','http://localhost:8080/client/'); + +CREATE TABLE `cloud`.`nicira_nvp_router_map` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `logicalrouter_uuid` varchar(255) NOT NULL UNIQUE COMMENT 'nicira uuid of logical router', + `network_id` bigint unsigned NOT NULL UNIQUE COMMENT 'cloudstack id of the network', + PRIMARY KEY (`id`), + CONSTRAINT `fk_nicira_nvp_router_map__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`external_bigswitch_vns_devices` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(255) UNIQUE, + `physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which bigswitch vns device is added', + `provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this bigswitch vns device', + `device_name` varchar(255) NOT NULL COMMENT 'name of the bigswitch vns device', + `host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external bigswitch vns device', + PRIMARY KEY (`id`), + CONSTRAINT `fk_external_bigswitch_vns_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_external_bigswitch_vns_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`counter` ( + `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40), + `source` varchar(255) NOT NULL COMMENT 'source e.g. netscaler, snmp', + `name` varchar(255) NOT NULL COMMENT 'Counter name', + `value` varchar(255) NOT NULL COMMENT 'Value in case of source=snmp', + `removed` datetime COMMENT 'date removed if not null', + `created` datetime NOT NULL COMMENT 'date created', + PRIMARY KEY (`id`), + CONSTRAINT `uc_counter__uuid` UNIQUE (`uuid`), + INDEX `i_counter__removed`(`removed`), + INDEX `i_counter__source`(`source`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`conditions` ( + `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40), + `counter_id` bigint unsigned NOT NULL COMMENT 'Counter Id', + `threshold` bigint unsigned NOT NULL COMMENT 'threshold value for the given counter', + `relational_operator` char(2) COMMENT 'relational operator to be used upon the counter and condition', + `domain_id` bigint unsigned NOT NULL COMMENT 'domain the Condition belongs to', + `account_id` bigint unsigned NOT NULL COMMENT 'owner of this Condition', + `removed` datetime COMMENT 'date removed if not null', + `created` datetime NOT NULL COMMENT 'date created', + PRIMARY KEY (`id`), + CONSTRAINT `fk_conditions__counter_id` FOREIGN KEY `fk_condition__counter_id`(`counter_id`) REFERENCES `counter`(`id`), + CONSTRAINT `fk_conditions__account_id` FOREIGN KEY `fk_condition__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_conditions__domain_id` FOREIGN KEY `fk_condition__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, + CONSTRAINT `uc_conditions__uuid` UNIQUE (`uuid`), + INDEX `i_conditions__removed`(`removed`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`autoscale_vmprofiles` ( + `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), + `zone_id` bigint unsigned NOT NULL, + `domain_id` bigint unsigned NOT NULL, + `account_id` bigint unsigned NOT NULL, + `autoscale_user_id` bigint unsigned NOT NULL, + `service_offering_id` bigint unsigned NOT NULL, + `template_id` bigint unsigned NOT NULL, + `other_deploy_params` varchar(1024) COMMENT 'other deployment parameters that is in addition to zoneid,serviceofferingid,domainid', + `destroy_vm_grace_period` int unsigned COMMENT 'the time allowed for existing connections to get closed before a vm is destroyed', + `counter_params` varchar(1024) COMMENT 'the parameters for the counter to be used to get metric information from VMs', + `created` datetime NOT NULL COMMENT 'date created', + `removed` datetime COMMENT 'date removed if not null', + PRIMARY KEY (`id`), + CONSTRAINT `fk_autoscale_vmprofiles__domain_id` FOREIGN KEY `fk_autoscale_vmprofiles__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_autoscale_vmprofiles__account_id` FOREIGN KEY `fk_autoscale_vmprofiles__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_autoscale_vmprofiles__autoscale_user_id` FOREIGN KEY `fk_autoscale_vmprofiles__autoscale_user_id` (`autoscale_user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE, + CONSTRAINT `uc_autoscale_vmprofiles__uuid` UNIQUE (`uuid`), + INDEX `i_autoscale_vmprofiles__removed`(`removed`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`autoscale_policies` ( + `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), + `domain_id` bigint unsigned NOT NULL, + `account_id` bigint unsigned NOT NULL, + `duration` int unsigned NOT NULL, + `quiet_time` int unsigned NOT NULL, + `last_quiet_time` datetime DEFAULT NULL, + `action` varchar(15), + `created` datetime NOT NULL COMMENT 'date created', + `removed` datetime COMMENT 'date removed if not null', + PRIMARY KEY (`id`), + CONSTRAINT `fk_autoscale_policies__domain_id` FOREIGN KEY `fk_autoscale_policies__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_autoscale_policies__account_id` FOREIGN KEY `fk_autoscale_policies__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, + CONSTRAINT `uc_autoscale_policies__uuid` UNIQUE (`uuid`), + INDEX `i_autoscale_policies__removed`(`removed`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`autoscale_vmgroups` ( + `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), + `zone_id` bigint unsigned NOT NULL, + `domain_id` bigint unsigned NOT NULL, + `account_id` bigint unsigned NOT NULL, + `load_balancer_id` bigint unsigned NOT NULL, + `min_members` int unsigned DEFAULT 1, + `max_members` int unsigned NOT NULL, + `member_port` int unsigned NOT NULL, + `interval` int unsigned NOT NULL, + `profile_id` bigint unsigned NOT NULL, + `state` varchar(255) NOT NULL COMMENT 'enabled or disabled, a vmgroup is disabled to stop autoscaling activity', + `created` datetime NOT NULL COMMENT 'date created', + `removed` datetime COMMENT 'date removed if not null', + PRIMARY KEY (`id`), + CONSTRAINT `fk_autoscale_vmgroup__autoscale_vmprofile_id` FOREIGN KEY(`profile_id`) REFERENCES `autoscale_vmprofiles`(`id`), + CONSTRAINT `fk_autoscale_vmgroup__load_balancer_id` FOREIGN KEY(`load_balancer_id`) REFERENCES `load_balancing_rules`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_autoscale_vmgroups__domain_id` FOREIGN KEY `fk_autoscale_vmgroups__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_autoscale_vmgroups__account_id` FOREIGN KEY `fk_autoscale_vmgroups__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_autoscale_vmgroups__zone_id` FOREIGN KEY `fk_autoscale_vmgroups__zone_id`(`zone_id`) REFERENCES `data_center`(`id`), + CONSTRAINT `uc_autoscale_vmgroups__uuid` UNIQUE (`uuid`), + INDEX `i_autoscale_vmgroups__removed`(`removed`), + INDEX `i_autoscale_vmgroups__load_balancer_id`(`load_balancer_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`autoscale_policy_condition_map` ( + `id` bigint unsigned NOT NULL auto_increment, + `policy_id` bigint unsigned NOT NULL, + `condition_id` bigint unsigned NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_autoscale_policy_condition_map__policy_id` FOREIGN KEY `fk_autoscale_policy_condition_map__policy_id` (`policy_id`) REFERENCES `autoscale_policies` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_autoscale_policy_condition_map__condition_id` FOREIGN KEY `fk_autoscale_policy_condition_map__condition_id` (`condition_id`) REFERENCES `conditions` (`id`), + INDEX `i_autoscale_policy_condition_map__policy_id`(`policy_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`autoscale_vmgroup_policy_map` ( + `id` bigint unsigned NOT NULL auto_increment, + `vmgroup_id` bigint unsigned NOT NULL, + `policy_id` bigint unsigned NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_autoscale_vmgroup_policy_map__vmgroup_id` FOREIGN KEY `fk_autoscale_vmgroup_policy_map__vmgroup_id` (`vmgroup_id`) REFERENCES `autoscale_vmgroups` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_autoscale_vmgroup_policy_map__policy_id` FOREIGN KEY `fk_autoscale_vmgroup_policy_map__policy_id` (`policy_id`) REFERENCES `autoscale_policies` (`id`), + INDEX `i_autoscale_vmgroup_policy_map__vmgroup_id`(`vmgroup_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`autoscale_vmgroup_vm_map` ( + `id` bigint unsigned NOT NULL auto_increment, + `vmgroup_id` bigint unsigned NOT NULL, + `instance_id` bigint unsigned NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_autoscale_vmgroup_vm_map__vmgroup_id` FOREIGN KEY `fk_autoscale_vmgroup_vm_map__vmgroup_id` (`vmgroup_id`) REFERENCES `autoscale_vmgroups` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_autoscale_vmgroup_vm_map__instance_id` FOREIGN KEY `fk_autoscale_vmgroup_vm_map__instance_id` (`instance_id`) REFERENCES `vm_instance` (`id`), + INDEX `i_autoscale_vmgroup_vm_map__vmgroup_id`(`vmgroup_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (1, UUID(), 'snmp','Linux User CPU - percentage', '1.3.6.1.4.1.2021.11.9.0', now()); +INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (2, UUID(), 'snmp','Linux System CPU - percentage', '1.3.6.1.4.1.2021.11.10.0', now()); +INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (3, UUID(), 'snmp','Linux CPU Idle - percentage', '1.3.6.1.4.1.2021.11.11.0', now()); +INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (100, UUID(), 'netscaler','Response Time - microseconds', 'RESPTIME', now()); +INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (4, UUID(), 'cpu','Linux User CPU - percentage - native', '1.3.6.1.4.1.2021.11.9.1', now()); +INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (5, UUID(), 'memory','Linux User RAM - percentage - native', '1.3.6.1.4.1.2021.11.10.1', now()); + +CREATE TABLE `cloud`.`user_ipv6_address` ( + `id` bigint unsigned NOT NULL UNIQUE auto_increment, + `uuid` varchar(40), + `account_id` bigint unsigned NULL, + `domain_id` bigint unsigned NULL, + `ip_address` char(50) NOT NULL, + `data_center_id` bigint unsigned NOT NULL COMMENT 'zone that it belongs to', + `vlan_id` bigint unsigned NOT NULL, + `state` char(32) NOT NULL default 'Free' COMMENT 'state of the ip address', + `mac_address` varchar(40) NOT NULL COMMENT 'mac address of this ip', + `source_network_id` bigint unsigned NOT NULL COMMENT 'network id ip belongs to', + `network_id` bigint unsigned COMMENT 'network this public ip address is associated with', + `physical_network_id` bigint unsigned NOT NULL COMMENT 'physical network id that this configuration is based on', + `created` datetime NULL COMMENT 'Date this ip was allocated to someone', + PRIMARY KEY (`id`), + UNIQUE (`ip_address`, `source_network_id`), + CONSTRAINT `fk_user_ipv6_address__source_network_id` FOREIGN KEY (`source_network_id`) REFERENCES `networks`(`id`), + CONSTRAINT `fk_user_ipv6_address__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`), + CONSTRAINT `fk_user_ipv6_address__account_id` FOREIGN KEY (`account_id`) REFERENCES `account`(`id`), + CONSTRAINT `fk_user_ipv6_address__vlan_id` FOREIGN KEY (`vlan_id`) REFERENCES `vlan`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_user_ipv6_address__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE, + CONSTRAINT `uc_user_ipv6_address__uuid` UNIQUE (`uuid`), + CONSTRAINT `fk_user_ipv6_address__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE `cloud`.`networks` ADD COLUMN `ip6_gateway` varchar(50) COMMENT 'IPv6 gateway for this network'; +ALTER TABLE `cloud`.`networks` ADD COLUMN `ip6_cidr` varchar(50) COMMENT 'IPv6 cidr for this network'; + +ALTER TABLE `cloud`.`nics` ADD COLUMN `ip6_gateway` varchar(50) COMMENT 'gateway for ip6 address'; +ALTER TABLE `cloud`.`nics` ADD COLUMN `ip6_cidr` varchar(50) COMMENT 'cidr for ip6 address'; + +ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_gateway` varchar(255); +ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_cidr` varchar(255); +ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_range` varchar(255); + +ALTER TABLE `cloud`.`data_center` ADD COLUMN `ip6_dns1` varchar(255); +ALTER TABLE `cloud`.`data_center` ADD COLUMN `ip6_dns2` varchar(255); + +UPDATE `cloud`.`networks` INNER JOIN `cloud`.`vlan` ON networks.id = vlan.network_id +SET networks.gateway = vlan.vlan_gateway, networks.ip6_gateway = vlan.ip6_gateway, networks.ip6_cidr = vlan.ip6_cidr +WHERE networks.data_center_id = vlan.data_center_id AND networks.physical_network_id = vlan.physical_network_id; + +CREATE TABLE `cloud`.`baremetal_dhcp_devices` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40) UNIQUE, + `nsp_id` bigint unsigned DEFAULT NULL COMMENT 'Network Service Provider ID', + `pod_id` bigint unsigned DEFAULT NULL COMMENT 'Pod id where this dhcp server in', + `device_type` varchar(255) DEFAULT NULL COMMENT 'type of the external device', + `physical_network_id` bigint unsigned DEFAULT NULL COMMENT 'id of the physical network in to which external dhcp device is added', + `host_id` bigint unsigned DEFAULT NULL COMMENT 'host id coresponding to the external dhcp device', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`baremetal_pxe_devices` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40) UNIQUE, + `nsp_id` bigint unsigned DEFAULT NULL COMMENT 'Network Service Provider ID', + `pod_id` bigint unsigned DEFAULT NULL COMMENT 'Pod id where this pxe server in, for pxe per zone this field is null', + `device_type` varchar(255) DEFAULT NULL COMMENT 'type of the pxe device', + `physical_network_id` bigint unsigned DEFAULT NULL COMMENT 'id of the physical network in to which external pxe device is added', + `host_id` bigint unsigned DEFAULT NULL COMMENT 'host id coresponding to the external pxe device', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `cloud`.`ucs_blade` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40) UNIQUE, + `ucs_manager_id` bigint unsigned NOT NULL, + `host_id` bigint unsigned DEFAULT NULL, + `dn` varchar(512) NOT NULL, + `profile_dn` varchar(512) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`ucs_manager` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40) UNIQUE, + `zone_id` bigint unsigned NOT NULL, + `name` varchar(128) DEFAULT NULL, + `url` varchar(255) NOT NULL, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +SET foreign_key_checks = 1; + +UPDATE `cloud`.`configuration` SET value='KVM,XenServer,VMware,Ovm' WHERE name='hypervisor.list'; + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'concurrent.snapshots.threshold.perhost' , NULL, 'Limit number of snapshots that can be handled concurrently; default is NULL - unlimited.'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'network.ipv6.search.retry.max' , 10000, 'The maximum number of retrying times to search for an available IPv6 address in the table'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Usage', 'DEFAULT', 'management-server', 'traffic.sentinel.exclude.zones' , '', 'Traffic going into specified list of zones is not metered'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Usage', 'DEFAULT', 'management-server', 'traffic.sentinel.include.zones' , 'EXTERNAL', 'Traffic going into specified list of zones is metered. For metering all traffic leave this parameter empty'); + + +INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (163, UUID(), 10, 'Ubuntu 12.04 (32-bit)'); +INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (164, UUID(), 10, 'Ubuntu 12.04 (64-bit)'); + +DROP TABLE IF EXISTS `cloud`.`netscaler_pod_ref`; +CREATE TABLE `cloud`.`netscaler_pod_ref` ( + `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', + `external_load_balancer_device_id` bigint unsigned NOT NULL COMMENT 'id of external load balancer device', + `pod_id` bigint unsigned NOT NULL COMMENT 'pod id', + PRIMARY KEY (`id`), + CONSTRAINT `fk_ns_pod_ref__pod_id` FOREIGN KEY (`pod_id`) REFERENCES `cloud`.`host_pod_ref`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_ns_pod_ref__device_id` FOREIGN KEY (`external_load_balancer_device_id`) REFERENCES `external_load_balancer_devices`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'eip.use.multiple.netscalers' , 'false', 'Should be set to true, if there will be multiple NetScaler devices providing EIP service in a zone'); + +UPDATE `cloud`.`configuration` set category='Advanced' where category='Advanced '; +UPDATE `cloud`.`configuration` set category='Hidden' where category='Hidden '; + diff --git a/engine/schema/src/main/resources/META-INF/db/schema-40to410-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_1_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-40to410-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_1_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-410to420.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_2_0_0__upgrade.sql similarity index 61% rename from engine/schema/src/main/resources/META-INF/db/schema-410to420.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_2_0_0__upgrade.sql index d5173afc186b..e39d99ffbd2e 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-410to420.sql +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_2_0_0__upgrade.sql @@ -113,7 +113,7 @@ CREATE TABLE `cloud`.`image_store` ( `uuid` varchar(255) COMMENT 'uuid of data store', `parent` varchar(255) COMMENT 'parent path for the storage server', `created` datetime COMMENT 'date the image store first signed on', - `removed` datetime COMMENT 'date removed if not null', + `removed` datetime COMMENT 'date removed if not null', `total_size` bigint unsigned COMMENT 'storage total size statistics', `used_bytes` bigint unsigned COMMENT 'storage available bytes statistics', PRIMARY KEY(`id`) @@ -129,33 +129,8 @@ CREATE TABLE `cloud`.`image_store_details` ( INDEX `i_image_store__name__value`(`name`(128), `value`(128)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -DROP VIEW IF EXISTS `cloud`.`image_store_view`; -CREATE VIEW `cloud`.`image_store_view` AS - select - image_store.id, - image_store.uuid, - image_store.name, - image_store.image_provider_name, - image_store.protocol, - image_store.url, - image_store.scope, - image_store.role, - image_store.removed, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - image_store_details.name detail_name, - image_store_details.value detail_value - from - `cloud`.`image_store` - left join - `cloud`.`data_center` ON image_store.data_center_id = data_center.id - left join - `cloud`.`image_store_details` ON image_store_details.store_id = image_store.id; - - -- here we have to allow null for store_id to accomodate baremetal case to search for ready templates since template state is only stored in this table --- FK also commented out due to this +-- FK also commented out due to this CREATE TABLE `cloud`.`template_store_ref` ( `id` bigint unsigned NOT NULL auto_increment, `store_id` bigint unsigned, @@ -165,7 +140,7 @@ CREATE TABLE `cloud`.`template_store_ref` ( `job_id` varchar(255), `download_pct` int(10) unsigned, `size` bigint unsigned, - `store_role` varchar(255), + `store_role` varchar(255), `physical_size` bigint unsigned DEFAULT 0, `download_state` varchar(255), `error_str` varchar(255), @@ -177,7 +152,7 @@ CREATE TABLE `cloud`.`template_store_ref` ( `is_copy` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'indicates whether this was copied ', `update_count` bigint unsigned, `ref_cnt` bigint unsigned DEFAULT 0, - `updated` datetime, + `updated` datetime, PRIMARY KEY (`id`), -- CONSTRAINT `fk_template_store_ref__store_id` FOREIGN KEY `fk_template_store_ref__store_id` (`store_id`) REFERENCES `image_store` (`id`) ON DELETE CASCADE, INDEX `i_template_store_ref__store_id`(`store_id`), @@ -193,7 +168,7 @@ CREATE TABLE `cloud`.`template_store_ref` ( -- ALTER TABLE `cloud`.`snapshots` DROP COLUMN `sechost_id`; -- change upload host_id FK to point to image_store table -ALTER TABLE `cloud`.`upload` DROP FOREIGN KEY `fk_upload__host_id`; +ALTER TABLE `cloud`.`upload` DROP FOREIGN KEY `fk_upload__host_id`; ALTER TABLE `cloud`.`upload` ADD CONSTRAINT `fk_upload__store_id` FOREIGN KEY(`host_id`) REFERENCES `image_store` (`id`) ON DELETE CASCADE; CREATE TABLE `cloud`.`snapshot_store_ref` ( @@ -208,11 +183,11 @@ CREATE TABLE `cloud`.`snapshot_store_ref` ( `physical_size` bigint unsigned DEFAULT 0, `parent_snapshot_id` bigint unsigned DEFAULT 0, `install_path` varchar(255), - `state` varchar(255) NOT NULL, - -- `removed` datetime COMMENT 'date removed if not null', + `state` varchar(255) NOT NULL, + -- `removed` datetime COMMENT 'date removed if not null', `update_count` bigint unsigned, `ref_cnt` bigint unsigned, - `updated` datetime, + `updated` datetime, `volume_id` bigint unsigned, PRIMARY KEY (`id`), INDEX `i_snapshot_store_ref__store_id`(`store_id`), @@ -238,11 +213,11 @@ CREATE TABLE `cloud`.`volume_store_ref` ( `install_path` varchar(255), `url` varchar(255), `download_url` varchar(255), - `state` varchar(255) NOT NULL, + `state` varchar(255) NOT NULL, `destroyed` tinyint(1) COMMENT 'indicates whether the volume_host entry was destroyed by the user or not', `update_count` bigint unsigned, `ref_cnt` bigint unsigned, - `updated` datetime, + `updated` datetime, PRIMARY KEY (`id`), CONSTRAINT `fk_volume_store_ref__store_id` FOREIGN KEY `fk_volume_store_ref__store_id` (`store_id`) REFERENCES `image_store` (`id`) ON DELETE CASCADE, INDEX `i_volume_store_ref__store_id`(`store_id`), @@ -285,7 +260,7 @@ CREATE TABLE `cloud`.`load_balancer_healthcheck_policies` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vm.instancename.flag', 'false', 'If set to true, will set guest VM\'s name as it appears on the hypervisor, to its hostname'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vm.instancename.flag', 'false', 'If set to true, will set guest VM''s name as it appears on the hypervisor, to its hostname'); UPDATE `cloud`.`guest_os` SET category_id=10 where id=59; INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (165, UUID(), 6, 'Windows 8 (32-bit)'); @@ -485,46 +460,6 @@ ALTER TABLE `cloud`.`event` ADD COLUMN `archived` tinyint(1) unsigned NOT NULL D 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; - ALTER TABLE `cloud`.`region` ADD COLUMN `portableip_service_enabled` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Is Portable IP service enalbed in the Region'; ALTER TABLE `cloud`.`region` ADD COLUMN `gslb_service_enabled` tinyint(1) unsigned NOT NULL DEFAULT 1 COMMENT 'Is GSLB service enalbed in the Region'; @@ -662,12 +597,12 @@ ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `id` bigint unsigned NOT NULL ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `uuid` varchar(40) UNIQUE; -- START: support for LXC - + INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES (UUID(), 'LXC', 'default', 50, 1); ALTER TABLE `cloud`.`physical_network_traffic_types` ADD COLUMN `lxc_network_label` varchar(255) DEFAULT 'cloudbr0' COMMENT 'The network name label of the physical device dedicated to this traffic on a LXC host'; - + UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,LXC' WHERE name='hypervisor.list'; - + INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) VALUES (10, UUID(), 'routing-10', 'SystemVM Template (LXC)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloudstack.org/templates/acton/acton-systemvm-02062012.qcow2.bz2', '2755de1f9ef2ce4d6f2bee2efbb4da92', 0, 'SystemVM Template (LXC)', 'QCOW2', 15, 0, 1, 'LXC'); @@ -717,447 +652,7 @@ CREATE TABLE `cloud`.`service_offering_details` ( CONSTRAINT `fk_service_offering_details__service_offering_id` FOREIGN KEY (`service_offering_id`) REFERENCES `service_offering`(`id`) ON DELETE CASCADE, CONSTRAINT UNIQUE KEY `uk_service_offering_id_name` (`service_offering_id`, `name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE VIEW `cloud`.`user_vm_view` AS - select - vm_instance.id id, - vm_instance.name name, - user_vm.display_name display_name, - user_vm.user_data user_data, - 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, - instance_group.id instance_group_id, - instance_group.uuid instance_group_uuid, - instance_group.name instance_group_name, - vm_instance.uuid uuid, - vm_instance.last_host_id last_host_id, - vm_instance.vm_type type, - vm_instance.vnc_password vnc_password, - vm_instance.limit_cpu_use limit_cpu_use, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.ha_enabled ha_enabled, - vm_instance.hypervisor_type hypervisor_type, - vm_instance.instance_name instance_name, - vm_instance.guest_os_id guest_os_id, - guest_os.uuid guest_os_uuid, - vm_instance.pod_id pod_id, - host_pod_ref.uuid pod_uuid, - vm_instance.private_ip_address private_ip_address, - vm_instance.private_mac_address private_mac_address, - vm_instance.vm_type vm_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - data_center.is_security_group_enabled security_group_enabled, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.name template_name, - vm_template.display_text template_display_text, - vm_template.enable_password password_enabled, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - service_offering.id service_offering_id, - disk_offering.uuid service_offering_uuid, - service_offering.cpu cpu, - service_offering.speed speed, - service_offering.ram_size ram_size, - disk_offering.name service_offering_name, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.pool_type pool_type, - volumes.id volume_id, - volumes.uuid volume_uuid, - volumes.device_id volume_device_id, - volumes.volume_type volume_type, - security_group.id security_group_id, - security_group.uuid security_group_uuid, - security_group.name security_group_name, - security_group.description security_group_description, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - user_ip_address.id public_ip_id, - user_ip_address.uuid public_ip_uuid, - user_ip_address.public_ip_address public_ip_address, - ssh_keypairs.keypair_name keypair_name, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - affinity_group.id affinity_group_id, - affinity_group.uuid affinity_group_uuid, - affinity_group.name affinity_group_name, - affinity_group.description affinity_group_description - from - `cloud`.`user_vm` - inner join - `cloud`.`vm_instance` ON vm_instance.id = user_vm.id - and vm_instance.removed is NULL - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id - left join - `cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = user_vm.iso_id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id - left join - `cloud`.`volumes` ON vm_instance.id = volumes.instance_id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id - left join - `cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON networks.vpc_id = vpc.id - left join - `cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` ON user_vm_details.vm_id = vm_instance.id - and user_vm_details.name = 'SSH.PublicKey' - left join - `cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = user_vm_details.value - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id - and resource_tags.resource_type = 'UserVm' - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'VirtualMachine' - and async_job.job_status = 0 - left join - `cloud`.`affinity_group_vm_map` ON vm_instance.id = affinity_group_vm_map.instance_id - left join - `cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id; - -DROP VIEW IF EXISTS `cloud`.`affinity_group_view`; -CREATE VIEW `cloud`.`affinity_group_view` AS - select - affinity_group.id id, - affinity_group.name name, - affinity_group.type type, - affinity_group.description description, - affinity_group.uuid uuid, - affinity_group.acl_type acl_type, - 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, - vm_instance.id vm_id, - vm_instance.uuid vm_uuid, - vm_instance.name vm_name, - vm_instance.state vm_state, - user_vm.display_name vm_display_name - from - `cloud`.`affinity_group` - inner join - `cloud`.`account` ON affinity_group.account_id = account.id - inner join - `cloud`.`domain` ON affinity_group.domain_id = domain.id - left join - `cloud`.`affinity_group_vm_map` ON affinity_group.id = affinity_group_vm_map.affinity_group_id - left join - `cloud`.`vm_instance` ON vm_instance.id = affinity_group_vm_map.instance_id - left join - `cloud`.`user_vm` ON user_vm.id = vm_instance.id; - -DROP VIEW IF EXISTS `cloud`.`host_view`; -CREATE VIEW `cloud`.`host_view` AS - select - host.id, - host.uuid, - host.name, - host.status, - host.disconnected, - host.type, - host.private_ip_address, - host.version, - host.hypervisor_type, - host.hypervisor_version, - host.capabilities, - host.last_ping, - host.created, - host.removed, - host.resource_state, - host.mgmt_server_id, - host.cpus, - host.speed, - host.ram, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - host_tags.tag, - guest_os_category.id guest_os_category_id, - guest_os_category.uuid guest_os_category_uuid, - guest_os_category.name guest_os_category_name, - mem_caps.used_capacity memory_used_capacity, - mem_caps.reserved_capacity memory_reserved_capacity, - cpu_caps.used_capacity cpu_used_capacity, - cpu_caps.reserved_capacity cpu_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`host` - left join - `cloud`.`cluster` ON host.cluster_id = cluster.id - left join - `cloud`.`data_center` ON host.data_center_id = data_center.id - left join - `cloud`.`host_pod_ref` ON host.pod_id = host_pod_ref.id - left join - `cloud`.`host_details` ON host.id = host_details.host_id - and host_details.name = 'guest.os.category.id' - left join - `cloud`.`guest_os_category` ON guest_os_category.id = CONVERT( host_details.value , UNSIGNED) - left join - `cloud`.`host_tags` ON host_tags.host_id = host.id - left join - `cloud`.`op_host_capacity` mem_caps ON host.id = mem_caps.host_id - and mem_caps.capacity_type = 0 - left join - `cloud`.`op_host_capacity` cpu_caps ON host.id = cpu_caps.host_id - and cpu_caps.capacity_type = 1 - left join - `cloud`.`async_job` ON async_job.instance_id = host.id - and async_job.instance_type = 'Host' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`storage_pool_view`; -CREATE VIEW `cloud`.`storage_pool_view` AS - select - storage_pool.id, - storage_pool.uuid, - storage_pool.name, - storage_pool.status, - storage_pool.path, - storage_pool.pool_type, - storage_pool.host_address, - storage_pool.created, - storage_pool.removed, - storage_pool.capacity_bytes, - storage_pool.capacity_iops, - storage_pool.scope, - storage_pool.hypervisor, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - storage_pool_details.name tag, - op_host_capacity.used_capacity disk_used_capacity, - op_host_capacity.reserved_capacity disk_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`storage_pool` - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`data_center` ON storage_pool.data_center_id = data_center.id - left join - `cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id - left join - `cloud`.`storage_pool_details` ON storage_pool_details.pool_id = storage_pool.id - and storage_pool_details.value = 'true' - left join - `cloud`.`op_host_capacity` ON storage_pool.id = op_host_capacity.host_id - and op_host_capacity.capacity_type = 3 - left join - `cloud`.`async_job` ON async_job.instance_id = storage_pool.id - and async_job.instance_type = 'StoragePool' - and async_job.job_status = 0; - - -DROP VIEW IF EXISTS `cloud`.`domain_router_view`; -CREATE VIEW `cloud`.`domain_router_view` AS - select - vm_instance.id id, - vm_instance.name 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, - vm_instance.uuid uuid, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.pod_id pod_id, - vm_instance.instance_name instance_name, - host_pod_ref.uuid pod_uuid, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - data_center.dns1 dns1, - data_center.dns2 dns2, - data_center.ip6_dns1 ip6_dns1, - data_center.ip6_dns2 ip6_dns2, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - vm_template.id template_id, - vm_template.uuid template_uuid, - service_offering.id service_offering_id, - disk_offering.uuid service_offering_uuid, - disk_offering.name service_offering_name, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.network_domain network_domain, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - domain_router.template_version template_version, - domain_router.scripts_version scripts_version, - domain_router.is_redundant_router is_redundant_router, - domain_router.redundant_state redundant_state, - domain_router.stop_pending stop_pending, - domain_router.role role - from - `cloud`.`domain_router` - inner join - `cloud`.`vm_instance` ON vm_instance.id = domain_router.id - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON domain_router.vpc_id = vpc.id and vpc.removed is null - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'DomainRouter' - and async_job.job_status = 0; - + CREATE TABLE `cloud`.`external_cisco_vnmc_devices` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `uuid` varchar(255) UNIQUE, @@ -1240,46 +735,6 @@ ALTER TABLE `cloud`.`service_offering` ADD COLUMN `deployment_planner` varchar(2 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vm.deployment.planner', 'FirstFitPlanner', '[''FirstFitPlanner'', ''UserDispersingPlanner'', ''UserConcentratedPodPlanner'']: DeploymentPlanner heuristic that will be used for VM deployment.'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'host.reservation.release.period', '300000', 'The interval in milliseconds between host reservation release checks'); -DROP VIEW IF EXISTS `cloud`.`service_offering_view`; -CREATE VIEW `cloud`.`service_offering_view` AS - select - service_offering.id, - disk_offering.uuid, - disk_offering.name, - disk_offering.display_text, - disk_offering.created, - disk_offering.tags, - disk_offering.removed, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - service_offering.cpu, - service_offering.speed, - service_offering.ram_size, - service_offering.nw_rate, - service_offering.mc_rate, - service_offering.ha_enabled, - service_offering.limit_cpu_use, - service_offering.host_tag, - service_offering.default_use, - service_offering.vm_type, - service_offering.sort_key, - service_offering.is_volatile, - service_offering.deployment_planner, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`service_offering` - inner join - `cloud`.`disk_offering` ON service_offering.id = disk_offering.id - left join - `cloud`.`domain` ON disk_offering.domain_id = domain.id; - -- Add "default" field to account/user tables ALTER TABLE `cloud`.`account` ADD COLUMN `default` int(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 if account is default'; ALTER TABLE `cloud_usage`.`account` ADD COLUMN `default` int(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 if account is default'; @@ -1288,195 +743,6 @@ UPDATE `cloud`.`account` SET `cloud`.`account`.`default`=1 WHERE id IN (1,2); UPDATE `cloud_usage`.`account` SET `default`=1 WHERE id IN (1,2); UPDATE `cloud`.`user` SET `cloud`.`user`.`default`=1 WHERE id IN (1,2); -ALTER VIEW `cloud`.`user_view` AS - select - user.id, - user.uuid, - user.username, - user.password, - user.firstname, - user.lastname, - user.email, - user.state, - user.api_key, - user.secret_key, - user.created, - user.removed, - user.timezone, - user.registration_token, - user.is_registered, - user.incorrect_login_attempts, - user.default, - 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, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`user` - inner join - `cloud`.`account` ON user.account_id = account.id - inner join - `cloud`.`domain` ON account.domain_id = domain.id - left join - `cloud`.`async_job` ON async_job.instance_id = user.id - and async_job.instance_type = 'User' - and async_job.job_status = 0; - - -DROP VIEW IF EXISTS `cloud`.`account_view`; -CREATE VIEW `cloud`.`account_view` AS - select - account.id, - account.uuid, - account.account_name, - account.type, - account.state, - account.removed, - account.cleanup_needed, - account.network_domain, - account.default, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - account_netstats_view.bytesReceived, - account_netstats_view.bytesSent, - vmlimit.max vmLimit, - vmcount.count vmTotal, - runningvm.vmcount runningVms, - stoppedvm.vmcount stoppedVms, - iplimit.max ipLimit, - ipcount.count ipTotal, - free_ip_view.free_ip ipFree, - volumelimit.max volumeLimit, - volumecount.count volumeTotal, - snapshotlimit.max snapshotLimit, - snapshotcount.count snapshotTotal, - templatelimit.max templateLimit, - templatecount.count templateTotal, - vpclimit.max vpcLimit, - vpccount.count vpcTotal, - projectlimit.max projectLimit, - projectcount.count projectTotal, - networklimit.max networkLimit, - networkcount.count networkTotal, - cpulimit.max cpuLimit, - cpucount.count cpuTotal, - memorylimit.max memoryLimit, - memorycount.count memoryTotal, - primary_storage_limit.max primaryStorageLimit, - primary_storage_count.count primaryStorageTotal, - secondary_storage_limit.max secondaryStorageLimit, - secondary_storage_count.count secondaryStorageTotal, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`free_ip_view`, - `cloud`.`account` - inner join - `cloud`.`domain` ON account.domain_id = domain.id - left join - `cloud`.`data_center` ON account.default_zone_id = data_center.id - left join - `cloud`.`account_netstats_view` ON account.id = account_netstats_view.account_id - left join - `cloud`.`resource_limit` vmlimit ON account.id = vmlimit.account_id - and vmlimit.type = 'user_vm' - left join - `cloud`.`resource_count` vmcount ON account.id = vmcount.account_id - and vmcount.type = 'user_vm' - left join - `cloud`.`account_vmstats_view` runningvm ON account.id = runningvm.account_id - and runningvm.state = 'Running' - left join - `cloud`.`account_vmstats_view` stoppedvm ON account.id = stoppedvm.account_id - and stoppedvm.state = 'Stopped' - left join - `cloud`.`resource_limit` iplimit ON account.id = iplimit.account_id - and iplimit.type = 'public_ip' - left join - `cloud`.`resource_count` ipcount ON account.id = ipcount.account_id - and ipcount.type = 'public_ip' - left join - `cloud`.`resource_limit` volumelimit ON account.id = volumelimit.account_id - and volumelimit.type = 'volume' - left join - `cloud`.`resource_count` volumecount ON account.id = volumecount.account_id - and volumecount.type = 'volume' - left join - `cloud`.`resource_limit` snapshotlimit ON account.id = snapshotlimit.account_id - and snapshotlimit.type = 'snapshot' - left join - `cloud`.`resource_count` snapshotcount ON account.id = snapshotcount.account_id - and snapshotcount.type = 'snapshot' - left join - `cloud`.`resource_limit` templatelimit ON account.id = templatelimit.account_id - and templatelimit.type = 'template' - left join - `cloud`.`resource_count` templatecount ON account.id = templatecount.account_id - and templatecount.type = 'template' - left join - `cloud`.`resource_limit` vpclimit ON account.id = vpclimit.account_id - and vpclimit.type = 'vpc' - left join - `cloud`.`resource_count` vpccount ON account.id = vpccount.account_id - and vpccount.type = 'vpc' - left join - `cloud`.`resource_limit` projectlimit ON account.id = projectlimit.account_id - and projectlimit.type = 'project' - left join - `cloud`.`resource_count` projectcount ON account.id = projectcount.account_id - and projectcount.type = 'project' - left join - `cloud`.`resource_limit` networklimit ON account.id = networklimit.account_id - and networklimit.type = 'network' - left join - `cloud`.`resource_count` networkcount ON account.id = networkcount.account_id - and networkcount.type = 'network' - left join - `cloud`.`resource_limit` cpulimit ON account.id = cpulimit.account_id - and cpulimit.type = 'cpu' - left join - `cloud`.`resource_count` cpucount ON account.id = cpucount.account_id - and cpucount.type = 'cpu' - left join - `cloud`.`resource_limit` memorylimit ON account.id = memorylimit.account_id - and memorylimit.type = 'memory' - left join - `cloud`.`resource_count` memorycount ON account.id = memorycount.account_id - and memorycount.type = 'memory' - left join - `cloud`.`resource_limit` primary_storage_limit ON account.id = primary_storage_limit.account_id - and primary_storage_limit.type = 'primary_storage' - left join - `cloud`.`resource_count` primary_storage_count ON account.id = primary_storage_count.account_id - and primary_storage_count.type = 'primary_storage' - left join - `cloud`.`resource_limit` secondary_storage_limit ON account.id = secondary_storage_limit.account_id - and secondary_storage_limit.type = 'secondary_storage' - left join - `cloud`.`resource_count` secondary_storage_count ON account.id = secondary_storage_count.account_id - and secondary_storage_count.type = 'secondary_storage' - left join - `cloud`.`async_job` ON async_job.instance_id = account.id - and async_job.instance_type = 'Account' - and async_job.job_status = 0; - - - ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `source_ip_address` varchar(40) COMMENT 'source ip address for the load balancer rule'; ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `source_ip_address_network_id` bigint unsigned COMMENT 'the id of the network where source ip belongs to'; ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `scheme` varchar(40) NOT NULL COMMENT 'load balancer scheme; can be Internal or Public'; @@ -1548,328 +814,6 @@ CREATE TABLE `cloud`.`portable_ip_address` ( ALTER TABLE `cloud`.`user_ip_address` ADD COLUMN is_portable int(1) unsigned NOT NULL default '0'; -DROP VIEW IF EXISTS `cloud`.`disk_offering_view`; -CREATE VIEW `cloud`.`disk_offering_view` AS - select - disk_offering.id, - disk_offering.uuid, - disk_offering.name, - disk_offering.display_text, - disk_offering.disk_size, - disk_offering.min_iops, - disk_offering.max_iops, - disk_offering.created, - disk_offering.tags, - disk_offering.customized, - disk_offering.customized_iops, - disk_offering.removed, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.sort_key, - disk_offering.type, - disk_offering.display_offering, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`disk_offering` - left join - `cloud`.`domain` ON disk_offering.domain_id = domain.id; - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE VIEW `cloud`.`user_vm_view` AS - select - vm_instance.id id, - vm_instance.name name, - user_vm.display_name display_name, - user_vm.user_data user_data, - 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, - instance_group.id instance_group_id, - instance_group.uuid instance_group_uuid, - instance_group.name instance_group_name, - vm_instance.uuid uuid, - vm_instance.last_host_id last_host_id, - vm_instance.vm_type type, - vm_instance.vnc_password vnc_password, - vm_instance.limit_cpu_use limit_cpu_use, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.ha_enabled ha_enabled, - vm_instance.hypervisor_type hypervisor_type, - vm_instance.instance_name instance_name, - vm_instance.guest_os_id guest_os_id, - vm_instance.display_vm display_vm, - guest_os.uuid guest_os_uuid, - vm_instance.pod_id pod_id, - host_pod_ref.uuid pod_uuid, - vm_instance.private_ip_address private_ip_address, - vm_instance.private_mac_address private_mac_address, - vm_instance.vm_type vm_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.is_security_group_enabled security_group_enabled, - data_center.networktype data_center_type, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.name template_name, - vm_template.display_text template_display_text, - vm_template.enable_password password_enabled, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - service_offering.id service_offering_id, - disk_offering.uuid service_offering_uuid, - service_offering.cpu cpu, - service_offering.speed speed, - service_offering.ram_size ram_size, - disk_offering.name service_offering_name, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.pool_type pool_type, - volumes.id volume_id, - volumes.uuid volume_uuid, - volumes.device_id volume_device_id, - volumes.volume_type volume_type, - security_group.id security_group_id, - security_group.uuid security_group_uuid, - security_group.name security_group_name, - security_group.description security_group_description, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - user_ip_address.id public_ip_id, - user_ip_address.uuid public_ip_uuid, - user_ip_address.public_ip_address public_ip_address, - ssh_keypairs.keypair_name keypair_name, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - affinity_group.id affinity_group_id, - affinity_group.uuid affinity_group_uuid, - affinity_group.name affinity_group_name, - affinity_group.description affinity_group_description, - vm_instance.dynamically_scalable dynamically_scalable - - from - `cloud`.`user_vm` - inner join - `cloud`.`vm_instance` ON vm_instance.id = user_vm.id - and vm_instance.removed is NULL - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id - left join - `cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = user_vm.iso_id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id - left join - `cloud`.`volumes` ON vm_instance.id = volumes.instance_id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id - left join - `cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON networks.vpc_id = vpc.id and vpc.removed is null - left join - `cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` ON user_vm_details.vm_id = vm_instance.id - and user_vm_details.name = 'SSH.PublicKey' - left join - `cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = user_vm_details.value - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id - and resource_tags.resource_type = 'UserVm' - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'VirtualMachine' - and async_job.job_status = 0 - left join - `cloud`.`affinity_group_vm_map` ON vm_instance.id = affinity_group_vm_map.instance_id - left join - `cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id; - -DROP VIEW IF EXISTS `cloud`.`volume_view`; -CREATE VIEW `cloud`.`volume_view` AS - select - volumes.id, - volumes.uuid, - volumes.name, - volumes.device_id, - volumes.volume_type, - volumes.size, - volumes.min_iops, - volumes.max_iops, - volumes.created, - volumes.state, - volumes.attached, - volumes.removed, - volumes.pod_id, - volumes.display_volume, - volumes.format, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - vm_instance.id vm_id, - vm_instance.uuid vm_uuid, - vm_instance.name vm_name, - vm_instance.state vm_state, - vm_instance.vm_type, - user_vm.display_name vm_display_name, - volume_store_ref.size volume_store_size, - volume_store_ref.download_pct, - volume_store_ref.download_state, - volume_store_ref.error_str, - volume_store_ref.created created_on_store, - disk_offering.id disk_offering_id, - disk_offering.uuid disk_offering_uuid, - disk_offering.name disk_offering_name, - disk_offering.display_text disk_offering_display_text, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.name pool_name, - cluster.hypervisor_type, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.extractable, - vm_template.type template_type, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`volumes` - inner join - `cloud`.`account` ON volumes.account_id = account.id - inner join - `cloud`.`domain` ON volumes.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON volumes.data_center_id = data_center.id - left join - `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id - left join - `cloud`.`user_vm` ON user_vm.id = vm_instance.id - left join - `cloud`.`volume_store_ref` ON volumes.id = volume_store_ref.volume_id - left join - `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`vm_template` ON volumes.template_id = vm_template.id OR volumes.iso_id = vm_template.id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id - and resource_tags.resource_type = 'Volume' - left join - `cloud`.`async_job` ON async_job.instance_id = volumes.id - and async_job.instance_type = 'Volume' - and async_job.job_status = 0; - ALTER TABLE `cloud`.`data_center_details` MODIFY value varchar(1024); ALTER TABLE `cloud`.`cluster_details` MODIFY value varchar(255); ALTER TABLE `cloud`.`storage_pool_details` MODIFY value varchar(255); @@ -1877,104 +821,6 @@ ALTER TABLE `cloud`.`account_details` MODIFY value varchar(255); -- END: support for LXC -DROP VIEW IF EXISTS `cloud`.`template_view`; -CREATE VIEW `cloud`.`template_view` AS - select - vm_template.id, - vm_template.uuid, - vm_template.unique_name, - vm_template.name, - vm_template.public, - vm_template.featured, - vm_template.type, - vm_template.hvm, - vm_template.bits, - vm_template.url, - vm_template.format, - vm_template.created, - vm_template.checksum, - vm_template.display_text, - vm_template.enable_password, - vm_template.dynamically_scalable, - vm_template.guest_os_id, - guest_os.uuid guest_os_uuid, - guest_os.display_name guest_os_name, - vm_template.bootable, - vm_template.prepopulate, - vm_template.cross_zones, - vm_template.hypervisor_type, - vm_template.extractable, - vm_template.template_tag, - vm_template.sort_key, - vm_template.removed, - vm_template.enable_sshkey, - source_template.id source_template_id, - source_template.uuid source_template_uuid, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - launch_permission.account_id lp_account_id, - template_store_ref.store_id, - image_store.scope as store_scope, - template_store_ref.state, - template_store_ref.download_state, - template_store_ref.download_pct, - template_store_ref.error_str, - template_store_ref.size, - template_store_ref.destroyed, - template_store_ref.created created_on_store, - vm_template_details.name detail_name, - vm_template_details.value detail_value, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - CONCAT(vm_template.id, '_', IFNULL(data_center.id, 0)) as temp_zone_pair - from - `cloud`.`vm_template` - inner join - `cloud`.`guest_os` ON guest_os.id = vm_template.guest_os_id - inner join - `cloud`.`account` ON account.id = vm_template.account_id - inner join - `cloud`.`domain` ON domain.id = account.domain_id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`vm_template_details` ON vm_template_details.template_id = vm_template.id - left join - `cloud`.`vm_template` source_template ON source_template.id = vm_template.source_template_id - left join - `cloud`.`template_store_ref` ON template_store_ref.template_id = vm_template.id and template_store_ref.store_role = 'Image' - left join - `cloud`.`image_store` ON image_store.removed is NULL AND template_store_ref.store_id is not NULL AND image_store.id = template_store_ref.store_id - left join - `cloud`.`template_zone_ref` ON template_zone_ref.template_id = vm_template.id AND template_store_ref.store_id is NULL AND template_zone_ref.removed is null - left join - `cloud`.`data_center` ON (image_store.data_center_id = data_center.id OR template_zone_ref.zone_id = data_center.id) - left join - `cloud`.`launch_permission` ON launch_permission.template_id = vm_template.id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_template.id - and (resource_tags.resource_type = 'Template' or resource_tags.resource_type='ISO'); - INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'midonet.apiserver.address', 'http://localhost:8081', 'Specify the address at which the Midonet API server can be contacted (if using Midonet)'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'midonet.providerrouter.id', 'd7c5e6a3-e2f4-426b-b728-b7ce6a0448e5', 'Specifies the UUID of the Midonet provider router (if using Midonet)'); @@ -1996,7 +842,7 @@ CREATE TABLE `cloud`.`account_vnet_map` ( ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD COLUMN account_vnet_map_id bigint unsigned; ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD CONSTRAINT `fk_op_dc_vnet_alloc__account_vnet_map_id` FOREIGN KEY `fk_op_dc_vnet_alloc__account_vnet_map_id` (`account_vnet_map_id`) REFERENCES `account_vnet_map` (`id`); - + update `cloud`.`vm_template` set state='Allocated' where state is NULL; update `cloud`.`vm_template` set update_count=0 where update_count is NULL; @@ -2100,7 +946,7 @@ CREATE TABLE `cloud`.`vm_disk_statistics` ( CONSTRAINT `fk_vm_disk_statistics__account_id` FOREIGN KEY (`account_id`) REFERENCES `account` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; -insert into `cloud`.`vm_disk_statistics`(data_center_id,account_id,vm_id,volume_id) +insert into `cloud`.`vm_disk_statistics`(data_center_id,account_id,vm_id,volume_id) select volumes.data_center_id, volumes.account_id, vm_instance.id, volumes.id from volumes,vm_instance where vm_instance.vm_type="User" and vm_instance.state<>"Expunging" and volumes.instance_id=vm_instance.id order by vm_instance.id; DROP TABLE IF EXISTS `cloud`.`ovs_providers`; @@ -2166,7 +1012,7 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'manag INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vm.disk.throttling.bytes_write_rate', 0, 'Default disk I/O write rate in bytes per second allowed in User vm\'s disk. '); -- Re-enable foreign key checking, at the end of the upgrade path -SET foreign_key_checks = 1; +SET foreign_key_checks = 1; UPDATE `cloud`.`snapshot_policy` set uuid=id WHERE uuid is NULL; #update shared sg enabled network with not null name in Advance Security Group enabled network @@ -2218,53 +1064,12 @@ CREATE TABLE `cloud`.`external_stratosphere_ssp_credentials` ( ) Engine=InnoDB DEFAULT CHARSET=utf8; -DROP VIEW IF EXISTS `cloud`.`project_view`; -CREATE VIEW `cloud`.`project_view` AS - select - projects.id, - projects.uuid, - projects.name, - projects.display_text, - projects.state, - projects.removed, - projects.created, - projects.project_account_id, - account.account_name owner, - pacct.account_id, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer - from - `cloud`.`projects` - inner join - `cloud`.`domain` ON projects.domain_id = domain.id - inner join - `cloud`.`project_account` ON projects.id = project_account.project_id - and project_account.account_role = 'Admin' - inner join - `cloud`.`account` ON account.id = project_account.account_id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = projects.id - and resource_tags.resource_type = 'Project' - left join - `cloud`.`project_account` pacct ON projects.id = pacct.project_id; INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.max.conn', '4096', 'Load Balancer(haproxy) maximum number of concurrent connections(global max)'); ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `concurrent_connections` int(10) unsigned COMMENT 'Load Balancer(haproxy) maximum number of concurrent connections(global max)'; - + ALTER TABLE `cloud`.`sync_queue` MODIFY `queue_size` smallint(6) NOT NULL DEFAULT '0' COMMENT 'number of items being processed by the queue'; ALTER TABLE `cloud`.`sync_queue` MODIFY `queue_size_limit` smallint(6) NOT NULL DEFAULT '1' COMMENT 'max number of items the queue can process concurrently'; @@ -2277,16 +1082,6 @@ ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `virtual_size` bigint unsigne INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'kvm.ssh.to.agent', 'true', 'Specify whether or not the management server is allowed to SSH into KVM Agents'); -#update the account_vmstats_view - count only user vms -DROP VIEW IF EXISTS `cloud`.`account_vmstats_view`; -CREATE VIEW `cloud`.`account_vmstats_view` AS - SELECT - account_id, state, count(*) as vmcount - from - `cloud`.`vm_instance` - where - vm_type = 'User' - group by account_id , state; INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'network.loadbalancer.haproxy.max.conn', '4096', 'Load Balancer(haproxy) maximum number of concurrent connections(global max)'); @@ -2326,45 +1121,4 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Storage', 'DEFAULT', 'manage INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Storage', 'DEFAULT', 'management-server', 'storage.cache.replacement.interval', '86400', 'time interval between cache replacement threads (in seconds).'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'management-server', 'vmware.nested.virtualization', 'false', 'When set to true this will enable nested virtualization when this is supported by the hypervisor'); - -DROP VIEW IF EXISTS `cloud`.`data_center_view`; -CREATE VIEW `cloud`.`data_center_view` AS - select - data_center.id, - data_center.uuid, - data_center.name, - data_center.is_security_group_enabled, - data_center.is_local_storage_enabled, - data_center.description, - data_center.dns1, - data_center.dns2, - data_center.ip6_dns1, - data_center.ip6_dns2, - data_center.internal_dns1, - data_center.internal_dns2, - data_center.guest_network_cidr, - data_center.domain, - data_center.networktype, - data_center.allocation_state, - data_center.zone_token, - data_center.dhcp_provider, - data_center.removed, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path, - dedicated_resources.affinity_group_id, - dedicated_resources.account_id, - affinity_group.uuid affinity_group_uuid - from - `cloud`.`data_center` - left join - `cloud`.`domain` ON data_center.domain_id = domain.id - left join - `cloud`.`dedicated_resources` ON data_center.id = dedicated_resources.data_center_id - left join - `cloud`.`affinity_group` ON dedicated_resources.affinity_group_id = affinity_group.id; - - - UPDATE `cloud`.`ntwk_offering_service_map` SET Provider='VpcVirtualRouter' WHERE network_offering_id IN (SELECT id from `cloud`.`network_offerings` WHERE name IN ('DefaultIsolatedNetworkOfferingForVpcNetworks', 'DefaultIsolatedNetworkOfferingForVpcNetworksNoLB')); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-410to420-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_2_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-410to420-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_2_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/V4_2_1_0__upgrade.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_2_1_0__upgrade.sql new file mode 100644 index 000000000000..a7f228122afe --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_2_1_0__upgrade.sql @@ -0,0 +1,41 @@ +-- 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.2.0 to 4.2.1; +--; + + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 's3.singleupload.max.size', '5', + 'The maximum size limit for S3 single part upload API(in GB). If it is set to 0, then it means always use multi-part upload to upload object to S3. If it is set to -1, then it means always use single-part upload to upload object to S3.'); + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Storage", 'DEFAULT', 'management-server', "enable.ha.storage.migration", "true", "Enable/disable storage migration across primary storage during HA"); +UPDATE `cloud`.`configuration` SET description="Specify whether or not to reserve CPU based on CPU overprovisioning factor" where name="vmware.reserve.cpu"; +UPDATE `cloud`.`configuration` SET description="Specify whether or not to reserve memory based on memory overprovisioning factor" where name="vmware.reserve.mem"; +-- Remove Windows Server 8 from guest_os_type dropdown to use Windows Server 2012 +DELETE FROM `cloud`.`guest_os_hypervisor` where guest_os_id=168; +DELETE FROM `cloud`.`guest_os` where id=168; + +-- Add the format for volumes table for uploaded volumes (CLOUDSTACK-5013) +UPDATE `cloud`.`volumes` v, `cloud`.`volume_host_ref` vhr set v.format=vhr.format where v.id=vhr.volume_id and v.format is null; + + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'baremetal.ipmi.lan.interface', 'default', 'option specified in -I option of impitool. candidates are: open/bmc/lipmi/lan/lanplus/free/imb, see ipmitool man page for details. default valule "default" means using default option of ipmitool'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'baremetal.ipmi.fail.retry', 'default', "ipmi interface will be temporary out of order after power opertions(e.g. cycle, on), it leads following commands fail immediately. The value specifies retry times before accounting it as real failure"); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vmware.hung.wokervm.timeout', '7200', 'Worker VM timeout in seconds'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Alert", 'DEFAULT', 'management-server', "alert.smtp.connectiontimeout", "30000", "Socket connection timeout value in milliseconds. -1 for infinite timeout."); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Alert", 'DEFAULT', 'management-server', "alert.smtp.timeout", "30000", "Socket I/O timeout value in milliseconds. -1 for infinite timeout."); diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/V4_3_0_0__upgrade.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_3_0_0__upgrade.sql new file mode 100644 index 000000000000..cf38f401a1e0 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_3_0_0__upgrade.sql @@ -0,0 +1,391 @@ +-- 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.2.1 to 4.3.0; +--; + +-- Disable foreign key checking +SET foreign_key_checks = 0; + +ALTER TABLE `cloud`.`async_job` ADD COLUMN `related` CHAR(40) NOT NULL; +ALTER TABLE `cloud`.`async_job` DROP COLUMN `session_key`; +ALTER TABLE `cloud`.`async_job` DROP COLUMN `job_cmd_originator`; +ALTER TABLE `cloud`.`async_job` DROP COLUMN `callback_type`; +ALTER TABLE `cloud`.`async_job` DROP COLUMN `callback_address`; + +ALTER TABLE `cloud`.`async_job` ADD COLUMN `job_type` VARCHAR(32); +ALTER TABLE `cloud`.`async_job` ADD COLUMN `job_dispatcher` VARCHAR(64); +ALTER TABLE `cloud`.`async_job` ADD COLUMN `job_executing_msid` bigint; +ALTER TABLE `cloud`.`async_job` ADD COLUMN `job_pending_signals` int(10) NOT NULL DEFAULT 0; + +ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `keep_alive_enabled` int(1) unsigned NOT NULL DEFAULT 1 COMMENT 'true if connection should be reset after requests.'; + +ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `power_state` VARCHAR(74) DEFAULT 'PowerUnknown'; +ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `power_state_update_time` DATETIME; +ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `power_state_update_count` INT DEFAULT 0; +ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `power_host` bigint unsigned; +ALTER TABLE `cloud`.`vm_instance` ADD CONSTRAINT `fk_vm_instance__power_host` FOREIGN KEY (`power_host`) REFERENCES `cloud`.`host`(`id`); + +ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `lb_protocol` VARCHAR(40); + +DROP TABLE IF EXISTS `cloud`.`vm_snapshot_details`; +CREATE TABLE `cloud`.`vm_snapshot_details` ( + `id` bigint unsigned UNIQUE NOT NULL AUTO_INCREMENT, + `vm_snapshot_id` bigint unsigned NOT NULL, + `name` varchar(255) NOT NULL, + `value` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +DROP TABLE IF EXISTS `cloud`.`snapshot_details`; +CREATE TABLE `cloud`.`snapshot_details` ( + `id` bigint unsigned UNIQUE NOT NULL AUTO_INCREMENT, + `snapshot_id` bigint unsigned NOT NULL, + `name` varchar(255) NOT NULL, + `value` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`vm_work_job` ( + `id` bigint unsigned UNIQUE NOT NULL, + `step` char(32) NOT NULL COMMENT 'state', + `vm_type` char(32) NOT NULL COMMENT 'type of vm', + `vm_instance_id` bigint unsigned NOT NULL COMMENT 'vm instance', + PRIMARY KEY (`id`), + CONSTRAINT `fk_vm_work_job__instance_id` FOREIGN KEY (`vm_instance_id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE, + INDEX `i_vm_work_job__vm`(`vm_type`, `vm_instance_id`), + INDEX `i_vm_work_job__step`(`step`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`async_job_journal` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `job_id` bigint unsigned NOT NULL, + `journal_type` varchar(32), + `journal_text` varchar(1024) COMMENT 'journal descriptive informaton', + `journal_obj` varchar(1024) COMMENT 'journal strutural information, JSON encoded object', + `created` datetime NOT NULL COMMENT 'date created', + PRIMARY KEY (`id`), + CONSTRAINT `fk_async_job_journal__job_id` FOREIGN KEY (`job_id`) REFERENCES `async_job`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`async_job_join_map` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `job_id` bigint unsigned NOT NULL, + `join_job_id` bigint unsigned NOT NULL, + `join_status` int NOT NULL, + `join_result` varchar(1024), + `join_msid` bigint, + `complete_msid` bigint, + `sync_source_id` bigint COMMENT 'upper-level job sync source info before join', + `wakeup_handler` varchar(64), + `wakeup_dispatcher` varchar(64), + `wakeup_interval` bigint NOT NULL DEFAULT 3000 COMMENT 'wakeup interval in seconds', + `created` datetime NOT NULL, + `last_updated` datetime, + `next_wakeup` datetime, + `expiration` datetime, + PRIMARY KEY (`id`), + CONSTRAINT `fk_async_job_join_map__job_id` FOREIGN KEY (`job_id`) REFERENCES `async_job`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_async_job_join_map__join_job_id` FOREIGN KEY (`join_job_id`) REFERENCES `async_job`(`id`), + CONSTRAINT `fk_async_job_join_map__join` UNIQUE (`job_id`, `join_job_id`), + INDEX `i_async_job_join_map__join_job_id`(`join_job_id`), + INDEX `i_async_job_join_map__created`(`created`), + INDEX `i_async_job_join_map__last_updated`(`last_updated`), + INDEX `i_async_job_join_map__next_wakeup`(`next_wakeup`), + INDEX `i_async_job_join_map__expiration`(`expiration`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +#realhostip changes, before changing table and adding default value +UPDATE `cloud`.`configuration` SET value=CONCAT("*.",value) WHERE `name`="consoleproxy.url.domain" OR `name`="secstorage.ssl.cert.domain"; + +ALTER TABLE `cloud`.`configuration` ADD COLUMN `default_value` VARCHAR(4095) COMMENT 'Default value for a configuration parameter'; +ALTER TABLE `cloud`.`configuration` ADD COLUMN `updated` datetime COMMENT 'Time this was updated by the server. null means this row is obsolete.'; +ALTER TABLE `cloud`.`configuration` ADD COLUMN `scope` VARCHAR(255) DEFAULT NULL COMMENT 'Can this parameter be scoped'; +ALTER TABLE `cloud`.`configuration` ADD COLUMN `is_dynamic` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Can the parameter be change dynamically without restarting the server'; + +UPDATE `cloud`.`configuration` SET `default_value` = `value`; + +#Upgrade the offerings and template table to have actual remove and states +ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `state` CHAR(40) NOT NULL DEFAULT 'Active' COMMENT 'state for disk offering'; +ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `hv_ss_reserve` int(32) unsigned DEFAULT NULL COMMENT 'Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)'; + +ALTER TABLE `cloud`.`volumes` ADD COLUMN `hv_ss_reserve` int(32) unsigned DEFAULT NULL COMMENT 'Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)'; + +UPDATE `cloud`.`disk_offering` SET `state`='Inactive' WHERE `removed` IS NOT NULL; +UPDATE `cloud`.`disk_offering` SET `removed`=NULL; + +UPDATE `cloud`.`vm_template` SET `guest_os_id`= "142" WHERE `id` = "5"; +UPDATE `cloud`.`vm_template` SET `state`='Inactive' WHERE `removed` IS NOT NULL; +UPDATE `cloud`.`vm_template` SET `state`='Active' WHERE `removed` IS NULL; +UPDATE `cloud`.`vm_template` SET `removed`=NULL; + +ALTER TABLE `cloud`.`remote_access_vpn` MODIFY COLUMN `network_id` bigint unsigned; +ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `vpc_id` bigint unsigned default NULL; + +ALTER TABLE `cloud`.`s2s_vpn_connection` ADD COLUMN `passive` int(1) unsigned NOT NULL DEFAULT 0; + +CREATE TABLE `sslcerts` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(40) DEFAULT NULL, + `account_id` bigint(20) unsigned NOT NULL, + `domain_id` bigint(20) unsigned NOT NULL, + `certificate` text NOT NULL, + `fingerprint` varchar(62) NOT NULL, + `key` text NOT NULL, + `chain` text, + `password` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_sslcert__account_id` FOREIGN KEY (`account_id`) REFERENCES `account` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_sslcert__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`) ON DELETE CASCADE +); + +CREATE TABLE `load_balancer_cert_map` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(40) DEFAULT NULL, + `load_balancer_id` bigint(20) unsigned NOT NULL, + `certificate_id` bigint(20) unsigned NOT NULL, + `revoke` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + CONSTRAINT `fk_load_balancer_cert_map__certificate_id` FOREIGN KEY (`certificate_id`) REFERENCES `sslcerts` (`id`) ON DELETE CASCADE, + CONSTRAINT `fk_load_balancer_cert_map__load_balancer_id` FOREIGN KEY (`load_balancer_id`) REFERENCES `load_balancing_rules` (`id`) ON DELETE CASCADE); + +ALTER TABLE `cloud`.`host` ADD COLUMN `cpu_sockets` int(10) unsigned DEFAULT NULL COMMENT "the number of CPU sockets on the host" AFTER pod_id; +ALTER TABLE `cloud`.`physical_network_traffic_types` ADD COLUMN `hyperv_network_label` varchar(255) DEFAULT NULL COMMENT 'The network name label of the physical device dedicated to this traffic on a HyperV host'; + +CREATE TABLE `cloud`.`firewall_rule_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `firewall_rule_id` bigint unsigned NOT NULL COMMENT 'Firewall rule id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_firewall_rule_details__firewall_rule_id` FOREIGN KEY `fk_firewall_rule_details__firewall_rule_id`(`firewall_rule_id`) REFERENCES `firewall_rules`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +ALTER TABLE `cloud`.`data_center_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; +ALTER TABLE `cloud`.`network_details` CHANGE `display_detail` `display` tinyint(0) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; +ALTER TABLE `cloud`.`vm_template_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; +ALTER TABLE `cloud`.`volume_details` CHANGE `display_detail` `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; +ALTER TABLE `cloud`.`nic_details` CHANGE `display_detail` `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; +ALTER TABLE `cloud`.`user_vm_details` CHANGE `display_detail` `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; +ALTER TABLE `cloud`.`service_offering_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; +ALTER TABLE `cloud`.`storage_pool_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; + +UPDATE `cloud`.`configuration` SET name='ldap.basedn' WHERE name='ldap.searchbase'; +UPDATE `cloud`.`configuration` SET name='ldap.bind.principal' WHERE name='ldap.dn' ; +UPDATE `cloud`.`configuration` SET name='ldap.bind.password' WHERE name='ldap.passwd'; +UPDATE `cloud`.`configuration` SET name='ldap.truststore.password' WHERE name='ldap.truststorepass' ; + +INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.bind.principal', NULL, 'Specifies the bind principal to use for bind to LDAP', NULL) ON DUPLICATE KEY UPDATE category='Secure'; +INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.bind.password', NULL, 'Specifies the password to use for binding to LDAP', NULL) ON DUPLICATE KEY UPDATE category='Secure'; +INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.basedn', NULL, 'Sets the basedn for LDAP', NULL) ON DUPLICATE KEY UPDATE category='Secure'; +INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.search.group.principle', NULL, 'Sets the principle of the group that users must be a member of', NULL) ON DUPLICATE KEY UPDATE category='Secure'; +INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.truststore', NULL, 'Sets the path to the truststore to use for LDAP SSL', NULL) ON DUPLICATE KEY UPDATE category='Secure'; +INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.truststore.password', NULL, 'Sets the password for the truststore', NULL) ON DUPLICATE KEY UPDATE category='Secure'; + +CREATE TABLE `cloud`.`ldap_configuration` ( + `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', + `hostname` varchar(255) NOT NULL COMMENT 'the hostname of the ldap server', + `port` int(10) COMMENT 'port that the ldap server is listening on', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +UPDATE `cloud`.`volumes` SET display_volume=1 where id>0; + +create table `cloud`.`monitoring_services` ( +`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', +`uuid` varchar(40), `service` varchar(255) COMMENT 'Service name', +`process_name` varchar(255) COMMENT 'running process name', +`service_name` varchar(255) COMMENT 'exact name of the running service', +`service_path` varchar(255) COMMENT 'path of the service in system', +`pidfile` varchar(255) COMMENT 'path of the pid file of the service', +`isDefault` boolean COMMENT 'Default service', PRIMARY KEY (`id`) +); + +insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(1, UUID(), 'ssh','sshd', 'ssh','/etc/init.d/ssh','/var/run/sshd.pid',true); +insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(2, UUID(), 'dhcp','dnsmasq','dnsmasq','/etc/init.d/dnsmasq','/var/run/dnsmasq/dnsmasq.pid',false); +insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(3, UUID(), 'loadbalancing','haproxy','haproxy','/etc/init.d/haproxy','/var/run/haproxy.pid',false); +insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(4, UUID(), 'webserver','apache2','apache2','/etc/init.d/apache2','/var/run/apache2.pid', true); + +ALTER TABLE `cloud`.`service_offering` CHANGE COLUMN `cpu` `cpu` INT(10) UNSIGNED NULL COMMENT '# of cores' , CHANGE COLUMN `speed` `speed` INT(10) UNSIGNED NULL COMMENT 'speed per core in mhz' , CHANGE COLUMN `ram_size` `ram_size` BIGINT(20) UNSIGNED NULL ; + +CREATE TABLE `cloud`.`usage_event_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `usage_event_id` bigint unsigned NOT NULL COMMENT 'usage event id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_usage_event_details__usage_event_id` FOREIGN KEY `fk_usage_event_details__usage_event_id`(`usage_event_id`) REFERENCES `usage_event`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud_usage`.`usage_event_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `usage_event_id` bigint unsigned NOT NULL COMMENT 'usage event id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_usage_event_details__usage_event_id` FOREIGN KEY `fk_usage_event_details__usage_event_id`(`usage_event_id`) REFERENCES `usage_event`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`user_ip_address_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `user_ip_address_id` bigint unsigned NOT NULL COMMENT 'User ip address id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_user_ip_address_details__user_ip_address_id` FOREIGN KEY `fk_user_ip_address_details__user_ip_address_id`(`user_ip_address_id`) REFERENCES `user_ip_address`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`remote_access_vpn_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `remote_access_vpn_id` bigint unsigned NOT NULL COMMENT 'Remote access vpn id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_remote_access_vpn_details__remote_access_vpn_id` FOREIGN KEY `fk_remote_access_vpn_details__remote_access_vpn_id`(`remote_access_vpn_id`) REFERENCES `remote_access_vpn`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'management-server', "vmware.vcenter.session.timeout", "1200", "VMware client timeout in seconds", "1200", NULL,NULL,0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'management-server', "mgt.server.vendor", "ACS", "the vendor of management server", "ACS", NULL,NULL,0); +Update `cloud`.`configuration` set `component` = "VolumeOrchestrationService", `scope` = "Global" where `name`="custom.diskoffering.size.max"; +Update `cloud`.`configuration` set `component` = "VolumeOrchestrationService", `scope` = "Global" where `name`="custom.diskoffering.size.min"; + +ALTER TABLE `cloud_usage`.`usage_vm_instance` ADD COLUMN `cpu_speed` INT(10) UNSIGNED NULL COMMENT 'speed per core in Mhz', + ADD COLUMN `cpu_cores` INT(10) UNSIGNED NULL COMMENT 'number of cpu cores', + ADD COLUMN `memory` INT(10) UNSIGNED NULL COMMENT 'memory in MB'; + +CREATE TABLE `cloud`.`vpc_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `vpc_id` bigint unsigned NOT NULL COMMENT 'VPC id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_vpc_details__vpc_id` FOREIGN KEY `fk_vpc_details__vpc_id`(`vpc_id`) REFERENCES `vpc`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `cloud`.`vpc_gateway_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `vpc_gateway_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_vpc_gateway_details__vpc_gateway_id` FOREIGN KEY `fk_vpc_gateway_details__vpc_gateway_id`(`vpc_gateway_id`) REFERENCES `vpc_gateways`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`network_acl_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `network_acl_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_network_acl_details__network_acl_id` FOREIGN KEY `fk_network_acl_details__network_acl_id`(`network_acl_id`) REFERENCES `network_acl`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE `cloud`.`network_acl_item_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `network_acl_item_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_network_acl_item_details__network_acl_item_id` FOREIGN KEY `fk_network_acl_item_details__network_acl_item_id`(`network_acl_item_id`) REFERENCES `network_acl_item`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +ALTER TABLE `cloud`.`alert` ADD COLUMN `name` varchar(255) DEFAULT NULL COMMENT 'name of the alert'; + +UPDATE `cloud`.`hypervisor_capabilities` SET `max_data_volumes_limit`=13 WHERE `hypervisor_type`='Vmware'; +INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, storage_motion_supported) VALUES (UUID(), 'Hyperv', '6.2', 1024, 0, 64, 0); + +ALTER TABLE `cloud`.`external_load_balancer_devices` ADD COLUMN `is_exclusive_gslb_provider` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if load balancer appliance is acting exclusively as gslb service provider in the zone and can not be used for LB'; + +DELETE FROM `cloud`.`configuration` WHERE `name` IN ("xen.update.url", "update.check.interval", "baremetal_dhcp_devices", "host.updates.enable"); + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSnapshotManager', "vmsnapshot.create.wait", "1800", "In second, timeout for create vm snapshot", NULL, NULL,NULL,0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSnapshotManager', "vmsnapshot.max", "10", "Maximum vm snapshots for a vm", NULL, NULL,NULL,0); + +UPDATE `cloud`.`configuration` SET `component` = 'VMSnapshotManager' WHERE `name` IN ("vmsnapshot.create.wait", "vmsnapshot.max"); + +CREATE TABLE `cloud`.`s2s_vpn_gateway_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `s2s_vpn_gateway_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_s2s_vpn_gateway_details__s2s_vpn_gateway_id` FOREIGN KEY `fk_s2s_vpn_gateway_details__s2s_vpn_gateway_id`(`s2s_vpn_gateway_id`) REFERENCES `s2s_vpn_gateway`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Hidden', 'DEFAULT', 'management-server', 'hyperv.guest.network.device', null, 'Specify the virtual switch on host for guest network', NULL, NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Hidden', 'DEFAULT', 'management-server', 'hyperv.private.network.device', null, 'Specify the virtual switch on host for private network', NULL, NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Hidden', 'DEFAULT', 'management-server', 'hyperv.public.network.device', null, 'Specify the public virtual switch on host for public network', NULL, NULL, NULL, 0); + +DELETE FROM `cloud`.`configuration` WHERE `name` IN ("xen.update.url", "update.check.interval", "baremetal_dhcp_devices", "host.updates.enable"); + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSnapshotManager', "vmsnapshot.create.wait", "1800", "In second, timeout for create vm snapshot", NULL, NULL,NULL,0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSnapshotManager', "vmsnapshot.max", "10", "Maximum vm snapshots for a vm", NULL, NULL,NULL,0); + +INSERT IGNORE INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, state) + VALUES (9, UUID(), 'routing-9', 'SystemVM Template (HyperV)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloudstack.org/templates/4.3/systemvm64template-2013-12-23-hyperv.vhd.bz2', '5df45ee6ebe1b703a8805f4e1f4d0818', 0, 'SystemVM Template (HyperV)', 'VHD', 15, 0, 1, 'Hyperv', 'Active' ); + +UPDATE `cloud`.`vm_template` SET `bits` = "64", `url` = "http://download.cloudstack.org/templates/4.3/systemvm64template-2013-12-23-hyperv.vhd.bz2", `state` = "Active", `checksum` = "5df45ee6ebe1b703a8805f4e1f4d0818" WHERE `id` = "9"; + +INSERT IGNORE INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable, state) + VALUES (6, UUID(), 'centos64-x64', 'CentOS 6.4(64-bit) GUI (Hyperv)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloudstack.org/releases/4.3/centos6_4_64bit.vhd.bz2', 'eef6b9940ea3ed01221d963d4a012d0a', 0, 'CentOS 6.4 (64-bit) GUI (Hyperv)', 'VHD', 182, 1, 1, 'Hyperv', 1, 'Active'); + +UPDATE `cloud`.`configuration` SET `component` = 'VMSnapshotManager' WHERE `name` IN ("vmsnapshot.create.wait", "vmsnapshot.max"); + +CREATE TABLE `cloud`.`s2s_customer_gateway_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `s2s_customer_gateway_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_s2s_customer_gateway_details__s2s_customer_gateway_id` FOREIGN KEY `fk_s2s_customer_gateway_details__s2s_customer_gateway_id`(`s2s_customer_gateway_id`) REFERENCES `s2s_customer_gateway`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `cloud`.`s2s_vpn_connection_details` ( + `id` bigint unsigned NOT NULL auto_increment, + `s2s_vpn_connection_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', + `name` varchar(255) NOT NULL, + `value` varchar(1024) NOT NULL, + `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', + PRIMARY KEY (`id`), + CONSTRAINT `fk_s2s_vpn_connection_details__s2s_vpn_connection_id` FOREIGN KEY `fk_s2s_vpn_connection_details__s2s_vpn_connection_id`(`s2s_vpn_connection_id`) REFERENCES `s2s_vpn_connection`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE `cloud`.`vm_instance` DROP COLUMN `cpu`; +ALTER TABLE `cloud`.`vm_instance` DROP COLUMN `ram`; +ALTER TABLE `cloud`.`vm_instance` DROP COLUMN `speed`; + +INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported, vm_snapshot_enabled) VALUES (UUID(), 'VMware', '5.5', 128, 0, 13, 32, 1, 1); + +ALTER TABLE `cloud`.`network_acl_item` modify `cidr` varchar(2048); + +INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (168, UUID(), 6, 'Windows Server 2012 R2 (64-bit)'); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows Server 2012 R2 (64-bit)', 168); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Windows Server 2012 R2 (64-bit)', 168); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-421to430-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_3_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-421to430-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_3_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-430to440.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_0_0__upgrade.sql similarity index 95% rename from engine/schema/src/main/resources/META-INF/db/schema-430to440.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_0_0__upgrade.sql index ec10a3a70367..6be16f1b9820 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-430to440.sql +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_0_0__upgrade.sql @@ -28,209 +28,6 @@ UPDATE `cloud`.`hypervisor_capabilities` set max_guests_limit='150' WHERE hyperv UPDATE `cloud`.`hypervisor_capabilities` set max_guests_limit='500' WHERE hypervisor_version='6.2.0'; UPDATE `cloud`.`hypervisor_capabilities` set storage_motion_supported='1' WHERE hypervisor_version='6.2' AND hypervisor_type="Hyperv"; -DROP VIEW IF EXISTS `cloud`.`disk_offering_view`; -CREATE VIEW `cloud`.`disk_offering_view` AS - select - disk_offering.id, - disk_offering.uuid, - disk_offering.name, - disk_offering.display_text, - disk_offering.disk_size, - disk_offering.min_iops, - disk_offering.max_iops, - disk_offering.created, - disk_offering.tags, - disk_offering.customized, - disk_offering.customized_iops, - disk_offering.removed, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.hv_ss_reserve, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.cache_mode, - disk_offering.sort_key, - disk_offering.type, - disk_offering.display_offering, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`disk_offering` - left join - `cloud`.`domain` ON disk_offering.domain_id = domain.id - where - disk_offering.state='ACTIVE'; - -DROP VIEW IF EXISTS `cloud`.`service_offering_view`; -CREATE VIEW `cloud`.`service_offering_view` AS - select - service_offering.id, - disk_offering.uuid, - disk_offering.name, - disk_offering.display_text, - disk_offering.created, - disk_offering.tags, - disk_offering.removed, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.customized_iops, - disk_offering.min_iops, - disk_offering.max_iops, - disk_offering.hv_ss_reserve, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.cache_mode, - service_offering.cpu, - service_offering.speed, - service_offering.ram_size, - service_offering.nw_rate, - service_offering.mc_rate, - service_offering.ha_enabled, - service_offering.limit_cpu_use, - service_offering.host_tag, - service_offering.default_use, - service_offering.vm_type, - service_offering.sort_key, - service_offering.is_volatile, - service_offering.deployment_planner, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`service_offering` - inner join - `cloud`.`disk_offering` ON service_offering.id = disk_offering.id - left join - `cloud`.`domain` ON disk_offering.domain_id = domain.id - where - disk_offering.state='Active'; - -DROP VIEW IF EXISTS `cloud`.`volume_view`; -CREATE VIEW `cloud`.`volume_view` AS - select - volumes.id, - volumes.uuid, - volumes.name, - volumes.device_id, - volumes.volume_type, - volumes.size, - volumes.min_iops, - volumes.max_iops, - volumes.created, - volumes.state, - volumes.attached, - volumes.removed, - volumes.pod_id, - volumes.display_volume, - volumes.format, - volumes.path, - volumes.chain_info, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - vm_instance.id vm_id, - vm_instance.uuid vm_uuid, - vm_instance.name vm_name, - vm_instance.state vm_state, - vm_instance.vm_type, - user_vm.display_name vm_display_name, - volume_store_ref.size volume_store_size, - volume_store_ref.download_pct, - volume_store_ref.download_state, - volume_store_ref.error_str, - volume_store_ref.created created_on_store, - disk_offering.id disk_offering_id, - disk_offering.uuid disk_offering_uuid, - disk_offering.name disk_offering_name, - disk_offering.display_text disk_offering_display_text, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.cache_mode, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.name pool_name, - cluster.hypervisor_type, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.extractable, - vm_template.type template_type, - vm_template.name template_name, - vm_template.display_text template_display_text, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`volumes` - inner join - `cloud`.`account` ON volumes.account_id = account.id - inner join - `cloud`.`domain` ON volumes.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON volumes.data_center_id = data_center.id - left join - `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id - left join - `cloud`.`user_vm` ON user_vm.id = vm_instance.id - left join - `cloud`.`volume_store_ref` ON volumes.id = volume_store_ref.volume_id - left join - `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`vm_template` ON volumes.template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = volumes.iso_id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id - and resource_tags.resource_type = 'Volume' - left join - `cloud`.`async_job` ON async_job.instance_id = volumes.id - and async_job.instance_type = 'Volume' - and async_job.job_status = 0; - UPDATE `cloud`.`configuration` SET `description` = 'If set to true, StartCommand, StopCommand, CopyCommand, MigrateCommand will be synchronized on the agent side. If set to false, these commands become asynchronous. Default value is true.' WHERE `name` = 'execute.in.sequence.hypervisor.commands'; ALTER TABLE `cloud`.`disk_offering_details` CHANGE `display_detail` `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; @@ -256,211 +53,6 @@ CREATE TABLE `cloud`.`external_opendaylight_controllers` ( CONSTRAINT `fk_external_opendaylight_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE VIEW `cloud`.`user_vm_view` AS - select - vm_instance.id id, - vm_instance.name name, - user_vm.display_name display_name, - user_vm.user_data user_data, - 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, - instance_group.id instance_group_id, - instance_group.uuid instance_group_uuid, - instance_group.name instance_group_name, - vm_instance.uuid uuid, - vm_instance.last_host_id last_host_id, - vm_instance.vm_type type, - vm_instance.vnc_password vnc_password, - vm_instance.limit_cpu_use limit_cpu_use, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.ha_enabled ha_enabled, - vm_instance.hypervisor_type hypervisor_type, - vm_instance.instance_name instance_name, - vm_instance.guest_os_id guest_os_id, - vm_instance.display_vm display_vm, - guest_os.uuid guest_os_uuid, - vm_instance.pod_id pod_id, - host_pod_ref.uuid pod_uuid, - vm_instance.private_ip_address private_ip_address, - vm_instance.private_mac_address private_mac_address, - vm_instance.vm_type vm_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.is_security_group_enabled security_group_enabled, - data_center.networktype data_center_type, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.name template_name, - vm_template.display_text template_display_text, - vm_template.enable_password password_enabled, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - service_offering.id service_offering_id, - svc_disk_offering.uuid service_offering_uuid, - disk_offering.uuid disk_offering_uuid, - disk_offering.id disk_offering_id, - Case - When (`cloud`.`service_offering`.`cpu` is null) then (`custom_cpu`.`value`) - Else ( `cloud`.`service_offering`.`cpu`) - End as `cpu`, - Case - When (`cloud`.`service_offering`.`speed` is null) then (`custom_speed`.`value`) - Else ( `cloud`.`service_offering`.`speed`) - End as `speed`, - Case - When (`cloud`.`service_offering`.`ram_size` is null) then (`custom_ram_size`.`value`) - Else ( `cloud`.`service_offering`.`ram_size`) - END as `ram_size`, - svc_disk_offering.name service_offering_name, - disk_offering.name disk_offering_name, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.pool_type pool_type, - volumes.id volume_id, - volumes.uuid volume_uuid, - volumes.device_id volume_device_id, - volumes.volume_type volume_type, - security_group.id security_group_id, - security_group.uuid security_group_uuid, - security_group.name security_group_name, - security_group.description security_group_description, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - user_ip_address.id public_ip_id, - user_ip_address.uuid public_ip_uuid, - user_ip_address.public_ip_address public_ip_address, - ssh_keypairs.keypair_name keypair_name, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - affinity_group.id affinity_group_id, - affinity_group.uuid affinity_group_uuid, - affinity_group.name affinity_group_name, - affinity_group.description affinity_group_description, - vm_instance.dynamically_scalable dynamically_scalable, - all_details.name detail_name, - all_details.value detail_value - - from - `cloud`.`user_vm` - inner join - `cloud`.`vm_instance` ON vm_instance.id = user_vm.id - and vm_instance.removed is NULL - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id - left join - `cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = user_vm.iso_id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` svc_disk_offering ON vm_instance.service_offering_id = svc_disk_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.disk_offering_id = disk_offering.id - left join - `cloud`.`volumes` ON vm_instance.id = volumes.instance_id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id - left join - `cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON networks.vpc_id = vpc.id and vpc.removed is null - left join - `cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` as ssh_details ON ssh_details.vm_id = vm_instance.id - and ssh_details.name = 'SSH.PublicKey' - left join - `cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = ssh_details.value - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id - and resource_tags.resource_type = 'UserVm' - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'VirtualMachine' - and async_job.job_status = 0 - left join - `cloud`.`affinity_group_vm_map` ON vm_instance.id = affinity_group_vm_map.instance_id - left join - `cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id - left join - `cloud`.`user_vm_details` as all_details ON all_details.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_cpu`.`name` = 'CpuNumber'))) - left join - `cloud`.`user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_speed`.`name` = 'CpuSpeed'))) - left join - `cloud`.`user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_ram_size`.`name` = 'memory'))); - ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `cpu_speed` INT(10) UNSIGNED NULL COMMENT 'speed per core in Mhz', ADD COLUMN `cpu_cores` INT(10) UNSIGNED NULL COMMENT 'number of cpu cores', ADD COLUMN `memory` INT(10) UNSIGNED NULL COMMENT 'memory in MB'; @@ -697,46 +289,6 @@ CREATE TABLE `cloud`.`op_router_monitoring_services` ( ALTER TABLE `cloud`.`event` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'True if the detail can be displayed to the end user'; -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, - event.display, - 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; DROP TABLE IF EXISTS `cloud`.`host_gpu_groups`; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-430to440-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_0_3__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-430to440-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_0_3__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-440to441.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_1_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-440to441.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_1_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-440to441-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_1_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-440to441-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_1_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-441to442.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_2_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-441to442.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_2_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-443to444.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_4_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-443to444.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_4_4_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-442to450.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_0_0__upgrade.sql similarity index 68% rename from engine/schema/src/main/resources/META-INF/db/schema-442to450.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_0_0__upgrade.sql index 5f9fff5ff95d..aa5fdab40447 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-442to450.sql +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_0_0__upgrade.sql @@ -22,17 +22,6 @@ -- Disable foreign key checking -- SET foreign_key_checks = 0; -DROP VIEW IF EXISTS `cloud`.`storage_tag_view`; -CREATE VIEW `cloud`.`storage_tag_view` AS - select - storage_pool_details.id, - storage_pool_details.pool_id, - storage_pool_details.name - from - `cloud`.`storage_pool_details` - where - value='true'; - ALTER TABLE `cloud`.`volumes` ADD COLUMN `provisioning_type` VARCHAR(32) NOT NULL DEFAULT 'thin' COMMENT 'pre allocation setting of the volume'; ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `provisioning_type` VARCHAR(32) NOT NULL DEFAULT 'thin' COMMENT 'pre allocation setting of the volume'; @@ -47,44 +36,6 @@ ALTER TABLE `cloud`.`load_balancing_rules` MODIFY `id` bigint unsigned AUTO_INCR ALTER TABLE `cloud`.`port_forwarding_rules` MODIFY `id` bigint unsigned AUTO_INCREMENT NOT NULL; SET foreign_key_checks = 1; -DROP VIEW IF EXISTS `cloud`.`disk_offering_view`; -CREATE VIEW `cloud`.`disk_offering_view` AS - select - disk_offering.id, - disk_offering.uuid, - disk_offering.name, - disk_offering.display_text, - disk_offering.provisioning_type, - disk_offering.disk_size, - disk_offering.min_iops, - disk_offering.max_iops, - disk_offering.created, - disk_offering.tags, - disk_offering.customized, - disk_offering.customized_iops, - disk_offering.removed, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.hv_ss_reserve, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.cache_mode, - disk_offering.sort_key, - disk_offering.type, - disk_offering.display_offering, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`disk_offering` - left join - `cloud`.`domain` ON disk_offering.domain_id = domain.id - where - disk_offering.state='ACTIVE'; - DROP TABLE IF EXISTS `cloud`.`external_nuage_vsp_devices`; CREATE TABLE `cloud`.`external_nuage_vsp_devices` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', @@ -98,174 +49,6 @@ CREATE TABLE `cloud`.`external_nuage_vsp_devices` ( CONSTRAINT `fk_external_nuage_vsp_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -DROP VIEW IF EXISTS `cloud`.`service_offering_view`; -CREATE VIEW `cloud`.`service_offering_view` AS - select - service_offering.id, - disk_offering.uuid, - disk_offering.name, - disk_offering.display_text, - disk_offering.provisioning_type, - disk_offering.created, - disk_offering.tags, - disk_offering.removed, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.customized_iops, - disk_offering.min_iops, - disk_offering.max_iops, - disk_offering.hv_ss_reserve, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.cache_mode, - service_offering.cpu, - service_offering.speed, - service_offering.ram_size, - service_offering.nw_rate, - service_offering.mc_rate, - service_offering.ha_enabled, - service_offering.limit_cpu_use, - service_offering.host_tag, - service_offering.default_use, - service_offering.vm_type, - service_offering.sort_key, - service_offering.is_volatile, - service_offering.deployment_planner, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`service_offering` - inner join - `cloud`.`disk_offering` ON service_offering.id = disk_offering.id - left join - `cloud`.`domain` ON disk_offering.domain_id = domain.id - where - disk_offering.state='Active'; - -DROP VIEW IF EXISTS `cloud`.`volume_view`; -CREATE VIEW `cloud`.`volume_view` AS - select - volumes.id, - volumes.uuid, - volumes.name, - volumes.device_id, - volumes.volume_type, - volumes.provisioning_type, - volumes.size, - volumes.min_iops, - volumes.max_iops, - volumes.created, - volumes.state, - volumes.attached, - volumes.removed, - volumes.pod_id, - volumes.display_volume, - volumes.format, - volumes.path, - volumes.chain_info, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - vm_instance.id vm_id, - vm_instance.uuid vm_uuid, - vm_instance.name vm_name, - vm_instance.state vm_state, - vm_instance.vm_type, - user_vm.display_name vm_display_name, - volume_store_ref.size volume_store_size, - volume_store_ref.download_pct, - volume_store_ref.download_state, - volume_store_ref.error_str, - volume_store_ref.created created_on_store, - disk_offering.id disk_offering_id, - disk_offering.uuid disk_offering_uuid, - disk_offering.name disk_offering_name, - disk_offering.display_text disk_offering_display_text, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.cache_mode, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.name pool_name, - cluster.hypervisor_type, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.extractable, - vm_template.type template_type, - vm_template.name template_name, - vm_template.display_text template_display_text, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`volumes` - inner join - `cloud`.`account` ON volumes.account_id = account.id - inner join - `cloud`.`domain` ON volumes.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON volumes.data_center_id = data_center.id - left join - `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id - left join - `cloud`.`user_vm` ON user_vm.id = vm_instance.id - left join - `cloud`.`volume_store_ref` ON volumes.id = volume_store_ref.volume_id - left join - `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`vm_template` ON volumes.template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = volumes.iso_id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id - and resource_tags.resource_type = 'Volume' - left join - `cloud`.`async_job` ON async_job.instance_id = volumes.id - and async_job.instance_type = 'Volume' - and async_job.job_status = 0; - CREATE TABLE `cloud`.`external_brocade_vcs_devices` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `uuid` varchar(255) UNIQUE, @@ -291,470 +74,11 @@ ALTER TABLE `cloud`.`physical_network_traffic_types` CHANGE `xen_network_label` ALTER TABLE `cloud`.`volumes` CHANGE COLUMN `iso_id` `iso_id` bigint(20) unsigned COMMENT 'The id of the iso from which the volume was created'; -DROP VIEW IF EXISTS `cloud`.`storage_pool_view`; -CREATE VIEW `cloud`.`storage_pool_view` AS - select - storage_pool.id, - storage_pool.uuid, - storage_pool.name, - storage_pool.status, - storage_pool.path, - storage_pool.pool_type, - storage_pool.host_address, - storage_pool.created, - storage_pool.removed, - storage_pool.capacity_bytes, - storage_pool.capacity_iops, - storage_pool.scope, - storage_pool.hypervisor, - storage_pool.storage_provider_name, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - storage_pool_details.name tag, - op_host_capacity.used_capacity disk_used_capacity, - op_host_capacity.reserved_capacity disk_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`storage_pool` - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`data_center` ON storage_pool.data_center_id = data_center.id - left join - `cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id - left join - `cloud`.`storage_pool_details` ON storage_pool_details.pool_id = storage_pool.id - and storage_pool_details.value = 'true' - left join - `cloud`.`op_host_capacity` ON storage_pool.id = op_host_capacity.host_id - and op_host_capacity.capacity_type in (3,9) - left join - `cloud`.`async_job` ON async_job.instance_id = storage_pool.id - and async_job.instance_type = 'StoragePool' - and async_job.job_status = 0; - - -DROP VIEW IF EXISTS `cloud`.`template_view`; -CREATE VIEW `cloud`.`template_view` AS - select - vm_template.id, - vm_template.uuid, - vm_template.unique_name, - vm_template.name, - vm_template.public, - vm_template.featured, - vm_template.type, - vm_template.hvm, - vm_template.bits, - vm_template.url, - vm_template.format, - vm_template.created, - vm_template.checksum, - vm_template.display_text, - vm_template.enable_password, - vm_template.dynamically_scalable, - vm_template.state template_state, - vm_template.guest_os_id, - guest_os.uuid guest_os_uuid, - guest_os.display_name guest_os_name, - vm_template.bootable, - vm_template.prepopulate, - vm_template.cross_zones, - vm_template.hypervisor_type, - vm_template.extractable, - vm_template.template_tag, - vm_template.sort_key, - vm_template.removed, - vm_template.enable_sshkey, - source_template.id source_template_id, - source_template.uuid source_template_uuid, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - launch_permission.account_id lp_account_id, - template_store_ref.store_id, - image_store.scope as store_scope, - template_store_ref.state, - template_store_ref.download_state, - template_store_ref.download_pct, - template_store_ref.error_str, - template_store_ref.size, - template_store_ref.destroyed, - template_store_ref.created created_on_store, - vm_template_details.name detail_name, - vm_template_details.value detail_value, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - CONCAT(vm_template.id, '_', IFNULL(data_center.id, 0)) as temp_zone_pair - from - `cloud`.`vm_template` - inner join - `cloud`.`guest_os` ON guest_os.id = vm_template.guest_os_id - inner join - `cloud`.`account` ON account.id = vm_template.account_id - inner join - `cloud`.`domain` ON domain.id = account.domain_id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`vm_template_details` ON vm_template_details.template_id = vm_template.id - left join - `cloud`.`vm_template` source_template ON source_template.id = vm_template.source_template_id - left join - `cloud`.`template_store_ref` ON template_store_ref.template_id = vm_template.id and template_store_ref.store_role = 'Image' and template_store_ref.destroyed=0 - left join - `cloud`.`image_store` ON image_store.removed is NULL AND template_store_ref.store_id is not NULL AND image_store.id = template_store_ref.store_id - left join - `cloud`.`template_zone_ref` ON template_zone_ref.template_id = vm_template.id AND template_store_ref.store_id is NULL AND template_zone_ref.removed is null - left join - `cloud`.`data_center` ON (image_store.data_center_id = data_center.id OR template_zone_ref.zone_id = data_center.id) - left join - `cloud`.`launch_permission` ON launch_permission.template_id = vm_template.id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_template.id - and (resource_tags.resource_type = 'Template' or resource_tags.resource_type='ISO'); - UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,LXC,Hyperv' WHERE name='hypervisor.list'; UPDATE `cloud`.`configuration` SET description="If set to true, will set guest VM's name as it appears on the hypervisor, to its hostname. The flag is supported for VMware hypervisor only" WHERE name='vm.instancename.flag'; INSERT IGNORE INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Advanced', 'DEFAULT', 'management-server', 'implicit.host.tags', 'GPU', 'Tag hosts at the time of host disovery based on the host properties/capabilities ', 'GPU'); -DROP VIEW IF EXISTS `cloud`.`domain_router_view`; -CREATE VIEW `cloud`.`domain_router_view` AS - select - vm_instance.id id, - vm_instance.name 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, - vm_instance.uuid uuid, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.pod_id pod_id, - vm_instance.instance_name instance_name, - host_pod_ref.uuid pod_uuid, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - data_center.dns1 dns1, - data_center.dns2 dns2, - data_center.ip6_dns1 ip6_dns1, - data_center.ip6_dns2 ip6_dns2, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - host.hypervisor_type, - host.cluster_id cluster_id, - vm_template.id template_id, - vm_template.uuid template_uuid, - service_offering.id service_offering_id, - disk_offering.uuid service_offering_uuid, - disk_offering.name service_offering_name, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.network_domain network_domain, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - domain_router.template_version template_version, - domain_router.scripts_version scripts_version, - domain_router.is_redundant_router is_redundant_router, - domain_router.redundant_state redundant_state, - domain_router.stop_pending stop_pending, - domain_router.role role - from - `cloud`.`domain_router` - inner join - `cloud`.`vm_instance` ON vm_instance.id = domain_router.id - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON domain_router.vpc_id = vpc.id and vpc.removed is null - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'DomainRouter' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE VIEW `cloud`.`user_vm_view` AS - select - vm_instance.id id, - vm_instance.name name, - user_vm.display_name display_name, - user_vm.user_data user_data, - 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, - instance_group.id instance_group_id, - instance_group.uuid instance_group_uuid, - instance_group.name instance_group_name, - vm_instance.uuid uuid, - vm_instance.last_host_id last_host_id, - vm_instance.vm_type type, - vm_instance.limit_cpu_use limit_cpu_use, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.ha_enabled ha_enabled, - vm_instance.hypervisor_type hypervisor_type, - vm_instance.instance_name instance_name, - vm_instance.guest_os_id guest_os_id, - vm_instance.display_vm display_vm, - guest_os.uuid guest_os_uuid, - vm_instance.pod_id pod_id, - host_pod_ref.uuid pod_uuid, - vm_instance.private_ip_address private_ip_address, - vm_instance.private_mac_address private_mac_address, - vm_instance.vm_type vm_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.is_security_group_enabled security_group_enabled, - data_center.networktype data_center_type, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.name template_name, - vm_template.display_text template_display_text, - vm_template.enable_password password_enabled, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - service_offering.id service_offering_id, - svc_disk_offering.uuid service_offering_uuid, - disk_offering.uuid disk_offering_uuid, - disk_offering.id disk_offering_id, - Case - When (`cloud`.`service_offering`.`cpu` is null) then (`custom_cpu`.`value`) - Else ( `cloud`.`service_offering`.`cpu`) - End as `cpu`, - Case - When (`cloud`.`service_offering`.`speed` is null) then (`custom_speed`.`value`) - Else ( `cloud`.`service_offering`.`speed`) - End as `speed`, - Case - When (`cloud`.`service_offering`.`ram_size` is null) then (`custom_ram_size`.`value`) - Else ( `cloud`.`service_offering`.`ram_size`) - END as `ram_size`, - svc_disk_offering.name service_offering_name, - disk_offering.name disk_offering_name, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.pool_type pool_type, - volumes.id volume_id, - volumes.uuid volume_uuid, - volumes.device_id volume_device_id, - volumes.volume_type volume_type, - security_group.id security_group_id, - security_group.uuid security_group_uuid, - security_group.name security_group_name, - security_group.description security_group_description, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - user_ip_address.id public_ip_id, - user_ip_address.uuid public_ip_uuid, - user_ip_address.public_ip_address public_ip_address, - ssh_keypairs.keypair_name keypair_name, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - affinity_group.id affinity_group_id, - affinity_group.uuid affinity_group_uuid, - affinity_group.name affinity_group_name, - affinity_group.description affinity_group_description, - vm_instance.dynamically_scalable dynamically_scalable - - from - `cloud`.`user_vm` - inner join - `cloud`.`vm_instance` ON vm_instance.id = user_vm.id - and vm_instance.removed is NULL - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id - left join - `cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = user_vm.iso_id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` svc_disk_offering ON vm_instance.service_offering_id = svc_disk_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.disk_offering_id = disk_offering.id - left join - `cloud`.`volumes` ON vm_instance.id = volumes.instance_id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id - left join - `cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON networks.vpc_id = vpc.id and vpc.removed is null - left join - `cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` as ssh_details ON ssh_details.vm_id = vm_instance.id - and ssh_details.name = 'SSH.PublicKey' - left join - `cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = ssh_details.value - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id - and resource_tags.resource_type = 'UserVm' - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'VirtualMachine' - and async_job.job_status = 0 - left join - `cloud`.`affinity_group_vm_map` ON vm_instance.id = affinity_group_vm_map.instance_id - left join - `cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id - left join - `cloud`.`user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_cpu`.`name` = 'CpuNumber'))) - left join - `cloud`.`user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_speed`.`name` = 'CpuSpeed'))) - left join - `cloud`.`user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_ram_size`.`name` = 'memory'))); - - INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (231, UUID(), 1, 'CentOS 5 (32-bit)', utc_timestamp()); INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (232, UUID(), 1, 'CentOS 5 (64-bit)', utc_timestamp()); INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (233, UUID(), 3, 'Oracle Enterprise Linux 5 (32-bit)', utc_timestamp()); @@ -967,7 +291,7 @@ CREATE TABLE `cloud`.`baremetal_rct` ( PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; ---Remove duplicates from guest_os_hypervisor table +-- Remove duplicates from guest_os_hypervisor table DELETE t1 FROM guest_os_hypervisor t1, guest_os_hypervisor t2 WHERE (t1.hypervisor_type = t2.hypervisor_type AND t1.hypervisor_version = t2.hypervisor_version AND t1.guest_os_id = t2.guest_os_id AND t1.id > t2.id AND t1.is_user_defined=0); -- Set as removed built-in CentOS 5.3 template (if any) for XenServer, since CentOS 5.6 template already exists @@ -975,7 +299,7 @@ UPDATE `cloud`.`vm_template` SET removed=NOW() WHERE unique_name="centos53-x86_6 ALTER TABLE `cloud_usage`.`usage_vpn_user` CHANGE `user_name` `user_name` VARCHAR(255); ---Increase key value size generated from RSA-8192 to be stored. +-- Increase key value size generated from RSA-8192 to be stored. ALTER TABLE `cloud`.`user_vm_details` MODIFY `value` VARCHAR(5120); UPDATE `cloud`.`host` SET resource = REPLACE(resource, 'com.cloud.hypervisor.xen.resource', 'com.cloud.hypervisor.xenserver.resource') WHERE hypervisor_type='XenServer' AND REMOVED IS NULL; @@ -983,7 +307,7 @@ UPDATE `cloud`.`host` SET resource = REPLACE(resource, 'com.cloud.hypervisor.xen INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable, state) VALUES (11, UUID(), 'centos7-x86_64-lxc', 'CentOS 7(64-bit) no GUI (LXC)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloudstack.org/templates/builtin/centos-7-x86_64.tar.gz', 'c2c4fa2d0978121c7977db571f132d6e', 0, 'CentOS 7(64-bit) no GUI (LXC)', 'TAR', 246, 1, 1, 'LXC', 1, 'Active'); ---Support for RHEL 6.5 in relevant hypervisor versions +-- Support for RHEL 6.5 in relevant hypervisor versions INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (252, UUID(), 4, 'Red Hat Enterprise Linux 6.5 (32-bit)', utc_timestamp()); INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (253, UUID(), 4, 'Red Hat Enterprise Linux 6.5 (64-bit)', utc_timestamp()); @@ -1002,14 +326,14 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervis INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'VMware', '5.5', 'rhel6Guest', 252, utc_timestamp(), 0); INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'VMware', '5.5', 'rhel6_64Guest', 253, utc_timestamp(), 0); ---Support for Debian 7 on KVM/LXC +-- Support for Debian 7 on KVM/LXC INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'Debian GNU/Linux 7(32-bit)', 183, utc_timestamp(), 0); INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'Debian GNU/Linux 7(64-bit)', 184, utc_timestamp(), 0); INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'LXC', 'default', 'Debian GNU/Linux 7(32-bit)', 183, utc_timestamp(), 0); INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'LXC', 'default', 'Debian GNU/Linux 7(64-bit)', 184, utc_timestamp(), 0); ---Support for Ubuntu 14.04 +-- Support for Ubuntu 14.04 INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'VMware', '5.0', 'ubuntuGuest', 241, utc_timestamp(), 0); INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'VMware', '5.1', 'ubuntuGuest', 241, utc_timestamp(), 0); INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'VMware', '5.5', 'ubuntuGuest', 241, utc_timestamp(), 0); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-442to450-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_0_3__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-442to450-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_0_3__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-450to451.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_1_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-450to451.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_1_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-450to451-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_1_3__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-450to451-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_1_3__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-451to452.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_2_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-451to452.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_2_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-451to452-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_2_3__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-451to452-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_2_3__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-452to453.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_3_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-452to453.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_3_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-452to453-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_3_3__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-452to453-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_5_3_3__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/V4_6_0_0__upgrade.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_6_0_0__upgrade.sql new file mode 100644 index 000000000000..1f09f316c6ec --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_6_0_0__upgrade.sql @@ -0,0 +1,108 @@ +-- 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.5.1 to 4.6.0 +-- + +ALTER TABLE `cloud`.`snapshots` ADD COLUMN `min_iops` bigint(20) unsigned COMMENT 'Minimum IOPS'; +ALTER TABLE `cloud`.`snapshots` ADD COLUMN `max_iops` bigint(20) unsigned COMMENT 'Maximum IOPS'; + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'management-server', "stats.output.uri", "", "URI to additionally send StatsCollector statistics to", "", NULL, NULL, 0); + +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.user.vms','-1','The default maximum number of user VMs that can be deployed for a domain', '-1', NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.public.ips','-1','The default maximum number of public IPs that can be consumed by a domain', '-1', NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.templates','-1','The default maximum number of templates that can be deployed for a domain', '-1', NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.snapshots','-1','The default maximum number of snapshots that can be created for a domain', '-1', NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.volumes','-1','The default maximum number of volumes that can be created for a domain', '-1', NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.networks', '-1', 'The default maximum number of networks that can be created for a domain', '-1', NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.vpcs', '-1', 'The default maximum number of vpcs that can be created for a domain', '-1', NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.cpus', '-1', 'The default maximum number of cpu cores that can be used for a domain', '-1', NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.memory', '-1', 'The default maximum memory (in MiB) that can be used for a domain', '-1', NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.primary.storage', '-1', 'The default maximum primary storage space (in GiB) that can be used for a domain', '-1', NULL, NULL, 0); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.secondary.storage', '-1', 'The default maximum secondary storage space (in GiB) that can be used for a domain', '-1', NULL, NULL, 0); + +ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `user_id` bigint unsigned NOT NULL DEFAULT 1 COMMENT 'user id of VM deployer'; + +-- Additional checks to ensure duplicate keys are not registered and remove the previously stored duplicate keys. +DELETE `s1` FROM `ssh_keypairs` `s1`, `ssh_keypairs` `s2` WHERE `s1`.`id` > `s2`.`id` AND `s1`.`public_key` = `s2`.`public_key` AND `s1`.`account_id` = `s2`.`account_id`; +ALTER TABLE `ssh_keypairs` ADD UNIQUE `unique_index`(`fingerprint`,`account_id`); + +-- ovm3 stuff +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Sun Solaris 10(32-bit)', 79); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Sun Solaris 10(64-bit)', 80); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Sun Solaris 11(32-bit)', 158); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Sun Solaris 11(64-bit)', 159); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Other Linux (32-bit)', 98); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Other Linux (64-bit)', 99); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('Ovm3', 'Other PV (32-bit)', 139); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('Ovm3', 'Other PV (64-bit)', 140); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('Ovm3', 'DOS', 102); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Windows 8 (32-bit)', 165); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Windows 8 (64-bit)', 166); +INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Windows Server 2012 (64-bit)', 167); + +INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('Ovm3', '3.2', 25, 0); +INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('Ovm3', '3.3', 50, 0); +UPDATE `cloud`.`volumes` v, `cloud`.`storage_pool` s, `cloud`.`cluster` c set v.format='RAW' where v.pool_id=s.id and s.cluster_id=c.id and c.hypervisor_type='Ovm3'; +UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,Ovm3,LXC' WHERE name='hypervisor.list'; +INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id,featured, cross_zones, hypervisor_type, state) +VALUES (12, UUID(), 'routing-12', 'SystemVM Template (Ovm3)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-ovm.raw.bz2', 'c8577d27b2daafb2d9a4ed307ce2f00f', 0, 'SystemVM Template (Ovm3)', 'RAW', 183, 0, 1, 'Ovm3', 'Active' ); + +INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default_value`, `description`) VALUES ('Advanced', 'DEFAULT', 'ManagementServer', 'ovm3.heartbeat.timeout' , '180', '120', 'Timeout value to send to the checkheartbeat script for guarding the self fencing functionality on ovm3'); +INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default_value`, `description`) VALUES ('Advanced', 'DEFAULT', 'ManagementServer', 'ovm3.heartbeat.interval' , '10', '1', 'Interval value the checkheartbeat script uses before triggering the timeout for ovm3'); +INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'NetworkManager', 'router.template.ovm3', 'SystemVM Template (Ovm3)', 'Name of the default router template on Ovm3.','SystemVM Template (Ovm3)', NULL, NULL, 0); + +UPDATE IGNORE `cloud`.`configuration` SET `value`="PLAINTEXT" WHERE `name`="user.authenticators.exclude"; + +DROP TABLE IF EXISTS `cloud`.`external_bigswitch_vns_devices`; +CREATE TABLE `cloud`.`external_bigswitch_bcf_devices` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(255) UNIQUE, + `physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which bigswitch bcf device is added', + `provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this bigswitch bcf device', + `device_name` varchar(255) NOT NULL COMMENT 'name of the bigswitch bcf device', + `host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external bigswitch bcf device', + `hostname` varchar(255) NOT NULL COMMENT 'host name or IP address for the bigswitch bcf device', + `username` varchar(255) NOT NULL COMMENT 'username for the bigswitch bcf device', + `password` varchar(255) NOT NULL COMMENT 'password for the bigswitch bcf device', + `nat` boolean NOT NULL COMMENT 'NAT support for the bigswitch bcf device', + `hash` varchar(255) NOT NULL COMMENT 'topology hash for the bigswitch bcf networks', + PRIMARY KEY (`id`), + CONSTRAINT `fk_external_bigswitch_bcf_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE, + CONSTRAINT `fk_external_bigswitch_bcf_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +UPDATE `cloud`.`host` SET `resource`='com.cloud.hypervisor.xenserver.resource.XenServer600Resource' WHERE `resource`='com.cloud.hypervisor.xenserver.resource.XenServer602Resource'; + +CREATE TABLE `cloud`.`ldap_trust_map` ( + `id` int unsigned NOT NULL AUTO_INCREMENT, + `domain_id` bigint unsigned NOT NULL, + `type` varchar(10) NOT NULL, + `name` varchar(255) NOT NULL, + `account_type` int(1) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `uk_ldap_trust_map__domain_id` (`domain_id`), + CONSTRAINT `fk_ldap_trust_map__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'Red Hat Enterprise Linux 7', 245, utc_timestamp(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'CentOS 7', 246, utc_timestamp(), 0); + +UPDATE `cloud`.`hypervisor_capabilities` SET `max_data_volumes_limit` = '32' WHERE `hypervisor_capabilities`.`hypervisor_type` = 'KVM'; + + diff --git a/engine/schema/src/main/resources/META-INF/db/schema-452to460-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_6_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-452to460-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_6_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/V4_6_1_0__upgrade.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_6_1_0__upgrade.sql new file mode 100644 index 000000000000..e42d0b2e9ad8 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_6_1_0__upgrade.sql @@ -0,0 +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. + +--; +-- Schema upgrade from 4.6.0 to 4.6.1; +--; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-460to461-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_6_1_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-460to461-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_6_1_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-461to470.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_7_0_0__upgrade.sql similarity index 67% rename from engine/schema/src/main/resources/META-INF/db/schema-461to470.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_7_0_0__upgrade.sql index 7c701992c4d7..0cfd10590da7 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-461to470.sql +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_7_0_0__upgrade.sql @@ -142,110 +142,7 @@ INSERT IGNORE INTO `cloud_usage`.`quota_email_templates` (`template_name`, `temp UNLOCK TABLES; -DROP VIEW IF EXISTS `cloud`.`domain_router_view`; -CREATE VIEW `cloud`.`domain_router_view` AS - select - vm_instance.id id, - vm_instance.name 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, - vm_instance.uuid uuid, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.pod_id pod_id, - vm_instance.instance_name instance_name, - host_pod_ref.uuid pod_uuid, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - data_center.dns1 dns1, - data_center.dns2 dns2, - data_center.ip6_dns1 ip6_dns1, - data_center.ip6_dns2 ip6_dns2, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - host.hypervisor_type, - host.cluster_id cluster_id, - vm_template.id template_id, - vm_template.uuid template_uuid, - service_offering.id service_offering_id, - disk_offering.uuid service_offering_uuid, - disk_offering.name service_offering_name, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - vpc.name vpc_name, - networks.uuid network_uuid, - networks.name network_name, - networks.network_domain network_domain, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - domain_router.template_version template_version, - domain_router.scripts_version scripts_version, - domain_router.is_redundant_router is_redundant_router, - domain_router.redundant_state redundant_state, - domain_router.stop_pending stop_pending, - domain_router.role role - from - `cloud`.`domain_router` - inner join - `cloud`.`vm_instance` ON vm_instance.id = domain_router.id - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON domain_router.vpc_id = vpc.id and vpc.removed is null - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'DomainRouter' - and async_job.job_status = 0; + INSERT IGNORE INTO `cloud`.`hypervisor_capabilities` values (25,UUID(),'VMware','6.0',128,0,13,32,1,1); INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'VMware', '5.5', 'rhel7_64Guest', 245, utc_timestamp(), 0); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-461to470-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_7_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-461to470-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_7_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-470to471.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_7_1_0__upgrade.sql similarity index 99% rename from engine/schema/src/main/resources/META-INF/db/schema-470to471.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_7_1_0__upgrade.sql index d632a72680d6..41f41fed667b 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-470to471.sql +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_7_1_0__upgrade.sql @@ -18,4 +18,5 @@ --; -- Schema upgrade from 4.7.0 to 4.7.1; --; + ALTER TABLE cloud.s2s_customer_gateway ADD COLUMN force_encap INT(1) NOT NULL DEFAULT 0 AFTER dpd; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-470to471-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_7_1_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-470to471-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_7_1_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-471to480.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_8_0_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-471to480.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_8_0_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-471to480-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_8_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-471to480-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_8_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-480to481.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_8_1_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-480to481.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_8_1_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-480to481-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_8_1_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-480to481-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_8_1_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_0_0_0__upgrade.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_0_0_0__upgrade.sql new file mode 100644 index 000000000000..2d2d428e7f20 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_0_0_0__upgrade.sql @@ -0,0 +1,160 @@ +-- 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.8.1 to 4.9.0; +--; + +ALTER TABLE `event` ADD INDEX `archived` (`archived`); +ALTER TABLE `event` ADD INDEX `state` (`state`); + + + +-- Add cluster.storage.operations.exclude property +INSERT INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `description`, `default_value`, `updated`, `scope`, `is_dynamic`) VALUES ('Advanced', 'DEFAULT', 'CapacityManager', 'cluster.storage.operations.exclude', 'Exclude cluster from storage operations', 'false', now(), 'Cluster', '1'); + +-- 3) Missing indexes (Add indexes to avoid full table scans) +ALTER TABLE `cloud`.`op_it_work` ADD INDEX `i_type_and_updated` (`type` ASC, `updated_at` ASC); +ALTER TABLE `cloud`.`vm_root_disk_tags` ADD INDEX `i_vm_id` (`vm_id` ASC); +ALTER TABLE `cloud`.`vm_compute_tags` ADD INDEX `i_vm_id` (`vm_id` ASC); +ALTER TABLE `cloud`.`vm_network_map` ADD INDEX `i_vm_id` (`vm_id` ASC); +ALTER TABLE `cloud`.`ssh_keypairs` ADD INDEX `i_public_key` (`public_key` (64) ASC); +ALTER TABLE `cloud`.`user_vm_details` ADD INDEX `i_name_vm_id` (`vm_id` ASC, `name` ASC); +ALTER TABLE `cloud`.`instance_group` ADD INDEX `i_name` (`name` ASC); + +-- 4) Some views query (Change view to improve account retrieval speed) +CREATE OR REPLACE +VIEW `account_vmstats_view` AS + SELECT + `vm_instance`.`account_id` AS `account_id`, + `vm_instance`.`state` AS `state`, + COUNT(0) AS `vmcount` + FROM + `vm_instance` + WHERE + (`vm_instance`.`vm_type` = 'User' and `vm_instance`.`removed` is NULL) + GROUP BY `vm_instance`.`account_id` , `vm_instance`.`state`; +-- End CLOUDSTACK-9340 + +-- Dynamic roles +CREATE TABLE IF NOT EXISTS `cloud`.`roles` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(255) UNIQUE, + `name` varchar(255) COMMENT 'unique name of the dynamic role', + `role_type` varchar(255) NOT NULL COMMENT 'the type of the role', + `removed` datetime COMMENT 'date removed', + `description` text COMMENT 'description of the role', + PRIMARY KEY (`id`), + KEY `i_roles__name` (`name`), + KEY `i_roles__role_type` (`role_type`), + UNIQUE KEY (`name`, `role_type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `cloud`.`role_permissions` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(255) UNIQUE, + `role_id` bigint(20) unsigned NOT NULL COMMENT 'id of the role', + `rule` varchar(255) NOT NULL COMMENT 'rule for the role, api name or wildcard', + `permission` varchar(255) NOT NULL COMMENT 'access authority, allow or deny', + `description` text COMMENT 'description of the rule', + `sort_order` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT 'permission sort order', + PRIMARY KEY (`id`), + KEY `fk_role_permissions__role_id` (`role_id`), + KEY `i_role_permissions__sort_order` (`sort_order`), + UNIQUE KEY (`role_id`, `rule`), + CONSTRAINT `fk_role_permissions__role_id` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- Default CloudStack roles +INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (1, UUID(), 'Root Admin', 'Admin', 'Default root admin role') ON DUPLICATE KEY UPDATE name=name; +INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (2, UUID(), 'Resource Admin', 'ResourceAdmin', 'Default resource admin role') ON DUPLICATE KEY UPDATE name=name; +INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (3, UUID(), 'Domain Admin', 'DomainAdmin', 'Default domain admin role') ON DUPLICATE KEY UPDATE name=name; +INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (4, UUID(), 'User', 'User', 'Default Root Admin role') ON DUPLICATE KEY UPDATE name=name; + +-- Out-of-band management +CREATE TABLE IF NOT EXISTS `cloud`.`oobm` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `host_id` bigint(20) unsigned DEFAULT NULL COMMENT 'foreign key to host', + `enabled` int(1) unsigned DEFAULT '0' COMMENT 'is out-of-band management enabled for host', + `power_state` varchar(32) DEFAULT 'Disabled' COMMENT 'out-of-band management power status', + `driver` varchar(32) DEFAULT NULL COMMENT 'out-of-band management driver', + `address` varchar(255) DEFAULT NULL COMMENT 'out-of-band management interface address', + `port` int(10) unsigned DEFAULT NULL COMMENT 'out-of-band management interface port', + `username` varchar(255) DEFAULT NULL COMMENT 'out-of-band management interface username', + `password` varchar(255) DEFAULT NULL COMMENT 'out-of-band management interface password', + `update_count` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'atomic increase count making status update operation atomical', + `update_time` datetime COMMENT 'last power state update datetime', + `mgmt_server_id` bigint(20) unsigned DEFAULT NULL COMMENT 'management server id which owns out-of-band management for the host', + PRIMARY KEY (`id`), + KEY `fk_oobm__host_id` (`host_id`), + KEY `i_oobm__enabled` (`enabled`), + KEY `i_oobm__power_state` (`power_state`), + KEY `i_oobm__update_time` (`update_time`), + KEY `i_oobm__mgmt_server_id` (`mgmt_server_id`), + CONSTRAINT `fk_oobm__host_id` FOREIGN KEY (`host_id`) REFERENCES `host` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centosGuest', 171, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centosGuest', 171, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centosGuest', 171, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centosGuest', 171, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centosGuest', 171, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centos64Guest', 172, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centos64Guest', 172, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centos64Guest', 172, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centos64Guest', 172, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 172, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centosGuest', 177, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centosGuest', 177, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centosGuest', 177, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centosGuest', 177, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centosGuest', 177, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centos64Guest', 178, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centos64Guest', 178, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centos64Guest', 178, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centos64Guest', 178, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 178, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centosGuest', 179, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centosGuest', 179, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centosGuest', 179, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centosGuest', 179, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centosGuest', 179, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centos64Guest', 180, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centos64Guest', 180, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centos64Guest', 180, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centos64Guest', 180, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 180, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centosGuest', 181, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centosGuest', 181, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centosGuest', 181, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centosGuest', 181, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centosGuest', 181, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centos64Guest', 182, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centos64Guest', 182, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centos64Guest', 182, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centos64Guest', 182, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 182, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centosGuest', 227, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centosGuest', 227, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centosGuest', 227, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centosGuest', 227, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centosGuest', 227, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centos64Guest', 228, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centos64Guest', 228, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centos64Guest', 228, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centos64Guest', 228, now(), 0); +INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 228, now(), 0); diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_0_0_2__cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_0_0_2__cleanup.sql new file mode 100644 index 000000000000..2d9578c4599a --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_0_0_2__cleanup.sql @@ -0,0 +1,83 @@ +-- 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 cleanup from 4.8.1 to 4.9.0; +--; + +-- Added in CLOUDSTACK-9340: General DB optimization, 4 cases: + +-- 1) Incorrect PRIMARY key +ALTER TABLE `cloud`.`ovs_tunnel_network` +DROP PRIMARY KEY, +ADD PRIMARY KEY (`id`), +DROP INDEX `id` , +ADD UNIQUE INDEX `i_to_from_network_id` (`to` ASC, `from` ASC, `network_id` ASC); + +-- 2) Duplicate PRIMARY KEY +ALTER TABLE `cloud`.`user_vm` DROP INDEX `id_2` ,DROP INDEX `id` ; +ALTER TABLE `cloud`.`domain_router` DROP INDEX `id_2` ,DROP INDEX `id` ; +ALTER TABLE `cloud`.`vm_instance` DROP INDEX `id_2` ,DROP INDEX `id` ; +ALTER TABLE `cloud`.`account_vlan_map` DROP INDEX `id` ; +ALTER TABLE `cloud`.`account_vnet_map` DROP INDEX `id` ; +ALTER TABLE `cloud`.`baremetal_rct` DROP INDEX `id` ; +ALTER TABLE `cloud`.`cluster` DROP INDEX `id` ; +ALTER TABLE `cloud`.`conditions` DROP INDEX `id` ; +ALTER TABLE `cloud`.`counter` DROP INDEX `id` ; +ALTER TABLE `cloud`.`data_center` DROP INDEX `id` ; +ALTER TABLE `cloud`.`dc_storage_network_ip_range` DROP INDEX `id` ; +ALTER TABLE `cloud`.`dedicated_resources` DROP INDEX `id` ; +ALTER TABLE `cloud`.`host_pod_ref` DROP INDEX `id` ; +ALTER TABLE `cloud`.`iam_group` DROP INDEX `id` ; +ALTER TABLE `cloud`.`iam_policy` DROP INDEX `id` ; +ALTER TABLE `cloud`.`iam_policy_permission` DROP INDEX `id` ; +ALTER TABLE `cloud`.`image_store_details` DROP INDEX `id` ; +ALTER TABLE `cloud`.`instance_group` DROP INDEX `id` ; +ALTER TABLE `cloud`.`netapp_lun` DROP INDEX `id` ; +ALTER TABLE `cloud`.`netapp_pool` DROP INDEX `id` ; +ALTER TABLE `cloud`.`netapp_volume` DROP INDEX `id` ; +ALTER TABLE `cloud`.`network_acl_item_cidrs` DROP INDEX `id` ; +ALTER TABLE `cloud`.`network_offerings` DROP INDEX `id` ; +ALTER TABLE `cloud`.`nic_secondary_ips` DROP INDEX `id` ; +ALTER TABLE `cloud`.`nics` DROP INDEX `id` ; +ALTER TABLE `cloud`.`op_ha_work` DROP INDEX `id` ; +ALTER TABLE `cloud`.`op_host` DROP INDEX `id` ; +ALTER TABLE `cloud`.`op_host_transfer` DROP INDEX `id` ; +ALTER TABLE `cloud`.`op_networks` DROP INDEX `id` ; +ALTER TABLE `cloud`.`op_nwgrp_work` DROP INDEX `id` ; +ALTER TABLE `cloud`.`op_vm_ruleset_log` DROP INDEX `id` ; +ALTER TABLE `cloud`.`op_vpc_distributed_router_sequence_no` DROP INDEX `id` ; +ALTER TABLE `cloud`.`pod_vlan_map` DROP INDEX `id` ; +ALTER TABLE `cloud`.`portable_ip_address` DROP INDEX `id` ; +ALTER TABLE `cloud`.`portable_ip_range` DROP INDEX `id` ; +ALTER TABLE `cloud`.`region` DROP INDEX `id` ; +ALTER TABLE `cloud`.`remote_access_vpn` DROP INDEX `id` ; +ALTER TABLE `cloud`.`snapshot_details` DROP INDEX `id` ; +ALTER TABLE `cloud`.`snapshots` DROP INDEX `id` ; +ALTER TABLE `cloud`.`storage_pool` DROP INDEX `id` ; +ALTER TABLE `cloud`.`storage_pool_details` DROP INDEX `id` ; +ALTER TABLE `cloud`.`storage_pool_work` DROP INDEX `id` ; +ALTER TABLE `cloud`.`user_ip_address` DROP INDEX `id` ; +ALTER TABLE `cloud`.`user_ipv6_address` DROP INDEX `id` ; +ALTER TABLE `cloud`.`user_statistics` DROP INDEX `id` ; +ALTER TABLE `cloud`.`version` DROP INDEX `id` ; +ALTER TABLE `cloud`.`vlan` DROP INDEX `id` ; +ALTER TABLE `cloud`.`vm_disk_statistics` DROP INDEX `id` ; +ALTER TABLE `cloud`.`vm_snapshot_details` DROP INDEX `id` ; +ALTER TABLE `cloud`.`vm_work_job` DROP INDEX `id` ; +ALTER TABLE `cloud`.`vpc_gateways` DROP INDEX `id` ; +ALTER TABLE `cloud`.`vpn_users` DROP INDEX `id` ; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-490to4910.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_1_0_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-490to4910.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_1_0_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-490to4910-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_1_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-490to4910-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_1_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-4910to4920.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_2_0_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-4910to4920.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_2_0_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-4910to4920-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_2_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-4910to4920-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_2_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-4920to4930.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_3_0_0__upgrade.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-4920to4930.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_3_0_0__upgrade.sql diff --git a/engine/schema/src/main/resources/META-INF/db/schema-4920to4930-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_3_0_2__cleanup.sql similarity index 100% rename from engine/schema/src/main/resources/META-INF/db/schema-4920to4930-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/csmigration/V4_9_3_0_2__cleanup.sql diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/afterMigrate.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/afterMigrate.sql new file mode 100644 index 000000000000..8484b9588630 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/afterMigrate.sql @@ -0,0 +1,18 @@ +-- 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 sql_notes = 1; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/csmigration/beforeMigrate.sql b/engine/schema/src/main/resources/META-INF/db/csmigration/beforeMigrate.sql new file mode 100644 index 000000000000..3988d06a1e9f --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/csmigration/beforeMigrate.sql @@ -0,0 +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. + + +-- Disable show notes as warning (for DROP [TABLE|VIEW] IF EXISTS) + +SET sql_notes = 0; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/schema-40to410.sql b/engine/schema/src/main/resources/META-INF/db/schema-40to410.sql deleted file mode 100644 index 53b4a1a5b8a7..000000000000 --- a/engine/schema/src/main/resources/META-INF/db/schema-40to410.sql +++ /dev/null @@ -1,1671 +0,0 @@ --- 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.0.0 to 4.1.0; ---; - -use cloud; -SET foreign_key_checks = 0; - -alter table vm_template add size bigint unsigned; -alter table vm_template add state varchar(255); -alter table vm_template add update_count bigint unsigned; -alter table vm_template add updated datetime; -alter table storage_pool add storage_provider_id bigint unsigned; -alter table storage_pool add scope varchar(255); -alter table storage_pool modify id bigint unsigned AUTO_INCREMENT UNIQUE NOT NULL; -alter table template_spool_ref add state varchar(255); -alter table template_spool_ref add update_count bigint unsigned; -alter table volumes add disk_type varchar(255); -alter table volumes drop foreign key `fk_volumes__account_id`; -alter table vm_instance add column disk_offering_id bigint unsigned; -alter table vm_instance add column cpu int(10) unsigned; -alter table vm_instance add column ram bigint unsigned; -alter table vm_instance add column owner varchar(255); -alter table vm_instance add column speed int(10) unsigned; -alter table vm_instance add column host_name varchar(255); -alter table vm_instance add column display_name varchar(255); -alter table vm_instance add column `desired_state` varchar(32) NULL; - -alter table data_center add column owner varchar(255); -alter table data_center add column created datetime COMMENT 'date created'; -alter table data_center add column lastUpdated datetime COMMENT 'last updated'; -alter table data_center add column engine_state varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'the engine state of the zone'; -alter table host_pod_ref add column owner varchar(255); -alter table host_pod_ref add column created datetime COMMENT 'date created'; -alter table host_pod_ref add column lastUpdated datetime COMMENT 'last updated'; -alter table host_pod_ref add column engine_state varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'the engine state of the zone'; -alter table host add column owner varchar(255); -alter table host add column lastUpdated datetime COMMENT 'last updated'; -alter table host add column engine_state varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'the engine state of the zone'; - -alter table cluster add column owner varchar(255); -alter table cluster add column created datetime COMMENT 'date created'; -alter table cluster add column lastUpdated datetime COMMENT 'last updated'; -alter table cluster add column engine_state varchar(32) NOT NULL DEFAULT 'Disabled' COMMENT 'the engine state of the zone'; - -CREATE TABLE `cloud`.`vm_compute_tags` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `vm_id` bigint unsigned NOT NULL COMMENT 'vm id', - `compute_tag` varchar(255) NOT NULL COMMENT 'name of tag', - PRIMARY KEY(`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`vm_root_disk_tags` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `vm_id` bigint unsigned NOT NULL COMMENT 'vm id', - `root_disk_tag` varchar(255) NOT NULL COMMENT 'name of tag', - PRIMARY KEY(`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `cloud`.`vm_network_map` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `vm_id` bigint unsigned NOT NULL COMMENT 'vm id', - `network_id` bigint unsigned NOT NULL COMMENT 'network id', - PRIMARY KEY(`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `cloud`.`vm_reservation` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(40) NOT NULL COMMENT 'reservation id', - `vm_id` bigint unsigned NOT NULL COMMENT 'vm id', - `data_center_id` bigint unsigned NOT NULL COMMENT 'zone id', - `pod_id` bigint unsigned NOT NULL COMMENT 'pod id', - `cluster_id` bigint unsigned NOT NULL COMMENT 'cluster id', - `host_id` bigint unsigned NOT NULL COMMENT 'host id', - `created` datetime COMMENT 'date created', - `removed` datetime COMMENT 'date removed if not null', - CONSTRAINT `uc_vm_reservation__uuid` UNIQUE (`uuid`), - PRIMARY KEY(`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`volume_reservation` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `vm_reservation_id` bigint unsigned NOT NULL COMMENT 'id of the vm reservation', - `vm_id` bigint unsigned NOT NULL COMMENT 'vm id', - `volume_id` bigint unsigned NOT NULL COMMENT 'volume id', - `pool_id` bigint unsigned NOT NULL COMMENT 'pool assigned to the volume', - CONSTRAINT `fk_vm_pool_reservation__vm_reservation_id` FOREIGN KEY (`vm_reservation_id`) REFERENCES `vm_reservation`(`id`) ON DELETE CASCADE, - PRIMARY KEY(`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`s3` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(40), - `access_key` varchar(20) NOT NULL COMMENT ' The S3 access key', - `secret_key` varchar(40) NOT NULL COMMENT ' The S3 secret key', - `end_point` varchar(1024) COMMENT ' The S3 host', - `bucket` varchar(63) NOT NULL COMMENT ' The S3 host', - `https` tinyint unsigned DEFAULT NULL COMMENT ' Flag indicating whether or not to connect over HTTPS', - `connection_timeout` integer COMMENT ' The amount of time to wait (in milliseconds) when initially establishing a connection before giving up and timing out.', - `max_error_retry` integer COMMENT ' The maximum number of retry attempts for failed retryable requests (ex: 5xx error responses from services).', - `socket_timeout` integer COMMENT ' The amount of time to wait (in milliseconds) for data to be transfered over an established, open connection before the connection times out and is closed.', - `created` datetime COMMENT 'date the s3 first signed on', - PRIMARY KEY (`id`), - CONSTRAINT `uc_s3__uuid` UNIQUE (`uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`template_s3_ref` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `s3_id` bigint unsigned NOT NULL COMMENT ' Associated S3 instance id', - `template_id` bigint unsigned NOT NULL COMMENT ' Associated template id', - `created` DATETIME NOT NULL COMMENT ' The creation timestamp', - `size` bigint unsigned COMMENT ' The size of the object', - `physical_size` bigint unsigned DEFAULT 0 COMMENT ' The physical size of the object', - PRIMARY KEY (`id`), - CONSTRAINT `uc_template_s3_ref__template_id` UNIQUE (`template_id`), - CONSTRAINT `fk_template_s3_ref__s3_id` FOREIGN KEY `fk_template_s3_ref__s3_id` (`s3_id`) REFERENCES `s3` (`id`) ON DELETE CASCADE, - CONSTRAINT `fk_template_s3_ref__template_id` FOREIGN KEY `fk_template_s3_ref__template_id` (`template_id`) REFERENCES `vm_template` (`id`), - INDEX `i_template_s3_ref__s3_id`(`s3_id`), - INDEX `i_template_s3_ref__template_id`(`template_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 's3.enable', 'false', 'enable s3'); - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'NetworkManager', 'router.check.poolsize' , '10', 'Numbers of threads using to check redundant router status.'); - -ALTER TABLE `cloud`.`snapshots` ADD COLUMN `s3_id` bigint unsigned COMMENT 'S3 to which this snapshot will be stored'; - -ALTER TABLE `cloud`.`snapshots` ADD CONSTRAINT `fk_snapshots__s3_id` FOREIGN KEY `fk_snapshots__s3_id` (`s3_id`) REFERENCES `s3` (`id`); - -ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `inline` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Is this network offering LB provider is in inline mode'; - -ALTER TABLE `cloud`.`external_load_balancer_devices` DROP COLUMN `is_inline`; - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network','DEFAULT','NetworkManager','network.dhcp.nondefaultnetwork.setgateway.guestos','Windows','The guest OS\'s name start with this fields would result in DHCP server response gateway information even when the network it\'s on is not default network. Names are separated by comma.'); - -ALTER TABLE `cloud`.`sync_queue` ADD `queue_size` SMALLINT NOT NULL DEFAULT '0' COMMENT 'number of items being processed by the queue'; - -ALTER TABLE `cloud`.`sync_queue` ADD `queue_size_limit` SMALLINT NOT NULL DEFAULT '1' COMMENT 'max number of items the queue can process concurrently'; - -ALTER TABLE `cloud`.`sync_queue` DROP INDEX `i_sync_queue__queue_proc_time`; - -ALTER TABLE `cloud`.`sync_queue` DROP COLUMN `queue_proc_time`; - -ALTER TABLE `cloud`.`sync_queue` DROP COLUMN `queue_proc_msid`; - -ALTER TABLE `cloud`.`sync_queue_item` ADD `queue_proc_time` DATETIME COMMENT 'when processing started for the item' AFTER `queue_proc_number`; - -ALTER TABLE `cloud`.`sync_queue_item` ADD INDEX `i_sync_queue__queue_proc_time`(`queue_proc_time`); - -ALTER TABLE `cloud`.`inline_load_balancer_nic_map` DROP FOREIGN KEY fk_inline_load_balancer_nic_map__load_balancer_id; - -ALTER TABLE `cloud`.`inline_load_balancer_nic_map` DROP COLUMN load_balancer_id; - -ALTER TABLE upload ADD uuid VARCHAR(40); -ALTER TABLE async_job modify job_cmd VARCHAR(255); - - -ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `is_persistent` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides an ability to create persistent networks'; - - --- populate uuid column with db id if uuid is null -UPDATE `cloud`.`account` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`alert` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`async_job` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`cluster` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`data_center` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`dc_storage_network_ip_range` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`disk_offering` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`domain` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`event` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`external_firewall_devices` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`external_load_balancer_devices` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`external_nicira_nvp_devices` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`firewall_rules` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`guest_os` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`guest_os_category` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`host` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`host_pod_ref` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`hypervisor_capabilities` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`instance_group` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`load_balancer_stickiness_policies` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`network_external_firewall_device_map` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`network_external_lb_device_map` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`network_offerings` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`networks` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`nics` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`physical_network` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`physical_network_service_providers` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`physical_network_traffic_types` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`port_profile` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`project_invitations` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`projects` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`resource_tags` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`s2s_customer_gateway` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`s2s_vpn_connection` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`s2s_vpn_gateway` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`security_group` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`security_group_rule` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`snapshot_schedule` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`snapshots` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`snapshot_policy` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`static_routes` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`storage_pool` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`swift` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`upload` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`user` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`user_ip_address` set uuid=id WHERE uuid is NULL; --- UPDATE `cloud`.`user_vm_temp` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`virtual_router_providers` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`virtual_supervisor_module` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`vlan` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`vm_instance` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`vm_template` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`vpc` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`vpc_gateways` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`vpc_offerings` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`vpn_users` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`volumes` set uuid=id WHERE uuid is NULL; -UPDATE `cloud`.`configuration` set value = '/var/cloudstack/mnt' where name = 'mount.parent'; --- UPDATE `cloud`.`autoscale_vmgroups` set uuid=id WHERE uuid is NULL; --- UPDATE `cloud`.`autoscale_vmprofiles` set uuid=id WHERE uuid is NULL; --- UPDATE `cloud`.`autoscale_policies` set uuid=id WHERE uuid is NULL; --- UPDATE `cloud`.`counter` set uuid=id WHERE uuid is NULL; --- UPDATE `cloud`.`conditions` set uuid=id WHERE uuid is NULL; - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'detail.batch.query.size', '2000', 'Default entity detail batch query size for listing'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'api.throttling.enabled', 'false', 'Enable/Disable Api rate limit'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'api.throttling.interval', '1', 'Time interval (in seconds) to reset API count'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'api.throttling.max', '25', 'Max allowed number of APIs within fixed interval'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'api.throttling.cachesize', '50000', 'Account based API count cache size'); - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'direct.agent.pool.size', '500', 'Default size for DirectAgentPool'); - -ALTER TABLE `cloud`.`op_dc_vnet_alloc` DROP INDEX i_op_dc_vnet_alloc__vnet__data_center_id; - -ALTER TABLE `cloud`.`op_dc_vnet_alloc` ADD CONSTRAINT UNIQUE `i_op_dc_vnet_alloc__vnet__data_center_id`(`vnet`, `physical_network_id`, `data_center_id`); - -ALTER TABLE `cloud`.`op_dc_vnet_alloc` DROP INDEX i_op_dc_vnet_alloc__vnet__data_center_id__account_id; - -CREATE TABLE `cloud`.`region` ( - `id` int unsigned NOT NULL UNIQUE, - `name` varchar(255) NOT NULL UNIQUE, - `end_point` varchar(255) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -INSERT INTO `cloud`.`region` values ('1','Local','http://localhost:8080/client/'); - -CREATE TABLE `cloud`.`nicira_nvp_router_map` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `logicalrouter_uuid` varchar(255) NOT NULL UNIQUE COMMENT 'nicira uuid of logical router', - `network_id` bigint unsigned NOT NULL UNIQUE COMMENT 'cloudstack id of the network', - PRIMARY KEY (`id`), - CONSTRAINT `fk_nicira_nvp_router_map__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`external_bigswitch_vns_devices` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(255) UNIQUE, - `physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which bigswitch vns device is added', - `provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this bigswitch vns device', - `device_name` varchar(255) NOT NULL COMMENT 'name of the bigswitch vns device', - `host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external bigswitch vns device', - PRIMARY KEY (`id`), - CONSTRAINT `fk_external_bigswitch_vns_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_external_bigswitch_vns_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`counter` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(40), - `source` varchar(255) NOT NULL COMMENT 'source e.g. netscaler, snmp', - `name` varchar(255) NOT NULL COMMENT 'Counter name', - `value` varchar(255) NOT NULL COMMENT 'Value in case of source=snmp', - `removed` datetime COMMENT 'date removed if not null', - `created` datetime NOT NULL COMMENT 'date created', - PRIMARY KEY (`id`), - CONSTRAINT `uc_counter__uuid` UNIQUE (`uuid`), - INDEX `i_counter__removed`(`removed`), - INDEX `i_counter__source`(`source`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`conditions` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(40), - `counter_id` bigint unsigned NOT NULL COMMENT 'Counter Id', - `threshold` bigint unsigned NOT NULL COMMENT 'threshold value for the given counter', - `relational_operator` char(2) COMMENT 'relational operator to be used upon the counter and condition', - `domain_id` bigint unsigned NOT NULL COMMENT 'domain the Condition belongs to', - `account_id` bigint unsigned NOT NULL COMMENT 'owner of this Condition', - `removed` datetime COMMENT 'date removed if not null', - `created` datetime NOT NULL COMMENT 'date created', - PRIMARY KEY (`id`), - CONSTRAINT `fk_conditions__counter_id` FOREIGN KEY `fk_condition__counter_id`(`counter_id`) REFERENCES `counter`(`id`), - CONSTRAINT `fk_conditions__account_id` FOREIGN KEY `fk_condition__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_conditions__domain_id` FOREIGN KEY `fk_condition__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, - CONSTRAINT `uc_conditions__uuid` UNIQUE (`uuid`), - INDEX `i_conditions__removed`(`removed`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`autoscale_vmprofiles` ( - `id` bigint unsigned NOT NULL auto_increment, - `uuid` varchar(40), - `zone_id` bigint unsigned NOT NULL, - `domain_id` bigint unsigned NOT NULL, - `account_id` bigint unsigned NOT NULL, - `autoscale_user_id` bigint unsigned NOT NULL, - `service_offering_id` bigint unsigned NOT NULL, - `template_id` bigint unsigned NOT NULL, - `other_deploy_params` varchar(1024) COMMENT 'other deployment parameters that is in addition to zoneid,serviceofferingid,domainid', - `destroy_vm_grace_period` int unsigned COMMENT 'the time allowed for existing connections to get closed before a vm is destroyed', - `counter_params` varchar(1024) COMMENT 'the parameters for the counter to be used to get metric information from VMs', - `created` datetime NOT NULL COMMENT 'date created', - `removed` datetime COMMENT 'date removed if not null', - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_vmprofiles__domain_id` FOREIGN KEY `fk_autoscale_vmprofiles__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmprofiles__account_id` FOREIGN KEY `fk_autoscale_vmprofiles__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmprofiles__autoscale_user_id` FOREIGN KEY `fk_autoscale_vmprofiles__autoscale_user_id` (`autoscale_user_id`) REFERENCES `user`(`id`) ON DELETE CASCADE, - CONSTRAINT `uc_autoscale_vmprofiles__uuid` UNIQUE (`uuid`), - INDEX `i_autoscale_vmprofiles__removed`(`removed`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`autoscale_policies` ( - `id` bigint unsigned NOT NULL auto_increment, - `uuid` varchar(40), - `domain_id` bigint unsigned NOT NULL, - `account_id` bigint unsigned NOT NULL, - `duration` int unsigned NOT NULL, - `quiet_time` int unsigned NOT NULL, - `last_quiet_time` datetime DEFAULT NULL, - `action` varchar(15), - `created` datetime NOT NULL COMMENT 'date created', - `removed` datetime COMMENT 'date removed if not null', - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_policies__domain_id` FOREIGN KEY `fk_autoscale_policies__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_policies__account_id` FOREIGN KEY `fk_autoscale_policies__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, - CONSTRAINT `uc_autoscale_policies__uuid` UNIQUE (`uuid`), - INDEX `i_autoscale_policies__removed`(`removed`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`autoscale_vmgroups` ( - `id` bigint unsigned NOT NULL auto_increment, - `uuid` varchar(40), - `zone_id` bigint unsigned NOT NULL, - `domain_id` bigint unsigned NOT NULL, - `account_id` bigint unsigned NOT NULL, - `load_balancer_id` bigint unsigned NOT NULL, - `min_members` int unsigned DEFAULT 1, - `max_members` int unsigned NOT NULL, - `member_port` int unsigned NOT NULL, - `interval` int unsigned NOT NULL, - `profile_id` bigint unsigned NOT NULL, - `state` varchar(255) NOT NULL COMMENT 'enabled or disabled, a vmgroup is disabled to stop autoscaling activity', - `created` datetime NOT NULL COMMENT 'date created', - `removed` datetime COMMENT 'date removed if not null', - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_vmgroup__autoscale_vmprofile_id` FOREIGN KEY(`profile_id`) REFERENCES `autoscale_vmprofiles`(`id`), - CONSTRAINT `fk_autoscale_vmgroup__load_balancer_id` FOREIGN KEY(`load_balancer_id`) REFERENCES `load_balancing_rules`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmgroups__domain_id` FOREIGN KEY `fk_autoscale_vmgroups__domain_id` (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmgroups__account_id` FOREIGN KEY `fk_autoscale_vmgroups__account_id` (`account_id`) REFERENCES `account`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmgroups__zone_id` FOREIGN KEY `fk_autoscale_vmgroups__zone_id`(`zone_id`) REFERENCES `data_center`(`id`), - CONSTRAINT `uc_autoscale_vmgroups__uuid` UNIQUE (`uuid`), - INDEX `i_autoscale_vmgroups__removed`(`removed`), - INDEX `i_autoscale_vmgroups__load_balancer_id`(`load_balancer_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`autoscale_policy_condition_map` ( - `id` bigint unsigned NOT NULL auto_increment, - `policy_id` bigint unsigned NOT NULL, - `condition_id` bigint unsigned NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_policy_condition_map__policy_id` FOREIGN KEY `fk_autoscale_policy_condition_map__policy_id` (`policy_id`) REFERENCES `autoscale_policies` (`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_policy_condition_map__condition_id` FOREIGN KEY `fk_autoscale_policy_condition_map__condition_id` (`condition_id`) REFERENCES `conditions` (`id`), - INDEX `i_autoscale_policy_condition_map__policy_id`(`policy_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`autoscale_vmgroup_policy_map` ( - `id` bigint unsigned NOT NULL auto_increment, - `vmgroup_id` bigint unsigned NOT NULL, - `policy_id` bigint unsigned NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_vmgroup_policy_map__vmgroup_id` FOREIGN KEY `fk_autoscale_vmgroup_policy_map__vmgroup_id` (`vmgroup_id`) REFERENCES `autoscale_vmgroups` (`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmgroup_policy_map__policy_id` FOREIGN KEY `fk_autoscale_vmgroup_policy_map__policy_id` (`policy_id`) REFERENCES `autoscale_policies` (`id`), - INDEX `i_autoscale_vmgroup_policy_map__vmgroup_id`(`vmgroup_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`autoscale_vmgroup_vm_map` ( - `id` bigint unsigned NOT NULL auto_increment, - `vmgroup_id` bigint unsigned NOT NULL, - `instance_id` bigint unsigned NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk_autoscale_vmgroup_vm_map__vmgroup_id` FOREIGN KEY `fk_autoscale_vmgroup_vm_map__vmgroup_id` (`vmgroup_id`) REFERENCES `autoscale_vmgroups` (`id`) ON DELETE CASCADE, - CONSTRAINT `fk_autoscale_vmgroup_vm_map__instance_id` FOREIGN KEY `fk_autoscale_vmgroup_vm_map__instance_id` (`instance_id`) REFERENCES `vm_instance` (`id`), - INDEX `i_autoscale_vmgroup_vm_map__vmgroup_id`(`vmgroup_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (1, UUID(), 'snmp','Linux User CPU - percentage', '1.3.6.1.4.1.2021.11.9.0', now()); -INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (2, UUID(), 'snmp','Linux System CPU - percentage', '1.3.6.1.4.1.2021.11.10.0', now()); -INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (3, UUID(), 'snmp','Linux CPU Idle - percentage', '1.3.6.1.4.1.2021.11.11.0', now()); -INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (100, UUID(), 'netscaler','Response Time - microseconds', 'RESPTIME', now()); -INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (4, UUID(), 'cpu','Linux User CPU - percentage - native', '1.3.6.1.4.1.2021.11.9.1', now()); -INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (5, UUID(), 'memory','Linux User RAM - percentage - native', '1.3.6.1.4.1.2021.11.10.1', now()); - -CREATE TABLE `cloud`.`user_ipv6_address` ( - `id` bigint unsigned NOT NULL UNIQUE auto_increment, - `uuid` varchar(40), - `account_id` bigint unsigned NULL, - `domain_id` bigint unsigned NULL, - `ip_address` char(50) NOT NULL, - `data_center_id` bigint unsigned NOT NULL COMMENT 'zone that it belongs to', - `vlan_id` bigint unsigned NOT NULL, - `state` char(32) NOT NULL default 'Free' COMMENT 'state of the ip address', - `mac_address` varchar(40) NOT NULL COMMENT 'mac address of this ip', - `source_network_id` bigint unsigned NOT NULL COMMENT 'network id ip belongs to', - `network_id` bigint unsigned COMMENT 'network this public ip address is associated with', - `physical_network_id` bigint unsigned NOT NULL COMMENT 'physical network id that this configuration is based on', - `created` datetime NULL COMMENT 'Date this ip was allocated to someone', - PRIMARY KEY (`id`), - UNIQUE (`ip_address`, `source_network_id`), - CONSTRAINT `fk_user_ipv6_address__source_network_id` FOREIGN KEY (`source_network_id`) REFERENCES `networks`(`id`), - CONSTRAINT `fk_user_ipv6_address__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`), - CONSTRAINT `fk_user_ipv6_address__account_id` FOREIGN KEY (`account_id`) REFERENCES `account`(`id`), - CONSTRAINT `fk_user_ipv6_address__vlan_id` FOREIGN KEY (`vlan_id`) REFERENCES `vlan`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_user_ipv6_address__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE, - CONSTRAINT `uc_user_ipv6_address__uuid` UNIQUE (`uuid`), - CONSTRAINT `fk_user_ipv6_address__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -ALTER TABLE `cloud`.`networks` ADD COLUMN `ip6_gateway` varchar(50) COMMENT 'IPv6 gateway for this network'; -ALTER TABLE `cloud`.`networks` ADD COLUMN `ip6_cidr` varchar(50) COMMENT 'IPv6 cidr for this network'; - -ALTER TABLE `cloud`.`nics` ADD COLUMN `ip6_gateway` varchar(50) COMMENT 'gateway for ip6 address'; -ALTER TABLE `cloud`.`nics` ADD COLUMN `ip6_cidr` varchar(50) COMMENT 'cidr for ip6 address'; - -ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_gateway` varchar(255); -ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_cidr` varchar(255); -ALTER TABLE `cloud`.`vlan` ADD COLUMN `ip6_range` varchar(255); - -ALTER TABLE `cloud`.`data_center` ADD COLUMN `ip6_dns1` varchar(255); -ALTER TABLE `cloud`.`data_center` ADD COLUMN `ip6_dns2` varchar(255); - -UPDATE `cloud`.`networks` INNER JOIN `cloud`.`vlan` ON networks.id = vlan.network_id -SET networks.gateway = vlan.vlan_gateway, networks.ip6_gateway = vlan.ip6_gateway, networks.ip6_cidr = vlan.ip6_cidr -WHERE networks.data_center_id = vlan.data_center_id AND networks.physical_network_id = vlan.physical_network_id; - --- DB views for list api - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE VIEW `cloud`.`user_vm_view` AS - select - vm_instance.id id, - vm_instance.name name, - user_vm.display_name display_name, - user_vm.user_data user_data, - 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, - instance_group.id instance_group_id, - instance_group.uuid instance_group_uuid, - instance_group.name instance_group_name, - vm_instance.uuid uuid, - vm_instance.last_host_id last_host_id, - vm_instance.vm_type type, - vm_instance.vnc_password vnc_password, - vm_instance.limit_cpu_use limit_cpu_use, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.ha_enabled ha_enabled, - vm_instance.hypervisor_type hypervisor_type, - vm_instance.instance_name instance_name, - vm_instance.guest_os_id guest_os_id, - guest_os.uuid guest_os_uuid, - vm_instance.pod_id pod_id, - host_pod_ref.uuid pod_uuid, - vm_instance.private_ip_address private_ip_address, - vm_instance.private_mac_address private_mac_address, - vm_instance.vm_type vm_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.is_security_group_enabled security_group_enabled, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.name template_name, - vm_template.display_text template_display_text, - vm_template.enable_password password_enabled, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - service_offering.id service_offering_id, - disk_offering.uuid service_offering_uuid, - service_offering.cpu cpu, - service_offering.speed speed, - service_offering.ram_size ram_size, - disk_offering.name service_offering_name, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.pool_type pool_type, - volumes.id volume_id, - volumes.uuid volume_uuid, - volumes.device_id volume_device_id, - volumes.volume_type volume_type, - security_group.id security_group_id, - security_group.uuid security_group_uuid, - security_group.name security_group_name, - security_group.description security_group_description, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - user_ip_address.id public_ip_id, - user_ip_address.uuid public_ip_uuid, - user_ip_address.public_ip_address public_ip_address, - ssh_keypairs.keypair_name keypair_name, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`user_vm` - inner join - `cloud`.`vm_instance` ON vm_instance.id = user_vm.id - and vm_instance.removed is NULL - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id - left join - `cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = user_vm.iso_id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id - left join - `cloud`.`volumes` ON vm_instance.id = volumes.instance_id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id - left join - `cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON networks.vpc_id = vpc.id - left join - `cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` ON user_vm_details.vm_id = vm_instance.id - and user_vm_details.name = 'SSH.PublicKey' - left join - `cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = user_vm_details.value - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id - and resource_tags.resource_type = 'UserVm' - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'VirtualMachine' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`domain_router_view`; -CREATE VIEW `cloud`.`domain_router_view` AS - select - vm_instance.id id, - vm_instance.name 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, - vm_instance.uuid uuid, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.pod_id pod_id, - vm_instance.instance_name instance_name, - host_pod_ref.uuid pod_uuid, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - data_center.dns1 dns1, - data_center.dns2 dns2, - data_center.ip6_dns1 ip6_dns1, - data_center.ip6_dns2 ip6_dns2, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - vm_template.id template_id, - vm_template.uuid template_uuid, - service_offering.id service_offering_id, - disk_offering.uuid service_offering_uuid, - disk_offering.name service_offering_name, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.network_domain network_domain, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - domain_router.template_version template_version, - domain_router.scripts_version scripts_version, - domain_router.is_redundant_router is_redundant_router, - domain_router.redundant_state redundant_state, - domain_router.stop_pending stop_pending, - domain_router.role role - from - `cloud`.`domain_router` - inner join - `cloud`.`vm_instance` ON vm_instance.id = domain_router.id - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id - left join - `cloud`.`volumes` ON vm_instance.id = volumes.instance_id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON domain_router.vpc_id = vpc.id - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'DomainRouter' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`security_group_view`; -CREATE VIEW `cloud`.`security_group_view` AS - select - security_group.id id, - security_group.name name, - security_group.description description, - security_group.uuid uuid, - 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, - security_group_rule.id rule_id, - security_group_rule.uuid rule_uuid, - security_group_rule.type rule_type, - security_group_rule.start_port rule_start_port, - security_group_rule.end_port rule_end_port, - security_group_rule.protocol rule_protocol, - security_group_rule.allowed_network_id rule_allowed_network_id, - security_group_rule.allowed_ip_cidr rule_allowed_ip_cidr, - security_group_rule.create_status rule_create_status, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`security_group` - left join - `cloud`.`security_group_rule` ON security_group.id = security_group_rule.security_group_id - inner join - `cloud`.`account` ON security_group.account_id = account.id - inner join - `cloud`.`domain` ON security_group.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = security_group.account_id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = security_group.id - and resource_tags.resource_type = 'SecurityGroup' - left join - `cloud`.`async_job` ON async_job.instance_id = security_group.id - and async_job.instance_type = 'SecurityGroup' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`resource_tag_view`; -CREATE VIEW `cloud`.`resource_tag_view` AS - select - resource_tags.id, - resource_tags.uuid, - resource_tags.key, - resource_tags.value, - resource_tags.resource_id, - resource_tags.resource_uuid, - resource_tags.resource_type, - resource_tags.customer, - 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`.`resource_tags` - inner join - `cloud`.`account` ON resource_tags.account_id = account.id - inner join - `cloud`.`domain` ON resource_tags.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = resource_tags.account_id; - - -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, - 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; - -DROP VIEW IF EXISTS `cloud`.`instance_group_view`; -CREATE VIEW `cloud`.`instance_group_view` AS - select - instance_group.id, - instance_group.uuid, - instance_group.name, - instance_group.removed, - instance_group.created, - 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`.`instance_group` - inner join - `cloud`.`account` ON instance_group.account_id = account.id - inner join - `cloud`.`domain` ON account.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = instance_group.account_id; - -DROP VIEW IF EXISTS `cloud`.`user_view`; -CREATE VIEW `cloud`.`user_view` AS - select - user.id, - user.uuid, - user.username, - user.password, - user.firstname, - user.lastname, - user.email, - user.state, - user.api_key, - user.secret_key, - user.created, - user.removed, - user.timezone, - user.registration_token, - user.is_registered, - user.incorrect_login_attempts, - 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, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`user` - inner join - `cloud`.`account` ON user.account_id = account.id - inner join - `cloud`.`domain` ON account.domain_id = domain.id - left join - `cloud`.`async_job` ON async_job.instance_id = user.id - and async_job.instance_type = 'User' - and async_job.job_status = 0; - - -DROP VIEW IF EXISTS `cloud`.`project_view`; -CREATE VIEW `cloud`.`project_view` AS - select - projects.id, - projects.uuid, - projects.name, - projects.display_text, - projects.state, - projects.removed, - projects.created, - account.account_name owner, - pacct.account_id, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer - from - `cloud`.`projects` - inner join - `cloud`.`domain` ON projects.domain_id = domain.id - inner join - `cloud`.`project_account` ON projects.id = project_account.project_id - and project_account.account_role = 'Admin' - inner join - `cloud`.`account` ON account.id = project_account.account_id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = projects.id - and resource_tags.resource_type = 'Project' - left join - `cloud`.`project_account` pacct ON projects.id = pacct.project_id; - -DROP VIEW IF EXISTS `cloud`.`project_account_view`; -CREATE VIEW `cloud`.`project_account_view` AS - select - project_account.id, - account.id account_id, - account.uuid account_uuid, - account.account_name, - account.type account_type, - project_account.account_role, - projects.id project_id, - projects.uuid project_uuid, - projects.name project_name, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`project_account` - inner join - `cloud`.`account` ON project_account.account_id = account.id - inner join - `cloud`.`domain` ON account.domain_id = domain.id - inner join - `cloud`.`projects` ON projects.id = project_account.project_id; - -DROP VIEW IF EXISTS `cloud`.`project_invitation_view`; -CREATE VIEW `cloud`.`project_invitation_view` AS - select - project_invitations.id, - project_invitations.uuid, - project_invitations.email, - project_invitations.created, - project_invitations.state, - projects.id project_id, - projects.uuid project_uuid, - projects.name project_name, - account.id account_id, - account.uuid account_uuid, - account.account_name, - account.type account_type, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`project_invitations` - left join - `cloud`.`account` ON project_invitations.account_id = account.id - left join - `cloud`.`domain` ON project_invitations.domain_id = domain.id - left join - `cloud`.`projects` ON projects.id = project_invitations.project_id; - -DROP VIEW IF EXISTS `cloud`.`host_view`; -CREATE VIEW `cloud`.`host_view` AS - select - host.id, - host.uuid, - host.name, - host.status, - host.disconnected, - host.type, - host.private_ip_address, - host.version, - host.hypervisor_type, - host.hypervisor_version, - host.capabilities, - host.last_ping, - host.created, - host.removed, - host.resource_state, - host.mgmt_server_id, - host.cpus, - host.speed, - host.ram, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - host_tags.tag, - guest_os_category.id guest_os_category_id, - guest_os_category.uuid guest_os_category_uuid, - guest_os_category.name guest_os_category_name, - mem_caps.used_capacity memory_used_capacity, - mem_caps.reserved_capacity memory_reserved_capacity, - cpu_caps.used_capacity cpu_used_capacity, - cpu_caps.reserved_capacity cpu_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`host` - left join - `cloud`.`cluster` ON host.cluster_id = cluster.id - left join - `cloud`.`data_center` ON host.data_center_id = data_center.id - left join - `cloud`.`host_pod_ref` ON host.pod_id = host_pod_ref.id - left join - `cloud`.`host_details` ON host.id = host_details.host_id - and host_details.name = 'guest.os.category.id' - left join - `cloud`.`guest_os_category` ON guest_os_category.id = CONVERT( host_details.value , UNSIGNED) - left join - `cloud`.`host_tags` ON host_tags.host_id = host.id - left join - `cloud`.`op_host_capacity` mem_caps ON host.id = mem_caps.host_id - and mem_caps.capacity_type = 0 - left join - `cloud`.`op_host_capacity` cpu_caps ON host.id = cpu_caps.host_id - and cpu_caps.capacity_type = 1 - left join - `cloud`.`async_job` ON async_job.instance_id = host.id - and async_job.instance_type = 'Host' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`volume_view`; -CREATE VIEW `cloud`.`volume_view` AS - select - volumes.id, - volumes.uuid, - volumes.name, - volumes.device_id, - volumes.volume_type, - volumes.size, - volumes.created, - volumes.state, - volumes.attached, - volumes.removed, - volumes.pod_id, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - vm_instance.id vm_id, - vm_instance.uuid vm_uuid, - vm_instance.name vm_name, - vm_instance.state vm_state, - vm_instance.vm_type, - user_vm.display_name vm_display_name, - volume_host_ref.size volume_host_size, - volume_host_ref.created volume_host_created, - volume_host_ref.format, - volume_host_ref.download_pct, - volume_host_ref.download_state, - volume_host_ref.error_str, - disk_offering.id disk_offering_id, - disk_offering.uuid disk_offering_uuid, - disk_offering.name disk_offering_name, - disk_offering.display_text disk_offering_display_text, - disk_offering.use_local_storage, - disk_offering.system_use, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.name pool_name, - cluster.hypervisor_type, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.extractable, - vm_template.type template_type, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`volumes` - inner join - `cloud`.`account` ON volumes.account_id = account.id - inner join - `cloud`.`domain` ON volumes.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON volumes.data_center_id = data_center.id - left join - `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id - left join - `cloud`.`user_vm` ON user_vm.id = vm_instance.id - left join - `cloud`.`volume_host_ref` ON volumes.id = volume_host_ref.volume_id - and volumes.data_center_id = volume_host_ref.zone_id - left join - `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`vm_template` ON volumes.template_id = vm_template.id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id - and resource_tags.resource_type = 'Volume' - left join - `cloud`.`async_job` ON async_job.instance_id = volumes.id - and async_job.instance_type = 'Volume' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`account_netstats_view`; -CREATE VIEW `cloud`.`account_netstats_view` AS - SELECT - account_id, - sum(net_bytes_received) + sum(current_bytes_received) as bytesReceived, - sum(net_bytes_sent) + sum(current_bytes_sent) as bytesSent - FROM - `cloud`.`user_statistics` - group by account_id; - - -DROP VIEW IF EXISTS `cloud`.`account_vmstats_view`; -CREATE VIEW `cloud`.`account_vmstats_view` AS - SELECT - account_id, state, count(*) as vmcount - from - `cloud`.`vm_instance` - group by account_id , state; - -DROP VIEW IF EXISTS `cloud`.`free_ip_view`; -CREATE VIEW `cloud`.`free_ip_view` AS - select - count(user_ip_address.id) free_ip - from - `cloud`.`user_ip_address` - inner join - `cloud`.`vlan` ON vlan.id = user_ip_address.vlan_db_id - and vlan.vlan_type = 'VirtualNetwork' - where - state = 'Free'; - -DROP VIEW IF EXISTS `cloud`.`account_view`; -CREATE VIEW `cloud`.`account_view` AS - select - account.id, - account.uuid, - account.account_name, - account.type, - account.state, - account.removed, - account.cleanup_needed, - account.network_domain, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - account_netstats_view.bytesReceived, - account_netstats_view.bytesSent, - vmlimit.max vmLimit, - vmcount.count vmTotal, - runningvm.vmcount runningVms, - stoppedvm.vmcount stoppedVms, - iplimit.max ipLimit, - ipcount.count ipTotal, - free_ip_view.free_ip ipFree, - volumelimit.max volumeLimit, - volumecount.count volumeTotal, - snapshotlimit.max snapshotLimit, - snapshotcount.count snapshotTotal, - templatelimit.max templateLimit, - templatecount.count templateTotal, - vpclimit.max vpcLimit, - vpccount.count vpcTotal, - projectlimit.max projectLimit, - projectcount.count projectTotal, - networklimit.max networkLimit, - networkcount.count networkTotal, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`free_ip_view`, - `cloud`.`account` - inner join - `cloud`.`domain` ON account.domain_id = domain.id - left join - `cloud`.`data_center` ON account.default_zone_id = data_center.id - left join - `cloud`.`account_netstats_view` ON account.id = account_netstats_view.account_id - left join - `cloud`.`resource_limit` vmlimit ON account.id = vmlimit.account_id - and vmlimit.type = 'user_vm' - left join - `cloud`.`resource_count` vmcount ON account.id = vmcount.account_id - and vmcount.type = 'user_vm' - left join - `cloud`.`account_vmstats_view` runningvm ON account.id = runningvm.account_id - and runningvm.state = 'Running' - left join - `cloud`.`account_vmstats_view` stoppedvm ON account.id = stoppedvm.account_id - and stoppedvm.state = 'Stopped' - left join - `cloud`.`resource_limit` iplimit ON account.id = iplimit.account_id - and iplimit.type = 'public_ip' - left join - `cloud`.`resource_count` ipcount ON account.id = ipcount.account_id - and ipcount.type = 'public_ip' - left join - `cloud`.`resource_limit` volumelimit ON account.id = volumelimit.account_id - and volumelimit.type = 'volume' - left join - `cloud`.`resource_count` volumecount ON account.id = volumecount.account_id - and volumecount.type = 'volume' - left join - `cloud`.`resource_limit` snapshotlimit ON account.id = snapshotlimit.account_id - and snapshotlimit.type = 'snapshot' - left join - `cloud`.`resource_count` snapshotcount ON account.id = snapshotcount.account_id - and snapshotcount.type = 'snapshot' - left join - `cloud`.`resource_limit` templatelimit ON account.id = templatelimit.account_id - and templatelimit.type = 'template' - left join - `cloud`.`resource_count` templatecount ON account.id = templatecount.account_id - and templatecount.type = 'template' - left join - `cloud`.`resource_limit` vpclimit ON account.id = vpclimit.account_id - and vpclimit.type = 'vpc' - left join - `cloud`.`resource_count` vpccount ON account.id = vpccount.account_id - and vpccount.type = 'vpc' - left join - `cloud`.`resource_limit` projectlimit ON account.id = projectlimit.account_id - and projectlimit.type = 'project' - left join - `cloud`.`resource_count` projectcount ON account.id = projectcount.account_id - and projectcount.type = 'project' - left join - `cloud`.`resource_limit` networklimit ON account.id = networklimit.account_id - and networklimit.type = 'network' - left join - `cloud`.`resource_count` networkcount ON account.id = networkcount.account_id - and networkcount.type = 'network' - left join - `cloud`.`async_job` ON async_job.instance_id = account.id - and async_job.instance_type = 'Account' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`async_job_view`; -CREATE VIEW `cloud`.`async_job_view` AS - select - 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, - user.id user_id, - user.uuid user_uuid, - async_job.id, - async_job.uuid, - async_job.job_cmd, - async_job.job_status, - async_job.job_process_status, - async_job.job_result_code, - async_job.job_result, - async_job.created, - async_job.removed, - async_job.instance_type, - async_job.instance_id, - CASE - WHEN async_job.instance_type = 'Volume' THEN volumes.uuid - WHEN - async_job.instance_type = 'Template' - or async_job.instance_type = 'Iso' - THEN - vm_template.uuid - WHEN - async_job.instance_type = 'VirtualMachine' - or async_job.instance_type = 'ConsoleProxy' - or async_job.instance_type = 'SystemVm' - or async_job.instance_type = 'DomainRouter' - THEN - vm_instance.uuid - WHEN async_job.instance_type = 'Snapshot' THEN snapshots.uuid - WHEN async_job.instance_type = 'Host' THEN host.uuid - WHEN async_job.instance_type = 'StoragePool' THEN storage_pool.uuid - WHEN async_job.instance_type = 'IpAddress' THEN user_ip_address.uuid - WHEN async_job.instance_type = 'SecurityGroup' THEN security_group.uuid - WHEN async_job.instance_type = 'PhysicalNetwork' THEN physical_network.uuid - WHEN async_job.instance_type = 'TrafficType' THEN physical_network_traffic_types.uuid - WHEN async_job.instance_type = 'PhysicalNetworkServiceProvider' THEN physical_network_service_providers.uuid - WHEN async_job.instance_type = 'FirewallRule' THEN firewall_rules.uuid - WHEN async_job.instance_type = 'Account' THEN acct.uuid - WHEN async_job.instance_type = 'User' THEN us.uuid - WHEN async_job.instance_type = 'StaticRoute' THEN static_routes.uuid - WHEN async_job.instance_type = 'PrivateGateway' THEN vpc_gateways.uuid - WHEN async_job.instance_type = 'Counter' THEN counter.uuid - WHEN async_job.instance_type = 'Condition' THEN conditions.uuid - WHEN async_job.instance_type = 'AutoScalePolicy' THEN autoscale_policies.uuid - WHEN async_job.instance_type = 'AutoScaleVmProfile' THEN autoscale_vmprofiles.uuid - WHEN async_job.instance_type = 'AutoScaleVmGroup' THEN autoscale_vmgroups.uuid - ELSE null - END instance_uuid - from - `cloud`.`async_job` - left join - `cloud`.`account` ON async_job.account_id = account.id - left join - `cloud`.`domain` ON domain.id = account.domain_id - left join - `cloud`.`user` ON async_job.user_id = user.id - left join - `cloud`.`volumes` ON async_job.instance_id = volumes.id - left join - `cloud`.`vm_template` ON async_job.instance_id = vm_template.id - left join - `cloud`.`vm_instance` ON async_job.instance_id = vm_instance.id - left join - `cloud`.`snapshots` ON async_job.instance_id = snapshots.id - left join - `cloud`.`host` ON async_job.instance_id = host.id - left join - `cloud`.`storage_pool` ON async_job.instance_id = storage_pool.id - left join - `cloud`.`user_ip_address` ON async_job.instance_id = user_ip_address.id - left join - `cloud`.`security_group` ON async_job.instance_id = security_group.id - left join - `cloud`.`physical_network` ON async_job.instance_id = physical_network.id - left join - `cloud`.`physical_network_traffic_types` ON async_job.instance_id = physical_network_traffic_types.id - left join - `cloud`.`physical_network_service_providers` ON async_job.instance_id = physical_network_service_providers.id - left join - `cloud`.`firewall_rules` ON async_job.instance_id = firewall_rules.id - left join - `cloud`.`account` acct ON async_job.instance_id = acct.id - left join - `cloud`.`user` us ON async_job.instance_id = us.id - left join - `cloud`.`static_routes` ON async_job.instance_id = static_routes.id - left join - `cloud`.`vpc_gateways` ON async_job.instance_id = vpc_gateways.id - left join - `cloud`.`counter` ON async_job.instance_id = counter.id - left join - `cloud`.`conditions` ON async_job.instance_id = conditions.id - left join - `cloud`.`autoscale_policies` ON async_job.instance_id = autoscale_policies.id - left join - `cloud`.`autoscale_vmprofiles` ON async_job.instance_id = autoscale_vmprofiles.id - left join - `cloud`.`autoscale_vmgroups` ON async_job.instance_id = autoscale_vmgroups.id; - -DROP VIEW IF EXISTS `cloud`.`storage_pool_view`; -CREATE VIEW `cloud`.`storage_pool_view` AS - select - storage_pool.id, - storage_pool.uuid, - storage_pool.name, - storage_pool.status, - storage_pool.path, - storage_pool.pool_type, - storage_pool.host_address, - storage_pool.created, - storage_pool.removed, - storage_pool.capacity_bytes, - storage_pool.scope, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - storage_pool_details.name tag, - op_host_capacity.used_capacity disk_used_capacity, - op_host_capacity.reserved_capacity disk_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`storage_pool` - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`data_center` ON storage_pool.data_center_id = data_center.id - left join - `cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id - left join - `cloud`.`storage_pool_details` ON storage_pool_details.pool_id = storage_pool.id - and storage_pool_details.value = 'true' - left join - `cloud`.`op_host_capacity` ON storage_pool.id = op_host_capacity.host_id - and op_host_capacity.capacity_type = 3 - left join - `cloud`.`async_job` ON async_job.instance_id = storage_pool.id - and async_job.instance_type = 'StoragePool' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`disk_offering_view`; -CREATE VIEW `cloud`.`disk_offering_view` AS - select - disk_offering.id, - disk_offering.uuid, - disk_offering.name, - disk_offering.display_text, - disk_offering.disk_size, - disk_offering.created, - disk_offering.tags, - disk_offering.customized, - disk_offering.removed, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.sort_key, - disk_offering.type, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`disk_offering` - left join - `cloud`.`domain` ON disk_offering.domain_id = domain.id; - -DROP VIEW IF EXISTS `cloud`.`service_offering_view`; -CREATE VIEW `cloud`.`service_offering_view` AS - select - service_offering.id, - disk_offering.uuid, - disk_offering.name, - disk_offering.display_text, - disk_offering.created, - disk_offering.tags, - disk_offering.removed, - disk_offering.use_local_storage, - disk_offering.system_use, - service_offering.cpu, - service_offering.speed, - service_offering.ram_size, - service_offering.nw_rate, - service_offering.mc_rate, - service_offering.ha_enabled, - service_offering.limit_cpu_use, - service_offering.host_tag, - service_offering.default_use, - service_offering.vm_type, - service_offering.sort_key, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`service_offering` - inner join - `cloud`.`disk_offering` ON service_offering.id = disk_offering.id - left join - `cloud`.`domain` ON disk_offering.domain_id = domain.id; - -DROP VIEW IF EXISTS `cloud`.`data_center_view`; -CREATE VIEW `cloud`.`data_center_view` AS - select - data_center.id, - data_center.uuid, - data_center.name, - data_center.is_security_group_enabled, - data_center.is_local_storage_enabled, - data_center.description, - data_center.dns1, - data_center.dns2, - data_center.ip6_dns1, - data_center.ip6_dns2, - data_center.internal_dns1, - data_center.internal_dns2, - data_center.guest_network_cidr, - data_center.domain, - data_center.networktype, - data_center.allocation_state, - data_center.zone_token, - data_center.dhcp_provider, - data_center.removed, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`data_center` - left join - `cloud`.`domain` ON data_center.domain_id = domain.id; - - -CREATE TABLE `cloud`.`baremetal_dhcp_devices` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(40) UNIQUE, - `nsp_id` bigint unsigned DEFAULT NULL COMMENT 'Network Service Provider ID', - `pod_id` bigint unsigned DEFAULT NULL COMMENT 'Pod id where this dhcp server in', - `device_type` varchar(255) DEFAULT NULL COMMENT 'type of the external device', - `physical_network_id` bigint unsigned DEFAULT NULL COMMENT 'id of the physical network in to which external dhcp device is added', - `host_id` bigint unsigned DEFAULT NULL COMMENT 'host id coresponding to the external dhcp device', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`baremetal_pxe_devices` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(40) UNIQUE, - `nsp_id` bigint unsigned DEFAULT NULL COMMENT 'Network Service Provider ID', - `pod_id` bigint unsigned DEFAULT NULL COMMENT 'Pod id where this pxe server in, for pxe per zone this field is null', - `device_type` varchar(255) DEFAULT NULL COMMENT 'type of the pxe device', - `physical_network_id` bigint unsigned DEFAULT NULL COMMENT 'id of the physical network in to which external pxe device is added', - `host_id` bigint unsigned DEFAULT NULL COMMENT 'host id coresponding to the external pxe device', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `cloud`.`ucs_blade` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(40) UNIQUE, - `ucs_manager_id` bigint unsigned NOT NULL, - `host_id` bigint unsigned DEFAULT NULL, - `dn` varchar(512) NOT NULL, - `profile_dn` varchar(512) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`ucs_manager` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(40) UNIQUE, - `zone_id` bigint unsigned NOT NULL, - `name` varchar(128) DEFAULT NULL, - `url` varchar(255) NOT NULL, - `username` varchar(255) NOT NULL, - `password` varchar(255) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -SET foreign_key_checks = 1; - -UPDATE `cloud`.`configuration` SET value='KVM,XenServer,VMware,Ovm' WHERE name='hypervisor.list'; - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'concurrent.snapshots.threshold.perhost' , NULL, 'Limit number of snapshots that can be handled concurrently; default is NULL - unlimited.'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'network.ipv6.search.retry.max' , 10000, 'The maximum number of retrying times to search for an available IPv6 address in the table'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Usage', 'DEFAULT', 'management-server', 'traffic.sentinel.exclude.zones' , '', 'Traffic going into specified list of zones is not metered'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Usage', 'DEFAULT', 'management-server', 'traffic.sentinel.include.zones' , 'EXTERNAL', 'Traffic going into specified list of zones is metered. For metering all traffic leave this parameter empty'); - - -INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (163, UUID(), 10, 'Ubuntu 12.04 (32-bit)'); -INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (164, UUID(), 10, 'Ubuntu 12.04 (64-bit)'); - -DROP TABLE IF EXISTS `cloud`.`netscaler_pod_ref`; -CREATE TABLE `cloud`.`netscaler_pod_ref` ( - `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', - `external_load_balancer_device_id` bigint unsigned NOT NULL COMMENT 'id of external load balancer device', - `pod_id` bigint unsigned NOT NULL COMMENT 'pod id', - PRIMARY KEY (`id`), - CONSTRAINT `fk_ns_pod_ref__pod_id` FOREIGN KEY (`pod_id`) REFERENCES `cloud`.`host_pod_ref`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_ns_pod_ref__device_id` FOREIGN KEY (`external_load_balancer_device_id`) REFERENCES `external_load_balancer_devices`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'eip.use.multiple.netscalers' , 'false', 'Should be set to true, if there will be multiple NetScaler devices providing EIP service in a zone'); - -UPDATE `cloud`.`configuration` set category='Advanced' where category='Advanced '; -UPDATE `cloud`.`configuration` set category='Hidden' where category='Hidden '; - diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql deleted file mode 100644 index 2e7f9e9fe9cf..000000000000 --- a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql +++ /dev/null @@ -1,569 +0,0 @@ --- 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.10.0.0 to 4.11.0.0 ---; - --- Add For VPC flag -ALTER TABLE cloud.network_offerings ADD COLUMN for_vpc INT(1) NOT NULL DEFAULT 0; -UPDATE cloud.network_offerings o -SET for_vpc = 1 -where - o.conserve_mode = 0 - and o.guest_type = 'Isolated' - and exists( - SELECT id - from cloud.ntwk_offering_service_map - where network_offering_id = o.id and ( - provider in ('VpcVirtualRouter', 'InternalLbVm', 'JuniperContrailVpcRouter') - or service in ('NetworkACL') - ) - ); - -UPDATE `cloud`.`configuration` SET value = '600', default_value = '600' WHERE category = 'Advanced' AND name = 'router.aggregation.command.each.timeout'; - --- CA framework changes -DELETE from `cloud`.`configuration` where name='ssl.keystore'; - --- Certificate Revocation List -CREATE TABLE IF NOT EXISTS `cloud`.`crl` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `serial` varchar(255) UNIQUE NOT NULL COMMENT 'certificate\'s serial number as hex string', - `cn` varchar(255) COMMENT 'certificate\'s common name', - `revoker_uuid` varchar(40) COMMENT 'revoker user account uuid', - `revoked` datetime COMMENT 'date of revocation', - PRIMARY KEY (`id`), - KEY (`serial`), - UNIQUE KEY (`serial`, `cn`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- Host HA feature -CREATE TABLE IF NOT EXISTS `cloud`.`ha_config` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `resource_id` bigint(20) unsigned DEFAULT NULL COMMENT 'id of the resource', - `resource_type` varchar(255) NOT NULL COMMENT 'the type of the resource', - `enabled` int(1) unsigned DEFAULT '0' COMMENT 'is HA enabled for the resource', - `ha_state` varchar(255) DEFAULT 'Disabled' COMMENT 'HA state', - `provider` varchar(255) DEFAULT NULL COMMENT 'HA provider', - `update_count` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'state based incr-only counter for atomic ha_state updates', - `update_time` datetime COMMENT 'last ha_state update datetime', - `mgmt_server_id` bigint(20) unsigned DEFAULT NULL COMMENT 'management server id that is responsible for the HA for the resource', - PRIMARY KEY (`id`), - KEY `i_ha_config__enabled` (`enabled`), - KEY `i_ha_config__ha_state` (`ha_state`), - KEY `i_ha_config__mgmt_server_id` (`mgmt_server_id`), - UNIQUE KEY (`resource_id`, `resource_type`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -DELETE from `cloud`.`configuration` where name='outofbandmanagement.sync.interval'; - --- Annotations specifc changes following -CREATE TABLE IF NOT EXISTS `cloud`.`annotations` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `uuid` varchar(40) UNIQUE, - `annotation` text, - `entity_uuid` varchar(40), - `entity_type` varchar(32), - `user_uuid` varchar(40), - `created` datetime COMMENT 'date of creation', - `removed` datetime COMMENT 'date of removal', - PRIMARY KEY (`id`), - KEY (`uuid`), - KEY `i_entity` (`entity_uuid`, `entity_type`, `created`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -DROP VIEW IF EXISTS `cloud`.`last_annotation_view`; -CREATE VIEW `last_annotation_view` AS - SELECT - `annotations`.`uuid` AS `uuid`, - `annotations`.`annotation` AS `annotation`, - `annotations`.`entity_uuid` AS `entity_uuid`, - `annotations`.`entity_type` AS `entity_type`, - `annotations`.`user_uuid` AS `user_uuid`, - `annotations`.`created` AS `created`, - `annotations`.`removed` AS `removed` - FROM - `annotations` - WHERE - `annotations`.`created` IN (SELECT - MAX(`annotations`.`created`) - FROM - `annotations` - WHERE - `annotations`.`removed` IS NULL - GROUP BY `annotations`.`entity_uuid`); - --- Host HA changes: -DROP VIEW IF EXISTS `cloud`.`host_view`; -CREATE VIEW `cloud`.`host_view` AS - SELECT - host.id, - host.uuid, - host.name, - host.status, - host.disconnected, - host.type, - host.private_ip_address, - host.version, - host.hypervisor_type, - host.hypervisor_version, - host.capabilities, - host.last_ping, - host.created, - host.removed, - host.resource_state, - host.mgmt_server_id, - host.cpu_sockets, - host.cpus, - host.speed, - host.ram, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - host_tags.tag, - guest_os_category.id guest_os_category_id, - guest_os_category.uuid guest_os_category_uuid, - guest_os_category.name guest_os_category_name, - mem_caps.used_capacity memory_used_capacity, - mem_caps.reserved_capacity memory_reserved_capacity, - cpu_caps.used_capacity cpu_used_capacity, - cpu_caps.reserved_capacity cpu_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - oobm.enabled AS `oobm_enabled`, - oobm.power_state AS `oobm_power_state`, - ha_config.enabled AS `ha_enabled`, - ha_config.ha_state AS `ha_state`, - ha_config.provider AS `ha_provider`, - `last_annotation_view`.`annotation` AS `annotation`, - `last_annotation_view`.`created` AS `last_annotated`, - `user`.`username` AS `username` - FROM - `cloud`.`host` - LEFT JOIN - `cloud`.`cluster` ON host.cluster_id = cluster.id - LEFT JOIN - `cloud`.`data_center` ON host.data_center_id = data_center.id - LEFT JOIN - `cloud`.`host_pod_ref` ON host.pod_id = host_pod_ref.id - LEFT JOIN - `cloud`.`host_details` ON host.id = host_details.host_id - AND host_details.name = 'guest.os.category.id' - LEFT JOIN - `cloud`.`guest_os_category` ON guest_os_category.id = CONVERT ( host_details.value, UNSIGNED ) - LEFT JOIN - `cloud`.`host_tags` ON host_tags.host_id = host.id - LEFT JOIN - `cloud`.`op_host_capacity` mem_caps ON host.id = mem_caps.host_id - AND mem_caps.capacity_type = 0 - LEFT JOIN - `cloud`.`op_host_capacity` cpu_caps ON host.id = cpu_caps.host_id - AND cpu_caps.capacity_type = 1 - LEFT JOIN - `cloud`.`async_job` ON async_job.instance_id = host.id - AND async_job.instance_type = 'Host' - AND async_job.job_status = 0 - LEFT JOIN - `cloud`.`oobm` ON oobm.host_id = host.id - left join - `cloud`.`ha_config` ON ha_config.resource_id=host.id - and ha_config.resource_type='Host' - LEFT JOIN - `cloud`.`last_annotation_view` ON `last_annotation_view`.`entity_uuid` = `host`.`uuid` - LEFT JOIN - `cloud`.`user` ON `user`.`uuid` = `last_annotation_view`.`user_uuid`; --- End Of Annotations specific changes - --- Out-of-band management driver for nested-cloudstack -ALTER TABLE `cloud`.`oobm` MODIFY COLUMN port VARCHAR(255); - --- CLOUDSTACK-9902: Console proxy SSL toggle -INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `description`, `default_value`, `is_dynamic`) VALUES ('Console Proxy', 'DEFAULT', 'AgentManager', 'consoleproxy.sslEnabled', 'false', 'Enable SSL for console proxy', 'false', 0); - --- CLOUDSTACK-9859: Retirement of midonet plugin (final removal) -delete from `cloud`.`configuration` where name in ('midonet.apiserver.address', 'midonet.providerrouter.id'); - --- CLOUDSTACK-9972: Enhance listVolumes API -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Premium', 'DEFAULT', 'management-server', 'volume.stats.interval', '600000', 'Interval (in seconds) to report volume statistics', '600000', now(), NULL, NULL); - -DROP VIEW IF EXISTS `cloud`.`volume_view`; -CREATE VIEW `cloud`.`volume_view` AS - SELECT - volumes.id, - volumes.uuid, - volumes.name, - volumes.device_id, - volumes.volume_type, - volumes.provisioning_type, - volumes.size, - volumes.min_iops, - volumes.max_iops, - volumes.created, - volumes.state, - volumes.attached, - volumes.removed, - volumes.display_volume, - volumes.format, - volumes.path, - volumes.chain_info, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - vm_instance.id vm_id, - vm_instance.uuid vm_uuid, - vm_instance.name vm_name, - vm_instance.state vm_state, - vm_instance.vm_type, - user_vm.display_name vm_display_name, - volume_store_ref.size volume_store_size, - volume_store_ref.download_pct, - volume_store_ref.download_state, - volume_store_ref.error_str, - volume_store_ref.created created_on_store, - disk_offering.id disk_offering_id, - disk_offering.uuid disk_offering_uuid, - disk_offering.name disk_offering_name, - disk_offering.display_text disk_offering_display_text, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.cache_mode, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.name pool_name, - cluster.id cluster_id, - cluster.name cluster_name, - cluster.uuid cluster_uuid, - cluster.hypervisor_type, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.extractable, - vm_template.type template_type, - vm_template.name template_name, - vm_template.display_text template_display_text, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - resource_tag_account.account_name tag_account_name, - resource_tag_domain.uuid tag_domain_uuid, - resource_tag_domain.name tag_domain_name - from - `cloud`.`volumes` - inner join - `cloud`.`account` ON volumes.account_id = account.id - inner join - `cloud`.`domain` ON volumes.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON volumes.data_center_id = data_center.id - left join - `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id - left join - `cloud`.`user_vm` ON user_vm.id = vm_instance.id - left join - `cloud`.`volume_store_ref` ON volumes.id = volume_store_ref.volume_id - left join - `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`vm_template` ON volumes.template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = volumes.iso_id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id - and resource_tags.resource_type = 'Volume' - left join - `cloud`.`async_job` ON async_job.instance_id = volumes.id - and async_job.instance_type = 'Volume' - and async_job.job_status = 0 - left join - `cloud`.`account` resource_tag_account ON resource_tag_account.id = resource_tags.account_id - left join - `cloud`.`domain` resource_tag_domain ON resource_tag_domain.id = resource_tags.domain_id; - --- Extra Dhcp Options -CREATE TABLE IF NOT EXISTS `cloud`.`nic_extra_dhcp_options` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(255) UNIQUE, - `nic_id` bigint unsigned NOT NULL COMMENT ' nic id where dhcp options are applied', - `code` int(32), - `value` text, - PRIMARY KEY (`id`), - CONSTRAINT `fk_nic_extra_dhcp_options_nic_id` FOREIGN KEY (`nic_id`) REFERENCES `nics`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- Add new OS versions - --- Add XenServer 7.1 and 7.2 hypervisor capabilities -INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, storage_motion_supported) values (UUID(), 'XenServer', '7.1.0', 500, 13, 1); -INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, max_data_volumes_limit, storage_motion_supported) values (UUID(), 'XenServer', '7.2.0', 500, 13, 1); - --- Add XenServer 7.0 support for windows 10 -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.0.0', 'Windows 10 (64-bit)', 258, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.0.0', 'Windows 10 (32-bit)', 257, now(), 0); - --- Add XenServer 7.1 hypervisor guest OS mappings (copy 7.0.0) -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '7.1.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.0.0'; - --- Add XenServer 7.1 hypervisor guest OS (see https://docs.citrix.com/content/dam/docs/en-us/xenserver/7-1/downloads/xenserver-7-1-release-notes.pdf) -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'Windows Server 2016 (64-bit)', 259, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'SUSE Linux Enterprise Server 11 SP4', 187, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'Red Hat Enterprise Linux 6 (64-bit)', 240, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'Red Hat Enterprise Linux 7', 245, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'Oracle Enterprise Linux 6 (64-bit)', 251, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'Xenserver', '7.1.0', 'Oracle Linux 7', 247, now(), 0); - --- Add XenServer 7.2 hypervisor guest OS mappings (copy 7.1.0 & remove Windows Vista, Windows XP, Windows 2003, CentOS 4.x, RHEL 4.xS, LES 10 (all versions) as per XenServer 7.2 Release Notes) -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) SELECT UUID(),'Xenserver', '7.2.0', guest_os_name, guest_os_id, utc_timestamp(), 0 FROM `cloud`.`guest_os_hypervisor` WHERE hypervisor_type='Xenserver' AND hypervisor_version='7.1.0' AND guest_os_id not in (1,2,3,4,56,101,56,58,93,94,50,51,87,88,89,90,91,92,26,27,28,29,40,41,42,43,44,45,96,97,107,108,109,110,151,152,153); - --- Add table to track primary storage in use for snapshots -DROP TABLE IF EXISTS `cloud_usage`.`usage_snapshot_on_primary`; -CREATE TABLE `cloud_usage`.`usage_snapshot_on_primary` ( - `id` bigint(20) unsigned NOT NULL, - `zone_id` bigint(20) unsigned NOT NULL, - `account_id` bigint(20) unsigned NOT NULL, - `domain_id` bigint(20) unsigned NOT NULL, - `vm_id` bigint(20) unsigned NOT NULL, - `name` varchar(128), - `type` int(1) unsigned NOT NULL, - `physicalsize` bigint(20), - `virtualsize` bigint(20), - `created` datetime NOT NULL, - `deleted` datetime, - INDEX `i_usage_snapshot_on_primary` (`account_id`,`id`,`vm_id`,`created`) -) ENGINE=InnoDB CHARSET=utf8; - --- Change monitor patch for apache2 in systemvm -UPDATE `cloud`.`monitoring_services` SET pidfile="/var/run/apache2/apache2.pid" WHERE process_name="apache2" AND service_name="apache2"; - --- Use 'Other Linux 64-bit' as guest os for the default systemvmtemplate for VMware --- This fixes a memory allocation issue to systemvms on VMware/ESXi -UPDATE `cloud`.`vm_template` SET guest_os_id=99 WHERE id=8; - --- Network External Ids -ALTER TABLE `cloud`.`networks` ADD `external_id` varchar(255); - --- Separate Subnet for CPVM and SSVM (system vms) -ALTER TABLE `cloud`.`op_dc_ip_address_alloc` -ADD COLUMN `forsystemvms` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'Indicates if IP is dedicated for CPVM or SSVM'; - -ALTER TABLE `cloud`.`op_dc_ip_address_alloc` -ADD COLUMN `vlan` INT(10) UNSIGNED NULL COMMENT 'Vlan the management network range is on'; - --- CLOUDSTACK-4757: Support multidisk OVA -ALTER TABLE `cloud`.`vm_template` ADD COLUMN `parent_template_id` bigint(20) unsigned DEFAULT NULL COMMENT 'If datadisk template, then id of the root template this template belongs to'; - --- CLOUDSTACK-10146: Bypass Secondary Storage for KVM templates -ALTER TABLE `cloud`.`vm_template` -ADD COLUMN `direct_download` TINYINT(1) DEFAULT '0' COMMENT 'Indicates if Secondary Storage is bypassed and template is downloaded to Primary Storage'; - --- Changes to template_view for both multidisk OVA and bypass secondary storage for KVM templates -DROP VIEW IF EXISTS `cloud`.`template_view`; -CREATE VIEW `cloud`.`template_view` AS - SELECT - `vm_template`.`id` AS `id`, - `vm_template`.`uuid` AS `uuid`, - `vm_template`.`unique_name` AS `unique_name`, - `vm_template`.`name` AS `name`, - `vm_template`.`public` AS `public`, - `vm_template`.`featured` AS `featured`, - `vm_template`.`type` AS `type`, - `vm_template`.`hvm` AS `hvm`, - `vm_template`.`bits` AS `bits`, - `vm_template`.`url` AS `url`, - `vm_template`.`format` AS `format`, - `vm_template`.`created` AS `created`, - `vm_template`.`checksum` AS `checksum`, - `vm_template`.`display_text` AS `display_text`, - `vm_template`.`enable_password` AS `enable_password`, - `vm_template`.`dynamically_scalable` AS `dynamically_scalable`, - `vm_template`.`state` AS `template_state`, - `vm_template`.`guest_os_id` AS `guest_os_id`, - `guest_os`.`uuid` AS `guest_os_uuid`, - `guest_os`.`display_name` AS `guest_os_name`, - `vm_template`.`bootable` AS `bootable`, - `vm_template`.`prepopulate` AS `prepopulate`, - `vm_template`.`cross_zones` AS `cross_zones`, - `vm_template`.`hypervisor_type` AS `hypervisor_type`, - `vm_template`.`extractable` AS `extractable`, - `vm_template`.`template_tag` AS `template_tag`, - `vm_template`.`sort_key` AS `sort_key`, - `vm_template`.`removed` AS `removed`, - `vm_template`.`enable_sshkey` AS `enable_sshkey`, - `parent_template`.`id` AS `parent_template_id`, - `parent_template`.`uuid` AS `parent_template_uuid`, - `source_template`.`id` AS `source_template_id`, - `source_template`.`uuid` AS `source_template_uuid`, - `account`.`id` AS `account_id`, - `account`.`uuid` AS `account_uuid`, - `account`.`account_name` AS `account_name`, - `account`.`type` AS `account_type`, - `domain`.`id` AS `domain_id`, - `domain`.`uuid` AS `domain_uuid`, - `domain`.`name` AS `domain_name`, - `domain`.`path` AS `domain_path`, - `projects`.`id` AS `project_id`, - `projects`.`uuid` AS `project_uuid`, - `projects`.`name` AS `project_name`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `launch_permission`.`account_id` AS `lp_account_id`, - `template_store_ref`.`store_id` AS `store_id`, - `image_store`.`scope` AS `store_scope`, - `template_store_ref`.`state` AS `state`, - `template_store_ref`.`download_state` AS `download_state`, - `template_store_ref`.`download_pct` AS `download_pct`, - `template_store_ref`.`error_str` AS `error_str`, - `template_store_ref`.`size` AS `size`, - `template_store_ref`.physical_size AS `physical_size`, - `template_store_ref`.`destroyed` AS `destroyed`, - `template_store_ref`.`created` AS `created_on_store`, - `vm_template_details`.`name` AS `detail_name`, - `vm_template_details`.`value` AS `detail_value`, - `resource_tags`.`id` AS `tag_id`, - `resource_tags`.`uuid` AS `tag_uuid`, - `resource_tags`.`key` AS `tag_key`, - `resource_tags`.`value` AS `tag_value`, - `resource_tags`.`domain_id` AS `tag_domain_id`, - `domain`.`uuid` AS `tag_domain_uuid`, - `domain`.`name` AS `tag_domain_name`, - `resource_tags`.`account_id` AS `tag_account_id`, - `account`.`account_name` AS `tag_account_name`, - `resource_tags`.`resource_id` AS `tag_resource_id`, - `resource_tags`.`resource_uuid` AS `tag_resource_uuid`, - `resource_tags`.`resource_type` AS `tag_resource_type`, - `resource_tags`.`customer` AS `tag_customer`, - CONCAT(`vm_template`.`id`, - '_', - IFNULL(`data_center`.`id`, 0)) AS `temp_zone_pair`, - `vm_template`.`direct_download` AS `direct_download` - FROM - (((((((((((((`vm_template` - JOIN `guest_os` ON ((`guest_os`.`id` = `vm_template`.`guest_os_id`))) - JOIN `account` ON ((`account`.`id` = `vm_template`.`account_id`))) - JOIN `domain` ON ((`domain`.`id` = `account`.`domain_id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `vm_template_details` ON ((`vm_template_details`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `source_template` ON ((`source_template`.`id` = `vm_template`.`source_template_id`))) - LEFT JOIN `template_store_ref` ON (((`template_store_ref`.`template_id` = `vm_template`.`id`) - AND (`template_store_ref`.`store_role` = 'Image') - AND (`template_store_ref`.`destroyed` = 0)))) - LEFT JOIN `vm_template` `parent_template` ON ((`parent_template`.`id` = `vm_template`.`parent_template_id`))) - LEFT JOIN `image_store` ON ((ISNULL(`image_store`.`removed`) - AND (`template_store_ref`.`store_id` IS NOT NULL) - AND (`image_store`.`id` = `template_store_ref`.`store_id`)))) - LEFT JOIN `template_zone_ref` ON (((`template_zone_ref`.`template_id` = `vm_template`.`id`) - AND ISNULL(`template_store_ref`.`store_id`) - AND ISNULL(`template_zone_ref`.`removed`)))) - LEFT JOIN `data_center` ON (((`image_store`.`data_center_id` = `data_center`.`id`) - OR (`template_zone_ref`.`zone_id` = `data_center`.`id`)))) - LEFT JOIN `launch_permission` ON ((`launch_permission`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_template`.`id`) - AND ((`resource_tags`.`resource_type` = 'Template') - OR (`resource_tags`.`resource_type` = 'ISO'))))); - --- CLOUDSTACK-10109: Enable dedication of public IPs to SSVM and CPVM -ALTER TABLE `cloud`.`user_ip_address` -ADD COLUMN `forsystemvms` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'true if IP is set to system vms, false if not'; - --- ldap binding on domain level -CREATE TABLE IF NOT EXISTS `cloud`.`domain_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `domain_id` bigint unsigned NOT NULL COMMENT 'account id', - `name` varchar(255) NOT NULL, - `value` varchar(255) NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk_domain_details__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain`(`id`) ON DELETE CASCADE -)ENGINE=InnoDB DEFAULT CHARSET=utf8; - -ALTER TABLE cloud.ldap_configuration ADD COLUMN domain_id BIGINT(20) DEFAULT NULL; -ALTER TABLE cloud.ldap_trust_map ADD COLUMN account_id BIGINT(20) DEFAULT 0; -ALTER TABLE cloud.ldap_trust_map DROP FOREIGN KEY fk_ldap_trust_map__domain_id; -DROP INDEX uk_ldap_trust_map__domain_id ON cloud.ldap_trust_map; -CREATE UNIQUE INDEX uk_ldap_trust_map__bind_location ON ldap_trust_map (domain_id, account_id); - -CREATE TABLE IF NOT EXISTS `cloud`.`netscaler_servicepackages` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(255) UNIQUE, - `name` varchar(255) UNIQUE COMMENT 'name of the service package', - `description` varchar(255) COMMENT 'description of the service package', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `cloud`.`external_netscaler_controlcenter` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(255) UNIQUE, - `username` varchar(255) COMMENT 'username of the NCC', - `password` varchar(255) COMMENT 'password of NCC', - `ncc_ip` varchar(255) COMMENT 'IP of NCC Manager', - `num_retries` bigint unsigned NOT NULL default 2 COMMENT 'Number of retries in ncc for command failure', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -ALTER TABLE `cloud`.`sslcerts` ADD COLUMN `name` varchar(255) NULL default NULL COMMENT 'Name of the Certificate'; -ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `service_package_id` varchar(255) NULL default NULL COMMENT 'Netscaler ControlCenter Service Package'; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-420to421.sql b/engine/schema/src/main/resources/META-INF/db/schema-420to421.sql deleted file mode 100644 index 78687f22fecb..000000000000 --- a/engine/schema/src/main/resources/META-INF/db/schema-420to421.sql +++ /dev/null @@ -1,244 +0,0 @@ --- 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.2.0 to 4.2.1; ---; - - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 's3.singleupload.max.size', '5', - 'The maximum size limit for S3 single part upload API(in GB). If it is set to 0, then it means always use multi-part upload to upload object to S3. If it is set to -1, then it means always use single-part upload to upload object to S3.'); - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Storage", 'DEFAULT', 'management-server', "enable.ha.storage.migration", "true", "Enable/disable storage migration across primary storage during HA"); -UPDATE `cloud`.`configuration` SET description="Specify whether or not to reserve CPU based on CPU overprovisioning factor" where name="vmware.reserve.cpu"; -UPDATE `cloud`.`configuration` SET description="Specify whether or not to reserve memory based on memory overprovisioning factor" where name="vmware.reserve.mem"; --- Remove Windows Server 8 from guest_os_type dropdown to use Windows Server 2012 -DELETE FROM `cloud`.`guest_os_hypervisor` where guest_os_id=168; -DELETE FROM `cloud`.`guest_os` where id=168; - - ---Add details to the user_vm_view (CLOUDSTACK-4649 - xen and UI code needs to retrieve the value of "hypervisortoolsversion" detail) - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE VIEW `cloud`.`user_vm_view` AS - select - vm_instance.id id, - vm_instance.name name, - user_vm.display_name display_name, - user_vm.user_data user_data, - 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, - instance_group.id instance_group_id, - instance_group.uuid instance_group_uuid, - instance_group.name instance_group_name, - vm_instance.uuid uuid, - vm_instance.last_host_id last_host_id, - vm_instance.vm_type type, - vm_instance.vnc_password vnc_password, - vm_instance.limit_cpu_use limit_cpu_use, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.ha_enabled ha_enabled, - vm_instance.hypervisor_type hypervisor_type, - vm_instance.instance_name instance_name, - vm_instance.guest_os_id guest_os_id, - vm_instance.display_vm display_vm, - guest_os.uuid guest_os_uuid, - vm_instance.pod_id pod_id, - host_pod_ref.uuid pod_uuid, - vm_instance.private_ip_address private_ip_address, - vm_instance.private_mac_address private_mac_address, - vm_instance.vm_type vm_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.is_security_group_enabled security_group_enabled, - data_center.networktype data_center_type, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.name template_name, - vm_template.display_text template_display_text, - vm_template.enable_password password_enabled, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - service_offering.id service_offering_id, - disk_offering.uuid service_offering_uuid, - Case - When (`cloud`.`service_offering`.`cpu` is null) then (`custom_cpu`.`value`) - Else ( `cloud`.`service_offering`.`cpu`) - End as `cpu`, - Case - When (`cloud`.`service_offering`.`speed` is null) then (`custom_speed`.`value`) - Else ( `cloud`.`service_offering`.`speed`) - End as `speed`, - Case - When (`cloud`.`service_offering`.`ram_size` is null) then (`custom_ram_size`.`value`) - Else ( `cloud`.`service_offering`.`ram_size`) - END as `ram_size`, - disk_offering.name service_offering_name, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.pool_type pool_type, - volumes.id volume_id, - volumes.uuid volume_uuid, - volumes.device_id volume_device_id, - volumes.volume_type volume_type, - security_group.id security_group_id, - security_group.uuid security_group_uuid, - security_group.name security_group_name, - security_group.description security_group_description, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - user_ip_address.id public_ip_id, - user_ip_address.uuid public_ip_uuid, - user_ip_address.public_ip_address public_ip_address, - ssh_keypairs.keypair_name keypair_name, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - affinity_group.id affinity_group_id, - affinity_group.uuid affinity_group_uuid, - affinity_group.name affinity_group_name, - affinity_group.description affinity_group_description, - vm_instance.dynamically_scalable dynamically_scalable, - all_details.name detail_name, - all_details.value detail_value - - from - `cloud`.`user_vm` - inner join - `cloud`.`vm_instance` ON vm_instance.id = user_vm.id - and vm_instance.removed is NULL - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id - left join - `cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = user_vm.iso_id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id - left join - `cloud`.`volumes` ON vm_instance.id = volumes.instance_id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id - left join - `cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON networks.vpc_id = vpc.id and vpc.removed is null - left join - `cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` as ssh_details ON ssh_details.vm_id = vm_instance.id - and ssh_details.name = 'SSH.PublicKey' - left join - `cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = ssh_details.value - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id - and resource_tags.resource_type = 'UserVm' - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'VirtualMachine' - and async_job.job_status = 0 - left join - `cloud`.`affinity_group_vm_map` ON vm_instance.id = affinity_group_vm_map.instance_id - left join - `cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id - left join - `cloud`.`user_vm_details` as all_details ON all_details.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_cpu`.`name` = 'CpuNumber'))) - left join - `cloud`.`user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_speed`.`name` = 'CpuSpeed'))) - left join - `cloud`.`user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_ram_size`.`name` = 'memory'))); - ---Add the format for volumes table for uploaded volumes (CLOUDSTACK-5013) -update `cloud`.`volumes` v, `cloud`.`volume_host_ref` vhr set v.format=vhr.format where v.id=vhr.volume_id and v.format is null; - - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'baremetal.ipmi.lan.interface', 'default', 'option specified in -I option of impitool. candidates are: open/bmc/lipmi/lan/lanplus/free/imb, see ipmitool man page for details. default valule "default" means using default option of ipmitool'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'baremetal.ipmi.fail.retry', 'default', "ipmi interface will be temporary out of order after power opertions(e.g. cycle, on), it leads following commands fail immediately. The value specifies retry times before accounting it as real failure"); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vmware.hung.wokervm.timeout', '7200', 'Worker VM timeout in seconds'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Alert", 'DEFAULT', 'management-server', "alert.smtp.connectiontimeout", "30000", "Socket connection timeout value in milliseconds. -1 for infinite timeout."); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Alert", 'DEFAULT', 'management-server', "alert.smtp.timeout", "30000", "Socket I/O timeout value in milliseconds. -1 for infinite timeout."); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-421to430.sql b/engine/schema/src/main/resources/META-INF/db/schema-421to430.sql deleted file mode 100644 index 80d32dab3fb3..000000000000 --- a/engine/schema/src/main/resources/META-INF/db/schema-421to430.sql +++ /dev/null @@ -1,1105 +0,0 @@ --- 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.2.1 to 4.3.0; ---; - --- Disable foreign key checking -SET foreign_key_checks = 0; - -ALTER TABLE `cloud`.`async_job` ADD COLUMN `related` CHAR(40) NOT NULL; -ALTER TABLE `cloud`.`async_job` DROP COLUMN `session_key`; -ALTER TABLE `cloud`.`async_job` DROP COLUMN `job_cmd_originator`; -ALTER TABLE `cloud`.`async_job` DROP COLUMN `callback_type`; -ALTER TABLE `cloud`.`async_job` DROP COLUMN `callback_address`; - -ALTER TABLE `cloud`.`async_job` ADD COLUMN `job_type` VARCHAR(32); -ALTER TABLE `cloud`.`async_job` ADD COLUMN `job_dispatcher` VARCHAR(64); -ALTER TABLE `cloud`.`async_job` ADD COLUMN `job_executing_msid` bigint; -ALTER TABLE `cloud`.`async_job` ADD COLUMN `job_pending_signals` int(10) NOT NULL DEFAULT 0; - -ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `keep_alive_enabled` int(1) unsigned NOT NULL DEFAULT 1 COMMENT 'true if connection should be reset after requests.'; - -ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `power_state` VARCHAR(74) DEFAULT 'PowerUnknown'; -ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `power_state_update_time` DATETIME; -ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `power_state_update_count` INT DEFAULT 0; -ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `power_host` bigint unsigned; -ALTER TABLE `cloud`.`vm_instance` ADD CONSTRAINT `fk_vm_instance__power_host` FOREIGN KEY (`power_host`) REFERENCES `cloud`.`host`(`id`); - -ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `lb_protocol` VARCHAR(40); - -DROP TABLE IF EXISTS `cloud`.`vm_snapshot_details`; -CREATE TABLE `cloud`.`vm_snapshot_details` ( - `id` bigint unsigned UNIQUE NOT NULL AUTO_INCREMENT, - `vm_snapshot_id` bigint unsigned NOT NULL, - `name` varchar(255) NOT NULL, - `value` varchar(255) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -DROP TABLE IF EXISTS `cloud`.`snapshot_details`; -CREATE TABLE `cloud`.`snapshot_details` ( - `id` bigint unsigned UNIQUE NOT NULL AUTO_INCREMENT, - `snapshot_id` bigint unsigned NOT NULL, - `name` varchar(255) NOT NULL, - `value` varchar(255) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`vm_work_job` ( - `id` bigint unsigned UNIQUE NOT NULL, - `step` char(32) NOT NULL COMMENT 'state', - `vm_type` char(32) NOT NULL COMMENT 'type of vm', - `vm_instance_id` bigint unsigned NOT NULL COMMENT 'vm instance', - PRIMARY KEY (`id`), - CONSTRAINT `fk_vm_work_job__instance_id` FOREIGN KEY (`vm_instance_id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE, - INDEX `i_vm_work_job__vm`(`vm_type`, `vm_instance_id`), - INDEX `i_vm_work_job__step`(`step`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`async_job_journal` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `job_id` bigint unsigned NOT NULL, - `journal_type` varchar(32), - `journal_text` varchar(1024) COMMENT 'journal descriptive informaton', - `journal_obj` varchar(1024) COMMENT 'journal strutural information, JSON encoded object', - `created` datetime NOT NULL COMMENT 'date created', - PRIMARY KEY (`id`), - CONSTRAINT `fk_async_job_journal__job_id` FOREIGN KEY (`job_id`) REFERENCES `async_job`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`async_job_join_map` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `job_id` bigint unsigned NOT NULL, - `join_job_id` bigint unsigned NOT NULL, - `join_status` int NOT NULL, - `join_result` varchar(1024), - `join_msid` bigint, - `complete_msid` bigint, - `sync_source_id` bigint COMMENT 'upper-level job sync source info before join', - `wakeup_handler` varchar(64), - `wakeup_dispatcher` varchar(64), - `wakeup_interval` bigint NOT NULL DEFAULT 3000 COMMENT 'wakeup interval in seconds', - `created` datetime NOT NULL, - `last_updated` datetime, - `next_wakeup` datetime, - `expiration` datetime, - PRIMARY KEY (`id`), - CONSTRAINT `fk_async_job_join_map__job_id` FOREIGN KEY (`job_id`) REFERENCES `async_job`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_async_job_join_map__join_job_id` FOREIGN KEY (`join_job_id`) REFERENCES `async_job`(`id`), - CONSTRAINT `fk_async_job_join_map__join` UNIQUE (`job_id`, `join_job_id`), - INDEX `i_async_job_join_map__join_job_id`(`join_job_id`), - INDEX `i_async_job_join_map__created`(`created`), - INDEX `i_async_job_join_map__last_updated`(`last_updated`), - INDEX `i_async_job_join_map__next_wakeup`(`next_wakeup`), - INDEX `i_async_job_join_map__expiration`(`expiration`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -#realhostip changes, before changing table and adding default value -UPDATE `cloud`.`configuration` SET value=CONCAT("*.",value) WHERE `name`="consoleproxy.url.domain" OR `name`="secstorage.ssl.cert.domain"; - -ALTER TABLE `cloud`.`configuration` ADD COLUMN `default_value` VARCHAR(4095) COMMENT 'Default value for a configuration parameter'; -ALTER TABLE `cloud`.`configuration` ADD COLUMN `updated` datetime COMMENT 'Time this was updated by the server. null means this row is obsolete.'; -ALTER TABLE `cloud`.`configuration` ADD COLUMN `scope` VARCHAR(255) DEFAULT NULL COMMENT 'Can this parameter be scoped'; -ALTER TABLE `cloud`.`configuration` ADD COLUMN `is_dynamic` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Can the parameter be change dynamically without restarting the server'; - -UPDATE `cloud`.`configuration` SET `default_value` = `value`; - -#Upgrade the offerings and template table to have actual remove and states -ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `state` CHAR(40) NOT NULL DEFAULT 'Active' COMMENT 'state for disk offering'; -ALTER TABLE `cloud`.`disk_offering` ADD COLUMN `hv_ss_reserve` int(32) unsigned DEFAULT NULL COMMENT 'Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)'; - -ALTER TABLE `cloud`.`volumes` ADD COLUMN `hv_ss_reserve` int(32) unsigned DEFAULT NULL COMMENT 'Hypervisor snapshot reserve space as a percent of a volume (for managed storage using Xen or VMware)'; - -UPDATE `cloud`.`disk_offering` SET `state`='Inactive' WHERE `removed` IS NOT NULL; -UPDATE `cloud`.`disk_offering` SET `removed`=NULL; - -UPDATE `cloud`.`vm_template` SET `guest_os_id`= "142" WHERE `id` = "5"; -UPDATE `cloud`.`vm_template` SET `state`='Inactive' WHERE `removed` IS NOT NULL; -UPDATE `cloud`.`vm_template` SET `state`='Active' WHERE `removed` IS NULL; -UPDATE `cloud`.`vm_template` SET `removed`=NULL; - -ALTER TABLE `cloud`.`remote_access_vpn` MODIFY COLUMN `network_id` bigint unsigned; -ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `vpc_id` bigint unsigned default NULL; - -ALTER TABLE `cloud`.`s2s_vpn_connection` ADD COLUMN `passive` int(1) unsigned NOT NULL DEFAULT 0; - -DROP VIEW IF EXISTS `cloud`.`disk_offering_view`; -CREATE VIEW `cloud`.`disk_offering_view` AS - select - disk_offering.id, - disk_offering.uuid, - disk_offering.name, - disk_offering.display_text, - disk_offering.disk_size, - disk_offering.min_iops, - disk_offering.max_iops, - disk_offering.created, - disk_offering.tags, - disk_offering.customized, - disk_offering.customized_iops, - disk_offering.removed, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - disk_offering.sort_key, - disk_offering.type, - disk_offering.display_offering, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`disk_offering` - left join - `cloud`.`domain` ON disk_offering.domain_id = domain.id - where - disk_offering.state='ACTIVE'; - -DROP VIEW IF EXISTS `cloud`.`service_offering_view`; -CREATE VIEW `cloud`.`service_offering_view` AS - select - service_offering.id, - disk_offering.uuid, - disk_offering.name, - disk_offering.display_text, - disk_offering.created, - disk_offering.tags, - disk_offering.removed, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - service_offering.cpu, - service_offering.speed, - service_offering.ram_size, - service_offering.nw_rate, - service_offering.mc_rate, - service_offering.ha_enabled, - service_offering.limit_cpu_use, - service_offering.host_tag, - service_offering.default_use, - service_offering.vm_type, - service_offering.sort_key, - service_offering.is_volatile, - service_offering.deployment_planner, - domain.id domain_id, - domain.uuid domain_uuid, - domain.name domain_name, - domain.path domain_path - from - `cloud`.`service_offering` - inner join - `cloud`.`disk_offering` ON service_offering.id = disk_offering.id - left join - `cloud`.`domain` ON disk_offering.domain_id = domain.id - where - disk_offering.state='Active'; - -DROP VIEW IF EXISTS `cloud`.`template_view`; -CREATE VIEW `cloud`.`template_view` AS - select - vm_template.id, - vm_template.uuid, - vm_template.unique_name, - vm_template.name, - vm_template.public, - vm_template.featured, - vm_template.type, - vm_template.hvm, - vm_template.bits, - vm_template.url, - vm_template.format, - vm_template.created, - vm_template.checksum, - vm_template.display_text, - vm_template.enable_password, - vm_template.dynamically_scalable, - vm_template.state template_state, - vm_template.guest_os_id, - guest_os.uuid guest_os_uuid, - guest_os.display_name guest_os_name, - vm_template.bootable, - vm_template.prepopulate, - vm_template.cross_zones, - vm_template.hypervisor_type, - vm_template.extractable, - vm_template.template_tag, - vm_template.sort_key, - vm_template.removed, - vm_template.enable_sshkey, - source_template.id source_template_id, - source_template.uuid source_template_uuid, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - launch_permission.account_id lp_account_id, - template_store_ref.store_id, - image_store.scope as store_scope, - template_store_ref.state, - template_store_ref.download_state, - template_store_ref.download_pct, - template_store_ref.error_str, - template_store_ref.size, - template_store_ref.destroyed, - template_store_ref.created created_on_store, - vm_template_details.name detail_name, - vm_template_details.value detail_value, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - CONCAT(vm_template.id, '_', IFNULL(data_center.id, 0)) as temp_zone_pair - from - `cloud`.`vm_template` - inner join - `cloud`.`guest_os` ON guest_os.id = vm_template.guest_os_id - inner join - `cloud`.`account` ON account.id = vm_template.account_id - inner join - `cloud`.`domain` ON domain.id = account.domain_id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`vm_template_details` ON vm_template_details.template_id = vm_template.id - left join - `cloud`.`vm_template` source_template ON source_template.id = vm_template.source_template_id - left join - `cloud`.`template_store_ref` ON template_store_ref.template_id = vm_template.id and template_store_ref.store_role = 'Image' and template_store_ref.destroyed=0 - left join - `cloud`.`image_store` ON image_store.removed is NULL AND template_store_ref.store_id is not NULL AND image_store.id = template_store_ref.store_id - left join - `cloud`.`template_zone_ref` ON template_zone_ref.template_id = vm_template.id AND template_store_ref.store_id is NULL AND template_zone_ref.removed is null - left join - `cloud`.`data_center` ON (image_store.data_center_id = data_center.id OR template_zone_ref.zone_id = data_center.id) - left join - `cloud`.`launch_permission` ON launch_permission.template_id = vm_template.id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_template.id - and (resource_tags.resource_type = 'Template' or resource_tags.resource_type='ISO'); - -DROP VIEW IF EXISTS `cloud`.`volume_view`; -CREATE VIEW `cloud`.`volume_view` AS - select - volumes.id, - volumes.uuid, - volumes.name, - volumes.device_id, - volumes.volume_type, - volumes.size, - volumes.min_iops, - volumes.max_iops, - volumes.created, - volumes.state, - volumes.attached, - volumes.removed, - volumes.pod_id, - volumes.display_volume, - volumes.format, - volumes.path, - 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, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - vm_instance.id vm_id, - vm_instance.uuid vm_uuid, - vm_instance.name vm_name, - vm_instance.state vm_state, - vm_instance.vm_type, - user_vm.display_name vm_display_name, - volume_store_ref.size volume_store_size, - volume_store_ref.download_pct, - volume_store_ref.download_state, - volume_store_ref.error_str, - volume_store_ref.created created_on_store, - disk_offering.id disk_offering_id, - disk_offering.uuid disk_offering_uuid, - disk_offering.name disk_offering_name, - disk_offering.display_text disk_offering_display_text, - disk_offering.use_local_storage, - disk_offering.system_use, - disk_offering.bytes_read_rate, - disk_offering.bytes_write_rate, - disk_offering.iops_read_rate, - disk_offering.iops_write_rate, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.name pool_name, - cluster.hypervisor_type, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.extractable, - vm_template.type template_type, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`volumes` - inner join - `cloud`.`account` ON volumes.account_id = account.id - inner join - `cloud`.`domain` ON volumes.domain_id = domain.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON volumes.data_center_id = data_center.id - left join - `cloud`.`vm_instance` ON volumes.instance_id = vm_instance.id - left join - `cloud`.`user_vm` ON user_vm.id = vm_instance.id - left join - `cloud`.`volume_store_ref` ON volumes.id = volume_store_ref.volume_id - left join - `cloud`.`disk_offering` ON volumes.disk_offering_id = disk_offering.id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`vm_template` ON volumes.template_id = vm_template.id OR volumes.iso_id = vm_template.id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = volumes.id - and resource_tags.resource_type = 'Volume' - left join - `cloud`.`async_job` ON async_job.instance_id = volumes.id - and async_job.instance_type = 'Volume' - and async_job.job_status = 0; - -DROP VIEW IF EXISTS `cloud`.`storage_pool_view`; -CREATE VIEW `cloud`.`storage_pool_view` AS - select - storage_pool.id, - storage_pool.uuid, - storage_pool.name, - storage_pool.status, - storage_pool.path, - storage_pool.pool_type, - storage_pool.host_address, - storage_pool.created, - storage_pool.removed, - storage_pool.capacity_bytes, - storage_pool.capacity_iops, - storage_pool.scope, - storage_pool.hypervisor, - storage_pool.storage_provider_name, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - storage_pool_details.name tag, - op_host_capacity.used_capacity disk_used_capacity, - op_host_capacity.reserved_capacity disk_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`storage_pool` - left join - `cloud`.`cluster` ON storage_pool.cluster_id = cluster.id - left join - `cloud`.`data_center` ON storage_pool.data_center_id = data_center.id - left join - `cloud`.`host_pod_ref` ON storage_pool.pod_id = host_pod_ref.id - left join - `cloud`.`storage_pool_details` ON storage_pool_details.pool_id = storage_pool.id - and storage_pool_details.value = 'true' - left join - `cloud`.`op_host_capacity` ON storage_pool.id = op_host_capacity.host_id - and op_host_capacity.capacity_type = 3 - left join - `cloud`.`async_job` ON async_job.instance_id = storage_pool.id - and async_job.instance_type = 'StoragePool' - and async_job.job_status = 0; - - -CREATE TABLE `sslcerts` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `uuid` varchar(40) DEFAULT NULL, - `account_id` bigint(20) unsigned NOT NULL, - `domain_id` bigint(20) unsigned NOT NULL, - `certificate` text NOT NULL, - `fingerprint` varchar(62) NOT NULL, - `key` text NOT NULL, - `chain` text, - `password` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk_sslcert__account_id` FOREIGN KEY (`account_id`) REFERENCES `account` (`id`) ON DELETE CASCADE, - CONSTRAINT `fk_sslcert__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`) ON DELETE CASCADE -); - -CREATE TABLE `load_balancer_cert_map` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `uuid` varchar(40) DEFAULT NULL, - `load_balancer_id` bigint(20) unsigned NOT NULL, - `certificate_id` bigint(20) unsigned NOT NULL, - `revoke` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - CONSTRAINT `fk_load_balancer_cert_map__certificate_id` FOREIGN KEY (`certificate_id`) REFERENCES `sslcerts` (`id`) ON DELETE CASCADE, - CONSTRAINT `fk_load_balancer_cert_map__load_balancer_id` FOREIGN KEY (`load_balancer_id`) REFERENCES `load_balancing_rules` (`id`) ON DELETE CASCADE); - -ALTER TABLE `cloud`.`host` ADD COLUMN `cpu_sockets` int(10) unsigned DEFAULT NULL COMMENT "the number of CPU sockets on the host" AFTER pod_id; -ALTER TABLE `cloud`.`physical_network_traffic_types` ADD COLUMN `hyperv_network_label` varchar(255) DEFAULT NULL COMMENT 'The network name label of the physical device dedicated to this traffic on a HyperV host'; - -DROP VIEW IF EXISTS `cloud`.`host_view`; -CREATE VIEW `cloud`.`host_view` AS - select - host.id, - host.uuid, - host.name, - host.status, - host.disconnected, - host.type, - host.private_ip_address, - host.version, - host.hypervisor_type, - host.hypervisor_version, - host.capabilities, - host.last_ping, - host.created, - host.removed, - host.resource_state, - host.mgmt_server_id, - host.cpu_sockets, - host.cpus, - host.speed, - host.ram, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - host_tags.tag, - guest_os_category.id guest_os_category_id, - guest_os_category.uuid guest_os_category_uuid, - guest_os_category.name guest_os_category_name, - mem_caps.used_capacity memory_used_capacity, - mem_caps.reserved_capacity memory_reserved_capacity, - cpu_caps.used_capacity cpu_used_capacity, - cpu_caps.reserved_capacity cpu_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id - from - `cloud`.`host` - left join - `cloud`.`cluster` ON host.cluster_id = cluster.id - left join - `cloud`.`data_center` ON host.data_center_id = data_center.id - left join - `cloud`.`host_pod_ref` ON host.pod_id = host_pod_ref.id - left join - `cloud`.`host_details` ON host.id = host_details.host_id - and host_details.name = 'guest.os.category.id' - left join - `cloud`.`guest_os_category` ON guest_os_category.id = CONVERT( host_details.value , UNSIGNED) - left join - `cloud`.`host_tags` ON host_tags.host_id = host.id - left join - `cloud`.`op_host_capacity` mem_caps ON host.id = mem_caps.host_id - and mem_caps.capacity_type = 0 - left join - `cloud`.`op_host_capacity` cpu_caps ON host.id = cpu_caps.host_id - and cpu_caps.capacity_type = 1 - left join - `cloud`.`async_job` ON async_job.instance_id = host.id - and async_job.instance_type = 'Host' - and async_job.job_status = 0; - -CREATE TABLE `cloud`.`firewall_rule_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `firewall_rule_id` bigint unsigned NOT NULL COMMENT 'Firewall rule id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', - PRIMARY KEY (`id`), - CONSTRAINT `fk_firewall_rule_details__firewall_rule_id` FOREIGN KEY `fk_firewall_rule_details__firewall_rule_id`(`firewall_rule_id`) REFERENCES `firewall_rules`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -ALTER TABLE `cloud`.`data_center_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; -ALTER TABLE `cloud`.`network_details` CHANGE `display_detail` `display` tinyint(0) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; -ALTER TABLE `cloud`.`vm_template_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; -ALTER TABLE `cloud`.`volume_details` CHANGE `display_detail` `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; -ALTER TABLE `cloud`.`nic_details` CHANGE `display_detail` `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; -ALTER TABLE `cloud`.`user_vm_details` CHANGE `display_detail` `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; -ALTER TABLE `cloud`.`service_offering_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; -ALTER TABLE `cloud`.`storage_pool_details` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user'; - -UPDATE `cloud`.`configuration` SET name='ldap.basedn' WHERE name='ldap.searchbase'; -UPDATE `cloud`.`configuration` SET name='ldap.bind.principal' WHERE name='ldap.dn' ; -UPDATE `cloud`.`configuration` SET name='ldap.bind.password' WHERE name='ldap.passwd'; -UPDATE `cloud`.`configuration` SET name='ldap.truststore.password' WHERE name='ldap.truststorepass' ; - -INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.bind.principal', NULL, 'Specifies the bind principal to use for bind to LDAP', NULL) ON DUPLICATE KEY UPDATE category='Secure'; -INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.bind.password', NULL, 'Specifies the password to use for binding to LDAP', NULL) ON DUPLICATE KEY UPDATE category='Secure'; -INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.basedn', NULL, 'Sets the basedn for LDAP', NULL) ON DUPLICATE KEY UPDATE category='Secure'; -INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.search.group.principle', NULL, 'Sets the principle of the group that users must be a member of', NULL) ON DUPLICATE KEY UPDATE category='Secure'; -INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.truststore', NULL, 'Sets the path to the truststore to use for LDAP SSL', NULL) ON DUPLICATE KEY UPDATE category='Secure'; -INSERT INTO `cloud`.`configuration`(category, instance, component, name, value, description, default_value) VALUES ('Secure', 'DEFAULT', 'management-server', 'ldap.truststore.password', NULL, 'Sets the password for the truststore', NULL) ON DUPLICATE KEY UPDATE category='Secure'; - -CREATE TABLE `cloud`.`ldap_configuration` ( - `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', - `hostname` varchar(255) NOT NULL COMMENT 'the hostname of the ldap server', - `port` int(10) COMMENT 'port that the ldap server is listening on', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -UPDATE `cloud`.`volumes` SET display_volume=1 where id>0; - -create table `cloud`.`monitoring_services` ( -`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', -`uuid` varchar(40), `service` varchar(255) COMMENT 'Service name', -`process_name` varchar(255) COMMENT 'running process name', -`service_name` varchar(255) COMMENT 'exact name of the running service', -`service_path` varchar(255) COMMENT 'path of the service in system', -`pidfile` varchar(255) COMMENT 'path of the pid file of the service', -`isDefault` boolean COMMENT 'Default service', PRIMARY KEY (`id`) -); - -insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(1, UUID(), 'ssh','sshd', 'ssh','/etc/init.d/ssh','/var/run/sshd.pid',true); -insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(2, UUID(), 'dhcp','dnsmasq','dnsmasq','/etc/init.d/dnsmasq','/var/run/dnsmasq/dnsmasq.pid',false); -insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(3, UUID(), 'loadbalancing','haproxy','haproxy','/etc/init.d/haproxy','/var/run/haproxy.pid',false); -insert into cloud.monitoring_services(id, uuid, service, process_name, service_name, service_path, pidfile, isDefault) values(4, UUID(), 'webserver','apache2','apache2','/etc/init.d/apache2','/var/run/apache2.pid', true); - -ALTER TABLE `cloud`.`service_offering` CHANGE COLUMN `cpu` `cpu` INT(10) UNSIGNED NULL COMMENT '# of cores' , CHANGE COLUMN `speed` `speed` INT(10) UNSIGNED NULL COMMENT 'speed per core in mhz' , CHANGE COLUMN `ram_size` `ram_size` BIGINT(20) UNSIGNED NULL ; - -CREATE TABLE `cloud`.`usage_event_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `usage_event_id` bigint unsigned NOT NULL COMMENT 'usage event id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk_usage_event_details__usage_event_id` FOREIGN KEY `fk_usage_event_details__usage_event_id`(`usage_event_id`) REFERENCES `usage_event`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud_usage`.`usage_event_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `usage_event_id` bigint unsigned NOT NULL COMMENT 'usage event id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - PRIMARY KEY (`id`), - CONSTRAINT `fk_usage_event_details__usage_event_id` FOREIGN KEY `fk_usage_event_details__usage_event_id`(`usage_event_id`) REFERENCES `usage_event`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`user_ip_address_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `user_ip_address_id` bigint unsigned NOT NULL COMMENT 'User ip address id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', - PRIMARY KEY (`id`), - CONSTRAINT `fk_user_ip_address_details__user_ip_address_id` FOREIGN KEY `fk_user_ip_address_details__user_ip_address_id`(`user_ip_address_id`) REFERENCES `user_ip_address`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`remote_access_vpn_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `remote_access_vpn_id` bigint unsigned NOT NULL COMMENT 'Remote access vpn id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', - PRIMARY KEY (`id`), - CONSTRAINT `fk_remote_access_vpn_details__remote_access_vpn_id` FOREIGN KEY `fk_remote_access_vpn_details__remote_access_vpn_id`(`remote_access_vpn_id`) REFERENCES `remote_access_vpn`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -DROP VIEW IF EXISTS `cloud`.`domain_router_view`; -CREATE VIEW `cloud`.`domain_router_view` AS - select - vm_instance.id id, - vm_instance.name 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, - vm_instance.uuid uuid, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.pod_id pod_id, - vm_instance.instance_name instance_name, - host_pod_ref.uuid pod_uuid, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - data_center.dns1 dns1, - data_center.dns2 dns2, - data_center.ip6_dns1 ip6_dns1, - data_center.ip6_dns2 ip6_dns2, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - host.cluster_id cluster_id, - vm_template.id template_id, - vm_template.uuid template_uuid, - service_offering.id service_offering_id, - disk_offering.uuid service_offering_uuid, - disk_offering.name service_offering_name, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.network_domain network_domain, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - domain_router.template_version template_version, - domain_router.scripts_version scripts_version, - domain_router.is_redundant_router is_redundant_router, - domain_router.redundant_state redundant_state, - domain_router.stop_pending stop_pending, - domain_router.role role - from - `cloud`.`domain_router` - inner join - `cloud`.`vm_instance` ON vm_instance.id = domain_router.id - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON domain_router.vpc_id = vpc.id and vpc.removed is null - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'DomainRouter' - and async_job.job_status = 0; - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'management-server', "vmware.vcenter.session.timeout", "1200", "VMware client timeout in seconds", "1200", NULL,NULL,0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'management-server', "mgt.server.vendor", "ACS", "the vendor of management server", "ACS", NULL,NULL,0); -Update `cloud`.`configuration` set `component` = "VolumeOrchestrationService", `scope` = "Global" where `name`="custom.diskoffering.size.max"; -Update `cloud`.`configuration` set `component` = "VolumeOrchestrationService", `scope` = "Global" where `name`="custom.diskoffering.size.min"; - -ALTER TABLE `cloud_usage`.`usage_vm_instance` ADD COLUMN `cpu_speed` INT(10) UNSIGNED NULL COMMENT 'speed per core in Mhz', - ADD COLUMN `cpu_cores` INT(10) UNSIGNED NULL COMMENT 'number of cpu cores', - ADD COLUMN `memory` INT(10) UNSIGNED NULL COMMENT 'memory in MB'; - -CREATE TABLE `cloud`.`vpc_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `vpc_id` bigint unsigned NOT NULL COMMENT 'VPC id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', - PRIMARY KEY (`id`), - CONSTRAINT `fk_vpc_details__vpc_id` FOREIGN KEY `fk_vpc_details__vpc_id`(`vpc_id`) REFERENCES `vpc`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `cloud`.`vpc_gateway_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `vpc_gateway_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', - PRIMARY KEY (`id`), - CONSTRAINT `fk_vpc_gateway_details__vpc_gateway_id` FOREIGN KEY `fk_vpc_gateway_details__vpc_gateway_id`(`vpc_gateway_id`) REFERENCES `vpc_gateways`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`network_acl_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `network_acl_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', - PRIMARY KEY (`id`), - CONSTRAINT `fk_network_acl_details__network_acl_id` FOREIGN KEY `fk_network_acl_details__network_acl_id`(`network_acl_id`) REFERENCES `network_acl`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`network_acl_item_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `network_acl_item_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', - PRIMARY KEY (`id`), - CONSTRAINT `fk_network_acl_item_details__network_acl_item_id` FOREIGN KEY `fk_network_acl_item_details__network_acl_item_id`(`network_acl_item_id`) REFERENCES `network_acl_item`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -ALTER TABLE `cloud`.`alert` ADD COLUMN `name` varchar(255) DEFAULT NULL COMMENT 'name of the alert'; - -UPDATE `cloud`.`hypervisor_capabilities` SET `max_data_volumes_limit`=13 WHERE `hypervisor_type`='Vmware'; -INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, storage_motion_supported) VALUES (UUID(), 'Hyperv', '6.2', 1024, 0, 64, 0); - -ALTER TABLE `cloud`.`external_load_balancer_devices` ADD COLUMN `is_exclusive_gslb_provider` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if load balancer appliance is acting exclusively as gslb service provider in the zone and can not be used for LB'; - -DELETE FROM `cloud`.`configuration` WHERE `name` IN ("xen.update.url", "update.check.interval", "baremetal_dhcp_devices", "host.updates.enable"); - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSnapshotManager', "vmsnapshot.create.wait", "1800", "In second, timeout for create vm snapshot", NULL, NULL,NULL,0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSnapshotManager', "vmsnapshot.max", "10", "Maximum vm snapshots for a vm", NULL, NULL,NULL,0); - -UPDATE `cloud`.`configuration` SET `component` = 'VMSnapshotManager' WHERE `name` IN ("vmsnapshot.create.wait", "vmsnapshot.max"); - -CREATE TABLE `cloud`.`s2s_vpn_gateway_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `s2s_vpn_gateway_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', - PRIMARY KEY (`id`), - CONSTRAINT `fk_s2s_vpn_gateway_details__s2s_vpn_gateway_id` FOREIGN KEY `fk_s2s_vpn_gateway_details__s2s_vpn_gateway_id`(`s2s_vpn_gateway_id`) REFERENCES `s2s_vpn_gateway`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Hidden', 'DEFAULT', 'management-server', 'hyperv.guest.network.device', null, 'Specify the virtual switch on host for guest network', NULL, NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Hidden', 'DEFAULT', 'management-server', 'hyperv.private.network.device', null, 'Specify the virtual switch on host for private network', NULL, NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Hidden', 'DEFAULT', 'management-server', 'hyperv.public.network.device', null, 'Specify the public virtual switch on host for public network', NULL, NULL, NULL, 0); - -DELETE FROM `cloud`.`configuration` WHERE `name` IN ("xen.update.url", "update.check.interval", "baremetal_dhcp_devices", "host.updates.enable"); - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSnapshotManager', "vmsnapshot.create.wait", "1800", "In second, timeout for create vm snapshot", NULL, NULL,NULL,0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'VMSnapshotManager', "vmsnapshot.max", "10", "Maximum vm snapshots for a vm", NULL, NULL,NULL,0); - -INSERT IGNORE INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, state) - VALUES (9, UUID(), 'routing-9', 'SystemVM Template (HyperV)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloudstack.org/templates/4.3/systemvm64template-2013-12-23-hyperv.vhd.bz2', '5df45ee6ebe1b703a8805f4e1f4d0818', 0, 'SystemVM Template (HyperV)', 'VHD', 15, 0, 1, 'Hyperv', 'Active' ); - -UPDATE `cloud`.`vm_template` SET `bits` = "64", `url` = "http://download.cloudstack.org/templates/4.3/systemvm64template-2013-12-23-hyperv.vhd.bz2", `state` = "Active", `checksum` = "5df45ee6ebe1b703a8805f4e1f4d0818" WHERE `id` = "9"; - -INSERT IGNORE INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable, state) - VALUES (6, UUID(), 'centos64-x64', 'CentOS 6.4(64-bit) GUI (Hyperv)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloudstack.org/releases/4.3/centos6_4_64bit.vhd.bz2', 'eef6b9940ea3ed01221d963d4a012d0a', 0, 'CentOS 6.4 (64-bit) GUI (Hyperv)', 'VHD', 182, 1, 1, 'Hyperv', 1, 'Active'); - -UPDATE `cloud`.`configuration` SET `component` = 'VMSnapshotManager' WHERE `name` IN ("vmsnapshot.create.wait", "vmsnapshot.max"); - -CREATE TABLE `cloud`.`s2s_customer_gateway_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `s2s_customer_gateway_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', - PRIMARY KEY (`id`), - CONSTRAINT `fk_s2s_customer_gateway_details__s2s_customer_gateway_id` FOREIGN KEY `fk_s2s_customer_gateway_details__s2s_customer_gateway_id`(`s2s_customer_gateway_id`) REFERENCES `s2s_customer_gateway`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE `cloud`.`s2s_vpn_connection_details` ( - `id` bigint unsigned NOT NULL auto_increment, - `s2s_vpn_connection_id` bigint unsigned NOT NULL COMMENT 'VPC gateway id', - `name` varchar(255) NOT NULL, - `value` varchar(1024) NOT NULL, - `display` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'True if the detail can be displayed to the end user', - PRIMARY KEY (`id`), - CONSTRAINT `fk_s2s_vpn_connection_details__s2s_vpn_connection_id` FOREIGN KEY `fk_s2s_vpn_connection_details__s2s_vpn_connection_id`(`s2s_vpn_connection_id`) REFERENCES `s2s_vpn_connection`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -ALTER TABLE `cloud`.`vm_instance` DROP COLUMN `cpu`; -ALTER TABLE `cloud`.`vm_instance` DROP COLUMN `ram`; -ALTER TABLE `cloud`.`vm_instance` DROP COLUMN `speed`; - -INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported, vm_snapshot_enabled) VALUES (UUID(), 'VMware', '5.5', 128, 0, 13, 32, 1, 1); - -ALTER TABLE `cloud`.`network_acl_item` modify `cidr` varchar(2048); - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE VIEW `cloud`.`user_vm_view` AS - select - vm_instance.id id, - vm_instance.name name, - user_vm.display_name display_name, - user_vm.user_data user_data, - 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, - instance_group.id instance_group_id, - instance_group.uuid instance_group_uuid, - instance_group.name instance_group_name, - vm_instance.uuid uuid, - vm_instance.last_host_id last_host_id, - vm_instance.vm_type type, - vm_instance.limit_cpu_use limit_cpu_use, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.ha_enabled ha_enabled, - vm_instance.hypervisor_type hypervisor_type, - vm_instance.instance_name instance_name, - vm_instance.guest_os_id guest_os_id, - vm_instance.display_vm display_vm, - guest_os.uuid guest_os_uuid, - vm_instance.pod_id pod_id, - host_pod_ref.uuid pod_uuid, - vm_instance.private_ip_address private_ip_address, - vm_instance.private_mac_address private_mac_address, - vm_instance.vm_type vm_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.is_security_group_enabled security_group_enabled, - data_center.networktype data_center_type, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.name template_name, - vm_template.display_text template_display_text, - vm_template.enable_password password_enabled, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - service_offering.id service_offering_id, - disk_offering.uuid service_offering_uuid, - Case - When (`cloud`.`service_offering`.`cpu` is null) then (`custom_cpu`.`value`) - Else ( `cloud`.`service_offering`.`cpu`) - End as `cpu`, - Case - When (`cloud`.`service_offering`.`speed` is null) then (`custom_speed`.`value`) - Else ( `cloud`.`service_offering`.`speed`) - End as `speed`, - Case - When (`cloud`.`service_offering`.`ram_size` is null) then (`custom_ram_size`.`value`) - Else ( `cloud`.`service_offering`.`ram_size`) - END as `ram_size`, - disk_offering.name service_offering_name, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.pool_type pool_type, - volumes.id volume_id, - volumes.uuid volume_uuid, - volumes.device_id volume_device_id, - volumes.volume_type volume_type, - security_group.id security_group_id, - security_group.uuid security_group_uuid, - security_group.name security_group_name, - security_group.description security_group_description, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - user_ip_address.id public_ip_id, - user_ip_address.uuid public_ip_uuid, - user_ip_address.public_ip_address public_ip_address, - ssh_keypairs.keypair_name keypair_name, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - affinity_group.id affinity_group_id, - affinity_group.uuid affinity_group_uuid, - affinity_group.name affinity_group_name, - affinity_group.description affinity_group_description, - vm_instance.dynamically_scalable dynamically_scalable, - all_details.name detail_name, - all_details.value detail_value - from - `cloud`.`user_vm` - inner join - `cloud`.`vm_instance` ON vm_instance.id = user_vm.id - and vm_instance.removed is NULL - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id - left join - `cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = user_vm.iso_id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id - left join - `cloud`.`volumes` ON vm_instance.id = volumes.instance_id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id - left join - `cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON networks.vpc_id = vpc.id and vpc.removed is null - left join - `cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` as ssh_details ON ssh_details.vm_id = vm_instance.id - and ssh_details.name = 'SSH.PublicKey' - left join - `cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = ssh_details.value - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id - and resource_tags.resource_type = 'UserVm' - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'VirtualMachine' - and async_job.job_status = 0 - left join - `cloud`.`affinity_group_vm_map` ON vm_instance.id = affinity_group_vm_map.instance_id - left join - `cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id - left join - `cloud`.`user_vm_details` as all_details ON all_details.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_cpu`.`name` = 'CpuNumber'))) - left join - `cloud`.`user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_speed`.`name` = 'CpuSpeed'))) - left join - `cloud`.`user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_ram_size`.`name` = 'memory'))); - - -INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (168, UUID(), 6, 'Windows Server 2012 R2 (64-bit)'); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("XenServer", 'Windows Server 2012 R2 (64-bit)', 168); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("VmWare", 'Windows Server 2012 R2 (64-bit)', 168); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-452to460.sql b/engine/schema/src/main/resources/META-INF/db/schema-452to460.sql deleted file mode 100644 index 1989b6c00c2b..000000000000 --- a/engine/schema/src/main/resources/META-INF/db/schema-452to460.sql +++ /dev/null @@ -1,424 +0,0 @@ --- 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.5.1 to 4.6.0 --- - -ALTER TABLE `cloud`.`snapshots` ADD COLUMN `min_iops` bigint(20) unsigned COMMENT 'Minimum IOPS'; -ALTER TABLE `cloud`.`snapshots` ADD COLUMN `max_iops` bigint(20) unsigned COMMENT 'Maximum IOPS'; - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'management-server', "stats.output.uri", "", "URI to additionally send StatsCollector statistics to", "", NULL, NULL, 0); - -DROP VIEW IF EXISTS `cloud`.`domain_view`; -CREATE VIEW `cloud`.`domain_view` AS - select - domain.id id, - domain.parent parent, - domain.name name, - domain.uuid uuid, - domain.owner owner, - domain.path path, - domain.level level, - domain.child_count child_count, - domain.next_child_seq next_child_seq, - domain.removed removed, - domain.state state, - domain.network_domain network_domain, - domain.type type, - vmlimit.max vmLimit, - vmcount.count vmTotal, - iplimit.max ipLimit, - ipcount.count ipTotal, - volumelimit.max volumeLimit, - volumecount.count volumeTotal, - snapshotlimit.max snapshotLimit, - snapshotcount.count snapshotTotal, - templatelimit.max templateLimit, - templatecount.count templateTotal, - vpclimit.max vpcLimit, - vpccount.count vpcTotal, - projectlimit.max projectLimit, - projectcount.count projectTotal, - networklimit.max networkLimit, - networkcount.count networkTotal, - cpulimit.max cpuLimit, - cpucount.count cpuTotal, - memorylimit.max memoryLimit, - memorycount.count memoryTotal, - primary_storage_limit.max primaryStorageLimit, - primary_storage_count.count primaryStorageTotal, - secondary_storage_limit.max secondaryStorageLimit, - secondary_storage_count.count secondaryStorageTotal - from - `cloud`.`domain` - left join - `cloud`.`resource_limit` vmlimit ON domain.id = vmlimit.domain_id - and vmlimit.type = 'user_vm' - left join - `cloud`.`resource_count` vmcount ON domain.id = vmcount.domain_id - and vmcount.type = 'user_vm' - left join - `cloud`.`resource_limit` iplimit ON domain.id = iplimit.domain_id - and iplimit.type = 'public_ip' - left join - `cloud`.`resource_count` ipcount ON domain.id = ipcount.domain_id - and ipcount.type = 'public_ip' - left join - `cloud`.`resource_limit` volumelimit ON domain.id = volumelimit.domain_id - and volumelimit.type = 'volume' - left join - `cloud`.`resource_count` volumecount ON domain.id = volumecount.domain_id - and volumecount.type = 'volume' - left join - `cloud`.`resource_limit` snapshotlimit ON domain.id = snapshotlimit.domain_id - and snapshotlimit.type = 'snapshot' - left join - `cloud`.`resource_count` snapshotcount ON domain.id = snapshotcount.domain_id - and snapshotcount.type = 'snapshot' - left join - `cloud`.`resource_limit` templatelimit ON domain.id = templatelimit.domain_id - and templatelimit.type = 'template' - left join - `cloud`.`resource_count` templatecount ON domain.id = templatecount.domain_id - and templatecount.type = 'template' - left join - `cloud`.`resource_limit` vpclimit ON domain.id = vpclimit.domain_id - and vpclimit.type = 'vpc' - left join - `cloud`.`resource_count` vpccount ON domain.id = vpccount.domain_id - and vpccount.type = 'vpc' - left join - `cloud`.`resource_limit` projectlimit ON domain.id = projectlimit.domain_id - and projectlimit.type = 'project' - left join - `cloud`.`resource_count` projectcount ON domain.id = projectcount.domain_id - and projectcount.type = 'project' - left join - `cloud`.`resource_limit` networklimit ON domain.id = networklimit.domain_id - and networklimit.type = 'network' - left join - `cloud`.`resource_count` networkcount ON domain.id = networkcount.domain_id - and networkcount.type = 'network' - left join - `cloud`.`resource_limit` cpulimit ON domain.id = cpulimit.domain_id - and cpulimit.type = 'cpu' - left join - `cloud`.`resource_count` cpucount ON domain.id = cpucount.domain_id - and cpucount.type = 'cpu' - left join - `cloud`.`resource_limit` memorylimit ON domain.id = memorylimit.domain_id - and memorylimit.type = 'memory' - left join - `cloud`.`resource_count` memorycount ON domain.id = memorycount.domain_id - and memorycount.type = 'memory' - left join - `cloud`.`resource_limit` primary_storage_limit ON domain.id = primary_storage_limit.domain_id - and primary_storage_limit.type = 'primary_storage' - left join - `cloud`.`resource_count` primary_storage_count ON domain.id = primary_storage_count.domain_id - and primary_storage_count.type = 'primary_storage' - left join - `cloud`.`resource_limit` secondary_storage_limit ON domain.id = secondary_storage_limit.domain_id - and secondary_storage_limit.type = 'secondary_storage' - left join - `cloud`.`resource_count` secondary_storage_count ON domain.id = secondary_storage_count.domain_id - and secondary_storage_count.type = 'secondary_storage'; - -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.user.vms','-1','The default maximum number of user VMs that can be deployed for a domain', '-1', NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.public.ips','-1','The default maximum number of public IPs that can be consumed by a domain', '-1', NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.templates','-1','The default maximum number of templates that can be deployed for a domain', '-1', NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.snapshots','-1','The default maximum number of snapshots that can be created for a domain', '-1', NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.volumes','-1','The default maximum number of volumes that can be created for a domain', '-1', NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.networks', '-1', 'The default maximum number of networks that can be created for a domain', '-1', NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.vpcs', '-1', 'The default maximum number of vpcs that can be created for a domain', '-1', NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.cpus', '-1', 'The default maximum number of cpu cores that can be used for a domain', '-1', NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.memory', '-1', 'The default maximum memory (in MiB) that can be used for a domain', '-1', NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.primary.storage', '-1', 'The default maximum primary storage space (in GiB) that can be used for a domain', '-1', NULL, NULL, 0); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Domain Defaults', 'DEFAULT', 'management-server', 'max.domain.secondary.storage', '-1', 'The default maximum secondary storage space (in GiB) that can be used for a domain', '-1', NULL, NULL, 0); - -ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `user_id` bigint unsigned NOT NULL DEFAULT 1 COMMENT 'user id of VM deployer'; - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE VIEW `cloud`.`user_vm_view` AS - select - vm_instance.id id, - vm_instance.name name, - user_vm.display_name display_name, - user_vm.user_data user_data, - 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, - instance_group.id instance_group_id, - instance_group.uuid instance_group_uuid, - instance_group.name instance_group_name, - vm_instance.uuid uuid, - vm_instance.user_id user_id, - vm_instance.last_host_id last_host_id, - vm_instance.vm_type type, - vm_instance.limit_cpu_use limit_cpu_use, - vm_instance.created created, - vm_instance.state state, - vm_instance.removed removed, - vm_instance.ha_enabled ha_enabled, - vm_instance.hypervisor_type hypervisor_type, - vm_instance.instance_name instance_name, - vm_instance.guest_os_id guest_os_id, - vm_instance.display_vm display_vm, - guest_os.uuid guest_os_uuid, - vm_instance.pod_id pod_id, - host_pod_ref.uuid pod_uuid, - vm_instance.private_ip_address private_ip_address, - vm_instance.private_mac_address private_mac_address, - vm_instance.vm_type vm_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.is_security_group_enabled security_group_enabled, - data_center.networktype data_center_type, - host.id host_id, - host.uuid host_uuid, - host.name host_name, - vm_template.id template_id, - vm_template.uuid template_uuid, - vm_template.name template_name, - vm_template.display_text template_display_text, - vm_template.enable_password password_enabled, - iso.id iso_id, - iso.uuid iso_uuid, - iso.name iso_name, - iso.display_text iso_display_text, - service_offering.id service_offering_id, - svc_disk_offering.uuid service_offering_uuid, - disk_offering.uuid disk_offering_uuid, - disk_offering.id disk_offering_id, - Case - When (`cloud`.`service_offering`.`cpu` is null) then (`custom_cpu`.`value`) - Else ( `cloud`.`service_offering`.`cpu`) - End as `cpu`, - Case - When (`cloud`.`service_offering`.`speed` is null) then (`custom_speed`.`value`) - Else ( `cloud`.`service_offering`.`speed`) - End as `speed`, - Case - When (`cloud`.`service_offering`.`ram_size` is null) then (`custom_ram_size`.`value`) - Else ( `cloud`.`service_offering`.`ram_size`) - END as `ram_size`, - svc_disk_offering.name service_offering_name, - disk_offering.name disk_offering_name, - storage_pool.id pool_id, - storage_pool.uuid pool_uuid, - storage_pool.pool_type pool_type, - volumes.id volume_id, - volumes.uuid volume_uuid, - volumes.device_id volume_device_id, - volumes.volume_type volume_type, - security_group.id security_group_id, - security_group.uuid security_group_uuid, - security_group.name security_group_name, - security_group.description security_group_description, - nics.id nic_id, - nics.uuid nic_uuid, - nics.network_id network_id, - nics.ip4_address ip_address, - nics.ip6_address ip6_address, - nics.ip6_gateway ip6_gateway, - nics.ip6_cidr ip6_cidr, - nics.default_nic is_default_nic, - nics.gateway gateway, - nics.netmask netmask, - nics.mac_address mac_address, - nics.broadcast_uri broadcast_uri, - nics.isolation_uri isolation_uri, - vpc.id vpc_id, - vpc.uuid vpc_uuid, - networks.uuid network_uuid, - networks.name network_name, - networks.traffic_type traffic_type, - networks.guest_type guest_type, - user_ip_address.id public_ip_id, - user_ip_address.uuid public_ip_uuid, - user_ip_address.public_ip_address public_ip_address, - ssh_keypairs.keypair_name keypair_name, - resource_tags.id tag_id, - resource_tags.uuid tag_uuid, - resource_tags.key tag_key, - resource_tags.value tag_value, - resource_tags.domain_id tag_domain_id, - resource_tags.account_id tag_account_id, - resource_tags.resource_id tag_resource_id, - resource_tags.resource_uuid tag_resource_uuid, - resource_tags.resource_type tag_resource_type, - resource_tags.customer tag_customer, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - affinity_group.id affinity_group_id, - affinity_group.uuid affinity_group_uuid, - affinity_group.name affinity_group_name, - affinity_group.description affinity_group_description, - vm_instance.dynamically_scalable dynamically_scalable - - from - `cloud`.`user_vm` - inner join - `cloud`.`vm_instance` ON vm_instance.id = user_vm.id - and vm_instance.removed is NULL - inner join - `cloud`.`account` ON vm_instance.account_id = account.id - inner join - `cloud`.`domain` ON vm_instance.domain_id = domain.id - left join - `cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id - left join - `cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id - left join - `cloud`.`projects` ON projects.project_account_id = account.id - left join - `cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id - left join - `cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id - left join - `cloud`.`data_center` ON vm_instance.data_center_id = data_center.id - left join - `cloud`.`host` ON vm_instance.host_id = host.id - left join - `cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id - left join - `cloud`.`vm_template` iso ON iso.id = user_vm.iso_id - left join - `cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id - left join - `cloud`.`disk_offering` svc_disk_offering ON vm_instance.service_offering_id = svc_disk_offering.id - left join - `cloud`.`disk_offering` ON vm_instance.disk_offering_id = disk_offering.id - left join - `cloud`.`volumes` ON vm_instance.id = volumes.instance_id - left join - `cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id - left join - `cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id - left join - `cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id - left join - `cloud`.`nics` ON vm_instance.id = nics.instance_id and nics.removed is null - left join - `cloud`.`networks` ON nics.network_id = networks.id - left join - `cloud`.`vpc` ON networks.vpc_id = vpc.id and vpc.removed is null - left join - `cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id - left join - `cloud`.`user_vm_details` as ssh_details ON ssh_details.vm_id = vm_instance.id - and ssh_details.name = 'SSH.PublicKey' - left join - `cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = ssh_details.value AND ssh_keypairs.account_id = account.id - left join - `cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id - and resource_tags.resource_type = 'UserVm' - left join - `cloud`.`async_job` ON async_job.instance_id = vm_instance.id - and async_job.instance_type = 'VirtualMachine' - and async_job.job_status = 0 - left join - `cloud`.`affinity_group_vm_map` ON vm_instance.id = affinity_group_vm_map.instance_id - left join - `cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id - left join - `cloud`.`user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_cpu`.`name` = 'CpuNumber'))) - left join - `cloud`.`user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_speed`.`name` = 'CpuSpeed'))) - left join - `cloud`.`user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `cloud`.`vm_instance`.`id`) and (`custom_ram_size`.`name` = 'memory'))); - ----Additional checks to ensure duplicate keys are not registered and remove the previously stored duplicate keys. -DELETE `s1` FROM `ssh_keypairs` `s1`, `ssh_keypairs` `s2` WHERE `s1`.`id` > `s2`.`id` AND `s1`.`public_key` = `s2`.`public_key` AND `s1`.`account_id` = `s2`.`account_id`; -ALTER TABLE `ssh_keypairs` ADD UNIQUE `unique_index`(`fingerprint`,`account_id`); - --- ovm3 stuff -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Sun Solaris 10(32-bit)', 79); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Sun Solaris 10(64-bit)', 80); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Sun Solaris 11(32-bit)', 158); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Sun Solaris 11(64-bit)', 159); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Other Linux (32-bit)', 98); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Other Linux (64-bit)', 99); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('Ovm3', 'Other PV (32-bit)', 139); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('Ovm3', 'Other PV (64-bit)', 140); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('Ovm3', 'DOS', 102); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Windows 8 (32-bit)', 165); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Windows 8 (64-bit)', 166); -INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ("Ovm3", 'Windows Server 2012 (64-bit)', 167); - -INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('Ovm3', '3.2', 25, 0); -INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('Ovm3', '3.3', 50, 0); -UPDATE `cloud`.`volumes` v, `cloud`.`storage_pool` s, `cloud`.`cluster` c set v.format='RAW' where v.pool_id=s.id and s.cluster_id=c.id and c.hypervisor_type='Ovm3'; -UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,Ovm3,LXC' WHERE name='hypervisor.list'; -INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id,featured, cross_zones, hypervisor_type, state) -VALUES (12, UUID(), 'routing-12', 'SystemVM Template (Ovm3)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloudstack.org/systemvm/4.6/systemvm64template-4.6.0-ovm.raw.bz2', 'c8577d27b2daafb2d9a4ed307ce2f00f', 0, 'SystemVM Template (Ovm3)', 'RAW', 183, 0, 1, 'Ovm3', 'Active' ); - -INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default_value`, `description`) VALUES ('Advanced', 'DEFAULT', 'ManagementServer', 'ovm3.heartbeat.timeout' , '180', '120', 'Timeout value to send to the checkheartbeat script for guarding the self fencing functionality on ovm3'); -INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default_value`, `description`) VALUES ('Advanced', 'DEFAULT', 'ManagementServer', 'ovm3.heartbeat.interval' , '10', '1', 'Interval value the checkheartbeat script uses before triggering the timeout for ovm3'); -INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'NetworkManager', 'router.template.ovm3', 'SystemVM Template (Ovm3)', 'Name of the default router template on Ovm3.','SystemVM Template (Ovm3)', NULL, NULL, 0); - -UPDATE IGNORE `cloud`.`configuration` SET `value`="PLAINTEXT" WHERE `name`="user.authenticators.exclude"; - -DROP TABLE IF EXISTS `cloud`.`external_bigswitch_vns_devices`; -CREATE TABLE `cloud`.`external_bigswitch_bcf_devices` ( - `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', - `uuid` varchar(255) UNIQUE, - `physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which bigswitch bcf device is added', - `provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this bigswitch bcf device', - `device_name` varchar(255) NOT NULL COMMENT 'name of the bigswitch bcf device', - `host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external bigswitch bcf device', - `hostname` varchar(255) NOT NULL COMMENT 'host name or IP address for the bigswitch bcf device', - `username` varchar(255) NOT NULL COMMENT 'username for the bigswitch bcf device', - `password` varchar(255) NOT NULL COMMENT 'password for the bigswitch bcf device', - `nat` boolean NOT NULL COMMENT 'NAT support for the bigswitch bcf device', - `hash` varchar(255) NOT NULL COMMENT 'topology hash for the bigswitch bcf networks', - PRIMARY KEY (`id`), - CONSTRAINT `fk_external_bigswitch_bcf_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_external_bigswitch_bcf_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -UPDATE `cloud`.`host` SET `resource`='com.cloud.hypervisor.xenserver.resource.XenServer600Resource' WHERE `resource`='com.cloud.hypervisor.xenserver.resource.XenServer602Resource'; - -CREATE TABLE `cloud`.`ldap_trust_map` ( - `id` int unsigned NOT NULL AUTO_INCREMENT, - `domain_id` bigint unsigned NOT NULL, - `type` varchar(10) NOT NULL, - `name` varchar(255) NOT NULL, - `account_type` int(1) unsigned NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `uk_ldap_trust_map__domain_id` (`domain_id`), - CONSTRAINT `fk_ldap_trust_map__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'Red Hat Enterprise Linux 7', 245, utc_timestamp(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'CentOS 7', 246, utc_timestamp(), 0); - -UPDATE `cloud`.`hypervisor_capabilities` SET `max_data_volumes_limit` = '32' WHERE `hypervisor_capabilities`.`hypervisor_type` = 'KVM'; - - diff --git a/engine/schema/src/main/resources/META-INF/db/schema-481to490.sql b/engine/schema/src/main/resources/META-INF/db/schema-481to490.sql deleted file mode 100644 index 49cfc8346c54..000000000000 --- a/engine/schema/src/main/resources/META-INF/db/schema-481to490.sql +++ /dev/null @@ -1,624 +0,0 @@ --- 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.8.1 to 4.9.0; ---; - -ALTER TABLE `event` ADD INDEX `archived` (`archived`); -ALTER TABLE `event` ADD INDEX `state` (`state`); - -DROP VIEW IF EXISTS `cloud`.`template_view`; -CREATE -VIEW `template_view` AS - SELECT - `vm_template`.`id` AS `id`, - `vm_template`.`uuid` AS `uuid`, - `vm_template`.`unique_name` AS `unique_name`, - `vm_template`.`name` AS `name`, - `vm_template`.`public` AS `public`, - `vm_template`.`featured` AS `featured`, - `vm_template`.`type` AS `type`, - `vm_template`.`hvm` AS `hvm`, - `vm_template`.`bits` AS `bits`, - `vm_template`.`url` AS `url`, - `vm_template`.`format` AS `format`, - `vm_template`.`created` AS `created`, - `vm_template`.`checksum` AS `checksum`, - `vm_template`.`display_text` AS `display_text`, - `vm_template`.`enable_password` AS `enable_password`, - `vm_template`.`dynamically_scalable` AS `dynamically_scalable`, - `vm_template`.`state` AS `template_state`, - `vm_template`.`guest_os_id` AS `guest_os_id`, - `guest_os`.`uuid` AS `guest_os_uuid`, - `guest_os`.`display_name` AS `guest_os_name`, - `vm_template`.`bootable` AS `bootable`, - `vm_template`.`prepopulate` AS `prepopulate`, - `vm_template`.`cross_zones` AS `cross_zones`, - `vm_template`.`hypervisor_type` AS `hypervisor_type`, - `vm_template`.`extractable` AS `extractable`, - `vm_template`.`template_tag` AS `template_tag`, - `vm_template`.`sort_key` AS `sort_key`, - `vm_template`.`removed` AS `removed`, - `vm_template`.`enable_sshkey` AS `enable_sshkey`, - `source_template`.`id` AS `source_template_id`, - `source_template`.`uuid` AS `source_template_uuid`, - `account`.`id` AS `account_id`, - `account`.`uuid` AS `account_uuid`, - `account`.`account_name` AS `account_name`, - `account`.`type` AS `account_type`, - `domain`.`id` AS `domain_id`, - `domain`.`uuid` AS `domain_uuid`, - `domain`.`name` AS `domain_name`, - `domain`.`path` AS `domain_path`, - `projects`.`id` AS `project_id`, - `projects`.`uuid` AS `project_uuid`, - `projects`.`name` AS `project_name`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `launch_permission`.`account_id` AS `lp_account_id`, - `template_store_ref`.`store_id` AS `store_id`, - `image_store`.`scope` AS `store_scope`, - `template_store_ref`.`state` AS `state`, - `template_store_ref`.`download_state` AS `download_state`, - `template_store_ref`.`download_pct` AS `download_pct`, - `template_store_ref`.`error_str` AS `error_str`, - `template_store_ref`.`size` AS `size`, - `template_store_ref`.`destroyed` AS `destroyed`, - `template_store_ref`.`created` AS `created_on_store`, - `vm_template_details`.`name` AS `detail_name`, - `vm_template_details`.`value` AS `detail_value`, - `resource_tags`.`id` AS `tag_id`, - `resource_tags`.`uuid` AS `tag_uuid`, - `resource_tags`.`key` AS `tag_key`, - `resource_tags`.`value` AS `tag_value`, - `resource_tags`.`domain_id` AS `tag_domain_id`, - `domain`.`uuid` AS `tag_domain_uuid`, - `domain`.`name` AS `tag_domain_name`, - `resource_tags`.`account_id` AS `tag_account_id`, - `account`.`account_name` AS `tag_account_name`, - `resource_tags`.`resource_id` AS `tag_resource_id`, - `resource_tags`.`resource_uuid` AS `tag_resource_uuid`, - `resource_tags`.`resource_type` AS `tag_resource_type`, - `resource_tags`.`customer` AS `tag_customer`, - CONCAT(`vm_template`.`id`, - '_', - IFNULL(`data_center`.`id`, 0)) AS `temp_zone_pair` - FROM - ((((((((((((`vm_template` - JOIN `guest_os` ON ((`guest_os`.`id` = `vm_template`.`guest_os_id`))) - JOIN `account` ON ((`account`.`id` = `vm_template`.`account_id`))) - JOIN `domain` ON ((`domain`.`id` = `account`.`domain_id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `vm_template_details` ON ((`vm_template_details`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `source_template` ON ((`source_template`.`id` = `vm_template`.`source_template_id`))) - LEFT JOIN `template_store_ref` ON (((`template_store_ref`.`template_id` = `vm_template`.`id`) - AND (`template_store_ref`.`store_role` = 'Image') - AND (`template_store_ref`.`destroyed` = 0)))) - LEFT JOIN `image_store` ON ((ISNULL(`image_store`.`removed`) - AND (`template_store_ref`.`store_id` IS NOT NULL) - AND (`image_store`.`id` = `template_store_ref`.`store_id`)))) - LEFT JOIN `template_zone_ref` ON (((`template_zone_ref`.`template_id` = `vm_template`.`id`) - AND ISNULL(`template_store_ref`.`store_id`) - AND ISNULL(`template_zone_ref`.`removed`)))) - LEFT JOIN `data_center` ON (((`image_store`.`data_center_id` = `data_center`.`id`) - OR (`template_zone_ref`.`zone_id` = `data_center`.`id`)))) - LEFT JOIN `launch_permission` ON ((`launch_permission`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_template`.`id`) - AND ((`resource_tags`.`resource_type` = 'Template') - OR (`resource_tags`.`resource_type` = 'ISO'))))); - -DROP VIEW IF EXISTS `cloud`.`volume_view`; -CREATE -VIEW `volume_view` AS - SELECT - `volumes`.`id` AS `id`, - `volumes`.`uuid` AS `uuid`, - `volumes`.`name` AS `name`, - `volumes`.`device_id` AS `device_id`, - `volumes`.`volume_type` AS `volume_type`, - `volumes`.`provisioning_type` AS `provisioning_type`, - `volumes`.`size` AS `size`, - `volumes`.`min_iops` AS `min_iops`, - `volumes`.`max_iops` AS `max_iops`, - `volumes`.`created` AS `created`, - `volumes`.`state` AS `state`, - `volumes`.`attached` AS `attached`, - `volumes`.`removed` AS `removed`, - `volumes`.`pod_id` AS `pod_id`, - `volumes`.`display_volume` AS `display_volume`, - `volumes`.`format` AS `format`, - `volumes`.`path` AS `path`, - `volumes`.`chain_info` AS `chain_info`, - `account`.`id` AS `account_id`, - `account`.`uuid` AS `account_uuid`, - `account`.`account_name` AS `account_name`, - `account`.`type` AS `account_type`, - `domain`.`id` AS `domain_id`, - `domain`.`uuid` AS `domain_uuid`, - `domain`.`name` AS `domain_name`, - `domain`.`path` AS `domain_path`, - `projects`.`id` AS `project_id`, - `projects`.`uuid` AS `project_uuid`, - `projects`.`name` AS `project_name`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `data_center`.`networktype` AS `data_center_type`, - `vm_instance`.`id` AS `vm_id`, - `vm_instance`.`uuid` AS `vm_uuid`, - `vm_instance`.`name` AS `vm_name`, - `vm_instance`.`state` AS `vm_state`, - `vm_instance`.`vm_type` AS `vm_type`, - `user_vm`.`display_name` AS `vm_display_name`, - `volume_store_ref`.`size` AS `volume_store_size`, - `volume_store_ref`.`download_pct` AS `download_pct`, - `volume_store_ref`.`download_state` AS `download_state`, - `volume_store_ref`.`error_str` AS `error_str`, - `volume_store_ref`.`created` AS `created_on_store`, - `disk_offering`.`id` AS `disk_offering_id`, - `disk_offering`.`uuid` AS `disk_offering_uuid`, - `disk_offering`.`name` AS `disk_offering_name`, - `disk_offering`.`display_text` AS `disk_offering_display_text`, - `disk_offering`.`use_local_storage` AS `use_local_storage`, - `disk_offering`.`system_use` AS `system_use`, - `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`, - `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`, - `disk_offering`.`iops_read_rate` AS `iops_read_rate`, - `disk_offering`.`iops_write_rate` AS `iops_write_rate`, - `disk_offering`.`cache_mode` AS `cache_mode`, - `storage_pool`.`id` AS `pool_id`, - `storage_pool`.`uuid` AS `pool_uuid`, - `storage_pool`.`name` AS `pool_name`, - `cluster`.`hypervisor_type` AS `hypervisor_type`, - `vm_template`.`id` AS `template_id`, - `vm_template`.`uuid` AS `template_uuid`, - `vm_template`.`extractable` AS `extractable`, - `vm_template`.`type` AS `template_type`, - `vm_template`.`name` AS `template_name`, - `vm_template`.`display_text` AS `template_display_text`, - `iso`.`id` AS `iso_id`, - `iso`.`uuid` AS `iso_uuid`, - `iso`.`name` AS `iso_name`, - `iso`.`display_text` AS `iso_display_text`, - `resource_tags`.`id` AS `tag_id`, - `resource_tags`.`uuid` AS `tag_uuid`, - `resource_tags`.`key` AS `tag_key`, - `resource_tags`.`value` AS `tag_value`, - `resource_tags`.`domain_id` AS `tag_domain_id`, - `domain`.`uuid` AS `tag_domain_uuid`, - `domain`.`name` AS `tag_domain_name`, - `resource_tags`.`account_id` AS `tag_account_id`, - `account`.`account_name` AS `tag_account_name`, - `resource_tags`.`resource_id` AS `tag_resource_id`, - `resource_tags`.`resource_uuid` AS `tag_resource_uuid`, - `resource_tags`.`resource_type` AS `tag_resource_type`, - `resource_tags`.`customer` AS `tag_customer`, - `async_job`.`id` AS `job_id`, - `async_job`.`uuid` AS `job_uuid`, - `async_job`.`job_status` AS `job_status`, - `async_job`.`account_id` AS `job_account_id` - FROM - ((((((((((((((`volumes` - JOIN `account` ON ((`volumes`.`account_id` = `account`.`id`))) - JOIN `domain` ON ((`volumes`.`domain_id` = `domain`.`id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `data_center` ON ((`volumes`.`data_center_id` = `data_center`.`id`))) - LEFT JOIN `vm_instance` ON ((`volumes`.`instance_id` = `vm_instance`.`id`))) - LEFT JOIN `user_vm` ON ((`user_vm`.`id` = `vm_instance`.`id`))) - LEFT JOIN `volume_store_ref` ON ((`volumes`.`id` = `volume_store_ref`.`volume_id`))) - LEFT JOIN `disk_offering` ON ((`volumes`.`disk_offering_id` = `disk_offering`.`id`))) - LEFT JOIN `storage_pool` ON ((`volumes`.`pool_id` = `storage_pool`.`id`))) - LEFT JOIN `cluster` ON ((`storage_pool`.`cluster_id` = `cluster`.`id`))) - LEFT JOIN `vm_template` ON ((`volumes`.`template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `iso` ON ((`iso`.`id` = `volumes`.`iso_id`))) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `volumes`.`id`) - AND (`resource_tags`.`resource_type` = 'Volume')))) - LEFT JOIN `async_job` ON (((`async_job`.`instance_id` = `volumes`.`id`) - AND (`async_job`.`instance_type` = 'Volume') - AND (`async_job`.`job_status` = 0)))); - -DROP VIEW IF EXISTS `cloud`.`user_vm_view`; -CREATE -VIEW `user_vm_view` AS - SELECT - `vm_instance`.`id` AS `id`, - `vm_instance`.`name` AS `name`, - `user_vm`.`display_name` AS `display_name`, - `user_vm`.`user_data` AS `user_data`, - `account`.`id` AS `account_id`, - `account`.`uuid` AS `account_uuid`, - `account`.`account_name` AS `account_name`, - `account`.`type` AS `account_type`, - `domain`.`id` AS `domain_id`, - `domain`.`uuid` AS `domain_uuid`, - `domain`.`name` AS `domain_name`, - `domain`.`path` AS `domain_path`, - `projects`.`id` AS `project_id`, - `projects`.`uuid` AS `project_uuid`, - `projects`.`name` AS `project_name`, - `instance_group`.`id` AS `instance_group_id`, - `instance_group`.`uuid` AS `instance_group_uuid`, - `instance_group`.`name` AS `instance_group_name`, - `vm_instance`.`uuid` AS `uuid`, - `vm_instance`.`user_id` AS `user_id`, - `vm_instance`.`last_host_id` AS `last_host_id`, - `vm_instance`.`vm_type` AS `type`, - `vm_instance`.`limit_cpu_use` AS `limit_cpu_use`, - `vm_instance`.`created` AS `created`, - `vm_instance`.`state` AS `state`, - `vm_instance`.`removed` AS `removed`, - `vm_instance`.`ha_enabled` AS `ha_enabled`, - `vm_instance`.`hypervisor_type` AS `hypervisor_type`, - `vm_instance`.`instance_name` AS `instance_name`, - `vm_instance`.`guest_os_id` AS `guest_os_id`, - `vm_instance`.`display_vm` AS `display_vm`, - `guest_os`.`uuid` AS `guest_os_uuid`, - `vm_instance`.`pod_id` AS `pod_id`, - `host_pod_ref`.`uuid` AS `pod_uuid`, - `vm_instance`.`private_ip_address` AS `private_ip_address`, - `vm_instance`.`private_mac_address` AS `private_mac_address`, - `vm_instance`.`vm_type` AS `vm_type`, - `data_center`.`id` AS `data_center_id`, - `data_center`.`uuid` AS `data_center_uuid`, - `data_center`.`name` AS `data_center_name`, - `data_center`.`is_security_group_enabled` AS `security_group_enabled`, - `data_center`.`networktype` AS `data_center_type`, - `host`.`id` AS `host_id`, - `host`.`uuid` AS `host_uuid`, - `host`.`name` AS `host_name`, - `vm_template`.`id` AS `template_id`, - `vm_template`.`uuid` AS `template_uuid`, - `vm_template`.`name` AS `template_name`, - `vm_template`.`display_text` AS `template_display_text`, - `vm_template`.`enable_password` AS `password_enabled`, - `iso`.`id` AS `iso_id`, - `iso`.`uuid` AS `iso_uuid`, - `iso`.`name` AS `iso_name`, - `iso`.`display_text` AS `iso_display_text`, - `service_offering`.`id` AS `service_offering_id`, - `svc_disk_offering`.`uuid` AS `service_offering_uuid`, - `disk_offering`.`uuid` AS `disk_offering_uuid`, - `disk_offering`.`id` AS `disk_offering_id`, - (CASE - WHEN ISNULL(`service_offering`.`cpu`) THEN `custom_cpu`.`value` - ELSE `service_offering`.`cpu` - END) AS `cpu`, - (CASE - WHEN ISNULL(`service_offering`.`speed`) THEN `custom_speed`.`value` - ELSE `service_offering`.`speed` - END) AS `speed`, - (CASE - WHEN ISNULL(`service_offering`.`ram_size`) THEN `custom_ram_size`.`value` - ELSE `service_offering`.`ram_size` - END) AS `ram_size`, - `svc_disk_offering`.`name` AS `service_offering_name`, - `disk_offering`.`name` AS `disk_offering_name`, - `storage_pool`.`id` AS `pool_id`, - `storage_pool`.`uuid` AS `pool_uuid`, - `storage_pool`.`pool_type` AS `pool_type`, - `volumes`.`id` AS `volume_id`, - `volumes`.`uuid` AS `volume_uuid`, - `volumes`.`device_id` AS `volume_device_id`, - `volumes`.`volume_type` AS `volume_type`, - `security_group`.`id` AS `security_group_id`, - `security_group`.`uuid` AS `security_group_uuid`, - `security_group`.`name` AS `security_group_name`, - `security_group`.`description` AS `security_group_description`, - `nics`.`id` AS `nic_id`, - `nics`.`uuid` AS `nic_uuid`, - `nics`.`network_id` AS `network_id`, - `nics`.`ip4_address` AS `ip_address`, - `nics`.`ip6_address` AS `ip6_address`, - `nics`.`ip6_gateway` AS `ip6_gateway`, - `nics`.`ip6_cidr` AS `ip6_cidr`, - `nics`.`default_nic` AS `is_default_nic`, - `nics`.`gateway` AS `gateway`, - `nics`.`netmask` AS `netmask`, - `nics`.`mac_address` AS `mac_address`, - `nics`.`broadcast_uri` AS `broadcast_uri`, - `nics`.`isolation_uri` AS `isolation_uri`, - `vpc`.`id` AS `vpc_id`, - `vpc`.`uuid` AS `vpc_uuid`, - `networks`.`uuid` AS `network_uuid`, - `networks`.`name` AS `network_name`, - `networks`.`traffic_type` AS `traffic_type`, - `networks`.`guest_type` AS `guest_type`, - `user_ip_address`.`id` AS `public_ip_id`, - `user_ip_address`.`uuid` AS `public_ip_uuid`, - `user_ip_address`.`public_ip_address` AS `public_ip_address`, - `ssh_keypairs`.`keypair_name` AS `keypair_name`, - `resource_tags`.`id` AS `tag_id`, - `resource_tags`.`uuid` AS `tag_uuid`, - `resource_tags`.`key` AS `tag_key`, - `resource_tags`.`value` AS `tag_value`, - `resource_tags`.`domain_id` AS `tag_domain_id`, - `domain`.`uuid` AS `tag_domain_uuid`, - `domain`.`name` AS `tag_domain_name`, - `resource_tags`.`account_id` AS `tag_account_id`, - `account`.`account_name` AS `tag_account_name`, - `resource_tags`.`resource_id` AS `tag_resource_id`, - `resource_tags`.`resource_uuid` AS `tag_resource_uuid`, - `resource_tags`.`resource_type` AS `tag_resource_type`, - `resource_tags`.`customer` AS `tag_customer`, - `async_job`.`id` AS `job_id`, - `async_job`.`uuid` AS `job_uuid`, - `async_job`.`job_status` AS `job_status`, - `async_job`.`account_id` AS `job_account_id`, - `affinity_group`.`id` AS `affinity_group_id`, - `affinity_group`.`uuid` AS `affinity_group_uuid`, - `affinity_group`.`name` AS `affinity_group_name`, - `affinity_group`.`description` AS `affinity_group_description`, - `vm_instance`.`dynamically_scalable` AS `dynamically_scalable` - FROM - ((((((((((((((((((((((((((((((((`user_vm` - JOIN `vm_instance` ON (((`vm_instance`.`id` = `user_vm`.`id`) - AND ISNULL(`vm_instance`.`removed`)))) - JOIN `account` ON ((`vm_instance`.`account_id` = `account`.`id`))) - JOIN `domain` ON ((`vm_instance`.`domain_id` = `domain`.`id`))) - LEFT JOIN `guest_os` ON ((`vm_instance`.`guest_os_id` = `guest_os`.`id`))) - LEFT JOIN `host_pod_ref` ON ((`vm_instance`.`pod_id` = `host_pod_ref`.`id`))) - LEFT JOIN `projects` ON ((`projects`.`project_account_id` = `account`.`id`))) - LEFT JOIN `instance_group_vm_map` ON ((`vm_instance`.`id` = `instance_group_vm_map`.`instance_id`))) - LEFT JOIN `instance_group` ON ((`instance_group_vm_map`.`group_id` = `instance_group`.`id`))) - LEFT JOIN `data_center` ON ((`vm_instance`.`data_center_id` = `data_center`.`id`))) - LEFT JOIN `host` ON ((`vm_instance`.`host_id` = `host`.`id`))) - LEFT JOIN `vm_template` ON ((`vm_instance`.`vm_template_id` = `vm_template`.`id`))) - LEFT JOIN `vm_template` `iso` ON ((`iso`.`id` = `user_vm`.`iso_id`))) - LEFT JOIN `service_offering` ON ((`vm_instance`.`service_offering_id` = `service_offering`.`id`))) - LEFT JOIN `disk_offering` `svc_disk_offering` ON ((`vm_instance`.`service_offering_id` = `svc_disk_offering`.`id`))) - LEFT JOIN `disk_offering` ON ((`vm_instance`.`disk_offering_id` = `disk_offering`.`id`))) - LEFT JOIN `volumes` ON ((`vm_instance`.`id` = `volumes`.`instance_id`))) - LEFT JOIN `storage_pool` ON ((`volumes`.`pool_id` = `storage_pool`.`id`))) - LEFT JOIN `security_group_vm_map` ON ((`vm_instance`.`id` = `security_group_vm_map`.`instance_id`))) - LEFT JOIN `security_group` ON ((`security_group_vm_map`.`security_group_id` = `security_group`.`id`))) - LEFT JOIN `nics` ON (((`vm_instance`.`id` = `nics`.`instance_id`) - AND ISNULL(`nics`.`removed`)))) - LEFT JOIN `networks` ON ((`nics`.`network_id` = `networks`.`id`))) - LEFT JOIN `vpc` ON (((`networks`.`vpc_id` = `vpc`.`id`) - AND ISNULL(`vpc`.`removed`)))) - LEFT JOIN `user_ip_address` ON ((`user_ip_address`.`vm_id` = `vm_instance`.`id`))) - LEFT JOIN `user_vm_details` `ssh_details` ON (((`ssh_details`.`vm_id` = `vm_instance`.`id`) - AND (`ssh_details`.`name` = 'SSH.PublicKey')))) - LEFT JOIN `ssh_keypairs` ON (((`ssh_keypairs`.`public_key` = `ssh_details`.`value`) - AND (`ssh_keypairs`.`account_id` = `account`.`id`)))) - LEFT JOIN `resource_tags` ON (((`resource_tags`.`resource_id` = `vm_instance`.`id`) - AND (`resource_tags`.`resource_type` = 'UserVm')))) - LEFT JOIN `async_job` ON (((`async_job`.`instance_id` = `vm_instance`.`id`) - AND (`async_job`.`instance_type` = 'VirtualMachine') - AND (`async_job`.`job_status` = 0)))) - LEFT JOIN `affinity_group_vm_map` ON ((`vm_instance`.`id` = `affinity_group_vm_map`.`instance_id`))) - LEFT JOIN `affinity_group` ON ((`affinity_group_vm_map`.`affinity_group_id` = `affinity_group`.`id`))) - LEFT JOIN `user_vm_details` `custom_cpu` ON (((`custom_cpu`.`vm_id` = `vm_instance`.`id`) - AND (`custom_cpu`.`name` = 'CpuNumber')))) - LEFT JOIN `user_vm_details` `custom_speed` ON (((`custom_speed`.`vm_id` = `vm_instance`.`id`) - AND (`custom_speed`.`name` = 'CpuSpeed')))) - LEFT JOIN `user_vm_details` `custom_ram_size` ON (((`custom_ram_size`.`vm_id` = `vm_instance`.`id`) - AND (`custom_ram_size`.`name` = 'memory')))); - --- Add cluster.storage.operations.exclude property -INSERT INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `description`, `default_value`, `updated`, `scope`, `is_dynamic`) VALUES ('Advanced', 'DEFAULT', 'CapacityManager', 'cluster.storage.operations.exclude', 'Exclude cluster from storage operations', 'false', now(), 'Cluster', '1'); - ------ 3) Missing indexes (Add indexes to avoid full table scans) -ALTER TABLE `cloud`.`op_it_work` ADD INDEX `i_type_and_updated` (`type` ASC, `updated_at` ASC); -ALTER TABLE `cloud`.`vm_root_disk_tags` ADD INDEX `i_vm_id` (`vm_id` ASC); -ALTER TABLE `cloud`.`vm_compute_tags` ADD INDEX `i_vm_id` (`vm_id` ASC); -ALTER TABLE `cloud`.`vm_network_map` ADD INDEX `i_vm_id` (`vm_id` ASC); -ALTER TABLE `cloud`.`ssh_keypairs` ADD INDEX `i_public_key` (`public_key` (64) ASC); -ALTER TABLE `cloud`.`user_vm_details` ADD INDEX `i_name_vm_id` (`vm_id` ASC, `name` ASC); -ALTER TABLE `cloud`.`instance_group` ADD INDEX `i_name` (`name` ASC); - ------ 4) Some views query (Change view to improve account retrieval speed) -CREATE OR REPLACE -VIEW `account_vmstats_view` AS - SELECT - `vm_instance`.`account_id` AS `account_id`, - `vm_instance`.`state` AS `state`, - COUNT(0) AS `vmcount` - FROM - `vm_instance` - WHERE - (`vm_instance`.`vm_type` = 'User' and `vm_instance`.`removed` is NULL) - GROUP BY `vm_instance`.`account_id` , `vm_instance`.`state`; --- End CLOUDSTACK-9340 - --- Dynamic roles -CREATE TABLE IF NOT EXISTS `cloud`.`roles` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `uuid` varchar(255) UNIQUE, - `name` varchar(255) COMMENT 'unique name of the dynamic role', - `role_type` varchar(255) NOT NULL COMMENT 'the type of the role', - `removed` datetime COMMENT 'date removed', - `description` text COMMENT 'description of the role', - PRIMARY KEY (`id`), - KEY `i_roles__name` (`name`), - KEY `i_roles__role_type` (`role_type`), - UNIQUE KEY (`name`, `role_type`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `cloud`.`role_permissions` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `uuid` varchar(255) UNIQUE, - `role_id` bigint(20) unsigned NOT NULL COMMENT 'id of the role', - `rule` varchar(255) NOT NULL COMMENT 'rule for the role, api name or wildcard', - `permission` varchar(255) NOT NULL COMMENT 'access authority, allow or deny', - `description` text COMMENT 'description of the rule', - `sort_order` bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT 'permission sort order', - PRIMARY KEY (`id`), - KEY `fk_role_permissions__role_id` (`role_id`), - KEY `i_role_permissions__sort_order` (`sort_order`), - UNIQUE KEY (`role_id`, `rule`), - CONSTRAINT `fk_role_permissions__role_id` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- Default CloudStack roles -INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (1, UUID(), 'Root Admin', 'Admin', 'Default root admin role') ON DUPLICATE KEY UPDATE name=name; -INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (2, UUID(), 'Resource Admin', 'ResourceAdmin', 'Default resource admin role') ON DUPLICATE KEY UPDATE name=name; -INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (3, UUID(), 'Domain Admin', 'DomainAdmin', 'Default domain admin role') ON DUPLICATE KEY UPDATE name=name; -INSERT INTO `cloud`.`roles` (`id`, `uuid`, `name`, `role_type`, `description`) values (4, UUID(), 'User', 'User', 'Default Root Admin role') ON DUPLICATE KEY UPDATE name=name; - --- Out-of-band management -CREATE TABLE IF NOT EXISTS `cloud`.`oobm` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `host_id` bigint(20) unsigned DEFAULT NULL COMMENT 'foreign key to host', - `enabled` int(1) unsigned DEFAULT '0' COMMENT 'is out-of-band management enabled for host', - `power_state` varchar(32) DEFAULT 'Disabled' COMMENT 'out-of-band management power status', - `driver` varchar(32) DEFAULT NULL COMMENT 'out-of-band management driver', - `address` varchar(255) DEFAULT NULL COMMENT 'out-of-band management interface address', - `port` int(10) unsigned DEFAULT NULL COMMENT 'out-of-band management interface port', - `username` varchar(255) DEFAULT NULL COMMENT 'out-of-band management interface username', - `password` varchar(255) DEFAULT NULL COMMENT 'out-of-band management interface password', - `update_count` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'atomic increase count making status update operation atomical', - `update_time` datetime COMMENT 'last power state update datetime', - `mgmt_server_id` bigint(20) unsigned DEFAULT NULL COMMENT 'management server id which owns out-of-band management for the host', - PRIMARY KEY (`id`), - KEY `fk_oobm__host_id` (`host_id`), - KEY `i_oobm__enabled` (`enabled`), - KEY `i_oobm__power_state` (`power_state`), - KEY `i_oobm__update_time` (`update_time`), - KEY `i_oobm__mgmt_server_id` (`mgmt_server_id`), - CONSTRAINT `fk_oobm__host_id` FOREIGN KEY (`host_id`) REFERENCES `host` (`id`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- Out-of-band management -DROP VIEW IF EXISTS `cloud`.`host_view`; -CREATE VIEW `cloud`.`host_view` AS - select - host.id, - host.uuid, - host.name, - host.status, - host.disconnected, - host.type, - host.private_ip_address, - host.version, - host.hypervisor_type, - host.hypervisor_version, - host.capabilities, - host.last_ping, - host.created, - host.removed, - host.resource_state, - host.mgmt_server_id, - host.cpu_sockets, - host.cpus, - host.speed, - host.ram, - cluster.id cluster_id, - cluster.uuid cluster_uuid, - cluster.name cluster_name, - cluster.cluster_type, - data_center.id data_center_id, - data_center.uuid data_center_uuid, - data_center.name data_center_name, - data_center.networktype data_center_type, - host_pod_ref.id pod_id, - host_pod_ref.uuid pod_uuid, - host_pod_ref.name pod_name, - host_tags.tag, - guest_os_category.id guest_os_category_id, - guest_os_category.uuid guest_os_category_uuid, - guest_os_category.name guest_os_category_name, - mem_caps.used_capacity memory_used_capacity, - mem_caps.reserved_capacity memory_reserved_capacity, - cpu_caps.used_capacity cpu_used_capacity, - cpu_caps.reserved_capacity cpu_reserved_capacity, - async_job.id job_id, - async_job.uuid job_uuid, - async_job.job_status job_status, - async_job.account_id job_account_id, - oobm.enabled AS `oobm_enabled`, - oobm.power_state AS `oobm_power_state` - from - `cloud`.`host` - left join - `cloud`.`cluster` ON host.cluster_id = cluster.id - left join - `cloud`.`data_center` ON host.data_center_id = data_center.id - left join - `cloud`.`host_pod_ref` ON host.pod_id = host_pod_ref.id - left join - `cloud`.`host_details` ON host.id = host_details.host_id - and host_details.name = 'guest.os.category.id' - left join - `cloud`.`guest_os_category` ON guest_os_category.id = CONVERT( host_details.value , UNSIGNED) - left join - `cloud`.`host_tags` ON host_tags.host_id = host.id - left join - `cloud`.`op_host_capacity` mem_caps ON host.id = mem_caps.host_id - and mem_caps.capacity_type = 0 - left join - `cloud`.`op_host_capacity` cpu_caps ON host.id = cpu_caps.host_id - and cpu_caps.capacity_type = 1 - left join - `cloud`.`async_job` ON async_job.instance_id = host.id - and async_job.instance_type = 'Host' - and async_job.job_status = 0 - left join - `cloud`.`oobm` ON oobm.host_id = host.id; - -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centosGuest', 171, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centosGuest', 171, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centosGuest', 171, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centosGuest', 171, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centosGuest', 171, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centos64Guest', 172, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centos64Guest', 172, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centos64Guest', 172, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centos64Guest', 172, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 172, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centosGuest', 177, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centosGuest', 177, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centosGuest', 177, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centosGuest', 177, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centosGuest', 177, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centos64Guest', 178, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centos64Guest', 178, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centos64Guest', 178, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centos64Guest', 178, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 178, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centosGuest', 179, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centosGuest', 179, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centosGuest', 179, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centosGuest', 179, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centosGuest', 179, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centos64Guest', 180, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centos64Guest', 180, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centos64Guest', 180, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centos64Guest', 180, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 180, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centosGuest', 181, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centosGuest', 181, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centosGuest', 181, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centosGuest', 181, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centosGuest', 181, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centos64Guest', 182, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centos64Guest', 182, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centos64Guest', 182, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centos64Guest', 182, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 182, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centosGuest', 227, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centosGuest', 227, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centosGuest', 227, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centosGuest', 227, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centosGuest', 227, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.0', 'centos64Guest', 228, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '4.1', 'centos64Guest', 228, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.0', 'centos64Guest', 228, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.1', 'centos64Guest', 228, now(), 0); -INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(), 'VMware', '5.5', 'centos64Guest', 228, now(), 0); diff --git a/engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerTest.java b/engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerTest.java deleted file mode 100644 index 0b210872ff52..000000000000 --- a/engine/schema/src/test/java/com/cloud/upgrade/DatabaseUpgradeCheckerTest.java +++ /dev/null @@ -1,122 +0,0 @@ -// 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. -package com.cloud.upgrade; - -import com.cloud.upgrade.dao.DbUpgrade; -import com.cloud.upgrade.dao.Upgrade452to460; -import com.cloud.upgrade.dao.Upgrade460to461; -import com.cloud.upgrade.dao.Upgrade461to470; -import com.cloud.upgrade.dao.Upgrade470to471; -import com.cloud.upgrade.dao.Upgrade471to480; -import com.cloud.upgrade.dao.Upgrade480to481; -import com.cloud.upgrade.dao.Upgrade490to4910; -import org.apache.cloudstack.utils.CloudStackVersion; -import org.junit.Test; - -import java.util.Arrays; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -public class DatabaseUpgradeCheckerTest { - - @Test - public void testCalculateUpgradePath480to481() { - - final CloudStackVersion dbVersion = CloudStackVersion.parse("4.8.0"); - assertNotNull(dbVersion); - - final CloudStackVersion currentVersion = CloudStackVersion.parse("4.8.1"); - assertNotNull(currentVersion); - - final DatabaseUpgradeChecker checker = new DatabaseUpgradeChecker(); - final DbUpgrade[] upgrades = checker.calculateUpgradePath(dbVersion, currentVersion); - - assertNotNull(upgrades); - assertTrue(upgrades.length >= 1); - assertTrue(upgrades[0] instanceof Upgrade480to481); - - } - - @Test - public void testCalculateUpgradePath490to4910() { - - final CloudStackVersion dbVersion = CloudStackVersion.parse("4.9.0"); - assertNotNull(dbVersion); - - final CloudStackVersion currentVersion = CloudStackVersion.parse("4.9.1.0"); - assertNotNull(currentVersion); - - final DatabaseUpgradeChecker checker = new DatabaseUpgradeChecker(); - final DbUpgrade[] upgrades = checker.calculateUpgradePath(dbVersion, currentVersion); - - assertNotNull(upgrades); - assertTrue(upgrades.length >= 1); - assertTrue(upgrades[0] instanceof Upgrade490to4910); - - assertTrue(Arrays.equals(new String[] { "4.9.0", currentVersion.toString()}, upgrades[0].getUpgradableVersionRange())); - assertEquals(currentVersion.toString(), upgrades[0].getUpgradedVersion()); - - } - - @Test - public void testFindUpgradePath470to481() { - - final CloudStackVersion dbVersion = CloudStackVersion.parse("4.7.0"); - assertNotNull(dbVersion); - - final CloudStackVersion currentVersion = CloudStackVersion.parse("4.8.1"); - assertNotNull(currentVersion); - - final DatabaseUpgradeChecker checker = new DatabaseUpgradeChecker(); - final DbUpgrade[] upgrades = checker.calculateUpgradePath(dbVersion, currentVersion); - - assertNotNull(upgrades); - - assertTrue(upgrades[0] instanceof Upgrade470to471); - assertTrue(upgrades[1] instanceof Upgrade471to480); - assertTrue(upgrades[2] instanceof Upgrade480to481); - - } - - @Test - public void testFindUpgradePath452to490() { - - final CloudStackVersion dbVersion = CloudStackVersion.parse("4.5.2"); - assertNotNull(dbVersion); - - final CloudStackVersion currentVersion = CloudStackVersion.parse("4.9.0"); - assertNotNull(currentVersion); - - final DatabaseUpgradeChecker checker = new DatabaseUpgradeChecker(); - final DbUpgrade[] upgrades = checker.calculateUpgradePath(dbVersion, currentVersion); - - assertNotNull(upgrades); - - assertTrue(upgrades[0] instanceof Upgrade452to460); - assertTrue(upgrades[1] instanceof Upgrade460to461); - assertTrue(upgrades[2] instanceof Upgrade461to470); - assertTrue(upgrades[3] instanceof Upgrade470to471); - assertTrue(upgrades[4] instanceof Upgrade471to480); - assertTrue(upgrades[5] instanceof Upgrade480to481); - - assertTrue(Arrays.equals(new String[] { "4.8.1", currentVersion.toString()}, upgrades[6].getUpgradableVersionRange())); - assertEquals(currentVersion.toString(), upgrades[6].getUpgradedVersion()); - - } -} diff --git a/engine/schema/src/test/resources/db.properties b/engine/schema/src/test/resources/db.properties index 5571ad9cc967..5f0ab68f0992 100644 --- a/engine/schema/src/test/resources/db.properties +++ b/engine/schema/src/test/resources/db.properties @@ -31,6 +31,7 @@ db.root.password= db.cloud.host=localhost db.cloud.port=3306 db.cloud.name=cloud +db.cloud.driver=jdbc:mysql # CloudStack database tuning parameters db.cloud.maxActive=250 diff --git a/pom.xml b/pom.xml index 6c4f828bef9f..ccffdc6181b5 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 4.0.0 - + org.apache apache @@ -56,7 +56,7 @@ 1.10 1.1.1 0.5 - + 4.12 1.3 @@ -122,6 +122,7 @@ 10.1 2.11.0 9.4.8.v20171121 + 5.2.4 9.2.22.v20170606 @@ -636,7 +637,7 @@ true ${project.basedir} **\/*.java - **\/deps\/,**\/test\/,**\/target\/,**\/bin\/,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat,**\/apidoc\/ + **\/deps\/,**\/flyway\/,**\/test\/,**\/target\/,**\/bin\/,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat,**\/apidoc\/ diff --git a/tools/checkstyle/src/main/resources/cloud-suppressions.xml b/tools/checkstyle/src/main/resources/cloud-suppressions.xml new file mode 100644 index 000000000000..e69de29bb2d1