Revision 87f1a454
b/src/Ganeti/Network.hs | ||
---|---|---|
7 | 7 |
|
8 | 8 |
{- |
9 | 9 |
|
10 |
Copyright (C) 2011, 2012 Google Inc. |
|
10 |
Copyright (C) 2011, 2012, 2013 Google Inc.
|
|
11 | 11 |
|
12 | 12 |
This program is free software; you can redistribute it and/or modify |
13 | 13 |
it under the terms of the GNU General Public License as published by |
... | ... | |
42 | 42 |
|
43 | 43 |
import Ganeti.Objects |
44 | 44 |
|
45 |
-- | An address pool, holding a network plus internal and external |
|
46 |
-- reservations. |
|
45 | 47 |
data AddressPool = AddressPool { network :: Network, |
46 | 48 |
reservations :: V.Vector Bool, |
47 | 49 |
extReservations :: V.Vector Bool } |
... | ... | |
61 | 63 |
-- | Checks the consistency of the network object. So far, only checks the |
62 | 64 |
-- length of the reservation strings. |
63 | 65 |
networkIsValid :: Network -> Bool |
64 |
networkIsValid n = sameLength (networkReservations n) (networkExtReservations n) |
|
66 |
networkIsValid n = |
|
67 |
sameLength (networkReservations n) (networkExtReservations n) |
|
65 | 68 |
|
66 | 69 |
-- | Checks if two maybe strings are both nothing or of equal length. |
67 | 70 |
sameLength :: Maybe String -> Maybe String -> Bool |
... | ... | |
100 | 103 |
getMap :: AddressPool -> String |
101 | 104 |
getMap = V.toList . V.map mapPixel . allReservations |
102 | 105 |
where mapPixel c = if c then 'X' else '.' |
103 |
|
Also available in: Unified diff