```ruby
require 'stacks/namespace'

class Stacks::LoadBalancer < Stacks::MachineDef

  attr_accessor :virtual_router_id

  def initialize(server_group, index, &block)
    super(server_group.name + "-" + index)
  end

  def bind_to(environment)
    super(environment)
    @virtual_router_id = environment.options[:lb_virtual_router_id] || 1
  end

  def virtual_services(type)
    virtual_services = []
    environment.accept do |node|
      unless node.environment.contains_node_of_type?(Stacks::LoadBalancer) && environment != node.environment
        virtual_services << node if node.kind_of? type
      end
    end
    virtual_services
  end

  def to_enc
    virtual_services_array = virtual_services(Stacks::AbstractVirtualService).map do |virtual_service|
        virtual_service.to_loadbalancer_config
    end
    {
      'role::loadbalancer'=> {
        'virtual_router_id' => self.virtual_router_id,
        'virtual_servers' => Hash[virtual_services_array]
      }
    }
  end
end
```

Move virtual_service function to lb cluster, switch to using virtual_services instead of server group
user
```ruby
require 'stacks/namespace'

class Stacks::LoadBalancer < Stacks::MachineDef

  attr_accessor :virtual_router_id

  def initialize(virtual_service, index, &block)
    @virtual_service = virtual_service
    super(virtual_service.name + "-" + index)
  end

  def bind_to(environment)
    super(environment)
    @virtual_router_id = environment.options[:lb_virtual_router_id] || 1
  end

 def to_enc
    virtual_services_array = @virtual_service.virtual_services(Stacks::AbstractVirtualService).map do |virtual_service|
        virtual_service.to_loadbalancer_config
    end
    {
      'role::loadbalancer'=> {
        'virtual_router_id' => self.virtual_router_id,
        'virtual_servers' => Hash[virtual_services_array]
      }
    }
  end
end
```
assistant