Revision 1835fd75

b/src/Ganeti/Locking/Locks.hs
63 63
                 | Node String
64 64
                 | NodeResLockSet
65 65
                 | NodeRes String
66
                 | NetworkLockSet
67
                 | Network String
66 68
                 deriving (Ord, Eq, Show)
67 69

  
68 70
-- | Provide the String representation of a lock
......
79 81
lockName (Node uuid) = "node/" ++ uuid
80 82
lockName NodeResLockSet = "node-res/[lockset]"
81 83
lockName (NodeRes uuid) = "node-res/" ++ uuid
84
lockName NetworkLockSet = "network/[lockset]"
85
lockName (Network uuid) = "network/" ++ uuid
82 86

  
83 87
-- | Obtain a lock from its name.
84 88
lockFromName :: String -> J.Result GanetiLocks
......
94 98
lockFromName (stripPrefix "node-res/" -> Just uuid) = return $ NodeRes uuid
95 99
lockFromName "node/[lockset]" = return NodeLockSet
96 100
lockFromName (stripPrefix "node/" -> Just uuid) = return $ Node uuid
101
lockFromName "network/[lockset]" = return NetworkLockSet
102
lockFromName (stripPrefix "network/" -> Just uuid) = return $ Network uuid
97 103
lockFromName n = fail $ "Unknown lock name '" ++ n ++ "'"
98 104

  
99 105
instance J.JSON GanetiLocks where
......
108 114
  lockImplications NAL = [NodeAllocLockSet, BGL]
109 115
  lockImplications (NodeRes _) = [NodeResLockSet, BGL]
110 116
  lockImplications (Node _) = [NodeLockSet, BGL]
117
  lockImplications (Network _) = [NetworkLockSet, BGL]
111 118
  lockImplications _ = [BGL]
112 119

  
113 120
-- | The type of lock Allocations in Ganeti. In Ganeti, the owner of
b/test/hs/Test/Ganeti/Locking/Locks.hs
52 52
                    , NodeRes <$> genUUID
53 53
                    , return NodeLockSet
54 54
                    , Node <$> genUUID
55
                    , return NetworkLockSet
56
                    , Network <$> genUUID
55 57
                    ]
56 58

  
57 59
-- | Verify that readJSON . showJSON = Ok

Also available in: Unified diff