コード例 #1
0
ファイル: test_vmwareapi.py プロジェクト: dnguyenutsa/nova
    def test_spawn_with_sparse_image(self):
        # Only a sparse disk image triggers the copy
        self.mox.StubOutWithMock(vmware_images, 'get_vmdk_size_and_properties')
        result = [1024, {"vmware_ostype": "otherGuest",
                         "vmware_adaptertype": "lsiLogic",
                         "vmware_disktype": "sparse"}]
        vmware_images.get_vmdk_size_and_properties(
                mox.IgnoreArg(), mox.IgnoreArg(),
                mox.IgnoreArg()).AndReturn(result)

        # Ensure VMwareVCVMOps's get_copy_virtual_disk_spec is getting called
        # two times
        self.mox.StubOutWithMock(vmops.VMwareVCVMOps,
                                 'get_copy_virtual_disk_spec')
        self.conn._vmops.get_copy_virtual_disk_spec(
                mox.IgnoreArg(), mox.IgnoreArg(),
                mox.IgnoreArg()).AndReturn(None)
        self.conn._vmops.get_copy_virtual_disk_spec(
                mox.IgnoreArg(), mox.IgnoreArg(),
                mox.IgnoreArg()).AndReturn(None)

        self.mox.ReplayAll()
        self._create_vm()
        info = self.conn.get_info({'uuid': 'fake-uuid',
                                   'node': self.instance_node})
        self._check_vm_info(info, power_state.RUNNING)
コード例 #2
0
ファイル: test_vmwareapi.py プロジェクト: aneeshpu/nova
    def test_spawn_with_sparse_image(self):
        # Only a sparse disk image triggers the copy
        self.mox.StubOutWithMock(vmware_images, 'get_vmdk_size_and_properties')
        result = [1024, {"vmware_ostype": "otherGuest",
                         "vmware_adaptertype": "lsiLogic",
                         "vmware_disktype": "sparse"}]
        vmware_images.get_vmdk_size_and_properties(
                mox.IgnoreArg(), mox.IgnoreArg(),
                mox.IgnoreArg()).AndReturn(result)

        # Ensure VMwareVCVMOps's get_copy_virtual_disk_spec is getting called
        # two times
        self.mox.StubOutWithMock(vmops.VMwareVCVMOps,
                                 'get_copy_virtual_disk_spec')
        self.conn._vmops.get_copy_virtual_disk_spec(
                mox.IgnoreArg(), mox.IgnoreArg(),
                mox.IgnoreArg()).AndReturn(None)
        self.conn._vmops.get_copy_virtual_disk_spec(
                mox.IgnoreArg(), mox.IgnoreArg(),
                mox.IgnoreArg()).AndReturn(None)

        self.mox.ReplayAll()
        self._create_vm()
        info = self.conn.get_info({'uuid': 'fake-uuid',
                                   'node': self.instance_node})
        self._check_vm_info(info, power_state.RUNNING)
コード例 #3
0
ファイル: test_vmwareapi.py プロジェクト: dnguyenutsa/nova
 def test_spawn_disk_invalid_disk_size(self):
     self.mox.StubOutWithMock(vmware_images, 'get_vmdk_size_and_properties')
     result = [82 * 1024 * 1024 * 1024,
               {"vmware_ostype": "otherGuest",
                "vmware_adaptertype": "lsiLogic",
                "vmware_disktype": "sparse"}]
     vmware_images.get_vmdk_size_and_properties(
             mox.IgnoreArg(), mox.IgnoreArg(),
             mox.IgnoreArg()).AndReturn(result)
     self.mox.ReplayAll()
     self.assertRaises(exception.InstanceUnacceptable,
                       self._create_vm)
コード例 #4
0
ファイル: test_vmwareapi.py プロジェクト: aneeshpu/nova
 def test_spawn_disk_invalid_disk_size(self):
     self.mox.StubOutWithMock(vmware_images, 'get_vmdk_size_and_properties')
     result = [82 * 1024 * 1024 * 1024,
               {"vmware_ostype": "otherGuest",
                "vmware_adaptertype": "lsiLogic",
                "vmware_disktype": "sparse"}]
     vmware_images.get_vmdk_size_and_properties(
             mox.IgnoreArg(), mox.IgnoreArg(),
             mox.IgnoreArg()).AndReturn(result)
     self.mox.ReplayAll()
     self.assertRaises(exception.InstanceUnacceptable,
                       self._create_vm)
コード例 #5
0
ファイル: test_vmwareapi.py プロジェクト: dnguyenutsa/nova
 def test_spawn_disk_extend_sparse(self):
     self.mox.StubOutWithMock(vmware_images, 'get_vmdk_size_and_properties')
     result = [1024, {"vmware_ostype": "otherGuest",
                      "vmware_adaptertype": "lsiLogic",
                      "vmware_disktype": "sparse"}]
     vmware_images.get_vmdk_size_and_properties(
             mox.IgnoreArg(), mox.IgnoreArg(),
             mox.IgnoreArg()).AndReturn(result)
     self.mox.StubOutWithMock(self.conn._vmops, '_extend_virtual_disk')
     requested_size = 80 * 1024 * 1024
     self.conn._vmops._extend_virtual_disk(mox.IgnoreArg(),
             requested_size, mox.IgnoreArg(), mox.IgnoreArg())
     self.mox.ReplayAll()
     self._create_vm()
     info = self.conn.get_info({'uuid': 'fake-uuid',
                                'node': self.instance_node})
     self._check_vm_info(info, power_state.RUNNING)
コード例 #6
0
ファイル: test_vmwareapi.py プロジェクト: aneeshpu/nova
 def test_spawn_disk_extend_sparse(self):
     self.mox.StubOutWithMock(vmware_images, 'get_vmdk_size_and_properties')
     result = [1024, {"vmware_ostype": "otherGuest",
                      "vmware_adaptertype": "lsiLogic",
                      "vmware_disktype": "sparse"}]
     vmware_images.get_vmdk_size_and_properties(
             mox.IgnoreArg(), mox.IgnoreArg(),
             mox.IgnoreArg()).AndReturn(result)
     self.mox.StubOutWithMock(self.conn._vmops, '_extend_virtual_disk')
     requested_size = 80 * 1024 * 1024
     self.conn._vmops._extend_virtual_disk(mox.IgnoreArg(),
             requested_size, mox.IgnoreArg(), mox.IgnoreArg())
     self.mox.ReplayAll()
     self._create_vm()
     info = self.conn.get_info({'uuid': 'fake-uuid',
                                'node': self.instance_node})
     self._check_vm_info(info, power_state.RUNNING)
コード例 #7
0
ファイル: vmops.py プロジェクト: rajarammallya/openstack-nova
 def _get_image_properties():
     """
     Get the Size of the flat vmdk file that is there on the storage
     repository.
     """
     image_size, image_properties = vmware_images.get_vmdk_size_and_properties(instance.image_ref, instance)
     vmdk_file_size_in_kb = int(image_size) / 1024
     os_type = image_properties.get("vmware_ostype", "otherGuest")
     adapter_type = image_properties.get("vmware_adaptertype", "lsiLogic")
     return vmdk_file_size_in_kb, os_type, adapter_type
コード例 #8
0
ファイル: vmops.py プロジェクト: nicoleLiu/nova
 def _get_image_properties():
     """
     Get the Size of the flat vmdk file that is there on the storage
     repository.
     """
     image_size, image_properties = \
             vmware_images.get_vmdk_size_and_properties(context,
                                instance.image_ref, instance)
     vmdk_file_size_in_kb = int(image_size) / 1024
     os_type = image_properties.get("vmware_ostype", "otherGuest")
     adapter_type = image_properties.get("vmware_adaptertype",
                                         "lsiLogic")
     return vmdk_file_size_in_kb, os_type, adapter_type