openEuler 22.03 LTS SP3源码编译部署OpenStack-Caracal遇到的问题解决

news2024/10/18 13:01:36

openEuler 22.03 LTS SP3源码编译部署OpenStack-Caracal遇到的问题解决

  • 问题一 给路由设置外部网关后Status为DOWN(使用的是OVN)
    • 问题描述
    • 临时的解决办法
    • 永久解决办法(修改源代码)
  • 问题二 分离卷一直显示分离中
    • 问题描述
    • 解决办法(不太严谨)

问题一 给路由设置外部网关后Status为DOWN(使用的是OVN)

问题描述

问题如下图
在这里插入图片描述
经过排查后发现是
Logical_Router_Port的gateway_chassis : []为空导致openstack给路由设置外部网关后Status为DOWN
在这里插入图片描述

临时的解决办法

临时的解决办法是手动去添加gateway_chassis
首先通过如下命令查看需要添加的gateway_chassis的_uuid

ovn-nbctl list Logical_Router_Port

在这里插入图片描述再通过如下命令去查看需要添加的chassis值

ovn-sbctl show

在这里插入图片描述
在通过如下的命令去手动的添加即可

ovn-nbctl lrp-set-gateway-chassis _uuid值 Chassis值

在这里插入图片描述

永久解决办法(修改源代码)

只所以会出现这个状况是因为在代码中添加chassis无法匹配到合适的
具体如下
有关代码的路径如下
/usr/local/lib/python3.9/site-packages/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb
代码文件名叫ovn_client.py
未修改源代码如下

def get_candidates_for_scheduling(self, physnet, cms=None,
                                      chassis_physnets=None,
                                      availability_zone_hints=None):
        """Return chassis for scheduling gateway router.

        Criteria for selecting chassis as candidates
        1) Chassis from cms with proper bridge mappings only (that means these
           gateway chassis with the requested physical network).
        2) Filter the available chassis accordingly to the routers
           availability zone hints (if present)

        If the logical router port belongs to a tunnelled network, there won't
        be any candidate.
        """
        # TODO(lucasagomes): Simplify the logic here, the CMS option has
        # been introduced long ago and by now all gateway chassis should
        # include it. This will match the logic in the is_gateway_chassis()
        # (utils.py)
        cms = cms or self._sb_idl.get_gateway_chassis_from_cms_options()
        chassis_physnets = (chassis_physnets or
                            self._sb_idl.get_chassis_and_physnets())
        candidates = set()
        for chassis, physnets in chassis_physnets.items():
            if (physnet and
                    physnet in physnets and
                    chassis in cms):
                candidates.add(chassis)
        candidates = list(candidates)

        # Filter for availability zones
        if availability_zone_hints:
            LOG.debug('Filtering Chassis candidates by availability zone '
                      'hints: %s', ', '.join(availability_zone_hints))
            candidates = [ch for ch in candidates
                          for az in availability_zone_hints
                          if az in utils.get_chassis_availability_zones(
                              self._sb_idl.lookup('Chassis', ch, None))]

        LOG.debug('Chassis candidates for scheduling gateway router ports '
                  'for "%s" physical network: %s', physnet, candidates)
        return candidates

主要的原因是获取到cms列表未空导致无法匹配到合适gateway_chassis将其添加
在这里插入图片描述解决办法有两个

  1. 不需要修改源代码,去添加一个cms标记,让代码那个获取到,但是由于我是第一次遇到这个情况,我不知道要设置什么样的cms标记。所以无法从这方面入手。
  2. 修该源代码去添加一个处理cms列表为空的逻辑
    添加一个处理cms列表为空的逻辑,代码如下:
def get_candidates_for_scheduling(self, physnet, cms=None, chassis_physnets=None, availability_zone_hints=None):
    """Return chassis for scheduling gateway router.

    Criteria for selecting chassis as candidates:
    1) Chassis from cms with proper bridge mappings only (that means these
       gateway chassis with the requested physical network).
    2) Filter the available chassis accordingly to the routers
       availability zone hints (if present)

    If the logical router port belongs to a tunnelled network, there won't
    be any candidate.
    """
    cms = cms or self._sb_idl.get_gateway_chassis_from_cms_options()
    chassis_physnets = chassis_physnets or self._sb_idl.get_chassis_and_physnets()
    candidates = set()

    # If CMS is empty, we may assume all chassis are managed
    managed_chassis = cms if cms else [chassis for chassis in chassis_physnets]

    for chassis in managed_chassis:
        physnets = chassis_physnets.get(chassis, [])
        if physnet in physnets:
            candidates.add(chassis)

    # Convert candidates set to list
    candidates = list(candidates)

    # Filter for availability zones
    if availability_zone_hints:
        LOG.debug('Filtering Chassis candidates by availability zone hints: %s', ', '.join(availability_zone_hints))
        filtered_candidates = []
        for ch in candidates:
            azs = utils.get_chassis_availability_zones(self._sb_idl.lookup('Chassis', ch, None))
            if any(az in azs for az in availability_zone_hints):
                filtered_candidates.append(ch)
        candidates = filtered_candidates

    LOG.debug('Chassis candidates for scheduling gateway router ports for "%s" physical network: %s', physnet, candidates)
    return candidates

修改完成后重启一下neutron服务即可。

问题二 分离卷一直显示分离中

问题描述

创建了一个10G的卷
在这里插入图片描述连接到实例
在这里插入图片描述在这里插入图片描述
进行分离卷
在这里插入图片描述
在这里插入图片描述

解决办法(不太严谨)

根据日志提示

2024-05-27 20:08:29.656 59902 ERROR cinder.volume.api [req-e5dea5da-9565-4e0e-b05b-9dbc58f7deef req-87c34a80-75b3-4bdd-87bf-1136cbb88b96 950f09833b4e4dffaf4acf3ac9f1d4bd 840a040edf78409f92d7c7a128652718 - - default default] Detected user call to delete in-use attachment. Call must come from the nova service and nova must be configured to send the service token. Bug #2004555
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault [req-e5dea5da-9565-4e0e-b05b-9dbc58f7deef req-87c34a80-75b3-4bdd-87bf-1136cbb88b96 950f09833b4e4dffaf4acf3ac9f1d4bd 840a040edf78409f92d7c7a128652718 - - default default] Caught error: <class 'cinder.exception.ConflictNovaUsingAttachment'> Detach volume from instance 4164eba5-b07e-4546-8d41-c4cdc030c396 using the Compute API: cinder.exception.ConflictNovaUsingAttachment: Detach volume from instance 4164eba5-b07e-4546-8d41-c4cdc030c396 using the Compute API
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault Traceback (most recent call last):
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/cinder/api/middleware/fault.py", line 84, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return req.get_response(self.application)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1313, in send
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     status, headers, app_iter = self.call_application(
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1278, in call_application
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     app_iter = application(self.environ, start_response)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 143, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return resp(environ, start_response)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 129, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     resp = self.call_func(req, *args, **kw)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 193, in call_func
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return self.func(req, *args, **kwargs)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/osprofiler/web.py", line 111, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return request.get_response(self.application)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1313, in send
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     status, headers, app_iter = self.call_application(
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1278, in call_application
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     app_iter = application(self.environ, start_response)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 129, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     resp = self.call_func(req, *args, **kw)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 193, in call_func
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return self.func(req, *args, **kwargs)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/keystonemiddleware/auth_token/__init__.py", line 340, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     response = req.get_response(self._app)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1313, in send
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     status, headers, app_iter = self.call_application(
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/request.py", line 1278, in call_application
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     app_iter = application(self.environ, start_response)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 143, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return resp(environ, start_response)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 143, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return resp(environ, start_response)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/routes/middleware.py", line 153, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     response = self.app(environ, start_response)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 143, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return resp(environ, start_response)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 129, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     resp = self.call_func(req, *args, **kw)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/webob/dec.py", line 193, in call_func
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return self.func(req, *args, **kwargs)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/cinder/api/openstack/wsgi.py", line 839, in __call__
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return self._process_stack(request, action, action_args,
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/cinder/api/openstack/wsgi.py", line 900, in _process_stack
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     action_result = self.dispatch(meth, request, action_args)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/cinder/api/openstack/wsgi.py", line 995, in dispatch
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return method(req=request, **action_args)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/cinder/api/openstack/wsgi.py", line 1160, in version_select
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     return func.func(self, *args, **kwargs)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/cinder/api/v3/attachments.py", line 282, in delete
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     attachments = self.volume_api.attachment_delete(context, attachment)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/cinder/volume/api.py", line 2668, in attachment_delete
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     self.attachment_deletion_allowed(ctxt, attachment)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault   File "/usr/local/lib/python3.9/site-packages/cinder/volume/api.py", line 2659, in attachment_deletion_allowed
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault     raise exception.ConflictNovaUsingAttachment(instance_id=server_id)
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault cinder.exception.ConflictNovaUsingAttachment: Detach volume from instance 4164eba5-b07e-4546-8d41-c4cdc030c396 using the Compute API
2024-05-27 20:08:29.656 59902 ERROR cinder.api.middleware.fault

提示我using the Compute API
于是我去设置如下的内容
controller节点

vim /etc/nova/nova.conf
[cinder]
send_service_user_token = True #添加

compute节点

vim /etc/nova/nova.conf
[cinder]
send_service_user_token = True #添加

但是没有解决,还是提示同样的问题
于是去查看源代码
在/usr/local/lib/python3.9/site-packages/cinder/volume/api.py
源代码如下

def attachment_deletion_allowed(self,
                                    ctxt: context.RequestContext,
                                    attachment_or_attachment_id,
                                    volume=None):
        """Check if deleting an attachment is allowed (Bug #2004555)

        Allowed is based on the REST API policy, the status of the attachment,
        where it is used, and who is making the request.

        Deleting an attachment on the Cinder side while leaving the volume
        connected to the nova host results in leftover devices that can lead to
        data leaks/corruption.

        OS-Brick may have code to detect it, but in some cases it is detected
        after it has already been exposed, so it's better to prevent users from
        being able to intentionally triggering the issue.
        """
        # It's ok to delete an attachment if the request comes from a service
        if self.is_service_request(ctxt):
            return

        if not attachment_or_attachment_id and volume:
            if not volume.volume_attachment:
                return
            if len(volume.volume_attachment) == 1:
                attachment_or_attachment_id = volume.volume_attachment[0]

        if isinstance(attachment_or_attachment_id, str):
            try:
                attachment = objects.VolumeAttachment.get_by_id(
                    ctxt, attachment_or_attachment_id)
            except exception.VolumeAttachmentNotFound:
                attachment = None
        else:
            attachment = attachment_or_attachment_id

        if attachment:
            if volume:
                if volume.id != attachment.volume_id:
                    raise exception.InvalidInput(
                        reason='Mismatched volume and attachment')

            server_id = attachment.instance_uuid
            # It's ok to delete if it's not connected to a vm.
            if not server_id or not attachment.connection_info:
                return

            volume = volume or attachment.volume
            nova = compute.API()
            LOG.info('Attachment connected to vm %s, checking data on nova',
                     server_id)
            # If nova is down the client raises 503 and we report that
            try:
                nova_volume = nova.get_server_volume(ctxt, server_id,
                                                     volume.id)
            except nova.NotFound:
                LOG.warning('Instance or volume not found on Nova, deleting '
                            'attachment locally, which may leave leftover '
                            'devices on Nova compute')
                return

            if nova_volume.attachment_id != attachment.id:
                LOG.warning('Mismatch! Nova has different attachment id (%s) '
                            'for the volume, deleting attachment locally. '
                            'May leave leftover devices in a compute node',
                            nova_volume.attachment_id)
                return
        else:
            server_id = ''

        LOG.error('Detected user call to delete in-use attachment. Call must '
                  'come from the nova service and nova must be configured to '
                  'send the service token. Bug #2004555')
        raise exception.ConflictNovaUsingAttachment(instance_id=server_id)

添加一个逻辑处理,通过实例的uuid再一次确认它是否有附加卷

instance_uuid = attachment.instance_uuid
try:
	attachments = objects.VolumeAttachmentList.get_all_by_instance_uuid(ctxt, instance_uuid)
	if attachments:
		LOG.info("Instance {} has other attachments: {}".format(instance_uuid, [att.id for att in attachments]))
	else:
		LOG.info("No other attachments found for instance {}".format(instance_uuid))
		return
except Exception as e:
	LOG.error("Failed to retrieve attachments for instance {}: {}".format(instance_uuid, str(e)))
	raise exception.VolumeBackendAPIException(reason=str(e))

修改后的完整的代码如下

def attachment_deletion_allowed(self,
                                    ctxt: context.RequestContext,
                                    attachment_or_attachment_id,
                                    volume=None):
        """Check if deleting an attachment is allowed (Bug #2004555)

        Allowed is based on the REST API policy, the status of the attachment,
        where it is used, and who is making the request.

        Deleting an attachment on the Cinder side while leaving the volume
        connected to the nova host results in leftover devices that can lead to
        data leaks/corruption.

        OS-Brick may have code to detect it, but in some cases it is detected
        after it has already been exposed, so it's better to prevent users from
        being able to intentionally triggering the issue.
        """
        # It's ok to delete an attachment if the request comes from a service
        if self.is_service_request(ctxt):
            return

        if not attachment_or_attachment_id and volume:
            if not volume.volume_attachment:
                return
            if len(volume.volume_attachment) == 1:
                attachment_or_attachment_id = volume.volume_attachment[0]

        if isinstance(attachment_or_attachment_id, str):
            try:
                attachment = objects.VolumeAttachment.get_by_id(
                    ctxt, attachment_or_attachment_id)
            except exception.VolumeAttachmentNotFound:
                attachment = None
        else:
            attachment = attachment_or_attachment_id

        if attachment:
            if volume:
                if volume.id != attachment.volume_id:
                    raise exception.InvalidInput(
                        reason='Mismatched volume and attachment')

            server_id = attachment.instance_uuid
            # It's ok to delete if it's not connected to a vm.
            if not server_id or not attachment.connection_info:
                return

            volume = volume or attachment.volume
            nova = compute.API()
            LOG.info('Attachment connected to vm %s, checking data on nova',
                     server_id)
            # If nova is down the client raises 503 and we report that
            try:
                nova_volume = nova.get_server_volume(ctxt, server_id,
                                                     volume.id)
            except nova.NotFound:
                LOG.warning('Instance or volume not found on Nova, deleting '
                            'attachment locally, which may leave leftover '
                            'devices on Nova compute')
                return

            if nova_volume.attachment_id != attachment.id:
                LOG.warning('Mismatch! Nova has different attachment id (%s) '
                            'for the volume, deleting attachment locally. '
                            'May leave leftover devices in a compute node',
                            nova_volume.attachment_id)
                return
        else:
            server_id = ''
        instance_uuid = attachment.instance_uuid
        try:
            attachments = objects.VolumeAttachmentList.get_all_by_instance_uuid(ctxt, instance_uuid)
            if attachments:
                LOG.info("Instance {} has other attachments: {}".format(instance_uuid, [att.id for att in attachments]))
            else:
                LOG.info("No other attachments found for instance {}".format(instance_uuid))
                return
        except Exception as e:
            LOG.error("Failed to retrieve attachments for instance {}: {}".format(instance_uuid, str(e)))
            raise exception.VolumeBackendAPIException(reason=str(e))

最终成功解决,但是这个方法不是很严谨

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1703552.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

YOLOv8 Closing dataloader mosaic

在使用YOLOV8训练时&#xff0c;epoch训练到最后10次出现”Closing dataloader mosaic"&#xff0c;又不是报错&#xff0c;但又不往下进行训练&#xff0c;有点懵了&#xff0c;后面经过了解&#xff0c;Yolov8是默认设置close_mosaic10&#xff0c;需要把它修改为0; clo…

js:数组去重

let arr [{name:1},{name:2},{name:2}] let seen {} let new_arr arr.filter(item > {return seen.hasOwnProperty(item.name) ? false : (seen[item.name] true); }); console.log(new_arr,new_arr);

微信小程序仿胖东来轮播和背景效果(有效果图)

效果图 .wxml <view class"swiper-index" style"--width--:{{windowWidth}}px;"><image src"{{swiperList[(cardCur bgIndex -1?swiperList.length - 1:cardCur bgIndex > swiperList.length -1?0:cardCur bgIndex)]}}" clas…

抽屉网关停,Digg类网站退出互联网舞台

关注卢松松&#xff0c;会经常给你分享一些我的经验和观点。 别人我不清楚&#xff0c;至少在松松我心中&#xff1a;抽屉网是世界著名的网站&#xff0c;而近期抽屉新热榜突然宣布关站了&#xff0c;我内心充满遗憾。因为抽屉网站收集的内容&#xff0c;让我看到了更大的世界…

第十二届蓝桥杯物联网试题(国赛)

不得不说国赛相比较省赛而言确实&#xff0c;功能变得更加复杂&#xff0c;更加繁琐&#xff0c;特别是串口LORA通信相结合的更加频繁&#xff0c;且对收取的字符处理要求要更加复杂&#xff0c;处理判别起来会更加复杂。 对于收发数据本身来说&#xff0c;收发的数据本身是以…

源码编译安装LAMP与部署

目录 一、LAMP架构的简述 1.LAMP搭建时各组件安装顺序 二、编译安装Apache httpd服务 1.关闭防火墙&#xff0c;将安装Apache所需软件包传到/opt目录下 2.安装环境依赖包​编辑 3.配置软件模块 4.编译及安装 5.优化配置文件路径&#xff0c;并把httpd服务的可执行程序文…

重学java 47.集合 ② 迭代器

金榜题名&#xff0c;前程似锦 —— 24.5.27 一、迭代器的介绍和使用 1.概述 Iterator接口 2.主要作用 遍历集合 3.获取 Collection中的方法&#xff1a; Iterator<E> iterator() 4.方法 boolean hasNext() —> 判断集合中有没有下一个元素 E.next() —> 获取下一个…

Leetcode 力扣92. 反转链表 II (抖音号:708231408)

给你单链表的头指针 head 和两个整数 left 和 right &#xff0c;其中 left < right 。请你反转从位置 left 到位置 right 的链表节点&#xff0c;返回 反转后的链表 。 示例 1&#xff1a; 输入&#xff1a;head [1,2,3,4,5], left 2, right 4 输出&#xff1a;[1,4,3,2…

dp + 计数,1954D - Colored Balls

一、题目 1、题目描述 2、输入输出 2.1输入 2.2输出 3、原题链接 Problem - 1954D - Codeforces 二、解题报告 1、思路分析 本题前置题目&#xff1a; 1953. 你可以工作的最大周数 通过前置题目可以知道如何计算两两不同数对序列的最大长度 我们记最大数量为ma&#xf…

我的世界开服保姆级教程

前言 Minecraft开服教程 如果你要和朋友联机时&#xff0c;可以选择的方法有这样几种&#xff1a; 局域网联机&#xff1a;优点&#xff1a;简单方便&#xff0c;在MC客户端里自带。缺点&#xff1a;必须在同一局域网内。 有些工具会带有联机功能&#xff1a;优点&#xff1a;一…

剖析【C++】——类与对象(上)超详解——小白篇

目录 1.面向过程和面向对象的初步认识 1.面向过程&#xff08;Procedural Programming&#xff09; 2.面向对象&#xff08;Object-Oriented Programming&#xff09; 概念&#xff1a; 特点&#xff1a; 总结 2.C 类的引入 1.从 C 语言的结构体到 C 的类 2.C 中的结构…

LLaMa系列模型详解(原理介绍、代码解读):LLaMA 2

LLaMA 2 大型语言模型&#xff08;LLMs&#xff09;作为高度能力的人工智能助手&#xff0c;在需要跨多个领域专家知识的复杂推理任务中表现出巨大潜力&#xff0c;包括编程和创意写作等专业领域。它们通过直观的聊天界面与人类互动&#xff0c;这导致了快速和广泛的公众采用。…

分布式事务解决方案(最终一致性【TCC解决方案】)

最终一致性分布式事务概述 强一致性分布式事务解决方案要求参与事务的各个节点的数据时刻保持一致&#xff0c;查询任意节点的数据都能得到最新的数据结果&#xff0c;这就导致在分布式场景&#xff0c;尤其是高并发场景下&#xff0c;系统的性能受到了影响。而最终一致性分布式…

JavaScript表达式语句二

异常处理语句 异常标识一种非中正常得信息&#xff0c;它提示程序在运行过程中发生了意外或错误&#xff0c;然后JavaScript通过一定的方式把它暴露出来&#xff0c;这叫做抛出异常。抛出异常操作表示系统告诉我们当前程序出现了问题&#xff0c;JavaScript使用异常处理语句来…

【python】python商家会员数据分析可视化(源码+数据集+课程报告论文)

&#x1f449;博__主&#x1f448;&#xff1a;米码收割机 &#x1f449;技__能&#x1f448;&#xff1a;C/Python语言 &#x1f449;公众号&#x1f448;&#xff1a;测试开发自动化【获取源码商业合作】 &#x1f449;荣__誉&#x1f448;&#xff1a;阿里云博客专家博主、5…

【CSharp】将ushort数组保存为1通道位深16bit的Tiff图片

【CSharp】将ushort数组保存为1通道位深16bit的Tiff图片 1.背景2.接口 1.背景 System.Drawing.Common 是一个用于图像处理和图形操作的库&#xff0c;它是 System.Drawing 命名空间的一部分。由于 .NET Core 和 .NET 5 的跨平台特性&#xff0c;许多以前内置于 .NET Framework…

【傻呱呱】VirtualHere共享局域网中的USB设备(使用Pavadan老毛子固件搭建篇)

前期准备 SSH工具&#xff08;FinalShell&#xff09;老毛子固件路由器一台 搭建VirtualHere服务端 进入VirtualHere官网下载对应处理器架构的包&#xff0c;我的是RT-N14U-GPIO路由器刷的老毛子固件&#xff0c;这种一般选择最后一个或者倒数第二个包&#xff0c;这里我选择…

企业心声社区,应该如何规划?

企业内部员工社区是一个具有极大价值的平台&#xff0c;不仅为高层管理者提供了直接倾听一线员工心声的渠道&#xff0c;同时也为员工提供了表达建议、参与管理、吐槽发泄的重要途径。 通过这个社区&#xff0c;基层管理者始终处于员工监督之下&#xff0c;迫使他们不能懈怠。…

Qt 5前后调色板差异变化

Qt 5之前&#xff1a; QPalette palette;//调色板 设置背景颜色 palette.setColor(QPalette::Backgound, color...);Qt 5之后&#xff1a; 由原有的 Background 模式 更新为 Window 模式 QPalette palette;//调色板 设置背景颜色 palette.setColor(QPalette::Window, color..…

STM32H743+USBHID+CubeMX配置

一、环境准备 电脑系统&#xff1a;Windows 10 专业版 20H2 IDE&#xff1a;Keil v5.35、STM32CubeMX v6.5.0 测试硬件&#xff1a;正点原子阿波罗STM32H743 二、测试步骤 1、使用用例工程 配置STM32H743定时器功能-CSDN博客https://blog.csdn.net/horse_2007s/article/d…