The Maximum number of domains is 4.
The M5000 has 2 System Boards, can take 4 CPU trays, 8 RAM trays, 2 IOboats, 4 HDD, 1 CDROM, and am optional tape drive.
Most of the answers confuse system boards (SB) with CPU trays. The M5000 comes with 2 SBs in the case at purchase, each SB has slots for 2 CPU trays (with 2 cpu each) and 4 RAM trays.
With both system boards in UNI-Board config you have a maximum of 2 domains. However if a SB is fully populated with CPU trays (ie 2), then the SB can be put in X-board config. Meaning each of the 4 CPUs get associated with one of the 4 RAM trays and each CPU can be assigned to a domain. Note that a domain also requires RAM, so you cannot create a domain with only CPUs and no RAM trays.
So with only 1 fully populated SB (aka 2 CPU trays + 4 RAM trays) you can create 4 domains with 1 CPU (half a CPU tray) and 1 RAM tray each.
Hard drives and PCIe/PCIX slots can all be individually assigned to different domains.
ps. If you can, use same size ram trays. You cannot just mix say 2x16GB trays and 2x32GB trays, all trays need to be opened and DIMMs relocated