code: func validateVMForCreation(v *crimson.VM) error {
  	switch {
  	case v == nil:
  		return status.Error(codes.InvalidArgument, "VM specification is required")
  	case v.Name == "":
  		return status.Error(codes.InvalidArgument, "hostname is required and must be non-empty")
  	case v.Vlan != 0:
  		return status.Error(codes.InvalidArgument, "VLAN must not be specified, use IP address instead")
  	case v.Host == "":
  		return status.Error(codes.InvalidArgument, "physical hostname is required and must be non-empty")
  	case v.HostVlan != 0:
  		return status.Error(codes.InvalidArgument, "host VLAN must not be specified, use physical hostname instead")
  	case v.Os == "":
  		return status.Error(codes.InvalidArgument, "operating system is required and must be non-empty")
  	case v.Ipv4 == "":
  		return status.Error(codes.InvalidArgument, "IPv4 address is required and must be non-empty")
  	case v.State == states.State_STATE_UNSPECIFIED:
  		return status.Error(codes.InvalidArgument, "state is required")
  	default:
  		_, err := common.ParseIPv4(v.Ipv4)
  		if err != nil {
  			return status.Errorf(codes.InvalidArgument, "invalid IPv4 address %q", v.Ipv4)
  		}
  		return nil
  	}
  }
docs: // validateVMForCreation validates a VM for creation.