Bug 808544 - Migrate-2.0.9 will have to contend with multiple gears per app
Migrate-2.0.9 will have to contend with multiple gears per app
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Pod (Show other bugs)
2.x
Unspecified Unspecified
low Severity low
: ---
: ---
Assigned To: Dan McPherson
libra bugs
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-30 12:36 EDT by Rob Millner
Modified: 2015-05-14 21:49 EDT (History)
2 users (show)

See Also:
Fixed In Version: devenv_1721
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-27 16:46:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Rob Millner 2012-03-30 12:36:19 EDT
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 12:44:21 EDT
I know move is also broken with multiple gears.
Comment 2 Dan McPherson 2012-04-16 02:13:30 EDT
Change is in place for migrate-2.0.10
Comment 3 Johnny Liu 2012-04-17 07:05:22 EDT
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@redhat.com 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@redhat.com
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu@redhat.com' --migrate-gear 'f3b6852be0a845999644667bc9af2a81' --app-name 'racktest'
Migrating app 'myapp' gear 'myapp' with uuid 'fdce01211cb04c1289c6ab1962f765ad' on node 'ip-10-118-62-130' for user: jialiu@redhat.com
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu@redhat.com' --migrate-gear 'fdce01211cb04c1289c6ab1962f765ad' --app-name 'myapp'
Migrating app 'myapp' gear 'db3f446eae' with uuid 'db3f446eaec2416188f985eb2ce054a6' on node 'ip-10-118-62-130' for user: jialiu@redhat.com
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu@redhat.com' --migrate-gear 'db3f446eaec2416188f985eb2ce054a6' --app-name 'myapp'
Migrating app 'pytest' gear 'd110691aa3' with uuid 'd110691aa38d4899b6f0f73bd57e5c55' on node 'ip-10-118-62-130' for user: jialiu@redhat.com
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu@redhat.com' --migrate-gear 'd110691aa38d4899b6f0f73bd57e5c55' --app-name 'pytest'
Migrating app 'pytest' gear 'd78ff4395c' with uuid 'd78ff4395cc24713b36e9813475aac63' on node 'ip-10-118-62-130' for user: jialiu@redhat.com
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu@redhat.com' --migrate-gear 'd78ff4395cc24713b36e9813475aac63' --app-name 'pytest'
Migrating app 'pytest' gear 'pytest' with uuid '6eb29d43851a477fa4eaadf065bd85ff' on node 'ip-10-118-62-130' for user: jialiu@redhat.com
Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu@redhat.com' --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.