def setup_global_RG(principal_id, volume_name, gateway_name_prefix, slice_secret, RG_port, RG_closure, global_hostname="localhost"): """ Create/read an RG that will run on each host, on a particular global hostname. """ client = connect_syndicate() RG_name = syndicate_provisioning.make_gateway_name(gateway_name_prefix, "RG", volume_name, global_hostname) RG_key_password = syndicate_provisioning.make_gateway_private_key_password( RG_name, slice_secret) try: rc = syndicate_provisioning.ensure_RG_exists(client, principal_id, volume_name, RG_name, global_hostname, RG_port, RG_key_password, closure=RG_closure) except Exception, e: logger.exception(e) return False
def setup_global_RG( principal_id, volume_name, gateway_name_prefix, slice_secret, RG_port, RG_closure, global_hostname="localhost" ): """ Create/read an RG that will run on each host, on a particular global hostname. """ client = connect_syndicate() RG_name = syndicate_provisioning.make_gateway_name( gateway_name_prefix, "RG", volume_name, global_hostname ) RG_key_password = syndicate_provisioning.make_gateway_private_key_password( RG_name, slice_secret ) try: rc = syndicate_provisioning.ensure_RG_exists( client, principal_id, volume_name, RG_name, global_hostname, RG_port, RG_key_password, closure=RG_closure ) except Exception, e: logger.exception(e) return False
except Exception, e: logger.exception(e) return False RG_name = syndicate_provisioning.make_gateway_name("OpenCloud", "RG", volume_name, "localhost") RG_key_password = syndicate_provisioning.make_gateway_private_key_password( RG_name, slice_secret) try: rc = syndicate_provisioning.ensure_RG_exists(client, user_email, volume_name, RG_name, "localhost", RG_port, RG_key_password, closure=RG_closure) except Exception, e: logger.exception(e) return False return True #------------------------------- def teardown_volume_access(user_email, volume_name): """ Revoke access to a Volume for a User. * remove the user's Volume Access Right
""" client = connect_syndicate() try: rc = ensure_volume_access_right_exists( user_email, volume_name, caps ) assert rc is True, "Failed to create access right for %s in %s" % (user_email, volume_name) except Exception, e: logger.exception(e) return False RG_name = syndicate_provisioning.make_gateway_name( "OpenCloud", "RG", volume_name, "localhost" ) RG_key_password = syndicate_provisioning.make_gateway_private_key_password( RG_name, slice_secret ) try: rc = syndicate_provisioning.ensure_RG_exists( client, user_email, volume_name, RG_name, "localhost", RG_port, RG_key_password, closure=RG_closure ) except Exception, e: logger.exception(e) return False return True #------------------------------- def teardown_volume_access( user_email, volume_name ): """ Revoke access to a Volume for a User. * remove the user's Volume Access Right * remove the use'rs gateways """ client = connect_syndicate()