self.port = port
self.processor = processor
self.bind((bind_address, port))
- logging.debug("listening on ('%s':%d)" % (bind_address, port))
+ logging.debug("listening on ('%s':%d)", bind_address, port)
# this method is overriding a daemon.AsyncUDPSocket method
def handle_datagram(self, payload_in, ip, port):
# IN_IGNORED event from inotify, because of the file removal (which is
# contextual with the replacement). In such a case we need to create
# another watcher for the "new" file.
- logging.debug("Received 'ignored' inotify event for %s" % event.path)
+ logging.debug("Received 'ignored' inotify event for %s", event.path)
self.watch_handle = None
try:
# going to realod the file after setting up the new watch.
self.callback(False)
except errors.ConfdFatalError, err:
- logging.critical("Critical error, shutting down: %s" % err)
+ logging.critical("Critical error, shutting down: %s", err)
sys.exit(constants.EXIT_FAILURE)
except:
# we need to catch any exception here, log it, but proceed, because even
# usually happen in Ganeti, as the config file is normally replaced by a
# new one, at filesystem level, rather than actually modified (see
# utils.WriteFile)
- logging.debug("Received 'modify' inotify event for %s" % event.path)
+ logging.debug("Received 'modify' inotify event for %s", event.path)
try:
self.callback(True)
except errors.ConfdFatalError, err:
- logging.critical("Critical error, shutting down: %s" % err)
+ logging.critical("Critical error, shutting down: %s", err)
sys.exit(constants.EXIT_FAILURE)
except:
# we need to catch any exception here, log it, but proceed, because even
logging.error("Unexpected exception", exc_info=True)
def process_default(self, event):
- logging.error("Received unhandled inotify event: %s" % event)
+ logging.error("Received unhandled inotify event: %s", event)
class ConfdConfigurationReloader(object):
"""
arch_count, left_count = client.AutoArchiveJobs(age)
- logging.debug("Archived %s jobs, left %s" % (arch_count, left_count))
+ logging.debug("Archived %s jobs, left %s", arch_count, left_count)
def CheckDisks(self, notepad):
"""Check all nodes for restarted ones.
network_link = None
mode = constants.CONFD_REQQ_IP
else:
- logging.debug("Invalid query argument type for: %s" % query)
+ logging.debug("Invalid query argument type for: %s", query)
return QUERY_ARGUMENT_ERROR
pnodes_list = []
for instance_ip in instances_list:
if not isinstance(instance_ip, basestring):
- logging.debug("Invalid IP type for: %s" % instance_ip)
+ logging.debug("Invalid IP type for: %s", instance_ip)
return QUERY_ARGUMENT_ERROR
instance = self.reader.GetInstanceByLinkIp(instance_ip, network_link)
if not instance:
- logging.debug("Unknown instance IP: %s" % instance_ip)
+ logging.debug("Unknown instance IP: %s", instance_ip)
pnodes_list.append(QUERY_UNKNOWN_ENTRY_ERROR)
continue
pnode = self.reader.GetInstancePrimaryNode(instance)
if not pnode:
logging.error("Instance '%s' doesn't have an associated primary"
- " node" % instance)
+ " node", instance)
pnodes_list.append(QUERY_INTERNAL_ERROR)
continue
pnode_primary_ip = self.reader.GetNodePrimaryIp(pnode)
if not pnode_primary_ip:
logging.error("Primary node '%s' doesn't have an associated"
- " primary IP" % pnode)
+ " primary IP", pnode)
pnodes_list.append(QUERY_INTERNAL_ERROR)
continue
pnodes_list.append((constants.CONFD_REPL_STATUS_OK, pnode_primary_ip))
- # If a single ip was requested, return a single answer, otherwise the whole
- # list, with a success status (since each entry has its own success/failure)
+ # If a single ip was requested, return a single answer, otherwise
+ # the whole list, with a success status (since each entry has its
+ # own success/failure)
if mode == constants.CONFD_REQQ_IP:
return pnodes_list[0]
payload_out = self.PackReply(reply, rsalt)
return payload_out
except errors.ConfdRequestError, err:
- logging.info('Ignoring broken query from %s:%d: %s' % (ip, port, err))
+ logging.info('Ignoring broken query from %s:%d: %s', ip, port, err)
return None
def ExtractRequest(self, payload):
"""
current_time = time.time()
- logging.debug("Extracting request with size: %d" % (len(payload)))
+ logging.debug("Extracting request with size: %d", len(payload))
try:
(message, salt) = serializer.LoadSigned(payload, self.hmac_key)
except errors.SignatureError, err:
@return: tuple of reply and salt to add to the signature
"""
- logging.debug("Processing request: %s" % request)
+ logging.debug("Processing request: %s", request)
if request.protocol != constants.CONFD_PROTOCOL_VERSION:
msg = "wrong protocol version %d" % request.protocol
raise errors.ConfdRequestError(msg)
serial=self.reader.GetConfigSerialNo(),
)
- logging.debug("Sending reply: %s" % reply)
+ logging.debug("Sending reply: %s", reply)
return (reply, rsalt)
vnc_arg = '%s:%d' % (vnc_bind_address, display)
else:
logging.error("Network port is not a valid VNC display (%d < %d)."
- " Not starting VNC" %
- (instance.network_port,
- constants.VNC_BASE_PORT))
+ " Not starting VNC", instance.network_port,
+ constants.VNC_BASE_PORT)
vnc_arg = 'none'
# Only allow tls and other option when not binding to a file, for now.
raise errors.HypervisorError("Migration %s at the kvm level" %
status)
else:
- logging.info("KVM: unknown migration status '%s'" % status)
+ logging.info("KVM: unknown migration status '%s'", status)
time.sleep(2)
utils.KillProcess(pid)
if vrfy:
logging.error("Errors after conversion:")
for item in vrfy:
- logging.error(" - %s" % item)
+ logging.error(" - %s", item)
del cfg
logging.info("File loaded successfully")