mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
made the upgrade utility work with the current version
This commit is contained in:
parent
d3ecf719ce
commit
093fa851fa
@ -292,8 +292,10 @@
|
|||||||
<copy overwrite="true" todir="${db.scripts.dir}">
|
<copy overwrite="true" todir="${db.scripts.dir}">
|
||||||
<fileset dir="${setup.db.dir}">
|
<fileset dir="${setup.db.dir}">
|
||||||
<include name="**/*"/>
|
<include name="**/*"/>
|
||||||
<exclude name="**/override/*"/>
|
|
||||||
</fileset>
|
</fileset>
|
||||||
|
<filterset>
|
||||||
|
<filter token="VERSION" value="${impl.version}"/>
|
||||||
|
</filterset>
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|||||||
@ -205,7 +205,7 @@
|
|||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<echo message="deploydb ${server-setup.file} ${templates.file} ${DBROOTPW}" />
|
<echo message="deploydb ${server-setup.file} ${templates.file} ${DBROOTPW}" />
|
||||||
<exec dir="${setup.db.dir}" executable="bash">
|
<exec dir="${db.scripts.dir}" executable="bash">
|
||||||
<arg value="deploy-db-dev.sh" />
|
<arg value="deploy-db-dev.sh" />
|
||||||
<arg value="${server-setup.file}" />
|
<arg value="${server-setup.file}" />
|
||||||
<arg value="${templates.file}" />
|
<arg value="${templates.file}" />
|
||||||
|
|||||||
@ -34,7 +34,6 @@ import com.cloud.utils.db.GenericDaoBase;
|
|||||||
import com.cloud.utils.db.GenericSearchBuilder;
|
import com.cloud.utils.db.GenericSearchBuilder;
|
||||||
import com.cloud.utils.db.SearchBuilder;
|
import com.cloud.utils.db.SearchBuilder;
|
||||||
import com.cloud.utils.db.SearchCriteria;
|
import com.cloud.utils.db.SearchCriteria;
|
||||||
import com.cloud.utils.db.SearchCriteria.Func;
|
|
||||||
import com.cloud.utils.db.SearchCriteria.Op;
|
import com.cloud.utils.db.SearchCriteria.Op;
|
||||||
import com.cloud.utils.db.Transaction;
|
import com.cloud.utils.db.Transaction;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
@ -50,7 +49,7 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long> implements V
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
CurrentVersionSearch = createSearchBuilder(String.class);
|
CurrentVersionSearch = createSearchBuilder(String.class);
|
||||||
CurrentVersionSearch.select(null, Func.FIRST, CurrentVersionSearch.entity().getVersion());
|
CurrentVersionSearch.selectField(CurrentVersionSearch.entity().getVersion());
|
||||||
CurrentVersionSearch.and("step", CurrentVersionSearch.entity().getStep(), Op.EQ);
|
CurrentVersionSearch.and("step", CurrentVersionSearch.entity().getStep(), Op.EQ);
|
||||||
CurrentVersionSearch.done();
|
CurrentVersionSearch.done();
|
||||||
|
|
||||||
@ -62,6 +61,7 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long> implements V
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public VersionVO findByVersion(String version, Step step) {
|
public VersionVO findByVersion(String version, Step step) {
|
||||||
SearchCriteria<VersionVO> sc = AllFieldsSearch.create();
|
SearchCriteria<VersionVO> sc = AllFieldsSearch.create();
|
||||||
sc.setParameters("version", version);
|
sc.setParameters("version", version);
|
||||||
@ -70,6 +70,7 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long> implements V
|
|||||||
return findOneBy(sc);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getCurrentVersion() {
|
public String getCurrentVersion() {
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
try {
|
try {
|
||||||
@ -77,12 +78,12 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long> implements V
|
|||||||
|
|
||||||
conn = Transaction.getStandaloneConnection();
|
conn = Transaction.getStandaloneConnection();
|
||||||
|
|
||||||
PreparedStatement pstmt = conn.prepareStatement("SHOW TABLES LIKE 'VERSION'");
|
PreparedStatement pstmt = conn.prepareStatement("SHOW TABLES LIKE 'version'");
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
pstmt.close();
|
pstmt.close();
|
||||||
rs.close();
|
rs.close();
|
||||||
pstmt = conn.prepareStatement("SHOW TABLES LIKE 'NICS'");
|
pstmt = conn.prepareStatement("SHOW TABLES LIKE 'nics'");
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (!rs.next()) {
|
if (!rs.next()) {
|
||||||
pstmt.close();
|
pstmt.close();
|
||||||
@ -108,7 +109,7 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long> implements V
|
|||||||
SearchCriteria<String> sc = CurrentVersionSearch.create();
|
SearchCriteria<String> sc = CurrentVersionSearch.create();
|
||||||
|
|
||||||
sc.setParameters("step", Step.Complete);
|
sc.setParameters("step", Step.Complete);
|
||||||
Filter filter = new Filter(VersionVO.class, "updated", true, 0l, 1l);
|
Filter filter = new Filter(VersionVO.class, "id", true, 0l, 1l);
|
||||||
|
|
||||||
List<String> vers = customSearch(sc, filter);
|
List<String> vers = customSearch(sc, filter);
|
||||||
return vers.get(0);
|
return vers.get(0);
|
||||||
|
|||||||
@ -374,7 +374,7 @@ public class ComponentLocator implements ComponentLocatorMBean {
|
|||||||
if (info.singleton) {
|
if (info.singleton) {
|
||||||
Singleton s = s_singletons.get(info.clazz);
|
Singleton s = s_singletons.get(info.clazz);
|
||||||
if (s.state == Singleton.State.Instantiated) {
|
if (s.state == Singleton.State.Instantiated) {
|
||||||
s_logger.info("Injecting singleton Manager: " + info.name);
|
s_logger.debug("Injecting singleton Manager: " + info.name);
|
||||||
inject(info.clazz, info.instance);
|
inject(info.clazz, info.instance);
|
||||||
s.state = Singleton.State.Injected;
|
s.state = Singleton.State.Injected;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user