Description of problem: There are two issues with oo-admin-ctl-district requiring the district name for most subcommands: 1) It's valid to pass a comma-separated list of server identities to a subcommand, but unless all of the servers happen to be in the same district, there's not a valid district name which can be passed. 2) Looking up which district a given server belongs to is an awkward process for an administrator, but it's a single line of code in the script. We should not make admins do this manually. My upcoming PR will allow a district to be specified, but will search for it when it is omitted.
https://github.com/openshift/origin-server/pull/6130
*** Bug 1095934 has been marked as a duplicate of this bug. ***
stage PR https://github.com/openshift/origin-server/pull/6131
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/1f0626caae582f3bd65cd1de6eb34c73c6683a1e Bug 1216191 - oo-admin-ctl-district: look up district by server if not specified
Setup 1, I start 2 openshift virtual machine on Amazon cloud, Both of them with "AMI ID: devenv_5520 (ami-4a667822)" 2, I setup Multinode env with li/build/devenv/setup_multi_node scripts. Finally the multinode env works fine. # oo-broker oo-mco ping ip-10-229-30-112 time=143.75 ms ip-10-229-20-81 time=184.62 ms 3, I create region1 # oo-broker oo-admin-ctl-region -c create -r region1 Successfully created region: region1 {"_id"=>"555aa56097898a1815000001", "name"=>"region1", "description"=>nil, "updated_at"=>2015-05-19 02:52:16 UTC, "created_at"=>2015-05-19 02:52:16 UTC} 4, I create zone1 # oo-broker oo-admin-ctl-region -c add-zone -z zone1 -r region1 Success! {"_id"=>"555aa56097898a1815000001", "created_at"=>2015-05-19 02:52:16 UTC, "description"=>nil, "name"=>"region1", "updated_at"=>2015-05-19 02:52:16 UTC, "zones"=> [{"_id"=>"555aa58fbc44f09be5000001", "name"=>"zone1", "updated_at"=>2015-05-19 02:53:03 UTC, "created_at"=>2015-05-19 02:53:03 UTC}]} 5, I create district d1 # oo-broker oo-admin-ctl-district -c create -n d1 node_profile not specified. Using default: small /opt/rh/ruby193/root/usr/share/gems/gems/uuidtools-2.1.1/lib/uuidtools.rb:431: Use RbConfig instead of obsolete and deprecated Config. Successfully created district: 913ae65cfdd011e48fa00242ac110005 {"_id"=>"555aa2e04dfd4c1fed000001", "uuid"=>"913ae65cfdd011e48fa00242ac110005", "available_uids"=>"<6000 uids hidden>", "name"=>"d1", "platform"=>"linux", "gear_size"=>"small", "available_capacity"=>6000, "max_uid"=>6999, "max_capacity"=>6000, "active_servers_size"=>0, "updated_at"=>2015-05-19 02:41:36 UTC, "created_at"=>2015-05-19 02:41:36 UTC} 6, I create district d2 # oo-broker oo-admin-ctl-district -c create -n d2 node_profile not specified. Using default: small /opt/rh/ruby193/root/usr/share/gems/gems/uuidtools-2.1.1/lib/uuidtools.rb:431: Use RbConfig instead of obsolete and deprecated Config. Successfully created district: 4ac011befdd211e4ba810242ac110012 {"_id"=>"555aa5c41af35da19c000001", "uuid"=>"4ac011befdd211e4ba810242ac110012", "available_uids"=>"<6000 uids hidden>", "name"=>"d2", "platform"=>"linux", "gear_size"=>"small", "available_capacity"=>6000, "max_uid"=>6999, "max_capacity"=>6000, "active_servers_size"=>0, "updated_at"=>2015-05-19 02:53:56 UTC, "created_at"=>2015-05-19 02:53:56 UTC} 7, I add node ip-10-229-20-81 to district d1 # oo-broker oo-admin-ctl-district -c add-node -n d1 -i ip-10-229-20-81 Success for node 'ip-10-229-20-81'! {"_id"=>"555aa2e04dfd4c1fed000001", "active_servers_size"=>1, "available_capacity"=>6000, "available_uids"=>"<6000 uids hidden>", "created_at"=>2015-05-19 02:41:36 UTC, "gear_size"=>"small", "max_capacity"=>6000, "max_uid"=>6999, "name"=>"d1", "platform"=>"linux", "servers"=> [{"_id"=>"555aa32ff04145fd4f000001", "active"=>true, "name"=>"ip-10-229-20-81", "unresponsive"=>false}], "updated_at"=>2015-05-19 02:41:36 UTC, "uuid"=>"913ae65cfdd011e48fa00242ac110005"} 8, I add node ip-10-229-30-112 to district d1 # oo-broker oo-admin-ctl-district -c add-node -n d1 -i ip-10-229-30-112 Success for node 'ip-10-229-30-112'! {"_id"=>"555aa2e04dfd4c1fed000001", "active_servers_size"=>2, "available_capacity"=>6000, "available_uids"=>"<6000 uids hidden>", "created_at"=>2015-05-19 02:41:36 UTC, "gear_size"=>"small", "max_capacity"=>6000, "max_uid"=>6999, "name"=>"d1", "platform"=>"linux", "servers"=> [{"_id"=>"555aa32ff04145fd4f000001", "active"=>true, "name"=>"ip-10-229-20-81", "unresponsive"=>false}, {"_id"=>"555aa35729d0e99d5a000001", "active"=>true, "name"=>"ip-10-229-30-112", "unresponsive"=>false}], "updated_at"=>2015-05-19 02:41:36 UTC, "uuid"=>"913ae65cfdd011e48fa00242ac110005"} Steps: 1, I deactivate node ip-10-229-30-112 without district name # oo-broker oo-admin-ctl-district -c deactivate-node -i ip-10-229-30-112 Success for node 'ip-10-229-30-112'! 2, I remove node ip-10-229-30-112 without district name # oo-broker oo-admin-ctl-district -c remove-node -i ip-10-229-30-112 Success for node 'ip-10-229-30-112'! Results for 2: # oo-broker oo-admin-ctl-district -c list-available -n d1 Nodes in profile: small ip-10-229-30-112 {"_id"=>"555aa2e04dfd4c1fed000001", "active_servers_size"=>1, "available_capacity"=>6000, "available_uids"=>"<6000 uids hidden>", "created_at"=>2015-05-19 02:41:36 UTC, "gear_size"=>"small", "max_capacity"=>6000, "max_uid"=>6999, "name"=>"d1", "platform"=>"linux", "servers"=> [{"_id"=>"555aa32ff04145fd4f000001", "active"=>true, "name"=>"ip-10-229-20-81", "unresponsive"=>false}], "updated_at"=>2015-05-19 02:41:36 UTC, "uuid"=>"913ae65cfdd011e48fa00242ac110005"} 3, I deactive node ip-10-229-20-81 without district name # oo-broker oo-admin-ctl-district -c deactivate-node -i ip-10-229-20-81 Success for node 'ip-10-229-20-81'! Results for 3: # oo-broker oo-admin-ctl-district {"_id"=>"555aa2e04dfd4c1fed000001", "active_servers_size"=>0, "available_capacity"=>6000, "available_uids"=>"<6000 uids hidden>", "created_at"=>2015-05-19 02:41:36 UTC, "gear_size"=>"small", "max_capacity"=>6000, "max_uid"=>6999, "name"=>"d1", "platform"=>"linux", "servers"=> [{"_id"=>"555aa32ff04145fd4f000001", "active"=>false, "name"=>"ip-10-229-20-81", "unresponsive"=>false}], "updated_at"=>2015-05-19 02:41:36 UTC, "uuid"=>"913ae65cfdd011e48fa00242ac110005"} 4, I active node ip-10-229-20-81 without district name # oo-broker oo-admin-ctl-district -c activate-node -i ip-10-229-20-81 Success for node 'ip-10-229-20-81'! Results for 4: # oo-broker oo-admin-ctl-district {"_id"=>"555aa2e04dfd4c1fed000001", "active_servers_size"=>1, "available_capacity"=>6000, "available_uids"=>"<6000 uids hidden>", "created_at"=>2015-05-19 02:41:36 UTC, "gear_size"=>"small", "max_capacity"=>6000, "max_uid"=>6999, "name"=>"d1", "platform"=>"linux", "servers"=> [{"_id"=>"555aa32ff04145fd4f000001", "active"=>true, "name"=>"ip-10-229-20-81", "unresponsive"=>false}], "updated_at"=>2015-05-19 02:41:36 UTC, "uuid"=>"913ae65cfdd011e48fa00242ac110005"} 5, I set node ip-10-229-30-112 region without district name. # oo-broker oo-admin-ctl-district -c set-region -i ip-10-229-30-112 -r region1 -z zone1 Success for node 'ip-10-229-30-112'! Results for 5: # oo-broker oo-admin-ctl-district {"_id"=>"555aa2e04dfd4c1fed000001", "active_servers_size"=>1, "available_capacity"=>6000, "available_uids"=>"<6000 uids hidden>", "created_at"=>2015-05-19 02:41:36 UTC, "gear_size"=>"small", "max_capacity"=>6000, "max_uid"=>6999, "name"=>"d1", "platform"=>"linux", "servers"=> [{"_id"=>"555aa32ff04145fd4f000001", "active"=>true, "name"=>"ip-10-229-20-81", "unresponsive"=>false}], "updated_at"=>2015-05-19 02:41:36 UTC, "uuid"=>"913ae65cfdd011e48fa00242ac110005"} {"_id"=>"555aa5c41af35da19c000001", "active_servers_size"=>1, "available_capacity"=>6000, "available_uids"=>"<6000 uids hidden>", "created_at"=>2015-05-19 02:53:56 UTC, "gear_size"=>"small", "max_capacity"=>6000, "max_uid"=>6999, "name"=>"d2", "platform"=>"linux", "servers"=> [{"_id"=>"555aa8252b8b5c3346000001", "active"=>true, "name"=>"ip-10-229-30-112", "region_id"=>"555aa56097898a1815000001", "region_name"=>"region1", "unresponsive"=>false, "zone_id"=>"555aa58fbc44f09be5000001", "zone_name"=>"zone1"}], "updated_at"=>2015-05-19 02:53:56 UTC, "uuid"=>"4ac011befdd211e4ba810242ac110012"} 6, I unset node 10.229.30.112 region without district name. # oo-broker oo-admin-ctl-district -c unset-region -i ip-10-229-30-112 -r region1 -z zone1 Success for node 'ip-10-229-30-112'! Results for 6: # oo-broker oo-admin-ctl-district {"_id"=>"555aa2e04dfd4c1fed000001", "active_servers_size"=>1, "available_capacity"=>6000, "available_uids"=>"<6000 uids hidden>", "created_at"=>2015-05-19 02:41:36 UTC, "gear_size"=>"small", "max_capacity"=>6000, "max_uid"=>6999, "name"=>"d1", "platform"=>"linux", "servers"=> [{"_id"=>"555aa32ff04145fd4f000001", "active"=>true, "name"=>"ip-10-229-20-81", "unresponsive"=>false}], "updated_at"=>2015-05-19 02:41:36 UTC, "uuid"=>"913ae65cfdd011e48fa00242ac110005"} {"_id"=>"555aa5c41af35da19c000001", "active_servers_size"=>1, "available_capacity"=>6000, "available_uids"=>"<6000 uids hidden>", "created_at"=>2015-05-19 02:53:56 UTC, "gear_size"=>"small", "max_capacity"=>6000, "max_uid"=>6999, "name"=>"d2", "platform"=>"linux", "servers"=> [{"_id"=>"555aa8252b8b5c3346000001", "active"=>true, "name"=>"ip-10-229-30-112", "unresponsive"=>false}], "updated_at"=>2015-05-19 02:53:56 UTC, "uuid"=>"4ac011befdd211e4ba810242ac110012"}
Verified on OpenShift online Steps: 1, Create multinode env. 2, Create district; 3, Add node to this district; 4, Deactivate node without district name; 5, Activate node without district name; 6, Remove node without district name; 7, Set region without district name; 8, Unset region without district name; Result: 4, Deactivate node successful; 5, Activate node successful; 6, Remove node successful; 7, Set region successful; 8, Unset region successful;