def _get_fingerprint(self, obj_class): fields = obj_class.fields.items() fields.sort() methods = [] for name in dir(obj_class): thing = getattr(obj_class, name) if inspect.ismethod(thing) and hasattr(thing, "remotable"): methods.append((name, inspect.getargspec(thing.original_fn))) methods.sort() # NOTE(danms): Things that need a version bump are any fields # and their types, or the signatures of any remotable methods. # Of course, these are just the mechanical changes we can detect, # but many other things may require a version bump (method behavior # and return value changes, for example). relevant_data = (fields, methods) return "%s-%s" % (obj_class.VERSION, hashlib.md5(str(relevant_data)).hexdigest())
def _get_fingerprint(self, obj_class): fields = obj_class.fields.items() fields.sort() methods = [] for name in dir(obj_class): thing = getattr(obj_class, name) if inspect.ismethod(thing) and hasattr(thing, 'remotable'): methods.append((name, inspect.getargspec(thing.original_fn))) methods.sort() # NOTE(danms): Things that need a version bump are any fields # and their types, or the signatures of any remotable methods. # Of course, these are just the mechanical changes we can detect, # but many other things may require a version bump (method behavior # and return value changes, for example). relevant_data = (fields, methods) return '%s-%s' % (obj_class.VERSION, hashlib.md5( str(relevant_data)).hexdigest())
def _get_fingerprint(self, obj_name): obj_class = base.NovaObject._obj_classes[obj_name][0] fields = obj_class.fields.items() fields.sort() methods = [] for name in dir(obj_class): thing = getattr(obj_class, name) if inspect.ismethod(thing) or isinstance(thing, classmethod): method = self._find_remotable_method(obj_class, thing) if method: methods.append((name, inspect.getargspec(method))) methods.sort() # NOTE(danms): Things that need a version bump are any fields # and their types, or the signatures of any remotable methods. # Of course, these are just the mechanical changes we can detect, # but many other things may require a version bump (method behavior # and return value changes, for example). if hasattr(obj_class, "child_versions"): relevant_data = (fields, methods, obj_class.child_versions) else: relevant_data = (fields, methods) fingerprint = "%s-%s" % (obj_class.VERSION, hashlib.md5(str(relevant_data)).hexdigest()) return fingerprint
def _get_fingerprint(self, obj_name): obj_class = base.NovaObject._obj_classes[obj_name][0] fields = obj_class.fields.items() fields.sort() methods = [] for name in dir(obj_class): thing = getattr(obj_class, name) if inspect.ismethod(thing) or isinstance(thing, classmethod): method = self._find_remotable_method(obj_class, thing) if method: methods.append((name, inspect.getargspec(method))) methods.sort() # NOTE(danms): Things that need a version bump are any fields # and their types, or the signatures of any remotable methods. # Of course, these are just the mechanical changes we can detect, # but many other things may require a version bump (method behavior # and return value changes, for example). if hasattr(obj_class, 'child_versions'): relevant_data = (fields, methods, obj_class.child_versions) else: relevant_data = (fields, methods) fingerprint = '%s-%s' % (obj_class.VERSION, hashlib.md5(str(relevant_data)).hexdigest()) return fingerprint