~ubuntu-branches/ubuntu/quantal/python-novaclient/quantal

« back to all changes in this revision

Viewing changes to tests/v1_1/fakes.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-07-06 10:27:11 UTC
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20120706102711-0a397czu4bsq5j3v
Tags: upstream-2.6.10
ImportĀ upstreamĀ versionĀ 2.6.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
339
339
            assert set(body[action].keys()) == set(['host',
340
340
                                                    'block_migration',
341
341
                                                    'disk_over_commit'])
 
342
        elif action == 'os-resetState':
 
343
            assert body[action].keys() == ['state']
342
344
        else:
343
345
            raise AssertionError("Unexpected server action: %s" % action)
344
346
        return (resp, _body)
820
822
        result = {'host': 'dummy'}
821
823
        result.update(body)
822
824
        return (200, result)
 
825
 
 
826
    def get_os_hypervisors(self, **kw):
 
827
        return (200, {"hypervisors": [
 
828
                    {'id': 1234, 'hypervisor_hostname': 'hyper1'},
 
829
                    {'id': 5678, 'hypervisor_hostname': 'hyper2'},
 
830
                    ]})
 
831
 
 
832
    def get_os_hypervisors_detail(self, **kw):
 
833
        return (200, {"hypervisors": [
 
834
                    {'id': 1234,
 
835
                     'service': {'id': 1, 'host': 'compute1'},
 
836
                     'vcpus': 4,
 
837
                     'memory_mb': 10 * 1024,
 
838
                     'local_gb': 250,
 
839
                     'vcpus_used': 2,
 
840
                     'memory_mb_used': 5 * 1024,
 
841
                     'local_gb_used': 125,
 
842
                     'hypervisor_type': "xen",
 
843
                     'hypervisor_version': 3,
 
844
                     'hypervisor_hostname': "hyper1",
 
845
                     'free_ram_mb': 5 * 1024,
 
846
                     'free_disk_gb': 125,
 
847
                     'current_workload': 2,
 
848
                     'running_vms': 2,
 
849
                     'cpu_info': 'cpu_info',
 
850
                     'disk_available_least': 100},
 
851
                    {'id': 2,
 
852
                     'service': {'id': 2, 'host': "compute2"},
 
853
                     'vcpus': 4,
 
854
                     'memory_mb': 10 * 1024,
 
855
                     'local_gb': 250,
 
856
                     'vcpus_used': 2,
 
857
                     'memory_mb_used': 5 * 1024,
 
858
                     'local_gb_used': 125,
 
859
                     'hypervisor_type': "xen",
 
860
                     'hypervisor_version': 3,
 
861
                     'hypervisor_hostname': "hyper2",
 
862
                     'free_ram_mb': 5 * 1024,
 
863
                     'free_disk_gb': 125,
 
864
                     'current_workload': 2,
 
865
                     'running_vms': 2,
 
866
                     'cpu_info': 'cpu_info',
 
867
                     'disk_available_least': 100}
 
868
                    ]})
 
869
 
 
870
    def get_os_hypervisors_hyper_search(self, **kw):
 
871
        return (200, {'hypervisors': [
 
872
                    {'id': 1234, 'hypervisor_hostname': 'hyper1'},
 
873
                    {'id': 5678, 'hypervisor_hostname': 'hyper2'}
 
874
                    ]})
 
875
 
 
876
    def get_os_hypervisors_hyper_servers(self, **kw):
 
877
        return (200, {'hypervisors': [
 
878
                    {'id': 1234,
 
879
                     'hypervisor_hostname': 'hyper1',
 
880
                     'servers': [
 
881
                            {'name': 'inst1', 'uuid': 'uuid1'},
 
882
                            {'name': 'inst2', 'uuid': 'uuid2'}
 
883
                            ]},
 
884
                    {'id': 5678,
 
885
                     'hypervisor_hostname': 'hyper2',
 
886
                     'servers': [
 
887
                            {'name': 'inst3', 'uuid': 'uuid3'},
 
888
                            {'name': 'inst4', 'uuid': 'uuid4'}
 
889
                            ]}
 
890
                    ]})
 
891
 
 
892
    def get_os_hypervisors_1234(self, **kw):
 
893
        return (200, {'hypervisor':
 
894
                          {'id': 1234,
 
895
                           'service': {'id': 1, 'host': 'compute1'},
 
896
                           'vcpus': 4,
 
897
                           'memory_mb': 10 * 1024,
 
898
                           'local_gb': 250,
 
899
                           'vcpus_used': 2,
 
900
                           'memory_mb_used': 5 * 1024,
 
901
                           'local_gb_used': 125,
 
902
                           'hypervisor_type': "xen",
 
903
                           'hypervisor_version': 3,
 
904
                           'hypervisor_hostname': "hyper1",
 
905
                           'free_ram_mb': 5 * 1024,
 
906
                           'free_disk_gb': 125,
 
907
                           'current_workload': 2,
 
908
                           'running_vms': 2,
 
909
                           'cpu_info': 'cpu_info',
 
910
                           'disk_available_least': 100}})