From 35bff1608557c2f52c3c346e4107d299bd9b2cff Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 8 Oct 2026 13:21:44 +0800 Subject: [PATCH] Enforce automatic single-subnet VPCs --- docs/VALIDATION.md | 45 +++ web/app/Controllers/CloudVpcController.php | 14 - web/app/Services/Cloud/CloudVpcService.php | 341 +++++++++++------- web/config/routes_cloud.php | 3 - web/public/cloud/vpc.css | 2 +- web/public/cloud/vpc.js | 60 +-- .../views/venix/cloud/pages/vpcs.tpl | 9 +- web/resources/views/venix/layout_assets.tpl | 2 +- .../CloudVpcControlPlaneContractTest.php | 35 +- web/tests/CloudVpcCreatePolicyTest.php | 3 + web/tests/CloudVpcMemberReuseTest.php | 251 ++++++++++--- web/tests/CloudVpcUserPageContractTest.php | 42 ++- 12 files changed, 537 insertions(+), 270 deletions(-) diff --git a/docs/VALIDATION.md b/docs/VALIDATION.md index f7041d5c..a488d683 100644 --- a/docs/VALIDATION.md +++ b/docs/VALIDATION.md @@ -1,5 +1,50 @@ # 本版验证记录 +## 2026-10-08:租户单自动子网与创建页简化 + +- 租户创建页只保留 VPC 名称和地区;CIDR、前缀、唯一子网、成员容量与成员私网 IP + 均由平台管理。详情页不再显示子网管理卡片,成员加入也不再选择子网或手填地址;共享 + 前端资产版本已提升,避免部署后继续使用旧表单缓存。 +- 删除租户 `POST/DELETE /vpcs/{vpc_key}/subnets...` 路由、Controller 入口和 Service + mutator。新成员加入意图严格只有 `instance_id` 与 `request_key`,先锁 VPC 根及其全部 + 子网,确认恰好一个非删除、非清理中的有效子网,再从成员租约与 route `/32` 保留地址 + 之后自动选择最低可用 IP。仅为滚动升级重放已存在的同 key operation 才读取旧版 + `subnet_key/private_ip`;这些字段不能创建新成员,新请求携带时返回 422,且不产生 + member、lease、operation 或 revision 副作用。 +- 自动子网缺失或正在清理时返回 409;历史数据若存在多个活动子网或无效子网账本则 + fail-closed 为 503,不静默选择任一行。数据库表、引擎多子网 DTO 读取能力、根删除和 + 历史 `subnet_remove` tombstone 收敛逻辑继续保留;本轮没有增加会阻断历史升级的 + `UNIQUE(vpc_id)`,也没有自动合并或删除历史数据。 +- 成员加入继续把服务端选出的 `subnet_key` 与 `private_ip=null` 写入旧版 request hash, + 保持旧自动分配请求可重放。重放检查先于当前子网和实例状态,并从不可变 operation + payload 验证旧自动分配或旧显式 IP hash;因此丢失响应后,即使子网随后进入清理,刷新 + 到新版页面可用原 `request_key + instance_id` 安全读取结果,未刷新的旧页面也只能在 + `subnet_key/private_ip` 与原 hash 精确一致时重放,参数变化返回 409。 +- PHP 8.5/WASM + SQLite 下 `CloudVpcCreatePolicyTest`、 + `CloudVpcMemberReuseTest`、`CloudPrivateCidrAllocatorTest`、 + `CloudVpcRootDeletionTest` 和 `CloudVpcTombstoneConvergenceTest` 通过;源码契约 + `CloudVpcControlPlaneContractTest`、`CloudVpcUserPageContractTest`、 + `VirtualizationConfigTest`、272 条路由目标、105 个 Smarty/email 模板、52 个前端资产 + 模块及 schema 契约通过。修改 PHP 语法、`vpc.js` Node 语法和 + `git diff --check` 通过。 +- SQLite 不实现 MariaDB 的 `SELECT ... FOR UPDATE` 竞争语义,当前也未连接真实 + MariaDB、PHP-FPM、浏览器或宿主机。上线前先只读审计所有非删除 VPC;下列查询必须 + 没有结果,再在隔离 MariaDB 中并发加入同一 VPC、并发重放同一 key,并确认只有一个 + member、lease 和 operation: + +```sql +SELECT v.id, v.vpc_key, + SUM(CASE WHEN s.state IN ('applying', 'active', 'degraded', 'uncertain') + THEN 1 ELSE 0 END) AS live_subnets, + SUM(CASE WHEN s.state = 'deleting' THEN 1 ELSE 0 END) AS deleting_subnets +FROM cloud_vpcs AS v +LEFT JOIN cloud_vpc_subnets AS s + ON s.vpc_id = v.id AND s.state <> 'deleted' +WHERE v.state <> 'deleted' +GROUP BY v.id, v.vpc_key +HAVING live_subnets <> 1 OR deleting_subnets <> 0; +``` + ## 2026-10-08:租户 VPC 创建策略、账户配额与幂等加固 - 租户创建 API 现在只接收 `name`、`region_id` 和 `request_key`;CIDR、前缀、首个 diff --git a/web/app/Controllers/CloudVpcController.php b/web/app/Controllers/CloudVpcController.php index 84282216..c884fb23 100644 --- a/web/app/Controllers/CloudVpcController.php +++ b/web/app/Controllers/CloudVpcController.php @@ -45,20 +45,6 @@ final class CloudVpcController return $this->json($response, $value, 202); } - public function addSubnet($request, $response, $args) - { - $value = CloudVpcService::addSubnet((string) $args['vpc_key'], - $this->actor($request), CloudInput::object($request)); - return $this->json($response, $value, 202); - } - - public function removeSubnet($request, $response, $args) - { - $value = CloudVpcService::removeSubnet((string) $args['vpc_key'], - (string) $args['subnet_key'], $this->actor($request), CloudInput::object($request)); - return $this->json($response, $value, 202); - } - public function attachMember($request, $response, $args) { $value = CloudVpcService::attachMember((string) $args['vpc_key'], diff --git a/web/app/Services/Cloud/CloudVpcService.php b/web/app/Services/Cloud/CloudVpcService.php index ad89ac2c..32c484fc 100644 --- a/web/app/Services/Cloud/CloudVpcService.php +++ b/web/app/Services/Cloud/CloudVpcService.php @@ -31,7 +31,6 @@ use App\Services\Config; */ final class CloudVpcService { - public const MAX_SUBNETS = 64; /** Protocol/readback ceiling retained for existing large VPCs. */ public const MAX_MEMBERS = 4096; /** Tenant creation policy for newly allocated /24 VPCs. */ @@ -335,108 +334,38 @@ final class CloudVpcService }, 3); } - public static function addSubnet(string $vpcKey, array $actor, array $input): array - { - CloudInput::only($input, ['cidr', 'gateway_ip', 'request_key']); - $key = self::requestKey($input['request_key'] ?? null); - $vpc = self::lockOwned($vpcKey, $actor); - $value = self::cidr($input['cidr'] ?? null, (int) self::cidr( - (string) $vpc->cidr, 16, 24, 'VPC CIDR')['prefix'], 30, '子网 CIDR'); - $gateway = $input['gateway_ip'] ?? null; - if ($gateway !== null) { - throw new CloudError('当前 VPC 控制面不支持子网网关'); - } - $requestHash = self::requestHash('subnet_add', [ - 'cidr' => $value['cidr'], 'gateway_ip' => $gateway, - ]); - return $vpc->getConnection()->transaction(function () use ( - $vpc, $actor, $value, $gateway, $key, $requestHash - ): array { - $vpc = self::lockOwned($vpc->vpc_key, $actor); - if (self::hasOperation($vpc, $key, 'subnet_add', $requestHash)) { - return self::documentView($vpc, $actor); - } - self::assertWithinVpc($value, $vpc); - // Guest gateways are intentionally deferred to the data plane. - $subnets = CloudVpcSubnet::where('vpc_id', $vpc->id)->lockForUpdate()->get(); - $liveSubnetCount = $subnets->filter(static fn ($row): bool => !in_array( - (string) $row->state, ['deleted', 'deleting'], true - ))->count(); - if ($liveSubnetCount >= self::MAX_SUBNETS) { - throw new CloudError('VPC 子网数量已达到上限', 409); - } - foreach ($subnets as $row) { - if (self::overlap($value, [ - 'network' => (int) $row->network_address, - 'broadcast' => (int) $row->broadcast_address, - ])) { - throw new CloudError('子网 CIDR 与现有子网重叠', 409); - } - } - $now = time(); - $row = new CloudVpcSubnet(); - $row->subnet_key = self::randomKey(); - $row->vpc_id = $vpc->id; - $row->cidr = $value['cidr']; - $row->network_address = $value['network']; - $row->broadcast_address = $value['broadcast']; - $row->prefix_length = $value['prefix']; - $row->gateway_ip = $gateway; - $row->state = 'applying'; - $row->created_at = $row->updated_at = $now; - $row->save(); - $result = self::touchDesiredLocked($vpc, 'subnet_add', $key, $requestHash); - return self::documentView($result['vpc'], $actor); - }, 3); - } - - public static function removeSubnet(string $vpcKey, string $subnetKey, - array $actor, array $input): array - { - CloudInput::only($input, ['request_key']); - $key = self::requestKey($input['request_key'] ?? null); - $vpc = self::lockOwned($vpcKey, $actor); - self::assertKey($subnetKey, '子网'); - $requestHash = self::requestHash('subnet_remove', ['subnet_key' => $subnetKey]); - return $vpc->getConnection()->transaction(function () use ( - $vpc, $subnetKey, $actor, $key, $requestHash - ): array { - $vpc = self::lockOwned($vpc->vpc_key, $actor); - if (self::hasOperation($vpc, $key, 'subnet_remove', $requestHash)) { - return self::documentView($vpc, $actor); - } - $subnet = CloudVpcSubnet::where('vpc_id', $vpc->id) - ->where('subnet_key', $subnetKey)->lockForUpdate()->first(); - if ($subnet === null || in_array((string) $subnet->state, ['deleted', 'deleting'], true)) { - throw new CloudError('子网不存在', 404); - } - if (CloudVpcMember::where('subnet_id', $subnet->id) - ->where('state', '<>', 'deleted')->exists()) { - throw new CloudError('子网仍有私网成员,不能删除', 409); - } - if (CloudVpcPrivateIp::where('subnet_id', $subnet->id) - ->where('state', '<>', 'deleted')->exists()) { - throw new CloudError('子网仍有私网地址租约,不能删除', 409); - } - $subnet->state = 'deleting'; - $subnet->updated_at = time(); - $subnet->save(); - $result = self::touchDesiredLocked($vpc, 'subnet_remove', $key, $requestHash); - return self::documentView($result['vpc'], $actor); - }, 3); - } - public static function attachMember(string $vpcKey, array $actor, array $input): array { - CloudInput::only($input, ['subnet_key', 'instance_id', 'private_ip', 'request_key']); + // Legacy subnet/IP fields are admitted only far enough to replay an + // already committed operation during a rolling UI/API deployment. + // They can never create a new member under the automatic policy. + CloudInput::only($input, [ + 'instance_id', 'request_key', 'subnet_key', 'private_ip', + ]); $key = self::requestKey($input['request_key'] ?? null); $instanceId = self::positiveInt($input['instance_id'] ?? null, 1, 1000000000, '虚拟机无效'); - $requestHash = self::requestHash('member_attach', [ - 'subnet_key' => $input['subnet_key'] ?? null, - 'instance_id' => $instanceId, - 'private_ip' => $input['private_ip'] ?? null, - ]); + $hasLegacySubnet = array_key_exists('subnet_key', $input); + $hasLegacyIp = array_key_exists('private_ip', $input); + if ($hasLegacyIp && !$hasLegacySubnet) { + throw new CloudError('私网 IP 只能由平台自动分配,请刷新页面后重试', 422); + } + $legacyRequestHash = null; + if ($hasLegacySubnet) { + self::assertKey($input['subnet_key'] ?? null, '子网'); + $legacyIpForHash = null; + if ($hasLegacyIp && $input['private_ip'] !== null) { + self::ipv4($input['private_ip'], '私网 IP'); + // The former implementation hashed the validated raw string + // before storing its canonical address in the lease row. + $legacyIpForHash = (string) $input['private_ip']; + } + $legacyRequestHash = self::requestHash('member_attach', [ + 'subnet_key' => (string) $input['subnet_key'], + 'instance_id' => $instanceId, + 'private_ip' => $legacyIpForHash, + ]); + } // Older workers could persist a locally proven `deleted` pair after // the VPC root and every historical host had already reached the same // exact revision. Such rows still own the database uniqueness keys. @@ -454,17 +383,44 @@ final class CloudVpcService // legacy garbage collection. A client retry after the first response // was lost must still resolve the original operation even if the VM's // runtime state or host-region mapping has changed in the meantime. - $replay = $vpc->getConnection()->transaction(function () use ( - $vpc, $actor, $key, $requestHash - ): ?array { + $prepared = $vpc->getConnection()->transaction(function () use ( + $vpc, $actor, $key, $instanceId, $legacyRequestHash + ): array { $locked = self::lockOwned($vpc->vpc_key, $actor); - return self::hasOperation( - $locked, $key, 'member_attach', $requestHash - ) ? self::documentView($locked, $actor) : null; + if (self::hasMemberAttachOperation( + $locked, $key, $instanceId, $legacyRequestHash + )) { + return [ + 'request_hash' => null, + 'subnet_key' => null, + 'replay' => self::documentView($locked, $actor), + ]; + } + if ($legacyRequestHash !== null) { + throw new CloudError( + '子网和私网 IP 由平台自动分配,请刷新页面后重试', + 422 + ); + } + $subnet = self::lockedAutomaticSubnet($locked); + // Preserve the historical automatic-attach hash shape so a lost + // response from the former subnet selector remains replayable. + $requestHash = self::requestHash('member_attach', [ + 'subnet_key' => (string) $subnet->subnet_key, + 'instance_id' => $instanceId, + 'private_ip' => null, + ]); + return [ + 'request_hash' => $requestHash, + 'subnet_key' => (string) $subnet->subnet_key, + 'replay' => null, + ]; }, 3); - if ($replay !== null) { - return $replay; + if ($prepared['replay'] !== null) { + return $prepared['replay']; } + $requestHash = (string) $prepared['request_hash']; + $automaticSubnetKey = (string) $prepared['subnet_key']; $instance = CloudInstance::where('id', $instanceId) ->where('status', '<>', 'deleted')->first(); if ($instance !== null @@ -477,21 +433,19 @@ final class CloudVpcService ); } return $vpc->getConnection()->transaction(function () use ( - $vpc, $actor, $input, $key, $requestHash, $instanceId + $vpc, $actor, $key, $requestHash, $instanceId, $automaticSubnetKey, + $legacyRequestHash ): array { $vpc = self::lockOwned($vpc->vpc_key, $actor); - if (self::hasOperation($vpc, $key, 'member_attach', $requestHash)) { + if (self::hasMemberAttachOperation( + $vpc, $key, $instanceId, $legacyRequestHash + )) { return self::documentView($vpc, $actor); } - $subnetKey = $input['subnet_key'] ?? null; - self::assertKey($subnetKey, '子网'); - $subnet = CloudVpcSubnet::where('vpc_id', $vpc->id) - ->where('subnet_key', $subnetKey)->lockForUpdate()->first(); - if ($subnet === null || !in_array((string) $subnet->state, self::LIVE_STATES, true)) { - throw new CloudError('子网不存在或尚未可用', 409); + $subnet = self::lockedAutomaticSubnet($vpc); + if (!hash_equals($automaticSubnetKey, (string) $subnet->subnet_key)) { + throw new CloudError('VPC 自动子网状态已变化,请重新读取', 409); } - $requestedIp = ($input['private_ip'] ?? null) !== null - ? self::ipv4($input['private_ip'], '私网 IP') : null; $existing = CloudVpcMember::where('vpc_id', $vpc->id) ->where('instance_id', $instanceId)->lockForUpdate()->first(); if ($existing !== null) { @@ -527,10 +481,6 @@ final class CloudVpcService || in_array((string) $privateIp->state, ['deleted', 'deleting'], true)) { throw new CloudError('VPC 私网地址账本与成员不一致,请联系管理员', 503); } - if ($requestedIp !== null - && (string) $privateIp->private_ip !== $requestedIp) { - throw new CloudError('该虚拟机已加入 VPC 且 IP 不同', 409); - } return self::documentView($vpc, $actor); } $instance = CloudInstance::where('id', $instanceId) @@ -594,9 +544,7 @@ final class CloudVpcService $reservedRouteIps[(string) $route->next_hop_ip] = true; } } - $ip = $requestedIp !== null - ? $requestedIp - : self::firstFreeIp($subnet, $privateIps, $reservedRouteIps); + $ip = self::firstFreeIp($subnet, $privateIps, $reservedRouteIps); $ipInt = self::ipToInt($ip); if ($ipInt <= (int) $subnet->network_address || $ipInt >= (int) $subnet->broadcast_address) { @@ -2040,9 +1988,10 @@ final class CloudVpcService 'updated_at' => $observedAt, ]); } - // A subnet is only a control-plane address range. removeSubnet - // already requires it to have no live member or lease, so an - // empty-VPC terminal gate is sufficient absence proof. Never + // A subnet is only a control-plane address range. Historical + // subnet-removal operations were admitted only after proving + // no live member or lease, so an empty-VPC terminal gate is + // sufficient absence proof. Never // extend this branch to member/private-IP tombstones: those // still require libvirt removal readback from a host. if ((string) $operation->kind === 'member_detach') { @@ -4412,6 +4361,133 @@ final class CloudVpcService return ['vpc' => $vpc, 'operation' => $operation, 'unchanged' => false]; } + /** Lock and resolve the one platform-managed subnet used for member IPAM. */ + private static function lockedAutomaticSubnet(CloudVpc $vpc): CloudVpcSubnet + { + $rows = CloudVpcSubnet::where('vpc_id', $vpc->id) + ->orderBy('id')->lockForUpdate()->get(); + $live = []; + $deleting = false; + foreach ($rows as $row) { + $state = (string) $row->state; + if ($state === 'deleted') { + continue; + } + if ($state === 'deleting') { + $deleting = true; + continue; + } + if (!in_array($state, self::LIVE_STATES, true)) { + throw new CloudError('VPC 自动子网账本状态无效,请联系管理员', 503); + } + $live[] = $row; + } + if ($deleting) { + throw new CloudError('VPC 自动子网正在清理,请稍后重试', 409); + } + if ($live === []) { + throw new CloudError('VPC 自动子网尚未可用', 409); + } + if (count($live) !== 1) { + throw new CloudError( + 'VPC 存在多个活动子网,已停止自动分配,请联系管理员', 503 + ); + } + /** @var CloudVpcSubnet $subnet */ + $subnet = $live[0]; + try { + $root = self::cidr((string) $vpc->cidr, 16, 24, 'VPC CIDR'); + $value = self::cidr( + (string) $subnet->cidr, (int) $root['prefix'], 30, + '自动子网 CIDR' + ); + } catch (\Throwable) { + throw new CloudError('VPC 自动子网账本无效,请联系管理员', 503); + } + if ((string) $subnet->cidr !== $value['cidr'] + || preg_match(self::KEY_PATTERN, (string) $subnet->subnet_key) !== 1 + || (int) $subnet->network_address !== $value['network'] + || (int) $subnet->broadcast_address !== $value['broadcast'] + || (int) $subnet->prefix_length !== $value['prefix'] + || $value['network'] < $root['network'] + || $value['broadcast'] > $root['broadcast'] + || $subnet->gateway_ip !== null) { + throw new CloudError('VPC 自动子网账本无效,请联系管理员', 503); + } + return $subnet; + } + + /** + * Replay automatic member attachment before consulting mutable subnet or + * instance state. The immutable signed desired payload supplies the old + * subnet/IP fields needed to verify both former request hash shapes. + */ + private static function hasMemberAttachOperation( + CloudVpc $vpc, + string $requestKey, + int $instanceId, + ?string $legacyRequestHash = null + ): bool { + $operation = CloudVpcOperation::where('vpc_id', $vpc->id) + ->where('idempotency_key', $requestKey) + ->lockForUpdate()->first(); + if ($operation === null) { + return false; + } + if ((string) $operation->kind !== 'member_attach') { + throw new CloudError('同一请求幂等键的参数不一致', 409); + } + if ((int) $operation->user_id !== (int) $vpc->user_id) { + throw new CloudError('VPC 成员操作账本不完整,请联系管理员', 503); + } + if ($legacyRequestHash !== null) { + if (!hash_equals( + (string) $operation->request_hash, $legacyRequestHash + )) { + throw new CloudError('同一请求幂等键的参数不一致', 409); + } + return true; + } + try { + $payload = json_decode( + (string) $operation->payload_json, true, 64, JSON_THROW_ON_ERROR + ); + } catch (\Throwable) { + throw new CloudError('VPC 成员操作账本不完整,请联系管理员', 503); + } + if (!is_array($payload) || !is_array($payload['members'] ?? null)) { + throw new CloudError('VPC 成员操作账本不完整,请联系管理员', 503); + } + foreach ($payload['members'] as $member) { + if (!is_array($member) + || !is_string($member['subnet_id'] ?? null) + || preg_match(self::KEY_PATTERN, (string) $member['subnet_id']) !== 1) { + continue; + } + $privateCidr = $member['private_ip_cidr'] ?? null; + if (!is_string($privateCidr) + || preg_match('/^([0-9.]+)\/32$/D', $privateCidr, $match) !== 1 + || filter_var($match[1], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) { + throw new CloudError('VPC 成员操作账本不完整,请联系管理员', 503); + } + $automaticHash = self::requestHash('member_attach', [ + 'subnet_key' => (string) $member['subnet_id'], + 'instance_id' => $instanceId, + 'private_ip' => null, + ]); + $explicitHash = self::requestHash('member_attach', [ + 'subnet_key' => (string) $member['subnet_id'], + 'instance_id' => $instanceId, + 'private_ip' => $match[1], + ]); + if (hash_equals((string) $operation->request_hash, $automaticHash) + || hash_equals((string) $operation->request_hash, $explicitHash)) { + return true; + } + } + throw new CloudError('同一请求幂等键的参数不一致', 409); + } + /** Check a request key while the VPC root row is already locked. */ private static function hasOperation(CloudVpc $vpc, string $requestKey, string $kind, string $requestHash): bool @@ -4914,19 +4990,6 @@ final class CloudVpcService return $network >= $outerNetwork && $broadcast <= $outerBroadcast; } - private static function overlap(array $left, array $right): bool - { - return $left['network'] <= $right['broadcast'] && $right['network'] <= $left['broadcast']; - } - - private static function assertWithinVpc(array $value, CloudVpc $vpc): void - { - $root = self::cidr((string) $vpc->cidr, 16, 24, 'VPC CIDR'); - if (!self::contains($root['network'], $root['broadcast'], $value['network'], $value['broadcast'])) { - throw new CloudError('子网必须完全位于 VPC CIDR 内'); - } - } - /** * Return the first address absent from durable leases and live routes. * diff --git a/web/config/routes_cloud.php b/web/config/routes_cloud.php index 3ba2ae1e..afe7bbeb 100644 --- a/web/config/routes_cloud.php +++ b/web/config/routes_cloud.php @@ -28,9 +28,6 @@ $app->group('/api/v1', function () { $this->get('/vpcs/{vpc_key:[0-9a-f]{32}}', 'App\Controllers\CloudVpcController:show'); $this->delete('/vpcs/{vpc_key:[0-9a-f]{32}}', 'App\Controllers\CloudVpcController:delete'); - $this->post('/vpcs/{vpc_key:[0-9a-f]{32}}/subnets', 'App\Controllers\CloudVpcController:addSubnet'); - $this->delete('/vpcs/{vpc_key:[0-9a-f]{32}}/subnets/{subnet_key:[0-9a-f]{32}}', - 'App\Controllers\CloudVpcController:removeSubnet'); $this->post('/vpcs/{vpc_key:[0-9a-f]{32}}/members', 'App\Controllers\CloudVpcController:attachMember'); $this->delete('/vpcs/{vpc_key:[0-9a-f]{32}}/members/{member_key:[0-9a-f]{32}}', 'App\Controllers\CloudVpcController:detachMember'); diff --git a/web/public/cloud/vpc.css b/web/public/cloud/vpc.css index 8aad7a28..7ad9c34b 100644 --- a/web/public/cloud/vpc.css +++ b/web/public/cloud/vpc.css @@ -1,2 +1,2 @@ -.vpc-page-heading{align-items:flex-end}.vpc-overview{margin-bottom:18px}.vpc-notice{margin:-4px 0 18px;padding:11px 14px;border:1px solid #cfe9ea;border-radius:9px;background:#effafa;color:#28767d;font-size:11px;line-height:1.6}.vpc-notice.success{border-color:#ccead9;background:#effaf4;color:#26775c}.vpc-notice.warning{border-color:#f0d8aa;background:#fff8eb;color:#916323}.vpc-columns{display:grid;grid-template-columns:minmax(300px,.72fr) minmax(0,1.28fr);gap:18px;align-items:start}.vpc-list-panel,.vpc-detail-panel,.vpc-create-panel{min-width:0}.vpc-list{display:grid;gap:9px;padding:15px}.vpc-list-row{display:flex;align-items:center;justify-content:space-between;gap:13px;width:100%;padding:15px 16px;border:1px solid #e1eaee;border-radius:10px;background:#fff;color:inherit;text-align:left;transition:border-color .15s,background .15s,box-shadow .15s;cursor:pointer}.vpc-list-row:hover{border-color:#9fd5d8;background:#f8fcfc}.vpc-list-row.selected{border-color:#41b6ba;background:#f1faf9;box-shadow:0 0 0 3px rgba(40,171,177,.1)}.vpc-list-main{display:grid;gap:7px;min-width:0}.vpc-list-heading{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0}.vpc-list-heading strong{min-width:0;overflow-wrap:anywhere;color:#2d4659;font-size:13px}.vpc-list-main>small,.vpc-list-meta small{color:#8495a4;font-size:10px;line-height:1.4}.vpc-list-meta{display:grid;justify-items:end;gap:5px;flex:none;text-align:right}.vpc-state-pill{display:inline-flex;align-items:center;gap:5px;width:max-content;max-width:100%;padding:4px 8px;border-radius:999px;background:#f0f3f5;color:#718394;font-size:9px;font-weight:800;white-space:nowrap}.vpc-state-pill:before{width:5px;height:5px;border-radius:50%;background:currentColor;content:""}.vpc-state-pill.active{background:#e8f7ef;color:#23805d}.vpc-state-pill.applying{background:#eaf5f8;color:#277c91}.vpc-state-pill.waiting{background:#eef5fb;color:#4274a6}.vpc-state-pill.uncertain{background:#fff5e3;color:#a26d1e}.vpc-state-pill.degraded,.vpc-state-pill.failed{background:#fff0f1;color:#ae4854}.vpc-state-pill.deleting{background:#fff3ee;color:#aa6740}.vpc-detail-panel{overflow:hidden}.vpc-detail{display:grid;gap:14px;padding:18px}.vpc-detail-overview{padding:17px;border:1px solid #dce9ed;border-radius:11px;background:#f9fcfc}.vpc-detail-overview-heading{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.vpc-readback-note{flex:1;min-width:180px;color:#728896;font-size:10px;line-height:1.5}.vpc-detail-actions{display:flex;gap:7px;margin-left:auto}.vpc-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;margin:16px 0 0;border:1px solid #e1eaee;border-radius:8px;overflow:hidden;background:#e1eaee}.vpc-fact{min-width:0;padding:10px 12px;background:#fff}.vpc-fact dt{margin-bottom:5px;color:#8a9aa8;font-size:9px;font-weight:800}.vpc-fact dd{margin:0;overflow-wrap:anywhere;color:#3c5668;font-size:11px;font-weight:700}.vpc-subpanel{padding:17px;border:1px solid #e4ebef;border-radius:11px;background:#fff}.vpc-subpanel-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}.vpc-subpanel-heading h3{margin:0 0 5px;color:#304a5d;font-size:14px}.vpc-subpanel-heading p{margin:0;color:#8797a5;font-size:10px;line-height:1.55}.vpc-subpanel-count{color:#93a1ae;font-size:10px}.vpc-form,.vpc-inline-form{display:grid;gap:15px}.vpc-form{padding:21px 24px 23px}.vpc-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:17px}.vpc-inline-form{grid-template-columns:repeat(2,minmax(0,1fr));align-items:end;padding:13px;border:1px solid #e2eaee;border-radius:9px;background:#fbfcfd}.vpc-member-form{grid-template-columns:repeat(4,minmax(0,1fr))}.vpc-inline-form .field{min-width:0}.vpc-inline-form .button{min-height:38px}.vpc-form-actions,.vpc-editor-toolbar{display:flex;justify-content:flex-end;gap:8px;align-items:center}.vpc-row-list{display:grid;gap:8px;margin-top:12px}.vpc-data-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 12px;border:1px solid #e5ecef;border-radius:8px;background:#fcfefe}.vpc-row-copy{display:grid;gap:4px;min-width:0}.vpc-row-copy strong{overflow-wrap:anywhere;color:#3b5567;font-size:11px}.vpc-row-copy small{color:#8798a6;font-size:9px;line-height:1.4}.vpc-row-copy .vpc-row-error{color:#ad5b4f}.vpc-empty-inline{margin:0;padding:13px;color:#91a0ac;font-size:10px;text-align:center}.button.danger{border-color:#efd9dd;color:#b04a57}.button.danger:not(:disabled):hover{background:#fff0f1}.vpc-editor-list{display:grid;gap:8px}.vpc-editor-row{display:grid;grid-template-columns:minmax(130px,1.25fr) minmax(130px,1.1fr) 95px auto;gap:8px;align-items:end;padding:10px;border:1px solid #e5ecef;border-radius:8px;background:#fcfefe}.vpc-acl-row{grid-template-columns:72px 94px 84px 86px minmax(125px,1fr) minmax(125px,1fr) 90px 90px auto}.vpc-editor-row .field{min-width:0}.vpc-editor-row .field label{font-size:9px;margin-bottom:5px}.vpc-editor-row .field input,.vpc-editor-row .field select{height:35px;padding:0 8px;font-size:10px}.vpc-editor-toolbar{margin-top:11px;justify-content:space-between}.vpc-editor-toolbar .button:first-child{margin-right:auto}.vpc-operation-list{display:grid;gap:1px;border:1px solid #e5ecef;border-radius:8px;overflow:hidden;background:#e5ecef}.vpc-operation-row{display:grid;grid-template-columns:minmax(100px,1fr) auto minmax(110px,1fr);align-items:center;gap:10px;padding:10px 12px;background:#fff;color:#516a7c;font-size:10px}.vpc-operation-row small{color:#8c9ba8;text-align:right;overflow-wrap:anywhere}.vpc-create-panel{margin-top:18px}.vpc-create-panel .panel-heading{align-items:center}.vpc-create-panel[hidden]{display:none}@media(max-width:1050px){.vpc-columns{grid-template-columns:1fr}.vpc-list-panel{order:0}.vpc-detail-panel{order:1}.vpc-member-form{grid-template-columns:repeat(2,minmax(0,1fr))}.vpc-acl-row{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(max-width:740px){.vpc-form{padding:18px 19px 20px}.vpc-form-grid,.vpc-inline-form{grid-template-columns:1fr}.vpc-list{padding:12px}.vpc-list-row{align-items:flex-start;flex-direction:column}.vpc-list-meta{justify-items:start;text-align:left}.vpc-detail{padding:12px}.vpc-facts{grid-template-columns:repeat(2,minmax(0,1fr))}.vpc-subpanel{padding:14px}.vpc-editor-row,.vpc-acl-row{grid-template-columns:repeat(2,minmax(0,1fr))}.vpc-editor-row .button{grid-column:1/-1;justify-self:end}.vpc-operation-row{grid-template-columns:minmax(80px,1fr) auto}.vpc-operation-row small{grid-column:1/-1;text-align:left}.vpc-detail-overview-heading{align-items:flex-start}.vpc-detail-actions{width:100%;margin-left:0}.vpc-detail-actions .button{flex:1}}@media(max-width:510px){.vpc-facts{grid-template-columns:1fr}.vpc-page-heading .heading-actions{width:100%}.vpc-page-heading .heading-actions .button{flex:1}.vpc-form-actions .button{width:100%}.vpc-editor-toolbar{align-items:stretch;flex-wrap:wrap}.vpc-editor-toolbar .button{flex:1}.vpc-editor-toolbar .button:first-child{margin-right:0}} +.vpc-page-heading{align-items:flex-end}.vpc-overview{margin-bottom:18px}.vpc-notice{margin:-4px 0 18px;padding:11px 14px;border:1px solid #cfe9ea;border-radius:9px;background:#effafa;color:#28767d;font-size:11px;line-height:1.6}.vpc-notice.success{border-color:#ccead9;background:#effaf4;color:#26775c}.vpc-notice.warning{border-color:#f0d8aa;background:#fff8eb;color:#916323}.vpc-columns{display:grid;grid-template-columns:minmax(300px,.72fr) minmax(0,1.28fr);gap:18px;align-items:start}.vpc-list-panel,.vpc-detail-panel,.vpc-create-panel{min-width:0}.vpc-list{display:grid;gap:9px;padding:15px}.vpc-list-row{display:flex;align-items:center;justify-content:space-between;gap:13px;width:100%;padding:15px 16px;border:1px solid #e1eaee;border-radius:10px;background:#fff;color:inherit;text-align:left;transition:border-color .15s,background .15s,box-shadow .15s;cursor:pointer}.vpc-list-row:hover{border-color:#9fd5d8;background:#f8fcfc}.vpc-list-row.selected{border-color:#41b6ba;background:#f1faf9;box-shadow:0 0 0 3px rgba(40,171,177,.1)}.vpc-list-main{display:grid;gap:7px;min-width:0}.vpc-list-heading{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0}.vpc-list-heading strong{min-width:0;overflow-wrap:anywhere;color:#2d4659;font-size:13px}.vpc-list-main>small,.vpc-list-meta small{color:#8495a4;font-size:10px;line-height:1.4}.vpc-list-meta{display:grid;justify-items:end;gap:5px;flex:none;text-align:right}.vpc-state-pill{display:inline-flex;align-items:center;gap:5px;width:max-content;max-width:100%;padding:4px 8px;border-radius:999px;background:#f0f3f5;color:#718394;font-size:9px;font-weight:800;white-space:nowrap}.vpc-state-pill:before{width:5px;height:5px;border-radius:50%;background:currentColor;content:""}.vpc-state-pill.active{background:#e8f7ef;color:#23805d}.vpc-state-pill.applying{background:#eaf5f8;color:#277c91}.vpc-state-pill.waiting{background:#eef5fb;color:#4274a6}.vpc-state-pill.uncertain{background:#fff5e3;color:#a26d1e}.vpc-state-pill.degraded,.vpc-state-pill.failed{background:#fff0f1;color:#ae4854}.vpc-state-pill.deleting{background:#fff3ee;color:#aa6740}.vpc-detail-panel{overflow:hidden}.vpc-detail{display:grid;gap:14px;padding:18px}.vpc-detail-overview{padding:17px;border:1px solid #dce9ed;border-radius:11px;background:#f9fcfc}.vpc-detail-overview-heading{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.vpc-readback-note{flex:1;min-width:180px;color:#728896;font-size:10px;line-height:1.5}.vpc-detail-actions{display:flex;gap:7px;margin-left:auto}.vpc-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;margin:16px 0 0;border:1px solid #e1eaee;border-radius:8px;overflow:hidden;background:#e1eaee}.vpc-fact{min-width:0;padding:10px 12px;background:#fff}.vpc-fact dt{margin-bottom:5px;color:#8a9aa8;font-size:9px;font-weight:800}.vpc-fact dd{margin:0;overflow-wrap:anywhere;color:#3c5668;font-size:11px;font-weight:700}.vpc-subpanel{padding:17px;border:1px solid #e4ebef;border-radius:11px;background:#fff}.vpc-subpanel-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}.vpc-subpanel-heading h3{margin:0 0 5px;color:#304a5d;font-size:14px}.vpc-subpanel-heading p{margin:0;color:#8797a5;font-size:10px;line-height:1.55}.vpc-subpanel-count{color:#93a1ae;font-size:10px}.vpc-form,.vpc-inline-form{display:grid;gap:15px}.vpc-form{padding:21px 24px 23px}.vpc-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:17px}.vpc-inline-form{grid-template-columns:repeat(2,minmax(0,1fr));align-items:end;padding:13px;border:1px solid #e2eaee;border-radius:9px;background:#fbfcfd}.vpc-member-form{grid-template-columns:repeat(2,minmax(0,1fr))}.vpc-inline-form .field{min-width:0}.vpc-inline-form .button{min-height:38px}.vpc-form-actions,.vpc-editor-toolbar{display:flex;justify-content:flex-end;gap:8px;align-items:center}.vpc-row-list{display:grid;gap:8px;margin-top:12px}.vpc-data-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 12px;border:1px solid #e5ecef;border-radius:8px;background:#fcfefe}.vpc-row-copy{display:grid;gap:4px;min-width:0}.vpc-row-copy strong{overflow-wrap:anywhere;color:#3b5567;font-size:11px}.vpc-row-copy small{color:#8798a6;font-size:9px;line-height:1.4}.vpc-row-copy .vpc-row-error{color:#ad5b4f}.vpc-empty-inline{margin:0;padding:13px;color:#91a0ac;font-size:10px;text-align:center}.button.danger{border-color:#efd9dd;color:#b04a57}.button.danger:not(:disabled):hover{background:#fff0f1}.vpc-editor-list{display:grid;gap:8px}.vpc-editor-row{display:grid;grid-template-columns:minmax(130px,1.25fr) minmax(130px,1.1fr) 95px auto;gap:8px;align-items:end;padding:10px;border:1px solid #e5ecef;border-radius:8px;background:#fcfefe}.vpc-acl-row{grid-template-columns:72px 94px 84px 86px minmax(125px,1fr) minmax(125px,1fr) 90px 90px auto}.vpc-editor-row .field{min-width:0}.vpc-editor-row .field label{font-size:9px;margin-bottom:5px}.vpc-editor-row .field input,.vpc-editor-row .field select{height:35px;padding:0 8px;font-size:10px}.vpc-editor-toolbar{margin-top:11px;justify-content:space-between}.vpc-editor-toolbar .button:first-child{margin-right:auto}.vpc-operation-list{display:grid;gap:1px;border:1px solid #e5ecef;border-radius:8px;overflow:hidden;background:#e5ecef}.vpc-operation-row{display:grid;grid-template-columns:minmax(100px,1fr) auto minmax(110px,1fr);align-items:center;gap:10px;padding:10px 12px;background:#fff;color:#516a7c;font-size:10px}.vpc-operation-row small{color:#8c9ba8;text-align:right;overflow-wrap:anywhere}.vpc-create-panel{margin-top:18px}.vpc-create-panel .panel-heading{align-items:center}.vpc-create-panel[hidden]{display:none}@media(max-width:1050px){.vpc-columns{grid-template-columns:1fr}.vpc-list-panel{order:0}.vpc-detail-panel{order:1}.vpc-member-form{grid-template-columns:repeat(2,minmax(0,1fr))}.vpc-acl-row{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(max-width:740px){.vpc-form{padding:18px 19px 20px}.vpc-form-grid,.vpc-inline-form{grid-template-columns:1fr}.vpc-list{padding:12px}.vpc-list-row{align-items:flex-start;flex-direction:column}.vpc-list-meta{justify-items:start;text-align:left}.vpc-detail{padding:12px}.vpc-facts{grid-template-columns:repeat(2,minmax(0,1fr))}.vpc-subpanel{padding:14px}.vpc-editor-row,.vpc-acl-row{grid-template-columns:repeat(2,minmax(0,1fr))}.vpc-editor-row .button{grid-column:1/-1;justify-self:end}.vpc-operation-row{grid-template-columns:minmax(80px,1fr) auto}.vpc-operation-row small{grid-column:1/-1;text-align:left}.vpc-detail-overview-heading{align-items:flex-start}.vpc-detail-actions{width:100%;margin-left:0}.vpc-detail-actions .button{flex:1}}@media(max-width:510px){.vpc-facts{grid-template-columns:1fr}.vpc-page-heading .heading-actions{width:100%}.vpc-page-heading .heading-actions .button{flex:1}.vpc-form-actions .button{width:100%}.vpc-editor-toolbar{align-items:stretch;flex-wrap:wrap}.vpc-editor-toolbar .button{flex:1}.vpc-editor-toolbar .button:first-child{margin-right:0}} .vpc-tombstone-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 12px;border:1px dashed #e6c9a8;border-radius:8px;background:#fffaf2;color:#8a6a3b}.vpc-tombstone-row strong{overflow-wrap:anywhere;font-size:11px}.vpc-tombstone-row small{color:#a17e4d;font-size:9px;line-height:1.4;text-align:right} diff --git a/web/public/cloud/vpc.js b/web/public/cloud/vpc.js index 84306517..5cc7172c 100644 --- a/web/public/cloud/vpc.js +++ b/web/public/cloud/vpc.js @@ -176,7 +176,6 @@ function normalizeDocument(value) { if (!root) return null; return { vpc: root, - subnets: Array.isArray(value.subnets) ? value.subnets : [], members: Array.isArray(value.members) ? value.members : [], routes: Array.isArray(value.routes) ? value.routes : [], acl_rules: Array.isArray(value.acl_rules) ? value.acl_rules : [], @@ -210,7 +209,7 @@ function selectedRootDeleting() { function allowSelectedMutation() { if (!selectedRootDeleting()) return true; - setError('VPC 正在删除,完成所有宿主机清理前不能再修改子网、成员、路由或 ACL。'); + setError('VPC 正在删除,完成所有宿主机清理前不能再修改成员、路由或 ACL。'); return false; } @@ -376,7 +375,6 @@ function renderDetail() { overview.append(overviewHeading, facts); container.append(overview); - container.append(renderSubnets(doc)); container.append(renderMembers(doc)); container.append(renderRoutes(doc)); container.append(renderAcl(doc)); @@ -385,35 +383,9 @@ function renderDetail() { lockDeletingDetail(container, reconcile); } -function renderSubnets(doc) { - const card = section('子网与 CIDR', '子网是 VPC 内的地址范围;当前数据面使用成员精确 /32,不自动提供网关。', 'vpc-subnets'); - const form = element('form', 'vpc-inline-form'); form.dataset.vpcForm = 'subnet'; - const cidr = input('新增子网 CIDR', '', 'text', '10.40.1.0/24'); - cidr.control.name = 'cidr'; cidr.control.required = true; cidr.control.maxLength = 18; - const save = button('添加子网', 'button button-primary small'); save.type = 'submit'; - form.append(cidr.wrapper, save); card.append(form); - const list = element('div', 'vpc-row-list'); - for (const row of doc.subnets) { - const item = element('div', 'vpc-data-row'); - const copy = element('div', 'vpc-row-copy'); - copy.append(element('strong', '', row.cidr || '未知子网'), element('small', '', `状态:${STATUS_LABELS[childStatus(row.state)] || safeText(row.state)}`)); - if (row.last_error_code) copy.append(element('small', 'vpc-row-error', row.last_error_code)); - const remove = button('删除', 'button button-outline small danger'); - remove.dataset.vpcRemoveSubnet = row.subnet_key; - remove.disabled = state.busy || ['deleting', 'deleted'].includes(childStatus(row.state)); - item.append(copy, remove); list.append(item); - } - if (!doc.subnets.length) list.append(element('p', 'vpc-empty-inline', '暂无子网。')); - card.append(list); return card; -} - function renderMembers(doc) { - const card = section('成员与私网 IP', '把同一地区的实例加入 VPC;私网 IP 由 PHP 租约账本分配并在宿主机回读后生效。', 'vpc-members'); + const card = section('成员与私网 IP', '选择同一地区的实例即可加入;平台会使用唯一自动子网分配私网 IP,并在宿主机回读后生效。', 'vpc-members'); const form = element('form', 'vpc-inline-form vpc-member-form'); form.dataset.vpcForm = 'member'; - const subnet = input('加入子网', '', 'select'); subnet.control.name = 'subnet_key'; subnet.control.required = true; - for (const row of doc.subnets.filter(item => !['deleting', 'deleted'].includes(childStatus(item.state)))) { - subnet.control.append(new Option(row.cidr, row.subnet_key)); - } const instance = input('选择实例', '', 'select'); instance.control.name = 'instance_id'; instance.control.required = true; const vpcRegionId = Number(doc.vpc.region_id || 0); const attached = new Set(doc.members @@ -428,9 +400,8 @@ function renderMembers(doc) { option.disabled = alreadyAttached || !sameRegion; instance.control.append(option); } - const ip = input('指定私网 IP(可选)', '', 'text', '自动分配'); ip.control.name = 'private_ip'; ip.control.maxLength = 15; const save = button('加入 VPC', 'button button-primary small'); save.type = 'submit'; - form.append(subnet.wrapper, instance.wrapper, ip.wrapper, save); card.append(form); + form.append(instance.wrapper, save); card.append(form); const list = element('div', 'vpc-row-list'); for (const row of doc.members.filter(item => childStatus(item.state) !== 'deleted')) { const item = element('div', 'vpc-data-row'); @@ -706,22 +677,11 @@ async function createVpc(event) { finally { state.busy = false; createRegionOptions(); renderList(); schedulePoll(1500); } } -async function submitSubnet(form) { - if (!allowSelectedMutation() || !confirmDetailMutation()) return; - const value = form.cidr.value.trim(); - if (!value) return; - const payload = await mutate(`/api/v1/vpcs/${encodeURIComponent(state.selectedKey)}/subnets`, 'POST', { - cidr: value, request_key: requestKey('subnet-add'), - }, '子网目标已提交,等待宿主机回读。'); - if (payload) form.reset(); -} - async function submitMember(form) { if (!allowSelectedMutation() || !confirmDetailMutation()) return; - const body = { subnet_key: form.subnet_key.value, instance_id: Number(form.instance_id.value), request_key: requestKey('member-add') }; - if (form.private_ip.value.trim()) body.private_ip = form.private_ip.value.trim(); + const body = { instance_id: Number(form.instance_id.value), request_key: requestKey('member-add') }; await mutate(`/api/v1/vpcs/${encodeURIComponent(state.selectedKey)}/members`, 'POST', body, - '实例已加入 VPC 目标,私网网卡将在实际回读后显示为可用。'); + '实例已加入 VPC 目标,私网 IP 已自动分配,网卡将在实际回读后显示为可用。'); } function readRoutes() { @@ -778,13 +738,6 @@ async function reconcile() { await mutate(`/api/v1/vpcs/${encodeURIComponent(state.selectedKey)}/reconcile`, 'POST', {}, '已请求重新核对 VPC 状态。'); } -async function removeSubnet(key) { - if (!state.selectedKey || state.busy || !allowSelectedMutation() || !confirmDetailMutation() - || !confirm('确认删除这个子网?子网必须没有成员和地址租约。')) return; - await mutate(`/api/v1/vpcs/${encodeURIComponent(state.selectedKey)}/subnets/${encodeURIComponent(key)}`, - 'DELETE', { request_key: requestKey('subnet-remove') }, '子网删除目标已提交。'); -} - async function removeMember(key) { if (!state.selectedKey || state.busy || !allowSelectedMutation() || !confirmDetailMutation() || !confirm('确认让这个实例退出 VPC?宿主机回读确认前,私网 IP 不会重新分配。')) return; @@ -818,8 +771,6 @@ async function deleteVpc() { function handleClick(event) { const listRow = event.target.closest('[data-vpc-key]'); if (listRow && listRow.closest('#vpc-list')) { selectVpc(listRow.dataset.vpcKey); return; } - const removeSubnetKey = event.target.closest('[data-vpc-remove-subnet]')?.dataset.vpcRemoveSubnet; - if (removeSubnetKey) { removeSubnet(removeSubnetKey); return; } const removeMemberKey = event.target.closest('[data-vpc-remove-member]')?.dataset.vpcRemoveMember; if (removeMemberKey) { removeMember(removeMemberKey); return; } const action = event.target.closest('[data-vpc-action]')?.dataset.vpcAction; @@ -847,7 +798,6 @@ function handleClick(event) { function handleSubmit(event) { const kind = event.target.dataset.vpcForm; - if (kind === 'subnet') { event.preventDefault(); submitSubnet(event.target); } if (kind === 'member') { event.preventDefault(); submitMember(event.target); } } diff --git a/web/resources/views/venix/cloud/pages/vpcs.tpl b/web/resources/views/venix/cloud/pages/vpcs.tpl index 11d86d0d..9dfeedae 100644 --- a/web/resources/views/venix/cloud/pages/vpcs.tpl +++ b/web/resources/views/venix/cloud/pages/vpcs.tpl @@ -3,7 +3,7 @@
PRIVATE NETWORK

VPC 私网

-

在同一地区的实例之间建立受控三层私网。私网配置只有在宿主机实际回读确认后才会显示为可用。

+

填写名称并选择地区即可创建私网;平台会自动分配独立网段、唯一子网和成员地址,并在宿主机实际回读后标记为可用。

@@ -32,7 +32,7 @@