

def _save_security_groups(self, context):
    security_groups = (self.security_groups or [])
    for secgroup in security_groups:
        with secgroup.obj_alternate_context(context):
            secgroup.save()
    self.security_groups.obj_reset_changes()

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/objects/instance.py Instance._save_security_groups/original