# File lib/openshift-origin-controller/app/models/group_instance.rb, line 44
  def merge_inst(ginst)
    reused = [self.name, self.cart_name, self.profile_name, self.group_name]
    self.reused_by << reused
    self.name = ginst.name
    self.cart_name = ginst.cart_name
    self.profile_name = ginst.profile_name
    self.group_name = ginst.group_name
    ginst.component_instances.each { |ci_name|
      cinst = self.app.comp_instance_map[ci_name]
      next if cinst.nil?
      cur_ginst = self.app.group_instance_map[cinst.group_instance_name]
      self.app.group_instance_map[cinst.group_instance_name] = self if ginst==cur_ginst
    }
    self.component_instances = (self.component_instances + ginst.component_instances).uniq unless ginst.component_instances.nil?
    if not ginst.gears.nil? and ginst.gears.length > 0
      self.gears = [] if self.gears.nil?
      @gears += ginst.gears
      if self.gears.length == 0
        self.uuid = ginst.uuid
      else
        # Since two gear groups are being merged and the structure is being changed,
        # we cannot re-use the uuid from either of the two gear groups
        # Also, how do we merge two group instances that have gears in them
        # without deleting the gears that exist in them
      end
    end
    self.supported_min, self.supported_max = GroupInstance::merge_min_max(self.supported_min, self.supported_max, ginst.supported_min, ginst.supported_max)
    self.min, self.max = GroupInstance::merge_min_max(self.min, self.max, ginst.min, ginst.max)
  end