def vms(opts={})
headers = {
:accept => "application/xml; detail=disks; detail=nics; detail=hosts"
}
headers.merge!(auth_header)
if opts[:id]
vm = Client::parse_response(RHEVM::client(@api_entrypoint)["/vms/%s" % opts[:id]].get(headers)).root
return [] unless current_datacenter.cluster_ids.include?((vm/'cluster').first[:id])
[ RHEVM::VM::new(self, vm)]
else
Client::parse_response(RHEVM::client(@api_entrypoint)["/vms"].get(headers)).xpath('/vms/vm').collect do |vm|
next unless current_datacenter.cluster_ids.include?((vm/'cluster').first[:id])
RHEVM::VM::new(self, vm)
end.compact
end
end