Revision af5dd836 lib/config.py
b/lib/config.py | ||
---|---|---|
260 | 260 |
nodegroup = self._UnlockedGetNodeGroup(node.group) |
261 | 261 |
return self._UnlockedGetGroupDiskParams(nodegroup) |
262 | 262 |
|
263 |
def _UnlockedGetInstanceDisks(self, instance): |
|
264 |
"""Return the disks' info for the given instance |
|
265 |
|
|
266 |
This function is for internal use, when the config lock is already held. |
|
267 |
|
|
268 |
""" |
|
269 |
return [self._UnlockedGetDiskInfo(disk) for disk in instance.disks] |
|
270 |
|
|
271 |
@locking.ssynchronized(_config_lock, shared=1) |
|
272 |
def GetInstanceDisks(self, instance): |
|
273 |
"""Return the disks' info for the given instance |
|
274 |
|
|
275 |
@type instance: L{objects.Instance} |
|
276 |
@param instance: The instance we want to know the disks for |
|
277 |
|
|
278 |
@rtype: List of L{objects.Disk} |
|
279 |
@return: A list with all the disks' info |
|
280 |
|
|
281 |
""" |
|
282 |
return self._UnlockedGetInstanceDisks(instance) |
|
283 |
|
|
284 |
def _UnlockedGetDiskInfo(self, disk_uuid): |
|
285 |
"""Returns information about an instance. |
|
286 |
|
|
287 |
This function is for internal use, when the config lock is already held. |
|
288 |
|
|
289 |
""" |
|
290 |
if disk_uuid not in self._config_data.disks: |
|
291 |
return None |
|
292 |
|
|
293 |
return self._config_data.disks[disk_uuid] |
|
294 |
|
|
295 |
@locking.ssynchronized(_config_lock, shared=1) |
|
296 |
def GetDiskInfo(self, disk_uuid): |
|
297 |
"""Returns information about a disk. |
|
298 |
|
|
299 |
It takes the information from the configuration file. |
|
300 |
|
|
301 |
@param disk_uuid: UUID of the disk |
|
302 |
|
|
303 |
@rtype: L{objects.Disk} |
|
304 |
@return: the disk object |
|
305 |
|
|
306 |
""" |
|
307 |
return self._UnlockedGetDiskInfo(disk_uuid) |
|
308 |
|
|
263 | 309 |
# pylint: disable=R0201 |
264 | 310 |
def _UnlockedGetInstanceNodes(self, instance, disks=None): |
265 | 311 |
"""Get all disk-releated nodes for an instance. |
Also available in: Unified diff