def __init__(self, proxy_port, admin_port, proxy_iface, admin_iface, vm_port_start, vm_iface, vm_expire_time, backend, use_ssl=False, ssl_cert=None, ssl_key=None): Poller.__init__(self) self.proxy_port = proxy_port self.admin_port = admin_port self.vm_iface = vm_iface self.proxy_iface = proxy_iface; self.admin_iface = admin_iface; if not vm_port_start: # account for falsey things, not just None vm_port_start = None self.vm_port_next = vm_port_start self.vm_expire_time = vm_expire_time self.backend = backend self.orphans = [] self.vms = {} self.ports = {} self.vmotions = {} self.do_ssl = use_ssl self.ssl_cert = ssl_cert self.ssl_key = ssl_key self.task_queue = Queue.Queue() self.task_queue_threads = []
def __init__(self, host, admin_port, vm_name, src, dst, lock_mode): Poller.__init__(self) self.admin_port = admin_port self.host = host self.vm_name = vm_name # needed for the poller to work assert hasattr(src, "fileno") self.command_source = src self.destination = dst self.lock_mode = lock_mode
def __init__(self, proxy_port, admin_port, proxy_iface, admin_iface, vm_port_start, vm_iface, vm_expire_time, backend, use_ssl=False, ssl_cert=None, ssl_key=None): Poller.__init__(self) self.proxy_port = proxy_port self.admin_port = admin_port self.vm_iface = vm_iface self.proxy_iface = proxy_iface self.admin_iface = admin_iface if not vm_port_start: # account for falsey things, not just None vm_port_start = None self.vm_port_next = vm_port_start self.vm_expire_time = vm_expire_time self.backend = backend self.orphans = [] self.vms = {} self.ports = {} self.vmotions = {} self.do_ssl = use_ssl self.ssl_cert = ssl_cert self.ssl_key = ssl_key self.task_queue = Queue.Queue() self.task_queue_threads = [] # raise the open files soft limit up to the hard limit to maximize # the number of open connections this process can have open (_, open_files_limit) = resource.getrlimit(resource.RLIMIT_NOFILE) logging.debug("Setting open files soft limit to %d", open_files_limit) resource.setrlimit(resource.RLIMIT_NOFILE, (open_files_limit, open_files_limit)) # create an internal hard limit we want to stay below; the number of # open files used by this process is more than just the connections # so we build in a bit of buffer self.open_conns_hard_limit = open_files_limit - 64 # set a soft limit above which we'll start collecting orphans before # their expire time (75% of hard limit) self.open_conns_soft_limit = int(self.open_conns_hard_limit * 0.75) logging.debug("Connection limits: soft: %d; hard: %d", self.open_conns_soft_limit, self.open_conns_hard_limit)