Bug 808544 - Migrate-2.0.9 will have to contend with multiple gears per app
Summary: Migrate-2.0.9 will have to contend with multiple gears per app
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Pod
Version: 2.x
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: ---
Assignee: Dan McPherson
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-03-30 16:36 UTC by Rob Millner
Modified: 2015-05-15 01:49 UTC (History)
2 users (show)

Fixed In Version: devenv_1721
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-04-27 20:46:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Rob Millner 2012-03-30 16:36:19 UTC
I ran across this doing the gear size change in sprint 2.0.7 and gear name change in 2.0.8.  We'll likely have scalable apps on prod for the next migration.

The method of app.gear provides access to the first gear object of an application which should be fine for non-scalable apps.  The following will work on both non-scalable and scalable apps.


Access all the gears for an app:

users = CloudUser.find_all(nil)
users.each do |user|
  user.applications.each do |app| 
    app.group_instances.each do |gi|
      gi.gears.each do |gear|
        # Do something with gear
      end
    end
  end
end



An example for the migrate-mongo script:

users = $coll.find()
users.each do |user|
  user["apps"].each do |app|
    app["group_instances"].each do |gi|
      gi['gears'].each do |gear|
        # Do something with gear
      end
    end
  end
end

Comment 1 Dan McPherson 2012-03-30 16:44:21 UTC
I know move is also broken with multiple gears.

Comment 2 Dan McPherson 2012-04-16 06:13:30 UTC
Change is in place for migrate-2.0.10

Comment 3 Johnny Liu 2012-04-17 11:05:22 UTC
Verified this bug with migrate-2.0.10, and PASS.

# ./misc/maintenance/bin/migrate-2.0.10 
Getting all RHLogins...
RHLogins.length: 1
Gathering gears for user: jialiu with uuid: 677aecc95a5842b3be4bdbe1d908e7a7
#####################################################
Gear Counts Per Thread:
[6]
#####################################################
Writing 6 gears for node ip-10-118-62-130 to file /tmp/rhc/migration/migrate_ip-10-118-62-130
Migrating gears on node ip-10-118-62-130

Migrating app 'racktest' gear 'racktest' with uuid 'f3b6852be0a845999644667bc9af2a81' on node 'ip-10-118-62-130' for user: jialiu
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear 'f3b6852be0a845999644667bc9af2a81' --app-name 'racktest'
Migrating app 'myapp' gear 'myapp' with uuid 'fdce01211cb04c1289c6ab1962f765ad' on node 'ip-10-118-62-130' for user: jialiu
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear 'fdce01211cb04c1289c6ab1962f765ad' --app-name 'myapp'
Migrating app 'myapp' gear 'db3f446eae' with uuid 'db3f446eaec2416188f985eb2ce054a6' on node 'ip-10-118-62-130' for user: jialiu
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear 'db3f446eaec2416188f985eb2ce054a6' --app-name 'myapp'
Migrating app 'pytest' gear 'd110691aa3' with uuid 'd110691aa38d4899b6f0f73bd57e5c55' on node 'ip-10-118-62-130' for user: jialiu
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear 'd110691aa38d4899b6f0f73bd57e5c55' --app-name 'pytest'
Migrating app 'pytest' gear 'd78ff4395c' with uuid 'd78ff4395cc24713b36e9813475aac63' on node 'ip-10-118-62-130' for user: jialiu
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear 'd78ff4395cc24713b36e9813475aac63' --app-name 'pytest'
Migrating app 'pytest' gear 'pytest' with uuid '6eb29d43851a477fa4eaadf065bd85ff' on node 'ip-10-118-62-130' for user: jialiu
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear '6eb29d43851a477fa4eaadf065bd85ff' --app-name 'pytest'
#####################################################
Summary:
# of users: 1
# of gears: 6
# of failures: 0
Gear counts per thread: [6]
Total execution time: 34s
#####################################################


Note You need to log in before you can comment on or make changes to this bug.