# Path: mom/Collectors/GuestBalloon.py
# class GuestBalloon(Collector):
#     """
#     This Collector uses hypervisor interface to collect guest balloon info
#     """
#     def getFields(self):
#         return {'balloon_cur', 'balloon_max', 'balloon_min'}
# 
#     def __init__(self, properties):
#         self.hypervisor_iface = properties['hypervisor_iface']
#         self.uuid = properties['uuid']
#         self.logger = logging.getLogger('mom.Collectors.BalloonInfo')
#         self.balloon_info_available = True
# 
#     def stats_error(self, msg):
#         """
#         Only print stats interface errors one time when we first discover a
#         problem.  Otherwise the log will be overrun with noise.
#         """
#         if self.balloon_info_available:
#             self.logger.debug(msg)
#         self.balloon_info_available = False
# 
#     def collect(self):
#         stat = self.hypervisor_iface.getVmBalloonInfo(self.uuid)
#         if stat is None:
#             self.stats_error('getVmBalloonInfo() is not ready')
#         else:
#             self.balloon_info_available = True
# 
#         return stat


from mom.Collectors.GuestBalloon import GuestBalloon


class GuestBalloonOptional(GuestBalloon):
    """
    This Collector gets balloon statistics in the same way GuestBalloon does.
    The only difference is that it reports all the fields as optional and thus
    allows the policy to be evaluated even when the balloon device unavailable.
    """

    def getFields(self):
        return set()

    def getOptionalFields(self):
        return GuestBalloon.getFields(self).union(

# Path: mom/Collectors/GuestBalloon.py
# class GuestBalloon(Collector):
#     """
#     This Collector uses hypervisor interface to collect guest balloon info
#     """
#     def getFields(self):
#         return {'balloon_cur', 'balloon_max', 'balloon_min'}
# 
#     def __init__(self, properties):
#         self.hypervisor_iface = properties['hypervisor_iface']
#         self.uuid = properties['uuid']
#         self.logger = logging.getLogger('mom.Collectors.BalloonInfo')
#         self.balloon_info_available = True
# 
#     def stats_error(self, msg):
#         """
#         Only print stats interface errors one time when we first discover a
#         problem.  Otherwise the log will be overrun with noise.
#         """
#         if self.balloon_info_available:
#             self.logger.debug(msg)
#         self.balloon_info_available = False
# 
#     def collect(self):
#         stat = self.hypervisor_iface.getVmBalloonInfo(self.uuid)
#         if stat is None:
#             self.stats_error('getVmBalloonInfo() is not ready')
#         else:
#             self.balloon_info_available = True
# 
#         return stat


# Path: mom/Collectors/GuestBalloonOptional.py
from mom.Collectors.GuestBalloon import GuestBalloon



class GuestBalloonOptional(GuestBalloon):
    """
    This Collector gets balloon statistics in the same way GuestBalloon does.
    The only difference is that it reports all the fields as optional and thus
    allows the policy to be evaluated even when the balloon device unavailable.
    """

    def getFields(self):
        return set()

    def getOptionalFields(self):
        return GuestBalloon.getFields(self).union(

                GuestBalloon.getOptionalFields(self))