64
79
def service_get_all_by_topic(context, topic):
65
"""Get all compute services for a given topic """
80
"""Get all compute services for a given topic."""
66
81
return IMPL.service_get_all_by_topic(context, topic)
69
84
def service_get_all_compute_sorted(context):
70
"""Get all compute services sorted by instance count
72
Returns a list of (Service, instance_count) tuples
85
"""Get all compute services sorted by instance count.
87
Returns a list of (Service, instance_count) tuples.
74
90
return IMPL.service_get_all_compute_sorted(context)
77
93
def service_get_all_network_sorted(context):
78
"""Get all network services sorted by network count
80
Returns a list of (Service, network_count) tuples
94
"""Get all network services sorted by network count.
96
Returns a list of (Service, network_count) tuples.
82
99
return IMPL.service_get_all_network_sorted(context)
85
102
def service_get_all_volume_sorted(context):
86
"""Get all volume services sorted by volume count
88
Returns a list of (Service, volume_count) tuples
103
"""Get all volume services sorted by volume count.
105
Returns a list of (Service, volume_count) tuples.
90
108
return IMPL.service_get_all_volume_sorted(context)
415
439
def network_get_index(context, network_id):
416
"""Get non-conflicting index for network"""
440
"""Get non-conflicting index for network."""
417
441
return IMPL.network_get_index(context, network_id)
420
444
def network_get_vpn_ip(context, network_id):
421
"""Get non-conflicting index for network"""
445
"""Get non-conflicting index for network."""
422
446
return IMPL.network_get_vpn_ip(context, network_id)
425
449
def network_set_cidr(context, network_id, cidr):
426
"""Set the Classless Inner Domain Routing for the network"""
450
"""Set the Classless Inner Domain Routing for the network."""
427
451
return IMPL.network_set_cidr(context, network_id, cidr)
430
454
def network_set_host(context, network_id, host_id):
431
"""Safely set the host for network"""
455
"""Safely set the host for network."""
432
456
return IMPL.network_set_host(context, network_id, host_id)
475
499
The device is not returned. If the create violates the unique
476
500
constraints because the shelf_id and blade_id already exist,
501
no exception is raised.
504
return IMPL.export_device_create_safe(context, values)
510
def iscsi_target_count_by_host(context, host):
511
"""Return count of export devices."""
512
return IMPL.iscsi_target_count_by_host(context, host)
515
def iscsi_target_create_safe(context, values):
516
"""Create an iscsi_target from the values dictionary.
518
The device is not returned. If the create violates the unique
519
constraints because the iscsi_target and host already exist,
477
520
no exception is raised."""
478
return IMPL.export_device_create_safe(context, values)
521
return IMPL.iscsi_target_create_safe(context, values)
484
527
def auth_destroy_token(context, token):
485
"""Destroy an auth token"""
528
"""Destroy an auth token."""
486
529
return IMPL.auth_destroy_token(context, token)
489
532
def auth_get_token(context, token_hash):
490
"""Retrieves a token given the hash representing it"""
533
"""Retrieves a token given the hash representing it."""
491
534
return IMPL.auth_get_token(context, token_hash)
494
537
def auth_create_token(context, token):
495
"""Creates a new token"""
538
"""Creates a new token."""
496
539
return IMPL.auth_create_token(context, token)
577
625
return IMPL.volume_get_by_ec2_id(context, ec2_id)
628
def volume_get_instance(context, volume_id):
629
"""Get the instance that a volume is attached to."""
630
return IMPL.volume_get_instance(context, volume_id)
580
633
def volume_get_shelf_and_blade(context, volume_id):
581
634
"""Get the shelf and blade allocated to the volume."""
582
635
return IMPL.volume_get_shelf_and_blade(context, volume_id)
638
def volume_get_iscsi_target_num(context, volume_id):
639
"""Get the target num (tid) allocated to the volume."""
640
return IMPL.volume_get_iscsi_target_num(context, volume_id)
585
643
def volume_update(context, volume_id, values):
586
644
"""Set the given properties on an volume and update it.
597
655
def security_group_get_all(context):
598
"""Get all security groups"""
656
"""Get all security groups."""
599
657
return IMPL.security_group_get_all(context)
602
660
def security_group_get(context, security_group_id):
603
"""Get security group by its internal id"""
661
"""Get security group by its internal id."""
604
662
return IMPL.security_group_get(context, security_group_id)
607
665
def security_group_get_by_name(context, project_id, group_name):
608
"""Returns a security group with the specified name from a project"""
666
"""Returns a security group with the specified name from a project."""
609
667
return IMPL.security_group_get_by_name(context, project_id, group_name)
612
670
def security_group_get_by_project(context, project_id):
613
"""Get all security groups belonging to a project"""
671
"""Get all security groups belonging to a project."""
614
672
return IMPL.security_group_get_by_project(context, project_id)
617
675
def security_group_get_by_instance(context, instance_id):
618
"""Get security groups to which the instance is assigned"""
676
"""Get security groups to which the instance is assigned."""
619
677
return IMPL.security_group_get_by_instance(context, instance_id)
622
680
def security_group_exists(context, project_id, group_name):
623
"""Indicates if a group name exists in a project"""
681
"""Indicates if a group name exists in a project."""
624
682
return IMPL.security_group_exists(context, project_id, group_name)
627
685
def security_group_create(context, values):
628
"""Create a new security group"""
686
"""Create a new security group."""
629
687
return IMPL.security_group_create(context, values)
632
690
def security_group_destroy(context, security_group_id):
633
"""Deletes a security group"""
691
"""Deletes a security group."""
634
692
return IMPL.security_group_destroy(context, security_group_id)
637
695
def security_group_destroy_all(context):
638
"""Deletes a security group"""
696
"""Deletes a security group."""
639
697
return IMPL.security_group_destroy_all(context)
645
703
def security_group_rule_create(context, values):
646
"""Create a new security group"""
704
"""Create a new security group."""
647
705
return IMPL.security_group_rule_create(context, values)
650
708
def security_group_rule_get_by_security_group(context, security_group_id):
651
"""Get all rules for a a given security group"""
709
"""Get all rules for a a given security group."""
652
710
return IMPL.security_group_rule_get_by_security_group(context,
653
711
security_group_id)
656
714
def security_group_rule_destroy(context, security_group_rule_id):
657
"""Deletes a security group rule"""
715
"""Deletes a security group rule."""
658
716
return IMPL.security_group_rule_destroy(context, security_group_rule_id)
664
722
def user_get(context, id):
723
"""Get user by id."""
666
724
return IMPL.user_get(context, id)
669
727
def user_get_by_uid(context, uid):
670
"""Get user by uid"""
728
"""Get user by uid."""
671
729
return IMPL.user_get_by_uid(context, uid)
674
732
def user_get_by_access_key(context, access_key):
675
"""Get user by access key"""
733
"""Get user by access key."""
676
734
return IMPL.user_get_by_access_key(context, access_key)
679
737
def user_create(context, values):
680
"""Create a new user"""
738
"""Create a new user."""
681
739
return IMPL.user_create(context, values)
684
742
def user_delete(context, id):
686
744
return IMPL.user_delete(context, id)
689
747
def user_get_all(context):
690
"""Create a new user"""
748
"""Create a new user."""
691
749
return IMPL.user_get_all(context)
694
752
def user_add_role(context, user_id, role):
695
"""Add another global role for user"""
753
"""Add another global role for user."""
696
754
return IMPL.user_add_role(context, user_id, role)
699
757
def user_remove_role(context, user_id, role):
700
"""Remove global role from user"""
758
"""Remove global role from user."""
701
759
return IMPL.user_remove_role(context, user_id, role)
704
762
def user_get_roles(context, user_id):
705
"""Get global roles for user"""
763
"""Get global roles for user."""
706
764
return IMPL.user_get_roles(context, user_id)
709
767
def user_add_project_role(context, user_id, project_id, role):
710
"""Add project role for user"""
768
"""Add project role for user."""
711
769
return IMPL.user_add_project_role(context, user_id, project_id, role)
714
772
def user_remove_project_role(context, user_id, project_id, role):
715
"""Remove project role from user"""
773
"""Remove project role from user."""
716
774
return IMPL.user_remove_project_role(context, user_id, project_id, role)
719
777
def user_get_roles_for_project(context, user_id, project_id):
720
"""Return list of roles a user holds on project"""
778
"""Return list of roles a user holds on project."""
721
779
return IMPL.user_get_roles_for_project(context, user_id, project_id)
724
782
def user_update(context, user_id, values):
726
784
return IMPL.user_update(context, user_id, values)
729
787
def project_get(context, id):
730
"""Get project by id"""
788
"""Get project by id."""
731
789
return IMPL.project_get(context, id)
734
792
def project_create(context, values):
735
"""Create a new project"""
793
"""Create a new project."""
736
794
return IMPL.project_create(context, values)
739
797
def project_add_member(context, project_id, user_id):
740
"""Add user to project"""
798
"""Add user to project."""
741
799
return IMPL.project_add_member(context, project_id, user_id)
744
802
def project_get_all(context):
745
"""Get all projects"""
803
"""Get all projects."""
746
804
return IMPL.project_get_all(context)
749
807
def project_get_by_user(context, user_id):
750
"""Get all projects of which the given user is a member"""
808
"""Get all projects of which the given user is a member."""
751
809
return IMPL.project_get_by_user(context, user_id)
754
812
def project_remove_member(context, project_id, user_id):
755
"""Remove the given user from the given project"""
813
"""Remove the given user from the given project."""
756
814
return IMPL.project_remove_member(context, project_id, user_id)
759
817
def project_update(context, project_id, values):
760
"""Update Remove the given user from the given project"""
818
"""Update Remove the given user from the given project."""
761
819
return IMPL.project_update(context, project_id, values)
764
822
def project_delete(context, project_id):
823
"""Delete project."""
766
824
return IMPL.project_delete(context, project_id)