This is a simile! Because it is comparing two things using like or as
Oh my gosh, I love the Harry Potter series. But anyways, the central idea of this paragraph is that Harry should be getting some rest for the ongiong match and Mrs. Weasley will get Harry and the other's supplies.
The author's purpose is to give an example of a disadvantage or unfairness between being colored or being white and make the reader more sympathetic to the circumstance.