def test_set_os_type(self, mock_modify_vm, mock_os_types):
        mock_os_types.return_value = ['Other', 'Other_x64']
        vmutils.set_os_type(self._instance, 'fake-os')
        vmutils.set_os_type(self._instance, 'Other_x64')
        calls = [
            mock.call(self._instance, constants.FIELD_OS_TYPE,
                      constants.DEFAULT_OS_TYPE),
            mock.call(self._instance, constants.FIELD_OS_TYPE, 'Other_x64')
        ]

        mock_modify_vm.assert_has_calls(calls)
Beispiel #2
0
    def test_set_os_type(self, mock_modify_vm, mock_os_types):
        mock_os_types.return_value = ['Other', 'Other_x64']
        vmutils.set_os_type(self._instance, 'fake-os')
        vmutils.set_os_type(self._instance, 'Other_x64')
        calls = [
            mock.call(self._instance, constants.FIELD_OS_TYPE,
                      constants.DEFAULT_OS_TYPE),
            mock.call(self._instance, constants.FIELD_OS_TYPE, 'Other_x64')
        ]

        mock_modify_vm.assert_has_calls(calls)
    def create_instance(self, instance, image_meta, network_info,
                        overwrite=True):
        image_properties = image_meta.get("properties", {})
        action = constants.PATH_DELETE if overwrite else None

        basepath = pathutils.instance_basepath(instance, action=action)
        self._vbox_manage.create_vm(
            instance.name, basefolder=os.path.dirname(basepath),
            register=True)

        vmutils.set_os_type(instance, image_properties.get('os_type', None))
        vmutils.set_memory(instance)
        vmutils.set_cpus(instance)
        self._network_setup(instance, network_info)
Beispiel #4
0
    def create_instance(self,
                        instance,
                        image_meta,
                        network_info,
                        overwrite=True):
        image_properties = image_meta.get("properties", {})
        action = constants.PATH_DELETE if overwrite else None

        basepath = pathutils.instance_basepath(instance, action=action)
        self._vbox_manage.create_vm(instance.name,
                                    basefolder=os.path.dirname(basepath),
                                    register=True)

        vmutils.set_os_type(instance, image_properties.get('os_type', None))
        vmutils.set_memory(instance)
        vmutils.set_cpus(instance)
        self._network_setup(instance, network_info)