stricter zone_id checking
This commit is contained in:
@@ -63,6 +63,19 @@ flags.DEFINE_flag(flags.HelpshortFlag())
|
|||||||
flags.DEFINE_flag(flags.HelpXMLFlag())
|
flags.DEFINE_flag(flags.HelpXMLFlag())
|
||||||
|
|
||||||
|
|
||||||
|
def handle_flash_socket_policy(socket):
|
||||||
|
LOG.info(_("Received connection on flash socket policy port"))
|
||||||
|
|
||||||
|
fd = socket.makefile('rw')
|
||||||
|
expected_command = "<policy-file-request/>"
|
||||||
|
if expected_command in fd.read(len(expected_command) + 1):
|
||||||
|
LOG.info(_("Received valid flash socket policy request"))
|
||||||
|
fd.write('<?xml version="1.0"?><cross-domain-policy><allow-'
|
||||||
|
'access-from domain="*" to-ports="%d" /></cross-'
|
||||||
|
'domain-policy>' % (FLAGS.vncproxy_port))
|
||||||
|
fd.flush()
|
||||||
|
socket.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
utils.default_flagfile()
|
utils.default_flagfile()
|
||||||
FLAGS(sys.argv)
|
FLAGS(sys.argv)
|
||||||
@@ -101,4 +114,6 @@ if __name__ == "__main__":
|
|||||||
host=FLAGS.vncproxy_host,
|
host=FLAGS.vncproxy_host,
|
||||||
port=FLAGS.vncproxy_port)
|
port=FLAGS.vncproxy_port)
|
||||||
server.start()
|
server.start()
|
||||||
|
server.start_tcp(handle_flash_socket_policy, 843, host=FLAGS.vncproxy_host)
|
||||||
|
|
||||||
server.wait()
|
server.wait()
|
||||||
|
|||||||
@@ -178,12 +178,14 @@ class ZoneAwareScheduler(driver.Scheduler):
|
|||||||
to adjust the weights returned from the child zones. Alters
|
to adjust the weights returned from the child zones. Alters
|
||||||
child_results in place.
|
child_results in place.
|
||||||
"""
|
"""
|
||||||
for zone, result in child_results:
|
for zone_id, result in child_results:
|
||||||
if not result:
|
if not result:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
assert isinstance(zone_id, int)
|
||||||
|
|
||||||
for zone_rec in zones:
|
for zone_rec in zones:
|
||||||
if zone_rec['id'] != zone:
|
if zone_rec['id'] != zone_id:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for item in result:
|
for item in result:
|
||||||
@@ -196,7 +198,7 @@ class ZoneAwareScheduler(driver.Scheduler):
|
|||||||
item['raw_weight'] = raw_weight
|
item['raw_weight'] = raw_weight
|
||||||
except KeyError:
|
except KeyError:
|
||||||
LOG.exception(_("Bad child zone scaling values "
|
LOG.exception(_("Bad child zone scaling values "
|
||||||
"for Zone: %(zone)s") % locals())
|
"for Zone: %(zone_id)s") % locals())
|
||||||
|
|
||||||
def schedule_run_instance(self, context, instance_id, request_spec,
|
def schedule_run_instance(self, context, instance_id, request_spec,
|
||||||
*args, **kwargs):
|
*args, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user