On Thu, Apr 04, 2013 at 04:17:26PM +0000, Abhinandan Prateek wrote:
> I was wondering that during a clean install the template.sql inserts these
> os types in DB and then runs the upgrade from 40 to 410.
> Since I added these os types in 40-410 it throws duplicate key exception.
> 
> I guess to fix this we need to remove this os type from the template
> instead of 40 to 410 upgrade script.
> 
> Rohit, since you restructured the upgrades, can you comment ?

Hmm...  this is an odd situation to have to work through.  

How about using "INSERT IGNORE" in the upgrade script?  That should
work.

> 
> -abhi
> 
> 
> 
> 
> On 04/04/13 7:27 PM, "Chip Childers" <chip.child...@sungard.com> wrote:
> 
> >Abhi,
> >
> >Can you please review?  This is now a blocker.
> >
> >On Thu, Apr 4, 2013 at 9:25 AM, Milamber <milam...@apache.org> wrote:
> >>
> >>
> >> Le 04/04/2013 05:51, aprat...@apache.org a ecrit :
> >>
> >>> Updated Branches:
> >>>    refs/heads/4.1 489010123 ->  f1c7f4022
> >>>
> >>>
> >>> bug CLOUDSTACK-1842: adding the missing os type in upgrade script
> >>>
> >>>
> >>> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
> >>> Commit: 
> >>>http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f1c7f402
> >>> Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f1c7f402
> >>> Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f1c7f402
> >>>
> >>> Branch: refs/heads/4.1
> >>> Commit: f1c7f4022a406098ad23424d381d924f185ba456
> >>> Parents: 4890101
> >>> Author: Abhinandan Prateek<aprat...@apache.org>
> >>> Authored: Thu Apr 4 11:15:59 2013 +0530
> >>> Committer: Abhinandan Prateek<aprat...@apache.org>
> >>> Committed: Thu Apr 4 11:15:59 2013 +0530
> >>>
> >>> ----------------------------------------------------------------------
> >>>   setup/db/db/schema-40to410.sql |    4 ++++
> >>>   1 files changed, 4 insertions(+), 0 deletions(-)
> >>> ----------------------------------------------------------------------
> >>>
> >>>
> >>>
> >>> 
> >>>http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f1c7f402/setup/db
> >>>/db/schema-40to410.sql
> >>> ----------------------------------------------------------------------
> >>> diff --git a/setup/db/db/schema-40to410.sql
> >>> b/setup/db/db/schema-40to410.sql
> >>> index 5fe7127..8c70c6a 100644
> >>> --- a/setup/db/db/schema-40to410.sql
> >>> +++ b/setup/db/db/schema-40to410.sql
> >>> @@ -1685,3 +1685,7 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES
> >>> ('Network', 'DEFAULT', 'manage
> >>>   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 INTO `cloud`.`guest_os` (id, uuid, category_id, display_name)
> >>> VALUES (163, UUID(), 10, 'Ubuntu 12.04 (32-bit)');
> >>> +INSERT INTO `cloud`.`guest_os` (id, uuid, category_id, display_name)
> >>> VALUES (164, UUID(), 10, 'Ubuntu 12.04 (64-bit)');
> >>
> >>
> >> Seems have introduce a bug.
> >>
> >> With a fresh install of CS4.1 on CentOS (6.4), first startp of
> >> cloud-management service doesn't works.
> >>
> >> In catalina.out, a upgrade DB 4.0 to 4.1 are made and:
> >>
> >> ERROR [utils.db.ScriptRunner] (Timer-1:) Error executing: INSERT INTO
> >> `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (163,
> >> UUID(), 10, 'Ubuntu 12.04 (32-bit)')
> >> ERROR [utils.db.ScriptRunner] (Timer-1:)
> >> 
> >>com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationExceptio
> >>n:
> >> Duplicate entry '163' for key 'PRIMARY'
> >> ERROR [cloud.upgrade.DatabaseUpgradeChecker] (Timer-1:) Unable to
> >>execute
> >> upgrade script: 
> >>/usr/share/cloudstack-management/setup/db/schema-40to410.sql
> >> 
> >>com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationExceptio
> >>n:
> >> Duplicate entry '163' for key 'PRIMARY'
> >>         at 
> >>com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:193)
> >>         at 
> >>com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
> >>         at
> >> 
> >>com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker
> >>.java:173)
> >>         at
> >> 
> >>com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.j
> >>ava:233)
> >>         at
> >> 
> >>com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.jav
> >>a:358)
> >>         at
> >> 
> >>com.cloud.utils.component.ComponentContext.initComponentsLifeCycle(Compon
> >>entContext.java:90)
> >>         at
> >> com.cloud.servlet.CloudStartupServlet$1.run(CloudStartupServlet.java:50)
> >>         at java.util.TimerThread.mainLoop(Timer.java:534)
> >>         at java.util.TimerThread.run(Timer.java:484)
> >> ERROR [utils.component.ComponentContext] (Timer-1:) System integrity
> >>check
> >> failed. Refuse to startup
> >>
> >>
> >> Inside the cloud database, guest_os with id 163 and 164 (ubuntu 12.04
> >>32/64)
> >> are already exists.
> >>
> >>
> >> Milamber
> >>
> >>
> >>>
> >>>
> >>
> >>
> 
> 

Reply via email to