From: Andy Bavier Date: Wed, 6 Jul 2011 18:18:36 +0000 (-0400) Subject: Merge branch 'master' of ssh://git.planet-lab.org/git/sfa X-Git-Tag: sfa-1.0-27~24^2~1 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=b2d3e37b8c36a60f2449c235e0b4f7d2942e3292;hp=d1618de5ce6d251957494931d62ef19e21edabee;p=sfa.git Merge branch 'master' of ssh://git.planet-lab.org/git/sfa --- diff --git a/sfa/managers/aggregate_manager_eucalyptus.py b/sfa/managers/aggregate_manager_eucalyptus.py index 1b6d1432..c5d2ba34 100644 --- a/sfa/managers/aggregate_manager_eucalyptus.py +++ b/sfa/managers/aggregate_manager_eucalyptus.py @@ -12,13 +12,16 @@ from lxml import etree as ET from sqlobject import * from sfa.util.faults import * -from sfa.util.xrn import urn_to_hrn +from sfa.util.xrn import urn_to_hrn, Xrn from sfa.util.rspec import RSpec from sfa.server.registry import Registries from sfa.trust.credential import Credential from sfa.plc.api import SfaAPI from sfa.util.plxrn import hrn_to_pl_slicename, slicename_to_hrn from sfa.util.callids import Callids +from sfa.util.sfalogging import sfa_logger +from sfa.rspecs.sfa_rspec import sfa_rspec_version +from sfa.util.version import version_core ## # The data structure used to represent a cloud. @@ -404,7 +407,8 @@ def ListResources(api, creds, options, call_id): # get hrn of the original caller origin_hrn = options.get('origin_hrn', None) if not origin_hrn: - origin_hrn = Credential(string=creds[0]).get_gid_caller().get_hrn() + origin_hrn = Credential(string=creds).get_gid_caller().get_hrn() + # origin_hrn = Credential(string=creds[0]).get_gid_caller().get_hrn() conn = getEucaConnection() @@ -505,6 +509,11 @@ def CreateSliver(api, xrn, creds, xml, users, call_id): schemaXML = ET.parse(EUCALYPTUS_RSPEC_SCHEMA) rspecValidator = ET.RelaxNG(schemaXML) rspecXML = ET.XML(xml) + for network in rspecXML.iterfind("./network"): + if network.get('id') != cloud['name']: + # Throw away everything except my own RSpec + # sfa_logger().error("CreateSliver: deleting %s from rspec"%network.get('id')) + network.getparent().remove(network) if not rspecValidator(rspecXML): error = rspecValidator.error_log.last_error message = '%s (line %s)' % (error.message, error.line) @@ -521,7 +530,7 @@ def CreateSliver(api, xrn, creds, xml, users, call_id): pendingRmInst = [] for sliceInst in s.instances: pendingRmInst.append(sliceInst.instance_id) - existingInstGroup = rspecXML.findall('.//euca_instances') + existingInstGroup = rspecXML.findall(".//euca_instances") for instGroup in existingInstGroup: for existingInst in instGroup: if existingInst.get('id') in pendingRmInst: @@ -533,7 +542,7 @@ def CreateSliver(api, xrn, creds, xml, users, call_id): conn.terminate_instances(pendingRmInst) # Process new instance requests - requests = rspecXML.findall('.//request') + requests = rspecXML.findall(".//request") if requests: # Get all the public keys associate with slice. pubKeys = getKeysForSlice(s.slice_hrn) @@ -567,6 +576,19 @@ def CreateSliver(api, xrn, creds, xml, users, call_id): # with enough data for the client to understand what's happened return xml +def GetVersion(api): + xrn=Xrn(api.hrn) + request_rspec_versions = [dict(sfa_rspec_version)] + ad_rspec_versions = [dict(sfa_rspec_version)] + version_more = {'interface':'aggregate', + 'testbed':'myplc', + 'hrn':xrn.get_hrn(), + 'request_rspec_versions': request_rspec_versions, + 'ad_rspec_versions': ad_rspec_versions, + 'default_ad_rspec': dict(sfa_rspec_version) + } + return version_core(version_more) + def main(): init_server() diff --git a/sfa/managers/eucalyptus/eucalyptus.rnc b/sfa/managers/eucalyptus/eucalyptus.rnc index bc61ce3f..670a01e5 100644 --- a/sfa/managers/eucalyptus/eucalyptus.rnc +++ b/sfa/managers/eucalyptus/eucalyptus.rnc @@ -1,5 +1,7 @@ start = RSpec RSpec = element RSpec { + attribute expires { xsd:NMTOKEN }, + attribute generated { xsd:NMTOKEN }, attribute type { xsd:NMTOKEN }, network } diff --git a/sfa/managers/eucalyptus/eucalyptus.rng b/sfa/managers/eucalyptus/eucalyptus.rng index d7a85b49..d8be05eb 100644 --- a/sfa/managers/eucalyptus/eucalyptus.rng +++ b/sfa/managers/eucalyptus/eucalyptus.rng @@ -5,10 +5,18 @@ + + + + + + - + + + diff --git a/sfa/managers/slice_manager_pl.py b/sfa/managers/slice_manager_pl.py index 2cbc823f..7ceecd15 100644 --- a/sfa/managers/slice_manager_pl.py +++ b/sfa/managers/slice_manager_pl.py @@ -128,6 +128,11 @@ def ListResources(api, creds, options, call_id): # unless the caller is the aggregate's SM if caller_hrn == aggregate and aggregate != api.hrn: continue + + # For GENICloud + if aggregate == api.hrn: + continue + # get the rspec from the aggregate server = api.aggregates[aggregate] #threads.run(server.ListResources, credentials, my_opts, call_id)