Compare commits

...

197 Commits

Author SHA1 Message Date
Jian Qiu
197c91a014 fix: set bridge up after created (#24872)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-05-21 20:28:35 +08:00
wanyaoqi
37f6cd57a4 fix(scheduler): set options ContainerNumaAllocate default true (#24871) 2026-05-21 19:32:23 +08:00
Zexi Li
819f22dd99 feat(hermes): connect vllm/sglang/ollama (#24864)
Co-authored-by: cwz <cwz_eikoh@163.com>
2026-05-21 11:41:39 +08:00
Zexi Li
4432749b7b feat(llm): Implement resumable downloads for models from Hugging Face (#24860)
Co-authored-by: cwz <cwz_eikoh@163.com>
2026-05-21 10:48:56 +08:00
Zexi Li
588e282571 fix(region): ensure lb backend check_status returned when check_code missing (#24857) 2026-05-21 10:34:17 +08:00
wanyaoqi
42b85ba2c7 fix(host): remove cgroup root path check quotation marks (#24853) 2026-05-21 10:33:45 +08:00
Zexi Li
4401be272c fix(region): query metrics from monitor service (#24839) 2026-05-19 18:02:27 +08:00
Zexi Li
827c6b90dd fix(llm): persistent /config dir of hermes agent (#24836) 2026-05-18 14:57:59 +08:00
Zexi Li
3c90e78377 feat(climc): add generic feature-config command (#24831)
Add a generic `feature-config <feature> <on|off>` command alongside the
existing per-feature `feature-config-<name>` commands. A `--force` flag
skips the known-features validation so new features can be toggled
without a code change. Also adds "ai" to the known feature list.
2026-05-18 14:29:04 +08:00
Zexi Li
fd1767cebe feat(llm): support sglang (#24823)
Co-authored-by: cwz <cwz_eikoh@163.com>
2026-05-14 17:08:53 +08:00
Jian Qiu
2d8e88aae7 fix: lbagent keepalived service run may exit (#24806)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-05-13 12:07:54 +08:00
屈轩
d7dc96ac00 fix(region): support stop for change vm config (#24817) 2026-05-12 19:48:09 +08:00
屈轩
d1bbf45990 fix(region): update gp3 disk size (#24812) 2026-05-12 17:27:34 +08:00
Zexi Li
79ab73c980 Automated cherry pick of #24801: Feature(vllm): use entrypint instead of StartLLM (#24802)
* feat(llm): use entrypoint instead of StartLLM

* feat(llm): adapt front-end in comfyui instant-model

---------

Co-authored-by: cwz <cwz_eikoh@163.com>
2026-05-12 10:46:21 +08:00
Zexi Li
680dd5a2dc fix(llm): honor SLLM device override when building container spec (#24800) 2026-05-11 20:06:58 +08:00
wanyaoqi
f63e35af99 fix(host): remove -no-kvm args, -no-kvm argument was a synonym for setting -machine accel=tcg (#24789) 2026-05-11 20:01:14 +08:00
wanyaoqi
505ef9e5bb fix(host): check is cpu hotplug support on guest init (#24787) 2026-05-11 19:59:14 +08:00
Zexi Li
c1abc7570d feat(llm): add SLLM mounted_models override and driver-level validation (#24796) 2026-05-11 17:41:16 +08:00
Zexi Li
c28edb026e feat(monitor): use GET for unifiedmonitors resource-metrics (#24782) 2026-05-08 16:19:35 +08:00
Zexi Li
b5cf4bb575 fix(monitor): dedupe alert trigger condition in notify templates (#24780) 2026-05-07 15:52:51 +08:00
屈轩
c35e95046d fix(region): avoid vm set status start fail when serivce restart (#24777) 2026-05-07 15:22:32 +08:00
Zexi Li
48aa05c5c7 Automated cherry pick of #24760: Feature/comfyui instant model (#24776)
* feat(llm): support cursor

* feat(llm): support import from huggingface

* fix(llm): direction error

* feat(llm): support instant model for comfyui

* feat(llm): support multi file select when save-instant-model

---------

Co-authored-by: cwz <cwz_eikoh@163.com>
2026-05-07 14:43:10 +08:00
wanyaoqi
3c919a5e71 feat(host): mps add container device configuration (#24773) 2026-05-07 10:03:31 +08:00
Jian Qiu
f998448ad1 fix: update vendor for v4.0.3 (#24761)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-05-03 23:22:56 +08:00
Jian Qiu
71648a8e02 fix(host): cpu hotplug compatible with high qemu version (#24762)
Co-authored-by: wanyaoqi <d3lx.yq@gmail.com>
2026-05-03 23:22:31 +08:00
Jian Qiu
ece246f009 fix(host): auto merge backinf file generate disks index (#24763)
Co-authored-by: wanyaoqi <d3lx.yq@gmail.com>
2026-05-03 22:39:11 +08:00
Zexi Li
4eb015e649 fix(monitor): normalize resource-metrics alert_state (#24756)
Treat attach and init as init in PerformResourceMetrics output.
2026-04-30 18:42:01 +08:00
Zexi Li
0005ea8229 fix(monitor): support influxql derivative and difference function translation (#24748) 2026-04-30 13:11:45 +08:00
Jian Qiu
225791f78c fix: init ifb kernel module (#24745)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-04-29 23:48:59 +08:00
wanyaoqi
e9dde8eae6 fix(mcclient,region): add tasks mod, service app options (#24734) 2026-04-29 23:48:06 +08:00
屈轩
5375fff061 fix(region): optimized listener rule list (#24742) 2026-04-29 14:09:29 +08:00
Zexi Li
0f30ccf520 fix(host,llm): fix pod shm mount path return and llm restart memory config (#24737)
- Return shmPath instead of empty string when mountpoint is already
  mounted, so callers get the correct path
- Remove incorrect +1 offset in memory comparison and size formatting
  during LLM restart config change
2026-04-28 19:57:42 +08:00
Zexi Li
a403ad5091 fix(lbagent,monitor): use victoria-metrics for telegraf and fix influxql translation (#24732) 2026-04-27 16:41:55 +08:00
Jian Qiu
b1908b24e3 fix: create redirect lb listener fail (#24725)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-04-27 10:01:19 +08:00
屈轩
acdf623027 fix(region): lb redirect rule create validate (#24729) 2026-04-27 10:00:54 +08:00
wanyaoqi
e42d517b28 chore(host-deployer): update host-deployer-base to 1.5.9 (#24722) 2026-04-26 23:02:59 +08:00
Zexi Li
9be35e4b45 feat(llm): support OpenClaw manual config mode (#24719)
When ManualConfig is enabled, inject OPENCLAW_MANUAL_CONFIG=1 env var
and skip provider/channel credential injection, allowing users to
configure providers and channels themselves inside the desktop.
2026-04-24 11:45:46 +08:00
Zexi Li
67cceae9e2 Automated cherry pick of #24717: Feature/hf-search (#24718)
* llm: add instant-model huggingface query commands

* fix(vllm): use ping instead of health

---------

Co-authored-by: cwz <cwz_eikoh@163.com>
2026-04-24 10:28:34 +08:00
wanyaoqi
52bbe7c9a7 fix(host): usb device passthrough use hostport (#24708) 2026-04-23 13:52:49 +08:00
Jian Qiu
7e5f5cff5e fix: guest change ipaddr no-sync option (#24714)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-04-23 13:52:04 +08:00
Jian Qiu
bb7b50dbc0 fix: handling deleted task object (#24702)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-04-23 10:19:14 +08:00
屈轩
350412009e fix(notify): remove useless code (#24711) 2026-04-21 19:38:04 +08:00
Zexi Li
6372ef9819 refactor(llm): extract shared desktop webtop config (#24699)
Move common desktop/webtop container envs, base spec, rootfs, and login-info parsing
into llm_container helpers and reuse in openclaw and hermes-agent drivers.
2026-04-21 15:04:44 +08:00
Zexi Li
5577aefb22 fix(scheduler): refactor the pending usage logic (#24705) 2026-04-21 15:03:44 +08:00
Matt Gideon
cc1524a71f fix(host): fix isolated device detection regex for PCI and USB devices (#24692) 2026-04-20 14:22:38 +08:00
Zexi Li
23e21c2c16 feat(llm): support hermes-agent (#24696) 2026-04-20 12:47:23 +08:00
Zexi Li
2ee8ae31ad feat(llm): add hostpaths for llm-sku (#24695)
Co-authored-by: cwz <cwz_eikoh@163.com>
2026-04-20 10:51:40 +08:00
屈轩
c119af4b81 fix(region): show associate info (#24688) 2026-04-17 10:10:29 +08:00
Jian Qiu
e129e0477a fix: add version etc. aux handlers to mcp-server (#24686)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-04-17 09:59:56 +08:00
屈轩
c839d38f60 fix(region): vendor update (#24684) 2026-04-16 23:11:21 +08:00
Jian Qiu
54309f95f3 feature: support asymmmetric bandwidth limit (#24679)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-04-16 15:15:43 +08:00
Jian Qiu
ee66577d94 fix: climc container related commands improvements 20260414 (#24672)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-04-15 10:05:45 +08:00
屈轩
5a09e3d5c9 fix(region): sched fail notify (#24677) 2026-04-14 20:13:31 +08:00
屈轩
b55a9a5482 fix(region): disk fail notify (#24674) 2026-04-14 16:28:28 +08:00
Zexi Li
218c973638 fix(llm): harden volume resize and update size log (#24631)
- Wait for disk/desktop status after resize via backup worker
- Centralize volume SizeMB update with resize action log
- Expose vCPU/memory fields in LLM customize columns
2026-04-13 14:38:50 +08:00
Zexi Li
94d2e10f00 feat(climc): support setting rootfs sub_directory 2026-04-13 11:09:52 +08:00
Zexi Li
1b184d3ea7 fix(region): set rootfs default sub_directory (#24666) 2026-04-13 09:59:16 +08:00
屈轩
f8cab462c1 fix(esxi-agent): support esxi vm forder name same with vm name (#24664) 2026-04-13 09:50:48 +08:00
屈轩
255a1fe84f fix(region): support query public cloud vm modification types (#24654) 2026-04-10 16:54:24 +08:00
wanyaoqi
61b5b8b792 fix(region): optimize fetchHostGuestResource (#24633) 2026-04-10 16:53:03 +08:00
Zexi Li
6ccf058d5c fix(host): restart container on exit when AlwaysRestart is set (#24661) 2026-04-10 15:17:11 +08:00
Jian Qiu
258e47056c fix: vpcagent sync inconsistent networkaddress guestnetwork id (#24649)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-04-10 14:44:21 +08:00
屈轩
c568447a61 fix(mcp-server): update mcp docs (#24652) 2026-04-09 20:45:23 +08:00
屈轩
d2aef76bd5 fix(cloudmon): vendor update (#24643) 2026-04-09 16:33:12 +08:00
Jian Qiu
f9ac278ba3 fix: upgrade coredns to v1.10.1 at 4.0 (#24619)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-04-08 16:26:50 +08:00
Jian Qiu
05da992fba fix: undo pr 24532 (#24638)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-04-08 16:25:23 +08:00
wanyaoqi
99bef191f6 feat(host): container add rbd disk support (#24624) 2026-04-08 13:27:46 +08:00
屈轩
3f3c92fa7d fix(region): clean guest network when purge zone (#24627) 2026-04-07 20:55:45 +08:00
屈轩
c0c9ba6d78 fix(region): esxi wire sync (#24617) 2026-04-04 12:17:00 +08:00
Zexi Li
27874cdbeb feat(host): support CTyunOS rootfs (#24612) 2026-04-02 17:47:56 +08:00
屈轩
904ed8dd3a fix(region): vendor update (#24610) 2026-04-02 10:34:51 +08:00
Zexi Li
dffac28e32 feat(llm): get available models from base_url (for ollama & openai) (#24608)
Co-authored-by: cwz <cwz_eikoh@163.com>
2026-04-01 15:44:30 +08:00
Zexi Li
aa17f76589 fix(monitor): update silent_period when channel is empty (#24602)
silent_period is stored as Frequency on the notification, not on the
alert itself. PostUpdate only called UpdateNotification (which recreates
notifications with the new silent_period) when Channel was non-empty.
When channel was an empty array, the silent_period update was silently
skipped. Add an else-if branch to directly update the existing
notifications' Frequency when silent_period changes but channel is empty.
2026-03-31 20:00:39 +08:00
Jian Qiu
3553263bb6 fix(host): use findmnt instead of df to detect local mount point (#24599)
Co-authored-by: Haibersut <117586514+Haibersut@users.noreply.github.com>
2026-03-31 18:06:40 +08:00
Zexi Li
4f693c4641 feat(monitor): add batch resource metrics query API (#24596)
Add unifiedmonitor class action `resource-metrics` with client options/CLI command.
Implement host/guest metric drivers to query cpu/mem/disk/net rates and attach alert state.
2026-03-31 17:44:35 +08:00
Jian Qiu
11be1de968 fix: support build specific multi-arch buildx (#24588)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-03-31 17:43:09 +08:00
Jian Qiu
e1d108a7f0 fix: add customer usable filters that filter noaddr networks (#24585)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-03-31 17:27:47 +08:00
Zexi Li
ee98c29d9a fix(host): use proper shell quoting in pod tar/find commands (#24592)
Add shellQuote helper that safely escapes single quotes and apply it
consistently across tarGzDir and tarHostDir to prevent shell injection
via crafted paths, directory names, or exclude patterns.
2026-03-31 12:04:07 +08:00
Zexi Li
846ba369ac fix(host): get pod status by primary container status (#24581) 2026-03-30 16:21:18 +08:00
wanyaoqi
c61f5113d2 fix(host): add ovmf 4m code (#24575) 2026-03-30 07:54:08 +08:00
Zexi Li
e205da2232 fix(llm): 修复 llm 镜像没有根据 sku 更新的问题 (#24572) 2026-03-26 21:38:21 +08:00
屈轩
225de2334e fix(logger): add syslog init log (#24555) 2026-03-26 18:11:22 +08:00
wanyaoqi
9bb31f4b33 fix(region): validate kickstart enabled (#24558) 2026-03-26 18:09:41 +08:00
Zexi Li
9eaa72993b fix(region): order containers by created_at time (#24567) 2026-03-26 12:16:31 +08:00
Zexi Li
fb8a339cbb fix(keystone): allow blob update for image credentials (#24564)
Also fix type check to allow secret/image only.
2026-03-26 11:41:13 +08:00
屈轩
057e5ebeaa fix(region): add domain container usage (#24562) 2026-03-25 18:26:39 +08:00
Zexi Li
b1f7890324 fix(vllm): user customize args & health check in hostlocal net (#24553)
Co-authored-by: cwz <cwz_eikoh@163.com>
2026-03-25 10:36:46 +08:00
wanyaoqi
c1edcf27fe fix(host): metadata handler proxy telegraf data fix tenant_id (#24544)
* fix(host): metadata handler proxy telegraf data

* fix(host): append unknown dmesg to last entry
2026-03-25 10:34:09 +08:00
Jian Qiu
b45a5f7f9d fix: lbagent genHaproxyConfig possible nil pointer panic (#24537)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-03-25 10:32:41 +08:00
Jian Qiu
d73d3e0108 fix(hostmetrics): add checks for incomplete pod and container stats (#24549)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-03-25 10:31:07 +08:00
屈轩
84bbe1bfc1 fix(region): add container usage (#24542) 2026-03-25 10:23:27 +08:00
屈轩
b9ef8476f2 fix(host-image): update script for riscv64 host-image (#24535) 2026-03-24 11:37:36 +08:00
Zexi Li
7c26ab8db3 fix(host): probing multiple container status (#24529) 2026-03-24 10:27:06 +08:00
wanyaoqi
ab7210c6b6 fix(host): dd zero to lv wife partitions on lvremove (#24525) 2026-03-23 19:02:16 +08:00
wanyaoqi
c4a6c9ff8a fix(host-deployer): resizefs add fstype LVM2_member (#24516) 2026-03-23 00:00:17 +08:00
wanyaoqi
ec315b5516 fix(region): check instance snapshot joint is nil on snapshot purge (#24513) 2026-03-22 23:59:17 +08:00
屈轩
cb266540a1 fix(apigateway): stream download content-type (#24508) 2026-03-20 13:41:40 +08:00
Jian Qiu
64c362f20f feature: support host-local wire (#24497)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-03-20 01:36:42 +08:00
wanyaoqi
603f591ebf Cherry pick of #23094 upstream release 4.0 1770106850 (#24452)
* feat(region, climc): Add kickstart parameters and metadata

- Add kickstart parameters and metadata support
- Add kickstart CLI options and management commands
- Set kickstart metadata in PostCreate
- Add related kickstart metadata fields

* feat(host): Implement automated VM installation

- Mounts the installation ISO to a unique temp path, reusing existing mounts.
- Extracts kernel (`vmlinuz`, `initrd`) to configure QEMU boot.
- Injects kernel parameters to trigger the autoinstall.
- Add kickstart configuration validation.

Modified `guestLauncher` script to handle kernel parameters with spaces
that were previously truncated by the Python script.

* feat(host): Implement Kickstart monitoring

- Automatically updates the VM status upon
receiving `KICKSTART_SUCCESS` or `KICKSTART_FAILED` signals.
- On success, cleans up temporary mount points
and restarts the server via the Region API.

* feat(region): add kickstart type metadata

Adds the `VM_METADATA_KICKSTART_TYPE` to distinguish between
kickstart configurations passed by URL or by direct content.

* feat(host): Handle kickstart installing and timeout

- Set status to 'installing' upon successful kickstart boot
- Handle KICKSTART_INSTALLING serial message for status updates
- Add timeout handling for kickstart status monitoring

* feat(host): provide Kickstart config via content

Embed the provided config content as a file in a
labeled ISO (mkisofs), then mount the ISO during
the Kickstart installation to supply the config.

* refactor(host): Enhance the kickstart installation

- Integrates kickstart status directly into the VM status, replacing metadata.
- Unifies locations for kickstart logs and temporary files.
- Uses regex for more robust status matching.
- Moves helper functions to `kickstart_helper.go`.
- Fixes an incorrect kickstart configuration filename.
- Adjusts kickstart logging.

* feat(region, host): add kickstart support for openEuler

* refactor(host): extract kickstart cleanup function

* feat(region, climc): add kickstart-complete cli

Add this command to manually update the kickstart status and
reboot VM if needed. This is mainly used by users to manually
update the kickstart status when kickstart status detection is abnormal.

* refactor(region): reduce code duplication in Kickstart validation

- unify two validateKickstartConfig functions
- extract determineKickstartType function for type determination

* fix(region, host): fix kickstart auto-reboot

- Adjusted the timing of setting the status to
`kickstart_pending` to avoid incorrect reboot checks
- Skip setting kickstart if the status is already
`kickstart_completed` to prevent unnecessary reboots
- Added cleanup of kickstart files upon VM deletion

* feat(host): download kickstart config from URL

- download content when passing config via URL
- unified boot parameters

* feat(host): copy kickstart kernel files

* feat(host): ensure kickstart completion signal in config

---------

Co-authored-by: happygame <happygame1024@gmail.com>
2026-03-20 01:35:27 +08:00
wanyaoqi
9142916763 Fix/host deployer nbd driver40 (#24456)
* fix(host-deployer): nbd add concurrency control

* fix(host-deployer,glance): windows image add current version
2026-03-20 01:32:08 +08:00
Zexi Li
ef6241ac9b feat(llm): unify container access url info and login response (#24504) 2026-03-19 23:06:31 +08:00
wanyaoqi
508d4f7713 fix(host-deployer): get resize dev by serial panic (#24446) 2026-03-19 23:03:34 +08:00
cwz_eikoh
e3548b1830 Automated cherry pick of #24471: Feature(mcp): support x-api-key authentication for mcp-server (#24500)
* feat(mcp-server): support base64 ak/sk

* fix(mcp-agent): try to fix route of default-mcp-tools
2026-03-19 15:04:45 +08:00
cwz_eikoh
e3e04ab29d feat(llm): support model import for vllm (#24503) 2026-03-19 15:03:49 +08:00
wanyaoqi
8e83889c9f Automated cherry pick of #24473: fix(glance): cache images to ceph add brand filter (#24479)
* fix(glance): cache images to ceph add brand filter

* fix(region): iso image support default uefi boot mod
2026-03-19 11:45:43 +08:00
Jian Qiu
4314497e88 fix: logger add app-options-show api (#24493)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-03-19 11:43:55 +08:00
屈轩
f5beef50f5 fix(region): allow set disk auto-delete attribute (#24488) 2026-03-19 10:27:57 +08:00
Zexi Li
3e925b6d95 fix(llm): derive openclaw auth password from llm id (#24480) 2026-03-18 19:01:02 +08:00
屈轩
db451719dd fix(region): vendor update (#24485) 2026-03-18 18:52:18 +08:00
wanyaoqi
25fbf463bc fix(baremetal-agent): bm register reuse baseprepare updateBmInfo (#24474) 2026-03-18 10:10:31 +08:00
Zexi Li
bc9c5cf088 fix(monitor): align multi-metric alert conditions in notifications (#24468) 2026-03-17 15:57:19 +08:00
屈轩
5476c43cda fix: add more log info (#24461) 2026-03-17 14:38:57 +08:00
Zexi Li
354e3cd872 feat(llm): add llm_types filters and cleanup dify cli (#24457) 2026-03-16 17:01:36 +08:00
Zexi Li
8c6167bb7b feat(llm): 调整 openclaw 容器与 LLM 基础模型/sku 逻辑 (#24453) 2026-03-16 16:19:40 +08:00
Zexi Li
ace220a0ca fix(llm): mount openclaw home dir (#24449) 2026-03-13 20:38:28 +08:00
屈轩
f1df0e3ac1 fix(region): avoid delete ksyun vm error (#24441) 2026-03-13 15:23:11 +08:00
Jian Qiu
39f3853f3e fix: compat fixes for container host in vm (#24439)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-03-13 13:26:42 +08:00
cwz_eikoh
2c59756f75 Automated cherry pick of #24338: feat(llm): init vllm as llm_container (#24437)
* feat(llm): init vllm as llm_container

* feat(vllm): fix save-instant-model for vllm

* feat(llm): support quick-model for vllm

* feat(vllm): support preferred-model in llm

* fix(llm): add ValidateSpec in llm_container_driver

* feat(vllm): auto-set vllm params
2026-03-13 11:07:19 +08:00
Zexi Li
6c98f46671 feat(host): rotate container logs (#24432) 2026-03-12 15:14:49 +08:00
Zexi Li
25d1965950 feat(llm): add login-info api (#24429) 2026-03-12 07:20:43 +08:00
wanyaoqi
620814527a fix(region): guestnetworksecgroup list add network info (#24392) 2026-03-11 19:31:46 +08:00
wanyaoqi
c32b6792d9 fix(host): check file exist before copy ovmf vars (#24365) 2026-03-11 19:29:25 +08:00
Zexi Li
88f9b71e53 feat(llm): restart action (#24426) 2026-03-11 19:07:39 +08:00
屈轩
90cc427ad5 fix(cloudmon): update volc api (#24423) 2026-03-11 16:54:44 +08:00
Zexi Li
81d1308ddd openclaw llm agent (#24411)
* support comfyui and openclaw

feat(region,host): support env credential of container

feat(llm): openclaw url

* fix(region): delete server without host_id

* feat(llm): llm spec
2026-03-11 15:21:10 +08:00
屈轩
6b83d6148f fix(monitor): add vm out bandwidth metric (#24417) 2026-03-11 13:49:55 +08:00
屈轩
f2e3713e04 fix(region): vendor update (#24413) 2026-03-11 11:03:18 +08:00
屈轩
86ce69b4a1 fix(region): persistence server status change (#24409) 2026-03-10 15:06:47 +08:00
Zexi Li
804cbbfd45 Automated cherry pick of #24399: feat(llm): polymetric dify with llm (#24405)
* feat(llm): polymetric dify with llm

* fix(llm): drop LLMSpecHolder & fix some bugs

---------

Co-authored-by: cwz <cwz_eikoh@163.com>
2026-03-10 10:23:44 +08:00
Zexi Li
93820a5af4 fix(region): associate eip to pod (#24402) 2026-03-09 15:23:57 +08:00
Zexi Li
6eca607a9b fix(monitor): 仅在 From/To/Interval 为空时设置默认值 (#24395)
setDefaultValue 中 From、To、Interval 改为仅在当前值为空时
才用 inputQuery 覆盖,避免覆盖用户已指定的查询时间范围与间隔
2026-03-06 19:13:10 +08:00
Zexi Li
b7d7a1aa16 fix(host): hard code start index of va gpu 2026-03-05 11:49:02 +08:00
Zexi Li
5b4f6f1f72 feat(host): cgroupv2 implemented for pod (#24116) 2026-03-04 11:21:42 +08:00
cwz_eikoh
64d3842c93 Automated cherry pick of #24355: fix: some bugs in mcp-agent & llm (#24383)
* fix(mcp-agent): encoding issue when simulated streaming

* fix(mcp-agent): use chat-stream in phase tool-choose

* fix(mcp-agent): support reasoning model

* fix(llm): add pre-delete detection

* feat(mcp-agent): add default mcp-agent

* feat(mcp-agent): add default-mcp-tools
2026-03-03 16:08:22 +08:00
cwz_eikoh
6a7904788a Automated cherry pick of #24354: feat(mcp-server): add mcp-server config (#24385)
* feat(mcp-server): add mcp-server config

* fix(mcp-agent): add claude mcp-server-config
2026-03-03 16:06:15 +08:00
屈轩
30cb39af98 fix(esxi-agent): vendor update for rebuild root fail (#24380) 2026-03-03 00:17:06 +08:00
Zexi Li
acb62fc773 feat(monitor): support disable_notify_recovery for commonalert (#24375) 2026-03-02 16:12:49 +08:00
屈轩
9f4f88fc62 fix(region): check bind disk resource (#24372) 2026-03-02 12:02:53 +08:00
屈轩
bcc6800988 fix(region): snapshot size opslog (#24369) 2026-02-28 16:38:29 +08:00
屈轩
520ecda36b fix(region): avoid sync remove disk (#24362) 2026-02-27 15:06:05 +08:00
屈轩
ad4ee389e5 fix(ansibleserver): update telegraf (#24359) 2026-02-27 14:06:40 +08:00
Jian Qiu
0ff2ef0e19 fix: allow uncache deleted image (#24349)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-02-26 23:08:24 +08:00
wanyaoqi
d7b099efa0 fix(host): add guest max mem size options (#24342) 2026-02-26 20:26:41 +08:00
Zexi Li
0096082472 fix(monitor): convert SNodeAlert to SCommonAlert in FetchCustomizeColumns (#24344)
Pass cObjs of type *SCommonAlert to SCommonAlertManager.FetchCustomizeColumns
instead of *SNodeAlert so the parent correctly fetches common alert columns.
2026-02-25 19:31:51 +08:00
Jian Qiu
479e8e1b3a fix: keep climc network-create backward compatibility (#24340)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-02-25 09:03:12 +08:00
屈轩
df2a6d6170 fix(region): avoid account sync cost time abnormal (#24336) 2026-02-24 17:34:02 +08:00
Jian Qiu
b6e11061ef fix: instance snapshot virtual size (#24328)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-02-24 09:23:14 +08:00
Zexi Li
8ce635a36a fix(region): wrong args type on callback function of DiskCreateTask (#24330) 2026-02-13 17:05:22 +08:00
Zexi Li
fbd83ed9b0 fix(host): do not set cached image status to active for TGZ on host (#24324)
TGZ images are unpacked after fetch on host; leave status update to region
StorageCacheImageTask so cachedimage becomes active only in OnCacheSucc.
2026-02-13 10:04:49 +08:00
Jian Qiu
4bb85225b0 fix: ensure s3 client init for s3 storage driver (#24321)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-02-12 10:01:12 +08:00
Zexi Li
e1c2b122b1 feat(region,host): support post overlay uppper config (#24287) 2026-02-11 16:57:04 +08:00
屈轩
5a49aa6a3c fix(yunionconf): policy scope (#24314) 2026-02-11 11:23:51 +08:00
wanyaoqi
3e557a8eb9 fix(host): set dmesg parse failed log level to debug (#24309) 2026-02-11 00:59:35 +08:00
wanyaoqi
39b64b8edd fix(host-deployer): deploy single disk has no disk id (#24304) 2026-02-10 19:35:45 +08:00
wanyaoqi
1b36450a7c fix(host-deployer): online resize loop dev (#24301)
* fix(host-deployer): online resize loop dev

* fix(host-deployer): update host-deployer-base
2026-02-10 17:07:51 +08:00
Zexi Li
11ca895482 feat(monitor): support alert reason notification (#24290)
* feat(monitor): support alert reason notification

* fix(climc): commonalert list options
2026-02-10 09:06:24 +08:00
Jian Qiu
48b438d37b fix: guest syncstatus subtask for disk create task (#24292)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-02-10 09:03:19 +08:00
屈轩
99e582286c fix(notify): notify receiver (#24297) 2026-02-09 20:42:39 +08:00
Jian Qiu
42da4e038c fix: remove parent task info from task context (#24283)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-02-09 13:22:02 +08:00
wanyaoqi
33b60e4bc6 fix(host): add device_id only scsi-hd device (#24279) 2026-02-09 11:26:45 +08:00
wanyaoqi
7cc035a767 fix(host): deploy nics config defore do add nics (#24276) 2026-02-09 08:38:35 +08:00
Jian Qiu
f84b8f1a65 fix: unify lb charge type (#24272)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-02-08 18:43:14 +08:00
Jian Qiu
1659268809 feature: support postpaid traffic metering (#24269)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-02-08 12:57:45 +08:00
wanyaoqi
73f71776de feat(region,host,vpcagent): allow guest network dedicate secgroups (#24261) 2026-02-07 17:31:44 +08:00
wanyaoqi
cebeaae9d0 fix(region,host): rbd snapshot get actual size (#24240)
- add host down and auto migrate notification
2026-02-07 17:30:54 +08:00
屈轩
8b3b1a0ab6 fix(region): vendor update (#24265) 2026-02-07 13:52:06 +08:00
wanyaoqi
1479e5da3e fix(region,host): rename screen dump info structure (#24258) 2026-02-06 18:08:50 +08:00
cwz_eikoh
0b229dc00a fix(llm): add handler in apigateway for mcp-agent-chat (#24254) 2026-02-05 18:16:46 +08:00
屈轩
60da86e645 fix(region): snapshot policy operation (#24249) 2026-02-05 16:40:33 +08:00
wanyaoqi
987fca770c fix(glance): set s3 bucket name before s3 init check (#24237) 2026-02-04 23:07:33 +08:00
屈轩
ee161f21b0 fix(yunionconf): support tags (#24231) 2026-02-04 17:13:59 +08:00
屈轩
1d898e52a7 fix(region): public cloud sku create (#24226) 2026-02-04 14:56:55 +08:00
屈轩
873006650f fix(region): support cloudpods vm disk driver (#24221) 2026-02-04 14:28:09 +08:00
Zexi Li
24dda38605 fix(region,climc): persist netinterface vlan_id to hostnetwork (#24213)
- climc: add VlanId to host-add-netif, host-remove-netif, host-enable-netif,
  host-disable-netif
- region: set bn.VlanId from netif.VlanId when attaching to network
- mcclient: include Vlan_ID in baremetalnetworks list columns
2026-02-04 11:03:12 +08:00
屈轩
cc3a74b2f9 fix(host): support skip check kernel mod (#24218) 2026-02-04 10:30:02 +08:00
屈轩
522ca973f2 fix(region): avoid duplicate check when update account aksk (#24209) 2026-02-03 20:53:12 +08:00
Zexi Li
3e982a7438 Automated cherry pick of #24194: Fix(llm): some mistakes, use CmpId & InstantModelId insteadof SvrId & ModelId (#24205)
* fix(llm): some mistakes

* fix(llm): use CmpId instead of SvrId

* fix(llm): instant_model use id instead of modelId

---------

Co-authored-by: cwz <cwz_eikoh@163.com>
2026-02-03 16:46:07 +08:00
Zexi Li
05bb19c5a6 fix(monitor): comparator string (#24202) 2026-02-03 12:01:41 +08:00
屈轩
9489b6baa4 fix(region): init snapshot policy disk table (#24198) 2026-02-02 20:38:49 +08:00
wanyaoqi
e86609c969 fix(host): guestnetworksync do nothing on detach vfio nic (#24178) 2026-02-02 20:18:05 +08:00
Jian Qiu
8e1c23ec2e fix: allow guestnetwork ip4 addr field nullable (#24191)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-02-02 20:16:29 +08:00
Zexi Li
6b68d880c7 feat(monitor): add the registered model manger function (#24153) 2026-02-02 17:50:46 +08:00
屈轩
3f0c52be68 fix(climc): sku create support arch (#24186) 2026-02-02 14:17:08 +08:00
屈轩
9204340b38 fix(notify): support webhook sign (#24182) 2026-02-02 12:53:55 +08:00
wanyaoqi
c005337eed Automated cherry pick of #24126: feat(region,host): riscv64 cpu arch support (#24174)
* feat(region,host): riscv64 cpu arch support

* fix(region,host): compatible riscv64

* fix(host): add qemu v10.0.7 support
2026-02-01 20:27:12 +08:00
wanyaoqi
7d4245c677 fix(host): live migrate add timeout (#24162) 2026-02-01 20:24:00 +08:00
wanyaoqi
5341c97ccf fix(region): server add set network num queues (#24166) 2026-02-01 20:12:39 +08:00
wanyaoqi
a1bfcc1d9f fix(glance): set glance s3 bucket name default onecloud-images (#24171) 2026-02-01 20:10:57 +08:00
屈轩
e1730556e1 fix(region): defer ctx cancel (#24156) 2026-01-30 19:11:58 +08:00
cwz_eikoh
f2cc3f0c18 Automated cherry pick of #24149: Fix(llm): fix bugs & apikey encrypt & support history for mcp-agent-chat & delete modelname in llmSku (#24150)
* fix(llm): mcp-agent apiKey encrypt

* fix(llm): error-handle when instant-model import

* feature(llm): add get-available-network for llm

* feature(llm): support history for mcp-agent-chat

* fix(llm): llm create with net instead of networktype & networkid

* fix(llm): delete modelName in llmSku & fix some bugs
2026-01-29 10:50:11 +08:00
wanyaoqi
cd755ba02b fix(region): have agent add check is telegraf deployed (#24145) 2026-01-29 10:34:13 +08:00
屈轩
86ffcde03a fix(region): billing resource create time (#24140) 2026-01-28 19:59:48 +08:00
屈轩
fa08f8fd8f fix(glance): support prob iso image (#24133) 2026-01-28 15:28:56 +08:00
Zexi Li
7f54e038c0 fix(llm): add community-registry api (#24130) 2026-01-28 14:30:43 +08:00
Jian Qiu
d83585f158 fix: skip baremetal-agent riscv64 (#24123)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2026-01-24 20:33:16 +08:00
屈轩
855afe6dc5 fix(region): vendor update (#24118) 2026-01-23 17:03:32 +08:00
屈轩
784efcf211 fix(region): cloudpods container sync (#24113) 2026-01-21 15:33:40 +08:00
6042 changed files with 786138 additions and 276011 deletions

View File

@@ -260,7 +260,7 @@ dep:
@echo "$$depDeprecated"
@$(MAKE) mod
RELEASE_BRANCH:=release/4.0
RELEASE_BRANCH:=release/4.0.3
GOPROXY ?= direct
mod:

View File

@@ -2,7 +2,7 @@ FROM registry.cn-beijing.aliyuncs.com/yunionio/ansibleserver-base:3.22.2-0
# https://github.com/yunionio/telegraf/blob/yn-release-1.36/Makefile.yn#L28
# install playbook and telegraf install pkg
COPY --from=registry.cn-beijing.aliyuncs.com/yunionio/file-repo:v0.5.2 /opt/yunion/playbook /opt/yunion/playbook
COPY --from=registry.cn-beijing.aliyuncs.com/yunionio/file-repo:v0.5.2 /opt/yunion/ansible-install-pkg /opt/yunion/ansible-install-pkg
COPY --from=registry.cn-beijing.aliyuncs.com/yunionio/file-repo:v0.5.3 /opt/yunion/playbook /opt/yunion/playbook
COPY --from=registry.cn-beijing.aliyuncs.com/yunionio/file-repo:v0.5.3 /opt/yunion/ansible-install-pkg /opt/yunion/ansible-install-pkg
ADD ./_output/alpine-build/bin/ansibleserver /opt/yunion/bin/ansibleserver

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.5.3
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.5.9
LABEL maintainer="Yaoqi Wan wanyaoqi@yunionyun.com"

View File

@@ -71,18 +71,6 @@ glance-base-3-22-2:
$(DOCKER_BUILDX)/glance-base:$(GLANCE_BASE_VERSION_3-22-2) -f ./Dockerfile.glance-base .
HOST_IMAGE_VERSION ?= v1.0.2
HOST_IMAGE_NAME = $(REGISTRY)/host-image:$(HOST_IMAGE_VERSION)
host-image:
docker pull $(HOST_IMAGE_NAME)-amd64 --platform amd64
docker pull $(HOST_IMAGE_NAME)-arm64 --platform arm64
docker manifest create $(HOST_IMAGE_NAME) \
$(HOST_IMAGE_NAME)-amd64 \
$(HOST_IMAGE_NAME)-arm64
docker manifest annotate $(HOST_IMAGE_NAME) $(HOST_IMAGE_NAME)-amd64 --arch amd64
docker manifest annotate $(HOST_IMAGE_NAME) $(HOST_IMAGE_NAME)-arm64 --arch arm64
docker manifest push $(HOST_IMAGE_NAME)
LBAGENT_BASE_VERSION = v0.0.5
lbagent-base:
$(DOCKER_BUILDX)/lbagent-base:$(LBAGENT_BASE_VERSION) -f ./Dockerfile.lbagent-base .

View File

@@ -2,7 +2,8 @@
触发时间: {{.start_time}}
报警级别: {{.level}}
触发条件: {{.description | unescaped}}
报警数量:{{len .matches}}
{{if .reason}}报警原因: {{.reason}}
{{end}}报警数量:{{len .matches}}
资源名称:{{.resource_name}}
详情地址: {{.web_url}}

View File

@@ -88,8 +88,19 @@
</tr>
<tr>
<td class="td">策略详情:</td>
<td>{{.description}}</td>
<td>
{{- range $i, $m := .matches -}}
{{- if $i}}<br/>{{end -}}
{{- $m.condition | unescaped -}}
{{- end -}}
</td>
</tr>
{{if .reason}}
<tr>
<td class="td">报警原因:</td>
<td>{{.reason}}</td>
</tr>
{{end}}
</table>
<table class="table" style="padding-top: 6px; padding-bottom: 10px;">
<tr>

View File

@@ -2,7 +2,8 @@ AlertName: {{.name}}
Time: {{.start_time}}
Level: {{.level}}
TriggerCondition: {{.description | unescaped}}
AlertCount: {{len .matches}}
{{if .reason}}Reason: {{.reason}}
{{end}}AlertCount: {{len .matches}}
ResourceName: {{.resource_name}}
WebUrl: {{.web_url}}

View File

@@ -88,8 +88,19 @@
</tr>
<tr>
<td class="td">Strategy details</td>
<td>{{.description}}</td>
<td>
{{- range $i, $m := .matches -}}
{{- if $i}}<br/>{{end -}}
{{- $m.condition | unescaped -}}
{{- end -}}
</td>
</tr>
{{if .reason}}
<tr>
<td class="td">Reason</td>
<td>{{.reason}}</td>
</tr>
{{end}}
</table>
<table class="table" style="padding-top: 6px; padding-bottom: 10px;">
<tr>

View File

@@ -103,4 +103,5 @@ func init() {
cmd.Perform("enable-image-cache", new(AgentEnableImageCacheOpt))
cmd.Perform("disable-image-cache", new(AgentDisableImageCacheOpt))
cmd.Delete(new(AgentDeleteOpt))
cmd.Get("app-options", &options.BaseIdOptions{})
}

View File

@@ -19,6 +19,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path"
"strings"
"github.com/ghodss/yaml"
@@ -31,6 +32,7 @@ import (
"yunion.io/x/onecloud/pkg/mcclient"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
options "yunion.io/x/onecloud/pkg/mcclient/options/compute"
"yunion.io/x/onecloud/pkg/util/fileutils2"
"yunion.io/x/onecloud/pkg/util/pod/stream/cp"
)
@@ -137,15 +139,18 @@ func init() {
return nil
})
R(new(options.ContainerCopyOptions), "container-cp", "Container copy", func(s *mcclient.ClientSession, opts *options.ContainerCopyOptions) error {
parts := strings.Split(opts.CONTAINER_ID_FILE, ":")
copyToContainer := func(s *mcclient.ClientSession, src, dst string, rawFile bool) error {
parts := strings.Split(dst, ":")
if len(parts) != 2 {
return fmt.Errorf("invalid container id: %s", opts.CONTAINER_ID_FILE)
return fmt.Errorf("invalid container id: %s", dst)
}
if opts.RawFile {
fr, err := os.Open(opts.SRC_FILE)
if rawFile {
if fileutils2.IsDir(src) {
return fmt.Errorf("source path cannot be a directory when raw file is true: %s", src)
}
fr, err := os.Open(src)
if err != nil {
return errors.Wrapf(err, "open file: %v", opts.SRC_FILE)
return errors.Wrapf(err, "open file: %v", src)
}
defer fr.Close()
if err := modules.Containers.CopyTo(s, parts[0], parts[1], fr); err != nil {
@@ -153,22 +158,24 @@ func init() {
}
return nil
} else {
return cp.NewCopy().CopyToContainer(s, opts.SRC_FILE, cp.ContainerFileOpt{
return cp.NewCopy().CopyToContainer(s, src, cp.ContainerFileOpt{
ContainerId: parts[0],
File: parts[1],
})
}
})
R(new(options.ContainerCopyOptions), "container-cp-from", "Container copy", func(s *mcclient.ClientSession, opts *options.ContainerCopyOptions) error {
parts := strings.Split(opts.SRC_FILE, ":")
}
copyFromContainer := func(s *mcclient.ClientSession, src, dst string, rawFile bool) error {
parts := strings.Split(src, ":")
if len(parts) != 2 {
return fmt.Errorf("invalid container id: %s", opts.CONTAINER_ID_FILE)
return fmt.Errorf("invalid container id: %s", src)
}
ctrId := parts[0]
ctrFile := parts[1]
destFile := opts.CONTAINER_ID_FILE
if opts.RawFile {
destFile := dst
if fileutils2.IsDir(destFile) {
destFile = path.Join(destFile, path.Base(ctrFile))
}
if rawFile {
fw, err := os.Create(destFile)
if err != nil {
return errors.Wrapf(err, "open file: %v", destFile)
@@ -184,5 +191,37 @@ func init() {
File: ctrFile,
}, destFile)
}
}
R(new(options.ContainerCopyOptions), "container-cp", "Container copy", func(s *mcclient.ClientSession, opts *options.ContainerCopyOptions) error {
if strings.Contains(opts.SRC, ":") && !strings.Contains(opts.DST, ":") {
// copy from container to host
err := copyFromContainer(s, opts.SRC, opts.DST, opts.RawFile)
if err != nil {
return errors.Wrapf(err, "copy from container to host")
}
return nil
} else if !strings.Contains(opts.SRC, ":") && strings.Contains(opts.DST, ":") {
// copy from host to container
err := copyToContainer(s, opts.SRC, opts.DST, opts.RawFile)
if err != nil {
return errors.Wrapf(err, "copy to container")
}
return nil
} else if strings.Contains(opts.SRC, ":") && strings.Contains(opts.DST, ":") {
// copy from container to container
return fmt.Errorf("copy from container to container is not supported")
} else {
return fmt.Errorf("copy between local files is not supported")
}
})
R(new(options.ContainerCopyFromOptions), "container-cp-from", "Container copy", func(s *mcclient.ClientSession, opts *options.ContainerCopyFromOptions) error {
err := copyFromContainer(s, opts.CONTAINER_ID_PATH, opts.DST_PATH, opts.RawFile)
if err != nil {
return errors.Wrapf(err, "copy from container to host")
}
return nil
})
}

View File

@@ -42,6 +42,12 @@ import (
func init() {
cmd := shell.NewResourceCmd(&modules.Disks)
cmd.List(&compute_options.DiskListOptions{})
cmd.Show(&compute_options.DiskIdOptions{})
cmd.Perform("public", &compute_options.DiskIdOptions{})
cmd.Perform("private", &compute_options.DiskIdOptions{})
cmd.Perform("syncstatus", &compute_options.DiskIdOptions{})
cmd.Perform("change-owner-candidate-domains", &compute_options.DiskIdOptions{})
cmd.Perform("disk-cancel-delete", &compute_options.DiskIdOptions{})
cmd.Perform("set-class-metadata", &options.ResourceMetadataOptions{})
cmd.Perform("rebuild", &compute_options.DiskRebuildOptions{})
cmd.Perform("migrate", &compute_options.DiskMigrateOptions{})
@@ -49,26 +55,6 @@ func init() {
cmd.Perform("change-billing-type", new(compute_options.DiskChangeBillingTypeOptions))
cmd.Perform("change-storage-type", &compute_options.DiskChangeStorageTypeOptions{})
type DiskDetailOptions struct {
ID string `help:"ID or Name of disk"`
}
R(&DiskDetailOptions{}, "disk-show", "Show details of disk", func(s *mcclient.ClientSession, args *DiskDetailOptions) error {
disk, e := modules.Disks.Get(s, args.ID, nil)
if e != nil {
return e
}
printObject(disk)
return nil
})
R(&DiskDetailOptions{}, "disk-cancel-delete", "Cancel pending delete disks", func(s *mcclient.ClientSession, args *DiskDetailOptions) error {
disk, e := modules.Disks.PerformAction(s, args.ID, "cancel-delete", nil)
if e != nil {
return e
}
printObject(disk)
return nil
})
type DiskDeleteOptions struct {
ID []string `help:"ID of disks to delete" metavar:"DISK"`
OverridePendingDelete bool `help:"Delete disk directly instead of pending delete" short-token:"f"`
@@ -97,25 +83,7 @@ func init() {
return nil
})
R(&DiskDetailOptions{}, "disk-public", "Make a disk public", func(s *mcclient.ClientSession, args *DiskDetailOptions) error {
disk, e := modules.Disks.PerformAction(s, args.ID, "public", nil)
if e != nil {
return e
}
printObject(disk)
return nil
})
R(&DiskDetailOptions{}, "disk-private", "Make a disk private", func(s *mcclient.ClientSession, args *DiskDetailOptions) error {
disk, e := modules.Disks.PerformAction(s, args.ID, "private", nil)
if e != nil {
return e
}
printObject(disk)
return nil
})
R(&DiskDetailOptions{}, "disk-metadata", "Get metadata of a disk", func(s *mcclient.ClientSession, args *DiskDetailOptions) error {
R(&compute_options.DiskIdOptions{}, "disk-metadata", "Get metadata of a disk", func(s *mcclient.ClientSession, args *compute_options.DiskIdOptions) error {
meta, e := modules.Disks.GetMetadata(s, args.ID, nil)
if e != nil {
return e
@@ -124,20 +92,11 @@ func init() {
return nil
})
R(&DiskDetailOptions{}, "disk-syncstatus", "Sync status for disk", func(s *mcclient.ClientSession, args *DiskDetailOptions) error {
ret, e := modules.Disks.PerformAction(s, args.ID, "syncstatus", nil)
if e != nil {
return e
}
printObject(ret)
return nil
})
type DiskUpdateOptions struct {
ID string `help:"ID or name of disk"`
Name string `help:"New name of disk"`
Desc string `help:"Description" metavar:"DESCRIPTION"`
AutoDelete string `help:"enable/disable auto delete of disk" choices:"enable|disable"`
AutoDelete string `help:"Set disk auto_delete (true/false or enable/disable)" choices:"true|false|enable|disable"`
AutoSnapshot string `help:"enable/disable auto snapshot of disk" choices:"enable|disable"`
DiskType string `help:"Disk type" choices:"data|volume|sys"`
IsSsd *bool `help:"mark disk as ssd" negative:"no-is-ssd"`
@@ -152,7 +111,7 @@ func init() {
params.Add(jsonutils.NewString(args.Desc), "description")
}
if len(args.AutoDelete) > 0 {
if args.AutoDelete == "enable" {
if args.AutoDelete == "enable" || args.AutoDelete == "true" {
params.Add(jsonutils.JSONTrue, "auto_delete")
} else {
params.Add(jsonutils.JSONFalse, "auto_delete")
@@ -301,7 +260,7 @@ func init() {
return nil
})
R(&DiskDetailOptions{}, "disk-change-owner-candidate-domains", "Get change owner candidate domain list", func(s *mcclient.ClientSession, args *DiskDetailOptions) error {
R(&compute_options.DiskIdOptions{}, "disk-change-owner-candidate-domains", "Get change owner candidate domain list", func(s *mcclient.ClientSession, args *compute_options.DiskIdOptions) error {
result, err := modules.Disks.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
if err != nil {
return err

View File

@@ -267,6 +267,7 @@ func init() {
Ip6Addr string `help:"IPv6 address"`
Bridge string `help:"Bridge of hostwire"`
Interface string `help:"Interface name, eg:eth0, en0"`
VlanId int `help:"Vlan ID"`
}
R(&HostAddNetIfOptions{}, "host-add-netif", "Host add a NIC", func(s *mcclient.ClientSession, args *HostAddNetIfOptions) error {
params := jsonutils.NewDict()
@@ -289,6 +290,7 @@ func init() {
if len(args.Interface) > 0 {
params.Add(jsonutils.NewString(args.Interface), "interface")
}
addVlanIdToParams(params, args.VlanId)
result, err := modules.Hosts.PerformAction(s, args.ID, "add-netif", params)
if err != nil {
return err
@@ -298,12 +300,14 @@ func init() {
})
type HostRemoveNetIfOptions struct {
ID string `help:"ID or Name of host"`
MAC string `help:"MAC of NIC to remove"`
ID string `help:"ID or Name of host"`
MAC string `help:"MAC of NIC to remove"`
VlanId int `help:"Vlan Id"`
}
R(&HostRemoveNetIfOptions{}, "host-remove-netif", "Remove NIC from host", func(s *mcclient.ClientSession, args *HostRemoveNetIfOptions) error {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString(args.MAC), "mac")
addVlanIdToParams(params, args.VlanId)
result, err := modules.Hosts.PerformAction(s, args.ID, "remove-netif", params)
if err != nil {
return err
@@ -319,6 +323,7 @@ func init() {
Ip6 string `help:"IPv6 address"`
Network string `help:"network to connect"`
Reserved bool `help:"fetch IP from reserved pool"`
VlanId int `help:"Vlan ID"`
}
R(&HostEnableNetIfOptions{}, "host-enable-netif", "Enable a network interface for a host", func(s *mcclient.ClientSession, args *HostEnableNetIfOptions) error {
params := jsonutils.NewDict()
@@ -337,6 +342,7 @@ func init() {
if len(args.Network) > 0 {
params.Add(jsonutils.NewString(args.Network), "network")
}
addVlanIdToParams(params, args.VlanId)
result, err := modules.Hosts.PerformAction(s, args.ID, "enable-netif", params)
if err != nil {
return err
@@ -349,6 +355,7 @@ func init() {
ID string `help:"ID or Name of host"`
MAC string `help:"MAC of NIC to disable"`
Reserve bool `help:"Reserve the IP address"`
VlanId int `help:"Vlan Id"`
}
R(&HostDisableNetIfOptions{}, "host-disable-netif", "Disable a network interface", func(s *mcclient.ClientSession, args *HostDisableNetIfOptions) error {
params := jsonutils.NewDict()
@@ -356,6 +363,7 @@ func init() {
if args.Reserve {
params.Add(jsonutils.JSONTrue, "reserve")
}
addVlanIdToParams(params, args.VlanId)
result, err := modules.Hosts.PerformAction(s, args.ID, "disable-netif", params)
if err != nil {
return err
@@ -697,3 +705,9 @@ func init() {
},
)
}
func addVlanIdToParams(params *jsonutils.JSONDict, vlanId int) {
if vlanId > 1 {
params.Add(jsonutils.NewInt(int64(vlanId)), "vlan_id")
}
}

View File

@@ -37,7 +37,7 @@ func init() {
return nil
})
R(&options.TagListOptions{}, "tag-list", "List tags", func(s *mcclient.ClientSession, opts *options.TagListOptions) error {
R(&options.TagListOptions{}, "service-metadata-list", "List service metadata", func(s *mcclient.ClientSession, opts *options.TagListOptions) error {
var mod modulebase.IResourceManager
switch opts.Service {
case "compute":

View File

@@ -98,6 +98,22 @@ func init() {
return nil
})
type NetworkCreate3Options struct {
compute_options.NetworkCreateOptions `start_ip->positional:"false" end_ip->positional:"false" net_mask->positional:"false"`
}
R(&NetworkCreate3Options{}, "network-create3", "Create a dual-stack virtual network", func(s *mcclient.ClientSession, args *NetworkCreate3Options) error {
params, err := args.Params()
if err != nil {
return err
}
net, err := modules.Networks.Create(s, params)
if err != nil {
return err
}
printObject(net)
return nil
})
type NetworkSplitOptions struct {
NETWORK string `help:"ID or name of network to split"`
IP string `help:"Start ip of the split network"`

View File

@@ -36,4 +36,7 @@ func init() {
cmd.Perform("change-owner", &options.SecgroupChangeOwnerOptions{})
cmd.Perform("import-rules", &options.SecgroupImportRulesOptions{})
cmd.PerformClass("clean", &options.SecgroupCleanOptions{})
scmd := shell.NewResourceCmd(&modules.Servernetworksecgroups)
scmd.List(&options.ServerNetworkSecgroupListOptions{})
}

View File

@@ -23,14 +23,20 @@ import (
"yunion.io/x/pkg/util/printutils"
"yunion.io/x/pkg/util/regutils"
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudcommon/cmdline"
"yunion.io/x/onecloud/pkg/mcclient"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/options"
compute_options "yunion.io/x/onecloud/pkg/mcclient/options/compute"
)
func init() {
cmd := shell.NewResourceCmd(&modules.ServerNetworkTrafficLogs)
cmd.List(new(compute_options.ServerNetworkTrafficLogListOptions))
type ServerNetworkListOptions struct {
options.BaseListOptions
Server string `help:"ID or Name of Server"`
@@ -138,7 +144,10 @@ func init() {
type ServerNetworkBWOptions struct {
SERVER string `help:"ID or Name of server"`
MACORIP string `help:"IP, Mac, or Index of NIC"`
BW int64 `help:"Bandwidth in Mbps"`
BW int64 `help:"Bandwidth in Mbps"`
Tx int64 `help:"Tx bandwidth in Mbps"`
Rx int64 `help:"Rx bandwidth in Mbps"`
}
R(&ServerNetworkBWOptions{}, "server-change-bandwidth", "Change server network bandwidth in Mbps", func(s *mcclient.ClientSession, args *ServerNetworkBWOptions) error {
params := jsonutils.NewDict()
@@ -156,6 +165,8 @@ func init() {
return fmt.Errorf("Please specify Ip or Mac")
}
params.Add(jsonutils.NewInt(args.BW), "bandwidth")
params.Add(jsonutils.NewInt(args.Tx), "tx_bw_limit")
params.Add(jsonutils.NewInt(args.Rx), "rx_bw_limit")
server, err := modules.Servers.PerformAction(s, args.SERVER, "change-bandwidth", params)
if err != nil {
return err

View File

@@ -30,6 +30,7 @@ import (
"yunion.io/x/pkg/util/printutils"
"yunion.io/x/onecloud/cmd/climc/shell"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
"yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
@@ -132,7 +133,12 @@ func init() {
cmd.BatchPerform("set-root-disk-matcher", &options.ServerSetRootDiskMatcher{})
cmd.Perform("disable-auto-merge-snapshot", &options.ServerDisableAutoMergeSnapshot{})
cmd.BatchPerform("set-tpm", &options.ServerSetTpmOptions{})
cmd.Perform("set-kickstart", &options.ServerKickstartConfigOptions{})
cmd.Perform("delete-kickstart", &options.ServerIdOptions{})
cmd.Perform("kickstart-complete", &options.ServerKickstartCompleteOptions{})
cmd.Get("kickstart", new(options.ServerIdOptions))
cmd.Get("vnc", new(options.ServerVncOptions))
cmd.Get("modification-types", new(options.ServerIdOptions))
cmd.Get("desc", new(options.ServerIdOptions))
cmd.Get("status", new(options.ServerIdOptions))
cmd.Get("iso", new(options.ServerIdOptions))
@@ -148,6 +154,10 @@ func init() {
cmd.Get("screen-dump-show", new(options.ServerScreenDumpOptions))
cmd.Get("numa-info", new(options.ServerIdOptions))
cmd.BatchPerform("screen-dump", new(options.ServerIdsOptions))
cmd.Perform("set-network-num-queues", new(options.ServerSetNetworkNumQueues))
cmd.Perform("set-network-secgroup", new(options.ServerNetworkSecGroupsOptions))
cmd.Perform("add-network-secgroup", new(options.ServerNetworkSecGroupsOptions))
cmd.Perform("revoke-network-secgroup", new(options.ServerNetworkSecGroupsOptions))
cmd.GetProperty(&options.ServerStatusStatisticsOptions{})
cmd.GetProperty(&options.ServerProjectStatisticsOptions{})
@@ -209,8 +219,10 @@ func init() {
params.Name = opts.NAME
params.AutoStart = opts.AutoStart
params.Eip = opts.Eip
params.EipChargeType = opts.EipChargeType
params.EipChargeType = billing_api.ParseNetChargeType(opts.EipChargeType)
params.EipBw = opts.EipBw
params.EipTxBw = opts.EipTxBw
params.EipRxBw = opts.EipRxBw
server, err := modules.Servers.Create(s, params.JSON(params))
if err != nil {

View File

@@ -54,7 +54,7 @@ type ImageOptionalOptions struct {
OsDist string `help:"Distribution name of OS" metavar:"OS_DISTRIBUTION"`
OsVersion string `help:"Version of OS"`
OsCodename string `help:"Codename of OS"`
OsArch string `help:"Os hardware architecture" choices:"x86|x86_64|aarch32|aarch64"`
OsArch string `help:"Os hardware architecture" choices:"x86|x86_64|aarch32|aarch64|riscv32|riscv64"`
OsLang string `help:"OS Language" choices:"zh_CN|en_US"`
Preference int64 `help:"Disk preferences"`
Notes string `help:"Notes about the image"`

View File

@@ -7,7 +7,7 @@ import (
)
func init() {
cmd := shell.NewResourceCmd(&modules.Difies)
cmd := shell.NewResourceCmd(&modules.LLMs).WithKeyword("dify")
cmd.BatchCreate(new(options.DifyCreateOptions))
cmd.List(new(options.DifyListOptions))
cmd.Show(new(options.DifyShowOptions))

View File

@@ -1,20 +0,0 @@
package llm
import (
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/llm"
base_options "yunion.io/x/onecloud/pkg/mcclient/options"
options "yunion.io/x/onecloud/pkg/mcclient/options/llm"
)
func init() {
cmd := shell.NewResourceCmd(&modules.DifySku)
cmd.List(new(options.DifySkuListOptions))
cmd.Show(new(options.DifySkuShowOptions))
cmd.Update(new(options.DifySkuUpdateOptions))
cmd.Create(new(options.DifySkuCreateOptions))
cmd.Delete(new(options.DifySkuDeleteOptions))
cmd.Perform("public", &base_options.BasePublicOptions{})
cmd.Perform("private", &base_options.BaseIdOptions{})
// cmd.Perform("clone", new(options.DesktopSkuCloneOptions))
}

View File

@@ -2,7 +2,6 @@ package llm
import (
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/llm"
commonoptions "yunion.io/x/onecloud/pkg/mcclient/options"
options "yunion.io/x/onecloud/pkg/mcclient/options/llm"
@@ -22,4 +21,7 @@ func init() {
cmd.Perform("public", new(commonoptions.BasePublicOptions))
cmd.Perform("private", new(commonoptions.BaseIdOptions))
cmd.PerformClass("import", new(options.LLMInstantModelImportOptions))
cmd.GetProperty(new(options.LLMInstantModelHuggingFaceSearchOptions))
cmd.GetProperty(new(options.LLMInstantModelHuggingFaceRepoInfoOptions))
cmd.GetProperty(new(options.LLMInstantModelCommunityRegistryOptions))
}

View File

@@ -11,13 +11,18 @@ func init() {
cmd.BatchCreate(new(options.LLMCreateOptions))
cmd.List(new(options.LLMListOptions))
cmd.Show(new(options.LLMShowOptions))
cmd.Update(new(options.LLMUpdateOptions))
cmd.Delete(new(options.LLMDeleteOptions))
// cmd.Perform("change-model", new(options.LLMChangeModelOptions))
cmd.Perform("syncstatus", new(options.LLMIdOptions))
cmd.BatchPerform("stop", new(options.LLMStopOptions))
cmd.BatchPerform("start", new(options.LLMStartOptions))
cmd.BatchPerform("restart", new(options.LLMRestartOptions))
cmd.Get("probed-models", new(options.LLMIdOptions))
cmd.Get("url", new(options.LLMIdOptions))
cmd.Get("login-info", new(options.LLMIdOptions))
cmd.Custom(shell.CustomActionGet, "available-network", new(options.LLMAvailableNetworkOptions))
cmd.PerformClass("provider-models", new(options.LLMProviderModelsOptions))
cmd.Perform("save-instant-model", new(options.LLMSaveInstantModelOptions))
cmd.Perform("quick-models", new(options.LLMQuickModelsOptions))
}

View File

@@ -7,6 +7,7 @@ import (
options "yunion.io/x/onecloud/pkg/mcclient/options/llm"
)
// llm-sku: unified SKU (ollama/vllm/dify). Create/update here for ollama|vllm; for dify use dify-sku or list with --llm-type dify.
func init() {
cmd := shell.NewResourceCmd(&modules.LLMSku)
cmd.List(new(options.LLMSkuListOptions))
@@ -16,5 +17,4 @@ func init() {
cmd.Delete(new(options.LLMSkuDeleteOptions))
cmd.Perform("public", &base_options.BasePublicOptions{})
cmd.Perform("private", &base_options.BaseIdOptions{})
// cmd.Perform("clone", new(options.DesktopSkuCloneOptions))
}

View File

@@ -4,7 +4,7 @@ import (
"bufio"
"fmt"
"io"
"net/url"
"net/http"
"strings"
"yunion.io/x/onecloud/cmd/climc/shell"
@@ -28,6 +28,7 @@ func init() {
// cmd.Get("chat-test", new(options.MCPAgentChatTestOptions))
cmd.Get("request", new(options.MCPAgentMCPAgentRequestOptions))
shell.R(&options.MCPAgentMCPAgentRequestOptions{}, "mcp-agent-chat", "Chat with MCP Agent (Stream)", chatStream)
shell.R(&options.MCPAgentDefaultChatOptions{}, "mcp-agent-chat-default", "Chat with default MCP Agent (Stream, no ID required)", chatStreamDefault)
}
func chatStream(s *mcclient.ClientSession, args *options.MCPAgentMCPAgentRequestOptions) error {
@@ -36,15 +37,24 @@ func chatStream(s *mcclient.ClientSession, args *options.MCPAgentMCPAgentRequest
return err
}
path := fmt.Sprintf("/mcp_agents/%s/chat-stream?message=%s", id, url.QueryEscape(args.Message))
bodyJSON, err := args.Params()
if err != nil {
return fmt.Errorf("failed to build request params: %v", err)
}
headers := http.Header{}
headers.Set("Content-Type", "application/json")
body := strings.NewReader(bodyJSON.String())
path := fmt.Sprintf("/mcp_agents/%s/chat-stream", id)
resp, err := s.RawVersionRequest(
modules.MCPAgent.ServiceType(),
modules.MCPAgent.EndpointType(),
"GET",
"POST",
path,
nil,
nil,
headers,
body,
)
if err != nil {
return err
@@ -79,3 +89,50 @@ func chatStream(s *mcclient.ClientSession, args *options.MCPAgentMCPAgentRequest
fmt.Println()
return nil
}
func chatStreamDefault(s *mcclient.ClientSession, args *options.MCPAgentDefaultChatOptions) error {
bodyJSON, err := args.Params()
if err != nil {
return fmt.Errorf("failed to build request params: %v", err)
}
headers := http.Header{}
headers.Set("Content-Type", "application/json")
body := strings.NewReader(bodyJSON.String())
path := "/mcp_agents/default/chat-stream"
resp, err := s.RawVersionRequest(
modules.MCPAgent.ServiceType(),
modules.MCPAgent.EndpointType(),
"POST",
path,
headers,
body,
)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
respBody, _ := io.ReadAll(resp.Body)
return fmt.Errorf("Error: %s %s", resp.Status, string(respBody))
}
scanner := bufio.NewScanner(resp.Body)
var eventData []string
for scanner.Scan() {
line := scanner.Text()
if line == "" {
if len(eventData) > 0 {
fmt.Print(strings.Join(eventData, "\n"))
eventData = nil
}
continue
}
if after, found := strings.CutPrefix(line, "data: "); found {
eventData = append(eventData, after)
}
}
if err := scanner.Err(); err != nil {
return err
}
fmt.Println()
return nil
}

View File

@@ -95,6 +95,7 @@ func init() {
"default",
"k8s",
"pod",
"ai",
"monitor",
"bingocloud",
"ksyun",
@@ -120,77 +121,89 @@ func init() {
Switch string `help:"Config feature on or off" choices:"on|off"`
}
configFeature := func(s *mcclient.ClientSession, name string, enable bool) error {
items, err := yunionconf.Parameters.List(s, jsonutils.Marshal(map[string]string{
"name": GlobalSettings,
"scope": "system"}))
if err != nil {
return errors.Wrapf(err, "get %s from yunionconf", GlobalSettings)
}
if len(items.Data) == 0 {
// create it if enabled
if enable {
value := []string{name}
if utils.IsInStringArray(name, storageFeatures) {
value = append(value, "storage")
}
input := map[string]interface{}{
"name": GlobalSettings,
"service_id": YunionAgent,
"value": NewGlobalSettingsValue(value, true),
}
params := jsonutils.Marshal(input)
if _, err := yunionconf.Parameters.Create(s, params); err != nil {
return errors.Errorf("create %s for feature %q", GlobalSettings, name)
}
return nil
} else {
return errors.Errorf("not found %s", GlobalSettings)
}
}
if len(items.Data) != 1 {
return errors.Errorf("found %d %q from yunionconf", len(items.Data), GlobalSettings)
}
// update it
ss := items.Data[0]
value, err := ss.Get("value")
if err != nil {
return errors.Wrap(err, "get value")
}
curConf := new(GlobalSettingsValue)
if err := value.Unmarshal(curConf); err != nil {
return errors.Wrapf(err, "unmarshal to GlobalSettingsValue: %s", value)
}
if !enable {
curConf.Switch(name, false)
} else {
curConf.Switch(name, true)
if utils.IsInStringArray(name, storageFeatures) {
curConf.Switch("storage", true)
}
}
id, err := ss.GetString("id")
if err != nil {
return errors.Errorf("get id from %s", ss)
}
ss.(*jsonutils.JSONDict).Set("value", jsonutils.Marshal(curConf))
obj, err := yunionconf.Parameters.Update(s, id, ss)
if err != nil {
return errors.Wrapf(err, "update %s(%s)", GlobalSettings, id)
}
printObject(obj)
return nil
}
featureR := func(name string) {
R(&FeatureCfgOpts{}, fmt.Sprintf("feature-config-%s", name), fmt.Sprintf("Set feature %s on or off", name), func(s *mcclient.ClientSession, args *FeatureCfgOpts) error {
enable := true
if args.Switch == "off" {
enable = false
}
items, err := yunionconf.Parameters.List(s, jsonutils.Marshal(map[string]string{
"name": GlobalSettings,
"scope": "system"}))
if err != nil {
return errors.Wrapf(err, "get %s from yunionconf", GlobalSettings)
}
if len(items.Data) == 0 {
// create it if enabled
if enable {
value := []string{name}
if utils.IsInStringArray(name, storageFeatures) {
value = append(value, "storage")
}
input := map[string]interface{}{
"name": GlobalSettings,
"service_id": YunionAgent,
"value": NewGlobalSettingsValue(value, true),
}
params := jsonutils.Marshal(input)
if _, err := yunionconf.Parameters.Create(s, params); err != nil {
return errors.Errorf("create %s for feature %q", GlobalSettings, name)
}
return nil
} else {
return errors.Errorf("not found %s", GlobalSettings)
}
}
if len(items.Data) != 1 {
return errors.Errorf("found %d %q from yunionconf", len(items.Data), GlobalSettings)
}
// update it
ss := items.Data[0]
value, err := ss.Get("value")
if err != nil {
return errors.Wrap(err, "get value")
}
curConf := new(GlobalSettingsValue)
if err := value.Unmarshal(curConf); err != nil {
return errors.Wrapf(err, "unmarshal to GlobalSettingsValue: %s", value)
}
if !enable {
curConf.Switch(name, false)
} else {
curConf.Switch(name, true)
if utils.IsInStringArray(name, storageFeatures) {
curConf.Switch("storage", true)
}
}
id, err := ss.GetString("id")
if err != nil {
return errors.Errorf("get id from %s", ss)
}
ss.(*jsonutils.JSONDict).Set("value", jsonutils.Marshal(curConf))
obj, err := yunionconf.Parameters.Update(s, id, ss)
if err != nil {
return errors.Wrapf(err, "update %s(%s)", GlobalSettings, id)
}
printObject(obj)
return nil
return configFeature(s, name, args.Switch != "off")
})
}
for _, name := range features {
featureR(name)
}
type FeatureConfigOpts struct {
FEATURE string `help:"Feature name to config"`
SWITCH string `help:"Config feature on or off" choices:"on|off"`
Force bool `help:"Skip checking whether feature is in the known list"`
}
R(&FeatureConfigOpts{}, "feature-config", "Set a feature on or off", func(s *mcclient.ClientSession, args *FeatureConfigOpts) error {
if !args.Force && !utils.IsInStringArray(args.FEATURE, features) {
return errors.Errorf("unknown feature %q, supported: %v (use --force to skip this check)", args.FEATURE, features)
}
return configFeature(s, args.FEATURE, args.SWITCH != "off")
})
}

View File

@@ -23,11 +23,15 @@ import (
"yunion.io/x/onecloud/pkg/apis"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules/cloudevent"
"yunion.io/x/onecloud/pkg/mcclient/modules/cloudid"
"yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/modules/devtool"
"yunion.io/x/onecloud/pkg/mcclient/modules/identity"
"yunion.io/x/onecloud/pkg/mcclient/modules/image"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
"yunion.io/x/onecloud/pkg/mcclient/modules/llm"
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
"yunion.io/x/onecloud/pkg/mcclient/modules/notify"
)
@@ -132,6 +136,26 @@ func init() {
manager: &notify.Tasks,
archivedManager: &notify.ArchivedTasks,
},
{
service: "monitor",
manager: &monitor.Tasks,
archivedManager: &monitor.ArchivedTasks,
},
{
service: "cloudid",
manager: &cloudid.Tasks,
archivedManager: &cloudid.ArchivedTasks,
},
{
service: "cloudevent",
manager: &cloudevent.Tasks,
archivedManager: &cloudevent.ArchivedTasks,
},
{
service: "llm",
manager: &llm.LLMTasks,
archivedManager: &llm.ArchivedLLMTasks,
},
}
for i := range cmds {
c := cmds[i]

View File

@@ -16,6 +16,8 @@ package misc
import (
"fmt"
"regexp"
"strings"
"yunion.io/x/cloudmux/pkg/cloudprovider"
"yunion.io/x/jsonutils"
@@ -30,6 +32,20 @@ import (
"yunion.io/x/onecloud/pkg/mcclient/modules/identity"
)
var (
noValidEndpointsForServiceInRegionRegex = regexp.MustCompile(`no valid \w+ endpoints`)
)
func isSkippableVersionErr(err error) bool {
cause := errors.Cause(err)
if cause == cloudprovider.ErrNotFound || cause == errors.ErrConnectRefused {
return true
}
msg := strings.ToLower(err.Error())
return strings.Contains(msg, "connect: connection refused") ||
strings.Contains(msg, "connection refused") || noValidEndpointsForServiceInRegionRegex.MatchString(msg)
}
func init() {
type VersionOptions struct {
SERVICE string `help:"Service type"`
@@ -104,7 +120,7 @@ func init() {
}
ver, err := modules.GetVersion(s, serviceType)
if err != nil {
if errors.Cause(err) == cloudprovider.ErrNotFound || errors.Cause(err) == errors.ErrConnectRefused {
if isSkippableVersionErr(err) {
continue
}
vers[serviceType] = err.Error()

View File

@@ -23,4 +23,5 @@ func init() {
cmd := NewResourceCmd(modules.MonitorResourceManager)
cmd.GetProperty(new(options.MonitorResourceJointAlertOptions))
cmd.List(new(options.MonitorResourceListOptions))
cmd.Perform("do-action", new(options.MonitorResourceDoActionOptions))
}

View File

@@ -41,4 +41,17 @@ func init() {
printObject(resp)
return nil
})
R(new(options.ResourceMetricsOptions), "monitor-resource-metrics", "Query batch resource metrics (cpu/mem/disk/net) and alert state", func(s *mcclient.ClientSession, opts *options.ResourceMetricsOptions) error {
input, err := opts.GetInput()
if err != nil {
return err
}
resp, err := monitor.UnifiedMonitorManager.PerformResourceMetrics(s, input)
if err != nil {
return errors.Wrap(err, "PerformResourceMetrics")
}
printObject(resp)
return nil
})
}

View File

@@ -27,4 +27,6 @@ func init() {
cmd.Update(new(options.TopicUpdateOptions))
cmd.Show(new(options.TopicOptions))
cmd.Delete(new(options.TopicOptions))
cmd.Perform("add-actions", new(options.TopicAddActionInput))
cmd.Perform("add-resources", new(options.TopicAddResourcesInput))
}

87
cmd/isocli/main.go Normal file
View File

@@ -0,0 +1,87 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
"fmt"
"os"
"yunion.io/x/pkg/util/shellutils"
"yunion.io/x/structarg"
_ "yunion.io/x/onecloud/cmd/isocli/shell"
)
type BaseOptions struct {
Debug bool `help:"debug mode"`
SUBCOMMAND string `help:"aliyuncli subcommand" subcommand:"true"`
}
func getSubcommandParser() (*structarg.ArgumentParser, error) {
parse, e := structarg.NewArgumentParserWithHelp(&BaseOptions{},
"isocli",
"Command-line ISO tools.",
`See "isocli COMMAND --help" for help on a specific command.`)
if e != nil {
return nil, e
}
subcmd := parse.GetSubcommand()
if subcmd == nil {
return nil, fmt.Errorf("No subcommand argument.")
}
for _, v := range shellutils.CommandTable {
_, e := subcmd.AddSubParserWithHelp(v.Options, v.Command, v.Desc, v.Callback)
if e != nil {
return nil, e
}
}
return parse, nil
}
func showErrorAndExit(e error) {
fmt.Fprintf(os.Stderr, "%s", e)
fmt.Fprintln(os.Stderr)
os.Exit(1)
}
func main() {
parser, e := getSubcommandParser()
if e != nil {
showErrorAndExit(e)
}
e = parser.ParseArgs(os.Args[1:], false)
if parser.IsHelpSet() {
fmt.Print(parser.HelpString())
return
}
subcmd := parser.GetSubcommand()
subparser := subcmd.GetSubParser()
if e != nil || subparser == nil {
if subparser != nil {
fmt.Print(subparser.Usage())
} else {
fmt.Print(parser.Usage())
}
showErrorAndExit(e)
}
suboptions := subparser.Options()
e = subcmd.Invoke(suboptions)
if e != nil {
showErrorAndExit(e)
}
}

82
cmd/isocli/shell/iso.go Normal file
View File

@@ -0,0 +1,82 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package shell
import (
"fmt"
"os"
"path/filepath"
"strings"
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/util/shellutils"
"yunion.io/x/onecloud/pkg/util/isoutils"
)
func init() {
type DetectOSOptions struct {
ISO string `help:"ISO file"`
}
shellutils.R(&DetectOSOptions{}, "detect", "Detect", func(args *DetectOSOptions) error {
stat, err := os.Stat(args.ISO)
if err != nil {
return err
}
if stat.IsDir() {
// 如果是目录,仅遍历一层目录下的 .iso 文件
entries, err := os.ReadDir(args.ISO)
if err != nil {
return err
}
for _, entry := range entries {
if entry.IsDir() {
continue // 跳过子目录
}
if strings.HasSuffix(strings.ToLower(entry.Name()), ".iso") {
path := filepath.Join(args.ISO, entry.Name())
fmt.Printf("Processing: %s\n", path)
f, err := os.Open(path)
if err != nil {
fmt.Printf("Error opening %s: %v\n", path, err)
continue // 继续处理其他文件
}
isoInfo, err := isoutils.DetectOSFromISO(f)
f.Close()
if err != nil {
fmt.Printf("Error detecting OS from %s: %v\n", path, err)
continue
}
fmt.Printf("%s: %s\n", path, jsonutils.Marshal(isoInfo))
}
}
return nil
}
// 如果是文件,按原逻辑处理
f, err := os.Open(args.ISO)
if err != nil {
return err
}
defer f.Close()
isoInfo, err := isoutils.DetectOSFromISO(f)
if err != nil {
return err
}
fmt.Printf("%s: %s\n", args.ISO, jsonutils.Marshal(isoInfo))
return nil
})
}

View File

@@ -18,18 +18,23 @@ import (
"bytes"
"fmt"
"io"
"math"
"os"
"os/exec"
"strconv"
"strings"
"syscall"
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/util/signalutils"
"yunion.io/x/pkg/utils"
"yunion.io/x/onecloud/pkg/hostman/isolated_device"
"yunion.io/x/onecloud/pkg/hostman/isolated_device/container_device"
"yunion.io/x/onecloud/pkg/hostman/options"
"yunion.io/x/onecloud/pkg/util/fileutils2"
"yunion.io/x/onecloud/pkg/util/sysutils"
)
@@ -39,10 +44,13 @@ type Daemon struct {
logDir string
pipeDir string
replicas int
mpsConfig map[string]int
replicas int
}
func NewDaemon(logDir, pipeDir string, replicas int) (*Daemon, error) {
func NewDaemon() (*Daemon, error) {
var pipeDir = options.HostOptions.CudaMPSPipeDirectory
var logDir = options.HostOptions.CudaMPSLogDirectory
if err := os.MkdirAll(pipeDir, 0755); err != nil {
return nil, fmt.Errorf("error creating directory %v: %s", pipeDir, err)
}
@@ -51,11 +59,37 @@ func NewDaemon(logDir, pipeDir string, replicas int) (*Daemon, error) {
return nil, fmt.Errorf("error creating directory %v: %s", logDir, err)
}
return &Daemon{
logDir: logDir,
pipeDir: pipeDir,
var mpsReplicas = -1
var mpsConfig = map[string]int{}
devCfg, err := parseContainerDeviceConfig()
if err != nil {
return nil, errors.Wrap(err, "parseContainerDeviceConfig")
}
for i := range devCfg.Devices {
if devCfg.Devices[i].Type == isolated_device.ContainerDeviceTypeNvidiaMps {
dev, err := container_device.NewPCIGPURenderBaseDevice(devCfg.Devices[i].Path, 0, isolated_device.ContainerDeviceTypeNvidiaMps)
if err != nil {
return nil, errors.Wrapf(err, "parse pci device %s", devCfg.Devices[i].Path)
}
if devCfg.Devices[i].VirtualNumber <= 0 {
return nil, errors.Errorf("Mps replicas must >= 0")
}
mpsConfig[dev.GetOriginAddr()] = devCfg.Devices[i].VirtualNumber
}
}
if len(mpsConfig) == 0 {
mpsConfig = nil
mpsReplicas = options.HostOptions.CudaMPSReplicas
if mpsReplicas <= 0 {
return nil, errors.Errorf("Mps replicas must >= 0")
}
}
replicas: replicas,
return &Daemon{
logDir: logDir,
pipeDir: pipeDir,
mpsConfig: mpsConfig,
replicas: mpsReplicas,
}, nil
}
@@ -123,23 +157,45 @@ func parseMemSize(memTotalStr string) (int, error) {
func (d *Daemon) Start() error {
// nvidia-smi --query-gpu=gpu_uuid,memory.total,compute_mode --format=csv
// GPU-76aef7ff-372d-2432-b4b4-beca4d8d3400, 23040 MiB, Exclusive_Process
out, err := exec.Command("nvidia-smi", "--query-gpu=index,memory.total,compute_mode", "--format=csv").CombinedOutput()
out, err := exec.Command("nvidia-smi", "--query-gpu=index,memory.total,compute_mode,gpu_bus_id", "--format=csv").CombinedOutput()
if err != nil {
return errors.Wrapf(err, "nvidia-smi failed %s", out)
}
log.Infof("mps config %#v", d.mpsConfig)
var devices = map[string]int{}
var devicesReplicas = map[string]int{}
var minReplias = math.MaxInt32
lines := strings.Split(string(out), "\n")
for _, line := range lines {
if strings.HasPrefix(line, "index") {
continue
}
segs := strings.Split(line, ",")
if len(segs) != 3 {
if len(segs) != 4 {
log.Errorf("unknown nvidia-smi out line %s", line)
continue
}
gpuIdx, memTotal, computeMode := strings.TrimSpace(segs[0]), strings.TrimSpace(segs[1]), strings.TrimSpace(segs[2])
gpuIdx, memTotal, computeMode, pciAddr := strings.TrimSpace(segs[0]), strings.TrimSpace(segs[1]), strings.TrimSpace(segs[2]), strings.TrimSpace(segs[3])
pciAddrSegs := strings.SplitN(pciAddr, ":", 2)
if len(pciAddrSegs) != 2 {
return fmt.Errorf("failed parse pciaddr %s", pciAddr)
}
pciAddr = pciAddrSegs[1]
log.Infof("start parse pciaddr %s", pciAddr)
if len(d.mpsConfig) > 0 {
replicas, ok := d.mpsConfig[pciAddr]
if !ok {
continue
}
if replicas < minReplias {
minReplias = replicas
}
devicesReplicas[gpuIdx] = replicas
} else {
devicesReplicas[gpuIdx] = d.replicas
minReplias = d.replicas
}
if computeMode != "Exclusive_Process" {
output, err := exec.Command("nvidia-smi", "-i", gpuIdx, "-c", "EXCLUSIVE_PROCESS").CombinedOutput()
if err != nil {
@@ -160,7 +216,7 @@ func (d *Daemon) Start() error {
return err
}
for deviceIdx, memory := range devices {
memLimit := memory / d.replicas
memLimit := memory / devicesReplicas[deviceIdx]
memLimitCmd := fmt.Sprintf("set_default_device_pinned_mem_limit %s %dM", deviceIdx, memLimit)
log.Infof("set device mem limit cmd: %s", memLimitCmd)
_, err := d.EchoPipeToControl(memLimitCmd)
@@ -168,8 +224,7 @@ func (d *Daemon) Start() error {
return fmt.Errorf("error set_default_device_pinned_mem_limit %s", err)
}
}
threadPercentageCmd := fmt.Sprintf("set_default_active_thread_percentage %d", 100/d.replicas)
threadPercentageCmd := fmt.Sprintf("set_default_active_thread_percentage %d", 100/minReplias)
_, err = d.EchoPipeToControl(threadPercentageCmd)
if err != nil {
return fmt.Errorf("error setting active thread percentage: %s", err)
@@ -186,6 +241,37 @@ func (d *Daemon) Stop() error {
return nil
}
func parseContainerDeviceConfig() (*isolated_device.ContainerDeviceConfiguration, error) {
devConfig, err := fileutils2.FileGetContents(options.HostOptions.ContainerDeviceConfigFile)
if err != nil {
return nil, err
}
obj, err := jsonutils.ParseYAML(devConfig)
if err != nil {
return nil, errors.Wrapf(err, "parse YAML content: %s", devConfig)
}
cfg := new(isolated_device.ContainerDeviceConfiguration)
if err := obj.Unmarshal(cfg); err != nil {
return nil, errors.Wrapf(err, "unmarshal object to ContainerDeviceConfiguration")
}
return cfg, nil
}
func GetCudaMpsReplicas() (int, error) {
if options.HostOptions.ContainerDeviceConfigFile != "" {
cfg, err := parseContainerDeviceConfig()
if err != nil {
return -1, err
}
for i := range cfg.Devices {
if cfg.Devices[i].Type == isolated_device.ContainerDeviceTypeNvidiaMps {
return cfg.Devices[i].VirtualNumber, nil
}
}
}
return options.HostOptions.CudaMPSReplicas, nil
}
func main() {
options.Init()
isRoot := sysutils.IsRootPermission()
@@ -194,13 +280,14 @@ func main() {
return
}
daemon, err := NewDaemon(
options.HostOptions.CudaMPSLogDirectory,
options.HostOptions.CudaMPSPipeDirectory,
options.HostOptions.CudaMPSReplicas,
)
if !options.HostOptions.EnableCudaMPS {
log.Infof("Cuda mps not enabled !!!")
return
}
daemon, err := NewDaemon()
if err != nil {
log.Fatalf("%s", err.Error())
log.Fatalf("NewDaemon %s", err)
return
}

View File

@@ -17,7 +17,11 @@ package main
import (
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain"
_ "github.com/coredns/coredns/plugin/acl"
_ "github.com/coredns/coredns/plugin/bind"
_ "github.com/coredns/coredns/plugin/bufsize"
_ "github.com/coredns/coredns/plugin/cache"
_ "github.com/coredns/coredns/plugin/cancel"
_ "github.com/coredns/coredns/plugin/chaos"
_ "github.com/coredns/coredns/plugin/debug"
_ "github.com/coredns/coredns/plugin/errors"
@@ -25,12 +29,18 @@ import (
_ "github.com/coredns/coredns/plugin/forward"
_ "github.com/coredns/coredns/plugin/health"
_ "github.com/coredns/coredns/plugin/hosts"
_ "github.com/coredns/coredns/plugin/loadbalance"
_ "github.com/coredns/coredns/plugin/local"
_ "github.com/coredns/coredns/plugin/log"
_ "github.com/coredns/coredns/plugin/metrics"
_ "github.com/coredns/coredns/plugin/loop"
_ "github.com/coredns/coredns/plugin/metrics" // prometheus
_ "github.com/coredns/coredns/plugin/nsid"
_ "github.com/coredns/coredns/plugin/proxy"
_ "github.com/coredns/coredns/plugin/ready"
_ "github.com/coredns/coredns/plugin/reload"
_ "github.com/coredns/coredns/plugin/rewrite"
_ "github.com/coredns/coredns/plugin/timeouts"
_ "github.com/coredns/coredns/plugin/trace"
_ "github.com/coredns/coredns/plugin/whoami"
_ "github.com/mholt/caddy/startupshutdown"
_ "yunion.io/x/onecloud/pkg/dns"
@@ -38,18 +48,31 @@ import (
)
var directives = []string{
"cancel",
"timeouts",
"reload",
"nsid",
"bufsize",
"bind",
"debug",
"trace",
"ready",
"health",
"prometheus",
"errors",
"log",
"local",
"chaos",
"loadbalance",
"cache",
"rewrite",
"acl",
"yunion",
"hosts",
"file",
"yunion",
"loop",
"forward",
"proxy",
"whoami",
"startup",
"shutdown",
}

View File

@@ -15,10 +15,18 @@ $ cd /root/cloudpods && make cmd/mcp-server
# 编写mcp-server服务的配置文件
$ mkdir -p /etc/yunion/mcp-server
# 编写配置文件注意根据实际情况修改Cloudpods API的认证信息
# 需要在系统内先创建mcp-server-admin用户并以admin角色加入到system项目
$ cat<<EOF >/etc/yunion/mcp-server/mcp-server.conf
# ==================== 服务器基础配置 ====================
address = '127.0.0.1'
port = 12001
admin_domain = Default
admin_password = X8SXBkwkK3WtbSUA
admin_project = system
admin_project_domain = Default
admin_user = mcp-server-admin
auth_url = https://<ip_or_domain_of_apigatway>:30500/v3
session_endpoint_type = public
# ==================== MCP 服务配置 ====================
@@ -26,9 +34,6 @@ mcp_server_name = cloudpods-mcp-server # MCP 服务名称默认cloudpod
mcp_server_version = 1.0.0 # MCP 服务版本默认1.0.0
mcp_server_description = the mcp server of the cloudpods server # MCP 服务描述(默认)
# ==================== 外部服务配置 ====================
identity_base_url = "https://<ip_or_domain_of_apigatway>/api/s/identity/v3" # 认证服务入口
```
2) 启动MCP Server服务

233
go.mod
View File

@@ -6,29 +6,33 @@ require (
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669
github.com/360EntSecGroup-Skylar/excelize v1.4.0
github.com/LeeEirc/terminalparser v0.0.0-20240205084113-fbf78c8480f2
github.com/Microsoft/go-winio v0.6.2
github.com/aliyun/alibaba-cloud-sdk-go v1.61.684
github.com/anacrolix/torrent v1.57.0
github.com/benbjohnson/clock v1.0.0
github.com/bitly/go-simplejson v0.5.0
github.com/c-bata/go-prompt v0.2.4
github.com/cheggaaa/pb/v3 v3.0.8
github.com/containerd/containerd v1.4.1
github.com/coredns/coredns v1.3.0
github.com/containerd/containerd v1.7.13
github.com/containerd/typeurl v1.0.2
github.com/coredns/caddy v1.1.1
github.com/coredns/coredns v1.10.1
github.com/coreos/go-iptables v0.6.0
github.com/creack/pty v1.1.18
github.com/docker/docker v17.12.0-ce-rc1.0.20200916142827-bd33bbf0497b+incompatible
github.com/docker/go-units v0.5.0
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96
github.com/eggsampler/acme/v3 v3.6.2
github.com/fernet/fernet-go v0.0.0-20180830025343-9eac43b88a5e
github.com/fsnotify/fsnotify v1.5.4
github.com/fsnotify/fsnotify v1.6.0
github.com/ghodss/yaml v1.0.0
github.com/gin-gonic/gin v1.7.7
github.com/go-ldap/ldap/v3 v3.1.5
github.com/go-yaml/yaml v2.1.0+incompatible
github.com/golang-plus/errors v1.0.0
github.com/golang-plus/uuid v1.0.0
github.com/golang/mock v1.4.4
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
github.com/google/cadvisor v0.38.5
github.com/google/cadvisor v0.46.0
github.com/google/gopacket v1.1.17
github.com/google/uuid v1.6.0
github.com/googollee/go-socket.io v0.0.0-20181214084611-0ad7206c347a
@@ -39,8 +43,9 @@ require (
github.com/influxdata/influxql v1.1.0
github.com/influxdata/promql/v2 v2.12.0
github.com/jaypipes/ghw v0.11.0
github.com/kdomanski/iso9660 v0.4.0
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c
github.com/lestrrat-go/jwx v1.0.2
github.com/lestrrat-go/jwx v1.2.25
github.com/lestrrat/go-jwx v0.0.0-20180221005942-b7d4802280ae
github.com/libvirt/libvirt-go-xml v5.2.0+incompatible
github.com/mark3labs/mcp-go v0.42.0
@@ -49,11 +54,14 @@ require (
github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7
github.com/mdlayher/packet v1.1.2
github.com/mholt/caddy v0.10.11
github.com/miekg/dns v1.1.25
github.com/miekg/dns v1.1.50
github.com/minio/minio-go v6.0.14+incompatible
github.com/mitchellh/go-wordwrap v1.0.1
github.com/moby/term v0.5.0
github.com/mogaika/udf v0.0.0-20171019171931-167f0ab01c73
github.com/opencontainers/runtime-spec v1.1.0
github.com/petermattis/goid v0.0.0-20250904145737-900bdf8bb490
github.com/pierrec/lz4/v4 v4.1.15
github.com/pierrec/lz4/v4 v4.1.17
github.com/pkg/errors v0.9.1
github.com/pkg/sftp v1.13.6
github.com/pquerna/otp v1.2.0
@@ -70,40 +78,42 @@ require (
github.com/tatsushid/go-fastping v0.0.0-20160109021039-d7bb493dee3e
github.com/tjfoc/gmsm v1.4.1
github.com/tredoe/osutil v1.5.0
github.com/vishvananda/netlink v1.1.0
github.com/vishvananda/netlink v1.2.1-beta.2
github.com/vishvananda/netns v0.0.5-0.20240412164733-9469873f4601
github.com/vmihailenco/msgpack v4.0.4+incompatible
github.com/xuri/excelize/v2 v2.7.1
github.com/zeebo/xxh3 v1.0.2
github.com/zexi/influxql-to-metricsql v0.1.1
go.etcd.io/etcd/api/v3 v3.5.0
go.etcd.io/etcd/client/v3 v3.5.0
golang.org/x/crypto v0.21.0
golang.org/x/net v0.23.0
golang.org/x/sync v0.8.0
golang.org/x/sys v0.26.0
golang.org/x/text v0.14.0
github.com/zexi/influxql-to-metricsql v0.1.3
go.etcd.io/etcd/api/v3 v3.5.7
go.etcd.io/etcd/client/v3 v3.5.7
golang.org/x/crypto v0.41.0
golang.org/x/net v0.43.0
golang.org/x/sync v0.16.0
golang.org/x/sys v0.35.0
golang.org/x/text v0.28.0
golang.org/x/time v0.5.0
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230215201556-9c5414ab4bde
google.golang.org/grpc v1.62.0
google.golang.org/protobuf v1.35.1
gopkg.in/fatih/set.v0 v0.2.1
gopkg.in/ini.v1 v1.62.0
gopkg.in/mail.v2 v2.3.1
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.19.3
k8s.io/apimachinery v0.19.3
k8s.io/client-go v0.19.3
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.26.2
k8s.io/apimachinery v0.26.2
k8s.io/client-go v0.26.2
k8s.io/cluster-bootstrap v0.19.3
k8s.io/cri-api v0.28.15
k8s.io/klog/v2 v2.20.0
k8s.io/klog/v2 v2.90.1
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260115023540-d2cc546f0409
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20260512084604-0d6b96958d7b
yunion.io/x/executor v0.0.0-20260312022053-f538abd2b005
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900
yunion.io/x/pkg v1.10.4-0.20251114095758-2a2f105d9712
yunion.io/x/pkg v1.10.4-0.20260422030155-01b100134978
yunion.io/x/s3cli v0.0.0-20241221171442-1c11599d28e1
yunion.io/x/sqlchemy v1.1.3-0.20251231025938-b0a38f6e9fab
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c
@@ -116,21 +126,26 @@ require (
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/storage v1.39.1 // indirect
gitee.com/chunanyong/dm v1.8.14 // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Azure/go-autorest/autorest v0.9.6 // indirect
github.com/Azure/go-autorest/autorest/adal v0.8.2 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.3.1 // indirect
github.com/Azure/go-autorest/autorest/date v0.2.0 // indirect
github.com/Azure/go-autorest/logger v0.1.0 // indirect
github.com/Azure/go-autorest/tracing v0.5.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.28 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/ClickHouse/clickhouse-go v1.5.4 // indirect
github.com/DataDog/dd-trace-go v0.6.1 // indirect
github.com/DataDog/zstd v1.3.4 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.8.14 // indirect
github.com/DataDog/datadog-agent/pkg/obfuscate v0.0.0-20211129110424-6491aa3bf583 // indirect
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.42.0-rc.1 // indirect
github.com/DataDog/datadog-go v4.8.2+incompatible // indirect
github.com/DataDog/datadog-go/v5 v5.0.2 // indirect
github.com/DataDog/go-tuf v0.3.0--fix-localmeta-fork // indirect
github.com/DataDog/sketches-go v1.2.1 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/RoaringBitmap/roaring v1.2.3 // indirect
github.com/Shopify/sarama v1.20.0 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VividCortex/ewma v1.1.1 // indirect
github.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0 // indirect
@@ -152,67 +167,63 @@ require (
github.com/anacrolix/upnp v0.1.4 // indirect
github.com/anacrolix/utp v0.1.0 // indirect
github.com/aokoli/goutils v1.0.1 // indirect
github.com/apache/thrift v0.13.0 // indirect
github.com/aws/aws-sdk-go v1.39.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.39.2 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/aws/aws-sdk-go v1.44.194 // indirect
github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.1 // indirect
github.com/aws/aws-sdk-go-v2/config v1.31.12 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.18.16 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.9 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.9 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.9 // indirect
github.com/aws/aws-sdk-go-v2/service/organizations v1.45.3 // indirect
github.com/aws/aws-sdk-go-v2/service/organizations v1.51.1-0.20260401181752-9074b3ddace9 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.88.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.29.6 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.38.6 // indirect
github.com/aws/smithy-go v1.23.0 // indirect
github.com/aws/smithy-go v1.24.2 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/basgys/goxml2json v1.1.1-0.20181031222924-996d9fc8d313 // indirect
github.com/beevik/etree v1.1.0 // indirect
github.com/benbjohnson/immutable v0.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.2.2 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/checkpoint-restore/go-criu/v4 v4.1.0 // indirect
github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775 // indirect
github.com/checkpoint-restore/go-criu/v5 v5.3.0 // indirect
github.com/cilium/ebpf v0.9.1 // indirect
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect
github.com/containerd/cgroups v0.0.0-20200531161412-0dbf7f05ba59 // indirect
github.com/containerd/console v1.0.0 // indirect
github.com/containerd/cgroups v1.1.0 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/containerd/continuity v0.4.5 // indirect
github.com/containerd/fifo v1.1.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/ttrpc v1.0.2 // indirect
github.com/containerd/typeurl v1.0.1 // indirect
github.com/containerd/ttrpc v1.2.2 // indirect
github.com/containerd/typeurl/v2 v2.1.1 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.2 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/dimchansky/utfbom v1.1.0 // indirect
github.com/dnstap/golang-dnstap v0.0.0-20170829151710-2cf77a2b5e11 // indirect
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dnstap/golang-dnstap v0.4.0 // indirect
github.com/docker/go-events v0.0.0-20250114142523-c867878c5e32 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/eapache/go-resiliency v1.1.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/euank/go-kmsg-parser v2.0.0+incompatible // indirect
github.com/farsightsec/golang-framestream v0.0.0-20181102145529-8a0cb8ba8710 // indirect
github.com/farsightsec/golang-framestream v0.3.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
@@ -220,57 +231,70 @@ require (
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 // indirect
github.com/go-llsqlite/adapter v0.0.0-20230927005056-7f5ce7f0c916 // indirect
github.com/go-llsqlite/crawshaw v0.5.2-0.20240425034140-f30eb7704568 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/godbus/dbus/v5 v5.0.4 // indirect
github.com/goccy/go-json v0.9.7 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gofrs/uuid v4.1.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-plus/errors v1.0.0 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/glog v1.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.2 // indirect
github.com/googleapis/gnostic v0.4.1 // indirect
github.com/googollee/go-engine.io v0.0.0-20180829091931-e2f255711dcb // indirect
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 // indirect
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/huaweicloud/huaweicloud-sdk-go v1.0.26 // indirect
github.com/icholy/digest v1.1.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/infobloxopen/go-trees v0.0.0-20200715205103-96a057b8dfb9 // indirect
github.com/invopop/jsonschema v0.13.0 // indirect
github.com/jdcloud-api/jdcloud-sdk-go v1.55.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/josharian/native v1.1.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/karrick/godirwalk v1.17.0 // indirect
github.com/klauspost/compress v1.16.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.3 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/ks3sdklib/aws-sdk-go v1.8.1 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/lestrrat-go/iter v0.0.0-20200422075355-fc1769541911 // indirect
github.com/lestrrat-go/pdebug v0.0.0-20200204225717-4d6bd78da58d // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
github.com/lestrrat-go/blackmagic v1.0.0 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/iter v1.0.1 // indirect
github.com/lestrrat-go/option v1.0.0 // indirect
github.com/lestrrat/go-pdebug v0.0.0-20180220043741-569c97477ae8 // indirect
github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect
github.com/ma314smith/signedxml v0.0.0-20210628192057-abc5b481ae1c // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.9 // indirect
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-tty v0.0.0-20181127064339-e4f871175a2f // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mdlayher/raw v0.0.0-20190606142536-fef19f00fc18 // indirect
github.com/mdlayher/socket v0.4.1 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
@@ -279,28 +303,33 @@ require (
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/moby/sys/mountinfo v0.1.3 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/signal v0.7.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/mozillazg/go-httpheader v0.2.1 // indirect
github.com/mozillazg/go-pinyin v0.19.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/mrunalp/fileutils v0.0.0-20200520151820-abd8a0e76976 // indirect
github.com/mrunalp/fileutils v0.5.0 // indirect
github.com/mschoch/smat v0.2.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-varint v0.0.6 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/runc v1.0.0-rc92 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20200728170252-4d89ac9fbff6 // indirect
github.com/opencontainers/selinux v1.6.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect
github.com/opencontainers/runc v1.1.5 // indirect
github.com/opencontainers/selinux v1.11.0 // indirect
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 // indirect
github.com/opentracing/opentracing-go v1.0.2 // indirect
github.com/openzipkin/zipkin-go-opentracing v0.3.4 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/openzipkin-contrib/zipkin-go-opentracing v0.5.0 // indirect
github.com/openzipkin/zipkin-go v0.4.1 // indirect
github.com/oracle/oci-go-sdk v24.3.0+incompatible // indirect
github.com/philhofer/fwd v1.1.1 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pion/datachannel v1.5.2 // indirect
github.com/pion/dtls/v2 v2.2.4 // indirect
@@ -323,28 +352,29 @@ require (
github.com/pkg/term v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.35.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/protolambda/ctxlock v0.1.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/richardlehane/mscfb v1.0.4 // indirect
github.com/richardlehane/msoleps v1.0.3 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rs/dnscache v0.0.0-20211102005908-e0241e321417 // indirect
github.com/seccomp/libseccomp-golang v0.9.1 // indirect
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.4.0 // indirect
github.com/smartystreets/assertions v1.2.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.413 // indirect
github.com/tencentyun/cos-go-sdk-v5 v0.7.24 // indirect
github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e // indirect
github.com/tidwall/btree v1.6.0 // indirect
github.com/tinylib/msgp v1.1.6 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.5.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
@@ -352,14 +382,13 @@ require (
github.com/vmware/govmomi v0.37.1 // indirect
github.com/volcengine/ve-tos-golang-sdk/v2 v2.6.2 // indirect
github.com/volcengine/volc-sdk-golang v1.0.23 // indirect
github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.0 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0 // indirect
@@ -369,29 +398,35 @@ require (
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.17.0 // indirect
go4.org/intern v0.0.0-20211027215823-ae77deb06f29 // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/mod v0.26.0 // indirect
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/term v0.34.0 // indirect
golang.org/x/tools v0.35.0 // indirect
google.golang.org/api v0.167.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240304161311-37d4d3c04a78 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240228224816-df926f6c8641 // indirect
gopkg.in/DataDog/dd-trace-go.v1 v1.47.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
inet.af/netaddr v0.0.0-20220617031823-097006376321 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5 // indirect
lukechampine.com/blake3 v1.1.6 // indirect
modernc.org/libc v1.22.3 // indirect
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.5.0 // indirect
modernc.org/sqlite v1.21.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.0.1 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
zombiezen.com/go/sqlite v0.13.1 // indirect
)
replace github.com/influxdata/promql/v2 => github.com/zexi/promql/v2 v2.12.1
replace github.com/docker/docker => github.com/docker/docker v20.10.27+incompatible
replace inet.af/netaddr => github.com/inetaf/netaddr v0.0.0-20211027220019-c74959edd3b6

584
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -30,14 +30,18 @@ package service
import (
"yunion.io/x/onecloud/pkg/ansibleserver/models"
"yunion.io/x/onecloud/pkg/ansibleserver/options"
"yunion.io/x/onecloud/pkg/appsrv"
"yunion.io/x/onecloud/pkg/appsrv/dispatcher"
app_common "yunion.io/x/onecloud/pkg/cloudcommon/app"
"yunion.io/x/onecloud/pkg/cloudcommon/db"
)
func InitHandlers(app *appsrv.Application, isSlave bool) {
db.InitAllManagers()
app_common.ExportOptionsHandler(app, &options.Options)
db.RegisterModelManager(db.OpsLog)
db.RegisterModelManager(db.Metadata)
db.RegisterModelManager(db.UserCacheManager)

View File

@@ -19,13 +19,14 @@ import (
"net/http"
"strings"
"yunion.io/x/pkg/errors"
"yunion.io/x/onecloud/pkg/apigateway/clientman"
"yunion.io/x/onecloud/pkg/appsrv"
"yunion.io/x/onecloud/pkg/httperrors"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/auth"
"yunion.io/x/onecloud/pkg/util/netutils2"
"yunion.io/x/pkg/errors"
)
const (

View File

@@ -0,0 +1,257 @@
package handler
import (
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"strings"
"time"
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/util/httputils"
"yunion.io/x/onecloud/pkg/apigateway/options"
"yunion.io/x/onecloud/pkg/appsrv"
"yunion.io/x/onecloud/pkg/httperrors"
"yunion.io/x/onecloud/pkg/mcclient/auth"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/llm"
mcpServerOption "yunion.io/x/onecloud/pkg/mcp-server/options"
)
func mcpServersConfigHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
serviceName := "mcp-server"
url, err := auth.GetPublicServiceURL(serviceName, options.Options.Region, "", httputils.GET)
if err != nil {
log.Warningf("GetPublicServiceURL for %s failed: %v", serviceName, err)
}
sseURL := fmt.Sprintf("%s/sse", url)
responseType := r.URL.Query().Get("type")
switch responseType {
case "claude":
// Claude 仅支持单个自定义 header使用 X-API-Key。填写方式
// base64(ak:sk)`echo -n "你的AK:你的SK" | base64`,将输出填入
cmd := fmt.Sprintf("claude mcp add --transport sse %s --header \"X-API-Key: <填写 token 或 base64(AK:SK)>\"", sseURL)
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.Write([]byte(cmd))
return
case "cursor":
// fall through to JSON
default:
// default: return JSON (cursor format)
}
// Cursor在 headers 中填写控制台/CLI 获取的 Access Key 与 Secret Key
config := map[string]interface{}{
"mcpServers": map[string]interface{}{
mcpServerOption.Options.MCPServerName: map[string]interface{}{
"url": sseURL,
"headers": map[string]string{
"AK": "<填写 Access Key>",
"SK": "<填写 Secret Key>",
},
},
},
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(config)
}
func chatHandlerInfo(method, prefix string, handler func(context.Context, http.ResponseWriter, *http.Request)) *appsrv.SHandlerInfo {
log.Debugf("%s - %s", method, prefix)
hi := appsrv.SHandlerInfo{}
hi.SetMethod(method)
hi.SetPath(prefix)
hi.SetHandler(handler)
hi.SetProcessTimeout(6 * time.Hour)
// Use default worker manager with default pool size (usually 32)
// instead of uploader worker which has limited pool size (4)
return &hi
}
func mcpAgentChatStreamHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
params, _, body := appsrv.FetchEnv(ctx, w, r)
id := params["<id>"]
if len(id) == 0 {
httperrors.MissingParameterError(ctx, w, "id")
return
}
token := AppContextToken(ctx)
s := auth.GetSession(ctx, token, FetchRegion(r))
// Prepare request to backend
headers := http.Header{}
headers.Set("Content-Type", "application/json")
// Forward the request body to the backend
var bodyReader io.Reader
if body != nil {
bodyStr := body.String()
bodyReader = strings.NewReader(bodyStr)
}
path := fmt.Sprintf("/mcp_agents/%s/chat-stream", id)
resp, err := s.RawVersionRequest(
modules.MCPAgent.ServiceType(),
modules.MCPAgent.EndpointType(),
"POST",
path,
headers,
bodyReader,
)
if err != nil {
httperrors.GeneralServerError(ctx, w, errors.Wrap(err, "request backend"))
return
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
// Read error body
respBody, _ := io.ReadAll(resp.Body)
// Try to parse as JSON error if possible, or just return as is
if resp.StatusCode >= 400 && resp.StatusCode < 500 {
httperrors.InputParameterError(ctx, w, "backend error: %s", string(respBody))
} else {
httperrors.GeneralServerError(ctx, w, fmt.Errorf("backend error %d: %s", resp.StatusCode, string(respBody)))
}
return
}
// Set SSE headers
w.Header().Set("Content-Type", "text/event-stream")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
// For now just standard SSE headers.
if f, ok := w.(http.Flusher); ok {
f.Flush()
}
// Stream the response from backend to client
buf := make([]byte, 1024)
for {
n, err := resp.Body.Read(buf)
if n > 0 {
if _, wErr := w.Write(buf[:n]); wErr != nil {
log.Errorf("write response error: %v", wErr)
return
}
if f, ok := w.(http.Flusher); ok {
f.Flush()
}
}
if err != nil {
if err != io.EOF {
log.Errorf("read backend response error: %v", err)
}
break
}
}
}
// mcpAgentDefaultChatStreamHandler 将请求转发到 region 的 default-chat-stream使用 default_agent=true 的条目)
func mcpAgentDefaultChatStreamHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
token := AppContextToken(ctx)
s := auth.GetSession(ctx, token, FetchRegion(r))
headers := http.Header{}
headers.Set("Content-Type", "application/json")
var bodyReader io.Reader
if r.Body != nil {
bodyReader = r.Body
}
path := "/mcp_agents/default-chat-stream"
resp, err := s.RawVersionRequest(
modules.MCPAgent.ServiceType(),
modules.MCPAgent.EndpointType(),
"POST",
path,
headers,
bodyReader,
)
if err != nil {
httperrors.GeneralServerError(ctx, w, errors.Wrap(err, "request backend"))
return
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
respBody, _ := io.ReadAll(resp.Body)
if resp.StatusCode >= 400 && resp.StatusCode < 500 {
httperrors.InputParameterError(ctx, w, "backend error: %s", string(respBody))
} else {
httperrors.GeneralServerError(ctx, w, fmt.Errorf("backend error %d: %s", resp.StatusCode, string(respBody)))
}
return
}
w.Header().Set("Content-Type", "text/event-stream")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
if f, ok := w.(http.Flusher); ok {
f.Flush()
}
buf := make([]byte, 1024)
for {
n, err := resp.Body.Read(buf)
if n > 0 {
if _, wErr := w.Write(buf[:n]); wErr != nil {
log.Errorf("write response error: %v", wErr)
return
}
if f, ok := w.(http.Flusher); ok {
f.Flush()
}
}
if err != nil {
if err != io.EOF {
log.Errorf("read backend response error: %v", err)
}
break
}
}
}
// mcpAgentDefaultToolsHandler 将 GET 请求转发到 region 的 default-mcp-tools仅使用 options.MCPServerURL不通过 mcp_agent 条目)
func mcpAgentDefaultToolsHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
token := AppContextToken(ctx)
s := auth.GetSession(ctx, token, FetchRegion(r))
path := "/mcp_agents/default-mcp-tools"
resp, err := s.RawVersionRequest(
modules.MCPAgent.ServiceType(),
modules.MCPAgent.EndpointType(),
"GET",
path,
nil,
nil,
)
if err != nil {
httperrors.GeneralServerError(ctx, w, errors.Wrap(err, "request backend"))
return
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
respBody, _ := io.ReadAll(resp.Body)
if resp.StatusCode >= 400 && resp.StatusCode < 500 {
httperrors.InputParameterError(ctx, w, "backend error: %s", string(respBody))
} else {
httperrors.GeneralServerError(ctx, w, fmt.Errorf("backend error %d: %s", resp.StatusCode, string(respBody)))
}
return
}
w.Header().Set("Content-Type", "application/json")
_, err = io.Copy(w, resp.Body)
if err != nil {
log.Errorf("write default mcp tools response error: %v", err)
}
}

View File

@@ -105,11 +105,23 @@ func (h *MiscHandler) Bind(app *appsrv.Application) {
s3upload := uploadHandlerInfo(POST, prefix+"s3uploads", FetchAuthToken(h.postS3UploadHandler))
app.AddHandler3(s3upload)
// mcp agent chat stream
chatStream := chatHandlerInfo("POST", prefix+"mcp_agents/<id>/chat-stream", FetchAuthToken(mcpAgentChatStreamHandler))
app.AddHandler3(chatStream)
// mcp agent default chat stream (uses agent with default_agent=true)
defaultChatStream := chatHandlerInfo("POST", prefix+"mcp_agents/default/chat-stream", FetchAuthToken(mcpAgentDefaultChatStreamHandler))
app.AddHandler3(defaultChatStream)
// syslog webservice handlers
app.AddHandler(POST, prefix+"syslog/token", handleSyslogWebServiceToken)
app.AddHandler(POST, prefix+"syslog/message", handleSyslogWebServiceMessage)
// service settings
app.AddHandler(GET, prefix+"service_settings", h.getServiceSettings)
// mcp servers config
app.AddHandler(GET, prefix+"mcp-servers-config", mcpServersConfigHandler)
// mcp agent default MCP server tools (options.MCPServerURL only, no mcp_agent entry)
app.AddHandler(GET, prefix+"default-mcp-tools", FetchAuthToken(mcpAgentDefaultToolsHandler))
}
func UploadHandlerInfo(method, prefix string, handler func(context.Context, http.ResponseWriter, *http.Request)) *appsrv.SHandlerInfo {

View File

@@ -60,6 +60,9 @@ type sReport struct {
BaremetalMemSizeMb int64
BaremetalStorageSizeGb int64
ServerCnt int64
ContainerCnt int64
ContainerCpuCnt int64
ContainerMemSizeMb int64
ServerCpuCnt int64
ServerMemSizeMb int64
KvmServerCnt int64
@@ -270,6 +273,9 @@ func Report(ctx context.Context, userCred mcclient.TokenCredential, isStart bool
ret.ServerCnt, _ = usage.Int("all.servers")
ret.ServerCpuCnt, _ = usage.Int("all.servers.cpu")
ret.ServerMemSizeMb, _ = usage.Int("all.servers.memory")
ret.ContainerCnt, _ = usage.Int("all.containers")
ret.ContainerCpuCnt, _ = usage.Int("all.containers.cpu")
ret.ContainerMemSizeMb, _ = usage.Int("all.containers.memory")
ret.DiskCnt, _ = usage.Int("all.disks.count")
ret.DiskSizeMb, _ = usage.Int("all.disks")
ret.BucketCnt, _ = usage.Int("all.buckets")

View File

@@ -52,6 +52,7 @@ func StartService() {
serviceApp := app.NewApp(app_common.InitApp(baseOpts, false))
serviceApp.InitHandlers().Bind()
app_common.ExportOptionsHandler(serviceApp.Application, options.Options)
// mods, jmods := modulebase.GetRegisterdModules()
// log.Infof("Modules: %s", jsonutils.Marshal(mods).PrettyString())

View File

@@ -24,7 +24,7 @@ import (
"yunion.io/x/onecloud/pkg/apimap/options"
compute_api "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/appsrv"
common_app "yunion.io/x/onecloud/pkg/cloudcommon/app"
app_common "yunion.io/x/onecloud/pkg/cloudcommon/app"
common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
"yunion.io/x/onecloud/pkg/cloudcommon/policy"
"yunion.io/x/onecloud/pkg/compute/models"
@@ -43,12 +43,13 @@ func StartService() {
service.StartServiceWrapper(&opt.DBOptions, &opt.CommonOptions, func(app *appsrv.Application) error {
common_options.StartOptionManager(&opt, opt.ConfigSyncPeriodSeconds, compute_api.SERVICE_TYPE, compute_api.SERVICE_VERSION, options.OnOptionsChange)
InitHandlers(app)
common_app.ServeForever(app, &opt.BaseOptions)
app_common.ServeForever(app, &opt.BaseOptions)
return nil
})
}
func InitHandlers(app *appsrv.Application) {
app_common.ExportOptionsHandler(app, options.GetOptions())
app.AddHandler2("GET", "/vpcagent", auth.Authenticate(vpcAgentHandler), nil, "get_vpcagent_topo", nil)
}

View File

@@ -22,7 +22,7 @@ type BillingDetailsInfo struct {
type BillingResourceListInput struct {
// 计费类型,按需计费和预付费
// pattern:prepaid|postpaid
BillingType string `json:"billing_type"`
BillingType TBillingType `json:"billing_type"`
// 计费过期时间的查询起始时间
BillingExpireSince time.Time `json:"billing_expire_since"`

View File

@@ -14,9 +14,41 @@
package billing
import "yunion.io/x/cloudmux/pkg/apis/billing"
import (
"yunion.io/x/cloudmux/pkg/apis/billing"
"yunion.io/x/cloudmux/pkg/apis/compute"
)
type TBillingType string
const (
BILLING_TYPE_POSTPAID = billing.BILLING_TYPE_POSTPAID
BILLING_TYPE_PREPAID = billing.BILLING_TYPE_PREPAID
BILLING_TYPE_POSTPAID = TBillingType(billing.BILLING_TYPE_POSTPAID)
BILLING_TYPE_PREPAID = TBillingType(billing.BILLING_TYPE_PREPAID)
)
type TNetChargeType string
const (
NET_CHARGE_TYPE_BY_TRAFFIC = TNetChargeType(compute.EIP_CHARGE_TYPE_BY_TRAFFIC)
NET_CHARGE_TYPE_BY_BANDWIDTH = TNetChargeType(compute.EIP_CHARGE_TYPE_BY_BANDWIDTH)
)
func ParseBillingType(s string) TBillingType {
switch s {
case string(BILLING_TYPE_POSTPAID):
return BILLING_TYPE_POSTPAID
case string(BILLING_TYPE_PREPAID):
return BILLING_TYPE_PREPAID
}
return ""
}
func ParseNetChargeType(s string) TNetChargeType {
switch s {
case string(NET_CHARGE_TYPE_BY_TRAFFIC):
return NET_CHARGE_TYPE_BY_TRAFFIC
case string(NET_CHARGE_TYPE_BY_BANDWIDTH):
return NET_CHARGE_TYPE_BY_BANDWIDTH
}
return ""
}

View File

@@ -20,6 +20,7 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
)
type SchedtagConfig struct {
@@ -98,6 +99,8 @@ type NetworkConfig struct {
// 若指定镜像的网络驱动方式,此参数会被覆盖
Driver string `json:"driver"`
BwLimit int `json:"bw_limit"`
TxBwLimit int `json:"tx_bw_limit"`
RxBwLimit int `json:"rx_bw_limit"`
Vip bool `json:"vip"`
Reserved bool `json:"reserved"`
NumQueues int `json:"num_queues"`
@@ -121,7 +124,10 @@ type NetworkConfig struct {
PortMappings GuestPortMappings `json:"port_mappings"`
ChargeType string `json:"charge_type"`
// 计费模式
BillingType billing_api.TBillingType `json:"billing_type"`
// 计量模式
ChargeType billing_api.TNetChargeType `json:"charge_type"`
// swagger:ignore
Project string `json:"project_id"`
@@ -130,6 +136,9 @@ type NetworkConfig struct {
Domain string `json:"domain_id"`
Ifname string `json:"ifname"`
Schedtags []*SchedtagConfig `json:"schedtags"`
// network secgroups
Secgroups []string `json:"secgroups"`
}
type AttachNetworkInput struct {
@@ -190,6 +199,11 @@ type DiskConfig struct {
// required: false
AutoReset bool `json:"auto_reset"`
// 是否跟随主机删除而自动删除
// 默认跟随主机创建的磁盘为 true
// required: false
AutoDelete *bool `json:"auto_delete,omitempty"`
// 磁盘存储格式
// enum: ["qcow2", "raw", "docker", "iso", "vmdk", "vmdkflatver1", "vmdkflatver2", "vmdkflat", "vmdksparse", "vmdksparsever1", "vmdksparsever2", "vmdksepsparse", "vhd"]
// requried: false
@@ -466,6 +480,37 @@ type DeployConfig struct {
Content string `json:"content"`
}
// KickstartConfig Kickstart/Autoinstall自动化安装配置
type KickstartConfig struct {
// 配置文件内容 (当用户直接提供配置时使用)
// required: false
Config string `json:"config,omitempty"`
// 配置文件 URL (当配置文件位于外部服务器时使用)
// required: false
ConfigURL string `json:"config_url,omitempty"`
// 操作系统类型 (用于确定内核参数和文件路径)
// enum: centos,rhel,fedora,openeuler,ubuntu
// required: true
OSType string `json:"os_type" validate:"required,oneof=centos rhel fedora openeuler ubuntu"`
// 是否启用 (用于临时禁用而不删除配置)
// default: true
// required: false
Enabled *bool `json:"enabled,omitempty"`
// 最大重试次数
// default: 3
// required: false
MaxRetries int `json:"max_retries,omitempty"`
// 安装超时时间 (分钟)
// default: 60
// required: false
TimeoutMinutes int `json:"timeout_minutes,omitempty"`
}
type ServerCreateInput struct {
apis.VirtualResourceCreateInput
DeletePreventableCreateInput
@@ -601,10 +646,14 @@ type ServerCreateInput struct {
// 指定此参数后会创建新的弹性公网IP并绑定到新建的虚拟机
// 此参数优先级低于public_ip
EipBw int `json:"eip_bw,omitzero"`
// 弹性公网IP上行带宽
EipTxBw int `json:"eip_tx_bw,omitzero"`
// 弹性公网IP下行带宽
EipRxBw int `json:"eip_rx_bw,omitzero"`
// 弹性公网IP线路类型
EipBgpType string `json:"eip_bgp_type,omitzero"`
// 弹性公网IP计费类型
EipChargeType string `json:"eip_charge_type,omitempty"`
EipChargeType billing_api.TNetChargeType `json:"eip_charge_type,omitempty"`
// 是否跟随主机删除而自动释放
EipAutoDellocate bool `json:"eip_auto_dellocate,omitempty"`
@@ -630,7 +679,7 @@ type ServerCreateInput struct {
// |---- |------- |
// |traffic |按流量计费|
// |bandwidth |按带宽计费|
PublicIpChargeType string `json:"public_ip_charge_type,omitempty"`
PublicIpChargeType billing_api.TNetChargeType `json:"public_ip_charge_type,omitempty"`
// 使用主机快照创建虚拟机, 主机快照不会重置密码及秘钥信息
// 使用主机快照创建的虚拟机将沿用之前的密码秘钥及安全组信息
@@ -656,7 +705,7 @@ type ServerCreateInput struct {
// swagger:ignore
OsProfile jsonutils.JSONObject `json:"__os_profile__"`
// swagger:ignore
BillingType string `json:"billing_type"`
BillingType billing_api.TBillingType `json:"billing_type"`
// swagger:ignore
BillingCycle string `json:"billing_cycle"`
// 到期释放时间
@@ -677,9 +726,32 @@ type ServerCreateInput struct {
// 指定用于新建主机的主机镜像ID
GuestImageID string `json:"guest_image_id"`
// Kickstart/Autoinstall自动化安装配置
// required: false
KickstartConfig *KickstartConfig `json:"kickstart_config,omitempty"`
Pod *PodCreateInput `json:"pod"`
}
func (c *KickstartConfig) IsEnabled() bool {
if c.Enabled != nil && !*c.Enabled {
return false
}
return true
}
// ServerUpdateKickstartStatusInput 更新虚拟机 kickstart 状态的输入
type ServerUpdateKickstartStatusInput struct {
// kickstart 状态
// enum: kickstart_pending,kickstart_installing,kickstart_completed,kickstart_failed
// required: true
Status string `json:"status" validate:"required,oneof=kickstart_pending kickstart_installing kickstart_completed kickstart_failed"`
// 错误信息(可选)
// required: false
ErrorMessage string `json:"error_message,omitempty"`
}
func (input *ServerCreateInput) AfterUnmarshal() {
if input.Baremetal {
input.Hypervisor = HYPERVISOR_BAREMETAL

View File

@@ -100,6 +100,6 @@ type CachedimageListInput struct {
// valid cachedimage
Valid bool `json:"valid"`
// enum: [public, private]
// enum: ["public", "private"]
CloudEnv string `json:"cloud_env"`
}

View File

@@ -19,6 +19,7 @@ import (
"time"
"yunion.io/x/onecloud/pkg/apis"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
)
type DBInstanceCreateInput struct {
@@ -87,7 +88,7 @@ type DBInstanceCreateInput struct {
// 计费方式
// enum: ["postpaid", "prepaid"]
BillingType string
BillingType billing_api.TBillingType `json:"billing_type"`
// swagger:ignore
BillingCycle string

View File

@@ -25,6 +25,7 @@ import (
"yunion.io/x/onecloud/pkg/apis"
"yunion.io/x/onecloud/pkg/apis/billing"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
"yunion.io/x/onecloud/pkg/httperrors"
)
@@ -177,6 +178,8 @@ type DiskListInput struct {
// 根据是否绑定快照策略过滤
BindingSnapshotpolicy *bool `json:"binding_snapshotpolicy"`
// 根据是否磁盘所在虚拟机是否绑定主机快照策略
BindingServerSnapshotpolicy *bool `json:"binding_server_snapshotpolicy"`
}
type DiskResourceInput struct {
@@ -221,13 +224,22 @@ type SimpleGuest struct {
Bps int `json:"bps"`
// 计费类型
BillingType string `json:"billing_type"`
// 磁盘绑定的快照策略列表
Snapshotpolicy []SimpleSnapshotPolicy `json:"snapshotpolicy"`
}
type SimpleSnapshotPolicy struct {
Id string `json:"id"`
Name string `json:"name"`
RepeatWeekdays []int `json:"repeat_weekdays"`
TimePoints []int `json:"time_points"`
// 快照策略ID
Id string `json:"id"`
// 快照策略名称
Name string `json:"name"`
// 快照策略类型
ResourceType string `json:"resource_type"`
// 快照策略重复周期
RepeatWeekdays []int `json:"repeat_weekdays"`
// 快照策略时间点
TimePoints []int `json:"time_points"`
}
type DiskDetails struct {
@@ -247,11 +259,11 @@ type DiskDetails struct {
GuestStatus string `json:"guest_status"`
// 所挂载虚拟机计费类型
GuestBillingType string `json:"guest_billing_type"`
// 磁盘所在虚拟机绑定的主机快照策略数量
GuestSnapshotpolicyCount int `json:"guest_snapshotpolicy_count"`
// 自动清理时间
AutoDeleteAt time.Time `json:"auto_delete_at"`
// 自动快照策略状态
SnapshotpolicyStatus string `json:"snapshotpolicy_status,allowempty"`
// 自动快照策略
Snapshotpolicies []SimpleSnapshotPolicy `json:"snapshotpolicies"`
@@ -281,6 +293,11 @@ type DiskUpdateInput struct {
DiskType string `json:"disk_type"`
// 关机自动重置
AutoReset *bool `json:"auto_reset"`
// 是否跟随主机删除而自动删除
// 默认跟随主机创建的磁盘为 true
// required: false
AutoDelete *bool `json:"auto_delete,omitempty"`
}
type DiskSaveInput struct {
@@ -363,6 +380,7 @@ type DiskChagneStorageTypeInput struct {
}
type DiskSnapshotpolicyInput struct {
// 快照策略ID
SnapshotpolicyId string `json:"snapshotpolicy_id"`
}
@@ -405,5 +423,5 @@ type DiskChangeBillingTypeInput struct {
// 目前支持阿里云
// enmu: [postpaid, prepaid]
// required: true
BillingType string `json:"billing_type"`
BillingType billing_api.TBillingType `json:"billing_type"`
}

View File

@@ -18,6 +18,7 @@ import (
"time"
"yunion.io/x/onecloud/pkg/apis"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
)
type ElasticcacheDetails struct {
@@ -255,7 +256,7 @@ type ElasticcacheCreateInput struct {
// 计费方式
// enum: ["postpaid", "prepaid"]
BillingType string
BillingType billing_api.TBillingType `json:"billing_type"`
// swagger:ignore
BillingCycle string

View File

@@ -15,7 +15,10 @@
package compute
import (
"errors"
"yunion.io/x/onecloud/pkg/apis"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
)
type SElasticipCreateInput struct {
@@ -60,7 +63,7 @@ type SElasticipCreateInput struct {
// |OpenStack | traffic |
// default: traffic
// enum: ["traffic", "bandwidth"]
ChargeType string `json:"charge_type"`
ChargeType billing_api.TNetChargeType `json:"charge_type"`
Mode string `json:"mode"`
@@ -151,3 +154,26 @@ type ElasticipRemoteUpdateInput struct {
// 是否覆盖替换所有标签
ReplaceTags *bool `json:"replace_tags" help:"replace all remote tags"`
}
type ElasticipChangeBandwidthInput struct {
// 带宽限制单位mbps
// swagger:ignore
// Deprecated
Bandwidth int64 `json:"bandwidth" yunion-deprecated-by:"bandwidth_mb"`
// 带宽限制单位mbps
BandwidthMb int64 `json:"bandwidth_mb"`
// 下行带宽限制单位mbps
RxBwLimitMb int64 `json:"rx_bw_limit_mb"`
// 上行带宽限制单位mbps
TxBwLimitMb int64 `json:"tx_bw_limit_mb"`
}
func (input ElasticipChangeBandwidthInput) Validate() error {
if input.BandwidthMb <= 0 && input.RxBwLimitMb <= 0 {
return errors.New("bandwidth_mb or rx_bw_limit_mb must be greater than 0")
}
if input.BandwidthMb <= 0 && input.TxBwLimitMb <= 0 {
return errors.New("bandwidth_mb or tx_bw_limit_mb must be greater than 0")
}
return nil
}

View File

@@ -44,9 +44,6 @@ const (
EIP_STATUS_CHANGE_BANDWIDTH = "change_bandwidth"
EIP_CHARGE_TYPE_BY_TRAFFIC = compute.EIP_CHARGE_TYPE_BY_TRAFFIC
EIP_CHARGE_TYPE_BY_BANDWIDTH = compute.EIP_CHARGE_TYPE_BY_BANDWIDTH
INSTANCE_ASSOCIATE_EIP = "associate_eip"
INSTANCE_ASSOCIATE_EIP_FAILED = "associate_eip_failed"
INSTANCE_DISSOCIATE_EIP = "dissociate_eip"

View File

@@ -20,6 +20,7 @@ import (
"yunion.io/x/cloudmux/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/apis"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
)
const (
@@ -92,7 +93,7 @@ type FileSystemCreateInput struct {
// 计费方式
// enum: ["postpaid", "prepaid"]
BillingType string `json:"billing_type"`
BillingType billing_api.TBillingType `json:"billing_type"`
// swagger:ignore
BillingCycle string `json:"billing_cycle"`
}

View File

@@ -0,0 +1,15 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package guest // import "yunion.io/x/onecloud/pkg/apis/compute/guest"

View File

@@ -0,0 +1,47 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package guest
import (
"time"
"yunion.io/x/onecloud/pkg/apis"
compute_api "yunion.io/x/onecloud/pkg/apis/compute"
)
type GuestNetworkTrafficState string
const (
GuestNetworkTrafficStateContinue GuestNetworkTrafficState = ""
GuestNetworkTrafficStateStart GuestNetworkTrafficState = "start"
)
type GuestNetworkTrafficLogListInput struct {
apis.ProjectizedResourceListInput
compute_api.ServerFilterListInput
compute_api.NetworkFilterListInput
Since time.Time `json:"since"`
Until time.Time `json:"until"`
IpAddr []string `json:"ip_addr"`
Ip6Addr []string `json:"ip6_addr"`
State []GuestNetworkTrafficState `json:"state"`
}
type GuestNetworkTrafficLogDetails struct {
compute_api.SGuestNetworkTrafficLog
}

View File

@@ -180,6 +180,12 @@ const (
VM_QGA_SET_NETWORK = "qga_set_network"
VM_QGA_SET_NETWORK_FAILED = "qga_set_network_failed"
// Kickstart自动安装相关状态
VM_KICKSTART_PENDING = "kickstart_pending" // kickstart配置完成等待VM启动
VM_KICKSTART_INSTALLING = "kickstart_installing" // kickstart正在安装
VM_KICKSTART_COMPLETED = "kickstart_completed" // kickstart安装完成准备转为running
VM_KICKSTART_FAILED = "kickstart_failed" // kickstart安装失败
SHUTDOWN_STOP = "stop"
SHUTDOWN_TERMINATE = "terminate"
SHUTDOWN_STOP_RELEASE_GPU = "stop_release_gpu"
@@ -259,7 +265,7 @@ const (
VM_MACHINE_TYPE_PC = "pc"
VM_MACHINE_TYPE_Q35 = "q35"
VM_MACHINE_TYPE_ARM_VIRT = "virt"
VM_MACHINE_TYPE_VIRT = "virt"
VM_VDI_PROTOCOL_VNC = "vnc"
VM_VDI_PROTOCOL_SPICE = "spice"
@@ -274,6 +280,7 @@ const (
var VM_RUNNING_STATUS = []string{VM_START_START, VM_STARTING, VM_RUNNING, VM_BLOCK_STREAM, VM_BLOCK_STREAM_FAIL}
var VM_CREATING_STATUS = []string{VM_CREATE_NETWORK, VM_CREATE_DISK, VM_START_DEPLOY, VM_DEPLOYING}
var VM_KICKSTART_STATUS = []string{VM_KICKSTART_PENDING, VM_KICKSTART_INSTALLING, VM_KICKSTART_COMPLETED, VM_KICKSTART_FAILED}
var HYPERVISORS = []string{
HYPERVISOR_KVM,
@@ -349,8 +356,31 @@ const (
VM_METADATA_CPU_NUMA_PIN_TYPE = "__cpu_numa_pin_type"
VM_METADATA_VIRTUAL_ISOLATED_DEVICE_CONFIG = "__virtual_isolated_device_config"
// Kickstart相关metadata常量
VM_METADATA_KICKSTART_CONFIG = "kickstart_config"
VM_METADATA_KICKSTART_TYPE = "kickstart_type"
VM_METADATA_KICKSTART_ATTEMPT = "kickstart_attempt"
VM_METADATA_KICKSTART_COMPLETED_FLAG = "kickstart_completed_flag"
)
const (
KICKSTART_TYPE_URL = "url"
KICKSTART_TYPE_CONTENT = "content"
)
var KICKSTART_VALID_TYPES = []string{
KICKSTART_TYPE_URL,
KICKSTART_TYPE_CONTENT,
}
var KICKSTART_VALID_OS_TYPES = []string{
"centos",
"rhel",
"fedora",
"ubuntu",
"openeuler",
}
// windows allow a maximal length of 15
// http://support.microsoft.com/kb/909264
const MAX_WINDOWS_COMPUTER_NAME_LENGTH = 15

View File

@@ -28,7 +28,7 @@ type SImagesInGuest struct {
DataImages []SSubImage
}
type SGuestScreenDump struct {
type SGuestScreenDumpInfo struct {
S3AccessKey string
S3SecretKey string
S3Endpoint string

View File

@@ -16,10 +16,14 @@ package compute
import (
"reflect"
"time"
"yunion.io/x/cloudmux/pkg/apis/compute"
"yunion.io/x/jsonutils"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
"yunion.io/x/pkg/gotypes"
"yunion.io/x/onecloud/pkg/apis"
)
type GuestnetworkDetails struct {
@@ -76,12 +80,24 @@ type GuestnetworkShortDesc struct {
Ifname string `json:"ifname"`
// 是否为缺省路由网关
IsDefault bool `json:"is_default"`
// 线路类型
BgpType string `json:"bgp_type"`
// 计费模式
ChargeType string `json:"charge_type"`
BillingType billing_api.TBillingType `json:"billing_type"`
// 计量模式
ChargeType billing_api.TNetChargeType `json:"charge_type"`
// 网卡序号
Index int `json:"index"`
}
type GuestnetworkSecgroupShortDesc struct {
NetworkIndex int `json:"network_index"`
Secgroups []apis.StandaloneShortDesc `json:"secgroups"`
Mac string `json:"mac"`
}
type GuestnetworkListInput struct {
GuestJointsListInput
@@ -131,12 +147,17 @@ type GuestnetworkBaseDesc struct {
Masklen int8 `json:"masklen"`
Vlan int `json:"vlan"`
Bw int `json:"bw"`
RxBwLimit int `json:"rx_bw_limit"`
TxBwLimit int `json:"tx_bw_limit"`
Mtu int16 `json:"mtu"`
Index int `json:"index"`
RxTrafficLimit int64 `json:"rx_traffic_limit"`
TxTrafficLimit int64 `json:"tx_traffic_limit"`
NicType compute.TNicType `json:"nic_type"`
BillingType billing_api.TBillingType `json:"billing_type"`
ChargeType billing_api.TNetChargeType `json:"charge_type"`
Ip6 string `json:"ip6"`
Gateway6 string `json:"gateway6"`
Masklen6 uint8 `json:"masklen6"`
@@ -148,6 +169,9 @@ type GuestnetworkBaseDesc struct {
WireId string `json:"wire_id"`
Interface string `json:"interface"`
Secgroups []*SecgroupJsonDesc `json:"secgroups"`
SecurityRules string `json:"security_rules"`
Vpc struct {
Id string `json:"id"`
Provider string `json:"provider"`
@@ -183,6 +207,14 @@ type GuestnetworkJsonDesc struct {
LinkUp bool `json:"link_up"`
}
type GuestnetworkSecgroupDesc struct {
Secgroups []*SecgroupJsonDesc `json:"secgroups"`
SecurityRules string `json:"security_rules"`
Index int `json:"index"`
Mac string `json:"mac"`
}
type SNicTrafficRecord struct {
RxTraffic int64
TxTraffic int64
@@ -190,6 +222,24 @@ type SNicTrafficRecord struct {
HasBeenSetDown bool
}
type GuestNicTrafficSyncInput struct {
// 同步时间
SyncAt time.Time
// 是否重置计数器
IsReset bool `json:"is_reset"`
// first key: guest_id
// second key: nic_mac
Traffic map[string]map[string]*SNicTrafficRecord
}
func NewGuestNicTrafficSyncInput(syncAt time.Time, isReset bool) *GuestNicTrafficSyncInput {
return &GuestNicTrafficSyncInput{
SyncAt: syncAt,
Traffic: make(map[string]map[string]*SNicTrafficRecord),
IsReset: isReset,
}
}
type GuestPortMappingProtocol string
const (

View File

@@ -23,6 +23,7 @@ import (
"yunion.io/x/onecloud/pkg/apis"
"yunion.io/x/onecloud/pkg/apis/billing"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
"yunion.io/x/onecloud/pkg/apis/host"
imageapi "yunion.io/x/onecloud/pkg/apis/image"
"yunion.io/x/onecloud/pkg/httperrors"
@@ -135,6 +136,14 @@ type ServerListInput struct {
// 根据是否绑定快照策略过滤
BindingSnapshotpolicy *bool `json:"binding_snapshotpolicy"`
// 根据虚机关联的磁盘是否绑定快照策略过滤
BindingDisksSnapshotpolicy *bool `json:"binding_disks_snapshotpolicy"`
}
// 主机快照策略绑定/设置接口入参
type ServerSnapshotpolicyInput struct {
// 快照策略ID
SnapshotpolicyId string `json:"snapshotpolicy_id"`
}
func (input *ServerListInput) AfterUnmarshal() {
@@ -184,6 +193,11 @@ type ServerDetails struct {
// 磁盘概要
Disks string `json:"disks"`
// 主机快照策略数量
SnapshotpolicyCount int `json:"snapshotpolicy_count"`
// 磁盘快照策略数量
DisksSnapshotpolicyCount int `json:"disks_snapshotpolicy_count"`
// 磁盘详情
DisksInfo []GuestDiskInfo `json:"disks_info"`
// 虚拟机Ip列表
@@ -243,6 +257,9 @@ type ServerDetails struct {
// 关联主安全组
Secgroup string `json:"secgroup"`
// 网卡级别安全组
NetworkSecgroups []GuestnetworkSecgroupShortDesc `json:"network_secgroups"`
// 浮动IP
Eip string `json:"eip"`
// 浮动IP类型
@@ -558,12 +575,32 @@ type GuestSetSecgroupInput struct {
SecgroupIds []string `json:"secgroup_ids"`
}
type GuestSetNetworkSecgroupInput struct {
// 安全组Id列表
// 实例必须处于运行,休眠或者关机状态
SecgroupIds []string `json:"secgroup_ids"`
// 虚机网卡 index 或者 mac 地址
NetworkIndex *int `json:"network_index"`
MacAddr string `json:"mac_addr"`
}
type GuestRevokeSecgroupInput struct {
// 安全组Id列表
// 实例必须处于运行,休眠或者关机状态
SecgroupIds []string `json:"secgroup_ids"`
}
type GuestRevokeNetworkSecgroupInput struct {
// 安全组Id列表
// 实例必须处于运行,休眠或者关机状态
SecgroupIds []string `json:"secgroup_ids"`
// 虚机网卡 index 或者 mac 地址
NetworkIndex *int `json:"network_index"`
MacAddr string `json:"mac_addr"`
}
type GuestAssignSecgroupInput struct {
// 安全组Id
// 实例必须处于运行,休眠或者关机状态
@@ -593,6 +630,12 @@ type GuestAddSecgroupInput struct {
SecgroupIds []string `json:"secgroup_ids"`
}
type GuestNetworkAddSecgroupInput struct {
SecgroupIds []string `json:"secgroup_ids"`
NetworkIndex *int `json:"network_index"`
}
type ServerRemoteUpdateInput struct {
// 是否覆盖替换所有标签
ReplaceTags *bool `json:"replace_tags" help:"replace all remote tags"`
@@ -611,7 +654,7 @@ type ServerAssociateEipInput struct {
type ServerCreateEipInput struct {
// 计费方式traffic or bandwidth
ChargeType string `json:"charge_type"`
ChargeType billing_api.TNetChargeType `json:"charge_type"`
// Bandwidth
Bandwidth int64 `json:"bandwidth"`
@@ -728,6 +771,13 @@ func (input ServerDetachnetworkInput) IsForce() bool {
return input.Force != nil && *input.Force
}
type ServerSetNetworkNumQueuesInput struct {
// 虚机网卡 mac addr
MacAddr string `json:"mac_addr"`
// 网卡队列数
NumQueues int `json:"num_queues"`
}
type ServerMigrateForecastInput struct {
PreferHostId string `json:"prefer_host_id"`
// Deprecated
@@ -838,6 +888,10 @@ type ServerChangeConfigInput struct {
// 内存大小, 1024M, 1G
VmemSize string `json:"vmem_size"`
// 是否强制关机
// 若虚拟机不支持开机调整配置, 则需要指定此参数为true, 强制关机后, 再调整配置, 再启动虚拟机
ForceStop bool `json:"force_stop"`
// 调整完配置后是否自动启动
AutoStart bool `json:"auto_start"`
@@ -921,9 +975,10 @@ type GuestJsonDesc struct {
NetworkRoles []string `json:"network_roles"`
Secgroups []*SecgroupJsonDesc `json:"secgroups"`
SecurityRules string `json:"security_rules"`
AdminSecurityRules string `json:"admin_security_rules"`
Secgroups []*SecgroupJsonDesc `json:"secgroups"`
SecurityRules string `json:"security_rules"`
AdminSecurityRules string `json:"admin_security_rules"`
NicSecgroups []*GuestnetworkSecgroupDesc `json:"nic_secgroups"`
ExtraOptions jsonutils.JSONObject `json:"extra_options"`
@@ -1254,9 +1309,80 @@ type ServerSetLiveMigrateParamsInput struct {
}
type ServerNicTrafficLimit struct {
Mac string `json:"mac"`
Mac string `json:"mac"`
RxTrafficLimit *int64 `json:"rx_traffic_limit"`
TxTrafficLimit *int64 `json:"tx_traffic_limit"`
BillingType billing_api.TBillingType `json:"billing_type"`
ChargeType billing_api.TNetChargeType `json:"charge_type"`
}
func (input ServerNicTrafficLimit) Validate(billingType billing_api.TBillingType, chargeType billing_api.TNetChargeType, txLimit, rxLimit int64) (ServerNicTrafficLimit, bool, error) {
var billingChange bool
if len(input.BillingType) > 0 && input.BillingType != billingType {
billingChange = true
billingType = input.BillingType
}
if len(input.ChargeType) > 0 && input.ChargeType != chargeType {
billingChange = true
chargeType = input.ChargeType
}
if billingChange {
if len(input.BillingType) == 0 {
input.BillingType = billingType
}
if len(input.ChargeType) == 0 {
input.ChargeType = chargeType
}
}
if billingType == billing_api.BILLING_TYPE_POSTPAID && chargeType == billing_api.NET_CHARGE_TYPE_BY_TRAFFIC {
if txLimit > 0 {
txLimit = 0
input.TxTrafficLimit = &txLimit
} else {
input.TxTrafficLimit = nil
}
if rxLimit > 0 {
rxLimit = 0
input.RxTrafficLimit = &rxLimit
} else {
input.RxTrafficLimit = nil
}
} else if billingType == billing_api.BILLING_TYPE_POSTPAID && chargeType == billing_api.NET_CHARGE_TYPE_BY_BANDWIDTH {
return input, billingChange, errors.Wrapf(httperrors.ErrNotImplemented, "billing type %s and charge type %s are not supported", input.BillingType, input.ChargeType)
} else if billingType == billing_api.BILLING_TYPE_PREPAID && chargeType == billing_api.NET_CHARGE_TYPE_BY_TRAFFIC {
if txLimit == 0 && input.TxTrafficLimit == nil {
return input, billingChange, errors.Wrapf(httperrors.ErrBadRequest, "tx traffic limit is required")
}
if rxLimit == 0 && input.RxTrafficLimit == nil {
return input, billingChange, errors.Wrapf(httperrors.ErrBadRequest, "rx traffic limit is required")
}
if input.TxTrafficLimit != nil && *input.TxTrafficLimit <= 0 {
return input, billingChange, errors.Wrapf(httperrors.ErrBadRequest, "tx traffic limit must be greater than 0")
}
if input.RxTrafficLimit != nil && *input.RxTrafficLimit <= 0 {
return input, billingChange, errors.Wrapf(httperrors.ErrBadRequest, "rx traffic limit must be greater than 0")
}
} else if billingType == billing_api.BILLING_TYPE_PREPAID && chargeType == billing_api.NET_CHARGE_TYPE_BY_BANDWIDTH {
if txLimit > 0 {
txLimit = 0
input.TxTrafficLimit = &txLimit
} else {
input.TxTrafficLimit = nil
}
if rxLimit > 0 {
rxLimit = 0
input.RxTrafficLimit = &rxLimit
} else {
input.RxTrafficLimit = nil
}
} else {
return input, billingChange, errors.Wrapf(httperrors.ErrBadRequest, "invalid billing type %s and charge type %s", input.BillingType, input.ChargeType)
}
return input, billingChange, nil
}
type GuestAddSubIpsInfo struct {
@@ -1334,6 +1460,8 @@ type ServerChangeIpaddrInput struct {
Reserve *bool `json:"reserve"`
RestartNetwork *bool `json:"restart_network"`
NoSync *bool `json:"no_sync"`
}
type ServerChangeBandwidthInput struct {
@@ -1341,6 +1469,9 @@ type ServerChangeBandwidthInput struct {
Bandwidth int `json:"bandwidth"`
TxBwLimit int `json:"tx_bw_limit"`
RxBwLimit int `json:"rx_bw_limit"`
NoSync *bool `json:"no_sync"`
}
@@ -1372,7 +1503,9 @@ type ServerChangeConfigSettings struct {
AutoStart bool `json:"auto_start"`
GuestOnline bool `json:"guest_online"`
SetTrafficLimits []ServerNicTrafficLimit `json:"set_traffic_limits"`
// 设置虚拟网卡的流量上限
SetTrafficLimits []ServerNicTrafficLimit `json:"set_traffic_limits"`
// 重置虚拟网卡的流量上限,并且将网卡的流量归零
ResetTrafficLimits []ServerNicTrafficLimit `json:"reset_traffic_limits"`
SchedDesc jsonutils.JSONObject `json:"sched_desc"`
@@ -1438,10 +1571,18 @@ type ServerChangeBillingTypeInput struct {
// 仅在虚拟机开机或关机状态下调用
// enmu: [postpaid, prepaid]
// required: true
BillingType string `json:"billing_type"`
BillingType billing_api.TBillingType `json:"billing_type"`
}
type ServerPerformStatusInput struct {
apis.PerformStatusInput
Containers map[string]*ContainerPerformStatusInput `json:"containers"`
}
type ServerModificationType struct {
Name string `json:"name"`
}
type ServerModificationTypesOutput struct {
ModificationTypes []ServerModificationType `json:"modification_types"`
}

View File

@@ -18,6 +18,7 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
)
type GuestTemplateInput struct {
@@ -34,7 +35,8 @@ type GuestTemplateInput struct {
ImageType string `json:"image_type"`
ImageId string `json:"image_id"`
InstanceType string `json:"instance_type"`
BillingType string `json:"billing_type"`
BillingType billing_api.TBillingType `json:"billing_type"`
}
type GuestTemplateCreateInput struct {

View File

@@ -21,6 +21,7 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
"yunion.io/x/onecloud/pkg/cloudcommon/types"
)
@@ -370,7 +371,7 @@ type HostResourceInfo struct {
HostResourceType string `json:"host_resource_type"`
// 宿主机计费类型
HostBillingType string `json:"host_billing_type"`
HostBillingType billing_api.TBillingType `json:"host_billing_type"`
// 宿主机服务状态`
HostServiceStatus string `json:"host_service_status"`

View File

@@ -15,8 +15,11 @@
package compute
const (
HostVpcBridge = "__vpc_bridge__"
HostTapBridge = "__tap_bridge__"
TapConfigFileName = "tap-config.json"
HostVpcBridge = "__vpc_bridge__"
HostTapBridge = "__tap_bridge__"
HostLocalBridge = "brlocal"
)
type SMirrorConfig struct {

View File

@@ -150,6 +150,8 @@ type SnapshotPolicyListInput struct {
OrderBySnapshotCount string `json:"order_by_snapshot_count"`
// 按类型过滤
Type string `json:"type"`
ResourceId []string `json:"resource_id"`
}
type HostnameInput struct {

View File

@@ -31,8 +31,10 @@ type SimpleSnapshot struct {
DiskType string `json:"disk_type"`
// 区域Id
CloudregionId string `json:"cloudregion_id"`
// 快照大小
// 快照大小, MiB
Size int `json:"size"`
// 磁盘大小, MiB
VirtualSize int `json:"virtual_size"`
// 快照状态
Status string `json:"status"`
// 存储类型
@@ -61,8 +63,12 @@ type InstanceSnapshotDetails struct {
Snapshots []SimpleSnapshot `json:"snapshots"`
Properties map[string]string `json:"properties"`
// 主机快照大小
// 主机快照大小, B
Size int `json:"size"`
// 主机快照大小, MiB
SizeMb int `json:"size_mb"`
// 主机磁盘大小, MiB
VirtualSizeMb int `json:"virtual_size_mb"`
}
type InstanceSnapshotListInput struct {

View File

@@ -19,6 +19,7 @@ import (
"yunion.io/x/onecloud/pkg/apis"
"yunion.io/x/onecloud/pkg/apis/billing"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
"yunion.io/x/onecloud/pkg/util/ansible"
)
@@ -181,7 +182,7 @@ type LoadbalancerCreateInput struct {
// 弹性公网IP线路类型
EipBgpType string `json:"eip_bgp_type,omitzero"`
// 弹性公网IP计费类型
EipChargeType string `json:"eip_charge_type,omitempty"`
EipChargeType billing_api.TNetChargeType `json:"eip_charge_type,omitempty"`
// 是否跟随主机删除而自动释放
EipAutoDellocate bool `json:"eip_auto_dellocate,omitempty"`
@@ -200,7 +201,7 @@ type LoadbalancerCreateInput struct {
// 包年包月时长
Duration string `json:"duration"`
// swagger:ignore
BillingType string `json:"billing_type"`
BillingType billing_api.TBillingType `json:"billing_type"`
// swagger:ignore
BillingCycle string `json:"billing_cycle"`
@@ -234,7 +235,7 @@ type LoadbalancerAssociateEipInput struct {
type LoadbalancerCreateEipInput struct {
// 计费方式traffic or bandwidth
ChargeType string `json:"charge_type"`
ChargeType billing_api.TNetChargeType `json:"charge_type"`
// Bandwidth
Bandwidth int64 `json:"bandwidth"`

View File

@@ -160,6 +160,11 @@ var LB_LISTENER_TYPES = []string{
LB_LISTENER_TYPE_HTTPS,
}
var LB_APP_LISTENER_TYPES = []string{
LB_LISTENER_TYPE_HTTP,
LB_LISTENER_TYPE_HTTPS,
}
// aws_network_lb_listener
var AWS_NETWORK_LB_LISTENER_TYPES = choices.NewChoices(
LB_LISTENER_TYPE_TCP,

View File

@@ -181,6 +181,10 @@ type LoadbalancerListenerCreateInput struct {
AclType string `json:"acl_type"`
}
func (input LoadbalancerListenerCreateInput) IsRedirect() bool {
return len(input.Redirect) > 0 && input.Redirect != LB_REDIRECT_OFF
}
func (self *LoadbalancerListenerCreateInput) Validate() error {
if len(self.Status) == 0 {
self.Status = LB_STATUS_ENABLED
@@ -191,7 +195,13 @@ func (self *LoadbalancerListenerCreateInput) Validate() error {
if !utils.IsInStringArray(self.SendProxy, LB_SENDPROXY_CHOICES) {
return httperrors.NewInputParameterError("invalid send_proxy %s", self.SendProxy)
}
if !utils.IsInStringArray(self.Scheduler, LB_SCHEDULER_TYPES) {
if len(self.Redirect) == 0 {
self.Redirect = LB_REDIRECT_OFF
}
if !utils.IsInStringArray(self.Redirect, []string{LB_REDIRECT_OFF, LB_REDIRECT_RAW}) {
return httperrors.NewInputParameterError("invalid redirect %s", self.Redirect)
}
if !self.IsRedirect() && !utils.IsInStringArray(self.Scheduler, LB_SCHEDULER_TYPES) {
return httperrors.NewInputParameterError("invalid scheduler %s", self.Scheduler)
}
if len(self.StickySession) == 0 {
@@ -223,6 +233,9 @@ func (self *LoadbalancerListenerCreateInput) Validate() error {
if !utils.IsInStringArray(self.ListenerType, LB_LISTENER_TYPES) {
return httperrors.NewInputParameterError("invalid listener_type %s", self.ListenerType)
}
if self.IsRedirect() && !utils.IsInStringArray(self.ListenerType, LB_APP_LISTENER_TYPES) {
return httperrors.NewInputParameterError("redirect is only supported for http/https listeners")
}
if self.ListenerPort < 1 || self.ListenerPort > 65535 {
return httperrors.NewOutOfRangeError("listener_port out of range 1-65535")
}
@@ -272,12 +285,7 @@ func (self *LoadbalancerListenerCreateInput) Validate() error {
self.HealthCheckInterval = 30
}
}
if len(self.Redirect) == 0 {
self.Redirect = LB_REDIRECT_OFF
}
if !utils.IsInStringArray(self.Redirect, []string{LB_REDIRECT_OFF, LB_REDIRECT_RAW}) {
return httperrors.NewInputParameterError("invalid redirect %s", self.Redirect)
}
return nil
}

View File

@@ -21,6 +21,7 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
billing_api "yunion.io/x/onecloud/pkg/apis/billing"
)
const (
@@ -122,7 +123,7 @@ type NatgatewayCreateInput struct {
// 计费方式
// enum: ["postpaid", "prepaid"]
BillingType string `json:"billing_type"`
BillingType billing_api.TBillingType `json:"billing_type"`
// swagger:ignore
BillingCycle string `json:"billing_cycle"`
@@ -140,7 +141,8 @@ type NatgatewayCreateInput struct {
// 弹性公网IP计费类型
// enum: ["bandwidth", "traffic"]
// default: traffic
EipChargeType string `json:"eip_charge_type,omitempty"`
EipChargeType billing_api.TNetChargeType `json:"eip_charge_type,omitempty"`
EipBgpType string `json:"eip_bgp_type"`
EipAutoDellocate bool `json:"eip_auto_dellocate"`
}

View File

@@ -272,6 +272,9 @@ type SecgroupDetails struct {
// 关联云主机数量, 不包含回收站云主机
GuestCnt int `json:"guest_cnt,allowempty"`
// 关联云主机网卡数量, 不包含回收站云主机
GuestNicCnt int `json:"guest_nic_cnt,allowempty"`
// 关联此安全组的云主机is_system为true数量, , 不包含回收站云主机
SystemGuestCnt int `json:"system_guest_cnt,allowempty"`
@@ -310,6 +313,16 @@ type GuestsecgroupListInput struct {
SecgroupFilterListInput
}
type GuestnetworksecgroupListInput struct {
apis.ResourceBaseListInput
ServerFilterListInput
SecgroupFilterListInput
NetworkIndex *int `json:"network_index"`
IsAdmin bool `json:"is_admin"`
}
type ElasticcachesecgroupListInput struct {
ElasticcacheJointsListInput
SecgroupFilterListInput
@@ -324,6 +337,36 @@ type GuestsecgroupDetails struct {
Secgroup string `json:"secgroup"`
}
type GuestnetworksecgroupDetails struct {
GuestResourceInfo
SGuestsecgroup
SecurityGroupResourceInfo
ProjectId string `json:"tenant_id"`
apis.ProjectizedResourceInfo
// 安全组状态
SecgroupStatus string `json:"secgroup_status"`
// VPC ID
VpcId string `json:"vpc_id"`
Vpc string `json:"vpc"`
NetworkIndex int `json:"network_index"`
GuestNetwork string `json:"guest_network"`
MacAddr string `json:"mac_addr"`
Ifname string `json:"ifname"`
IpAddr string `json:"ip_addr"`
Ip6Addr string `json:"ip_6_addr"`
NetworkId string `json:"network_id"`
NetworkName string `json:"network_name"`
Admin bool `json:"admin"`
}
type ElasticcachesecgroupDetails struct {
ElasticcacheJointResourceDetails
@@ -353,11 +396,12 @@ type SSecurityGroupRef struct {
RdsCnt int `json:"rds_cnt"`
RedisCnt int `json:"redis_cnt"`
LoadbalancerCnt int `json:"loadbalancer_cnt"`
GuestNicCnt int `json:"guest_nic_cnt"`
TotalCnt int `json:"total_cnt"`
}
func (self *SSecurityGroupRef) Sum() {
self.TotalCnt = self.GuestCnt + self.AdminGuestCnt + self.RdsCnt + self.RedisCnt + self.LoadbalancerCnt
self.TotalCnt = self.GuestCnt + self.AdminGuestCnt + self.RdsCnt + self.RedisCnt + self.LoadbalancerCnt + self.GuestNicCnt
}
type SecurityGroupSyncstatusInput struct {

View File

@@ -18,6 +18,12 @@ import (
"yunion.io/x/onecloud/pkg/apis"
)
const (
SERVER_SKU_PROJECT_SRC_KEY = "project_src"
SERVER_SKU_PROJECT_SRC_VALUE_LOCAL = "local"
)
type ServerSkuCreateInput struct {
apis.EnabledStatusStandaloneResourceCreateInput

View File

@@ -36,6 +36,8 @@ type SnapshotCreateInput struct {
Location string `json:"location"`
// swagger:ignore
Size int `json:"size"`
// swagger:ingore
VirtualSize int `json:"virtual_size"`
// swagger:ignore
DiskType string `json:"disk_type"`
// swagger:ignore

View File

@@ -198,7 +198,7 @@ var (
STORAGE_PUBLIC_CLOUD, STORAGE_CLOUD_SSD, STORAGE_CLOUD_ESSD_PL0, STORAGE_CLOUD_ESSD, STORAGE_CLOUD_ESSD_PL2, STORAGE_CLOUD_ESSD_PL3,
STORAGE_EPHEMERAL_SSD, STORAGE_CLOUD_EFFICIENCY,
STORAGE_STANDARD_LRS, STORAGE_STANDARDSSD_LRS, STORAGE_PREMIUM_LRS,
STORAGE_GP2_SSD, STORAGE_GP3_SSD, STORAGE_IO1_SSD, STORAGE_ST1_HDD, STORAGE_SC1_HDD, STORAGE_STANDARD_HDD,
STORAGE_GP2_SSD, STORAGE_GP3_SSD, STORAGE_IO1_SSD, STORAGE_IO2_SSD, STORAGE_ST1_HDD, STORAGE_SC1_HDD, STORAGE_STANDARD_HDD,
STORAGE_LOCAL_BASIC, STORAGE_LOCAL_SSD, STORAGE_CLOUD_BASIC, STORAGE_CLOUD_PREMIUM,
STORAGE_HUAWEI_SSD, STORAGE_HUAWEI_SAS, STORAGE_HUAWEI_SATA,
STORAGE_OPENSTACK_ISCSI, STORAGE_UCLOUD_CLOUD_NORMAL, STORAGE_UCLOUD_CLOUD_SSD,

View File

@@ -21,4 +21,7 @@ const (
WIRE_STATUS_READY_DEPRECATED = "ready"
WIRE_STATUS_MERGE_NETWORK = "merge_network"
WIRE_STATUS_MERGE_NETWORK_FAILED = "merge_network_failed"
DEFAULT_HOST_LOCAL_WIRE_NAME = "hostlocal"
DEFAULT_HOST_LOCAL_WIRE_ID = "__host_local__"
)

View File

@@ -54,6 +54,20 @@ type SAccessGroupRule struct {
UserAccessType string `json:"user_access_type"`
}
// SAiGateway is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SAiGateway.
type SAiGateway struct {
apis.SVirtualResourceBase
apis.SExternalizedResourceBase
SManagedResourceBase
Authentication bool `json:"authentication"`
CacheInvalidateOnUpdate bool `json:"cache_invalidate_on_update"`
CacheTTL int `json:"cache_ttl"`
CollectLogs bool `json:"collect_logs"`
RateLimitingInterval int `json:"rate_limiting_interval"`
RateLimitingLimit int `json:"rate_limiting_limit"`
RateLimitingTechnique string `json:"rate_limiting_technique"`
}
// SApp is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SApp.
type SApp struct {
apis.SVirtualResourceBase
@@ -105,13 +119,20 @@ type SBaremetalagent struct {
DisableImageCache bool `json:"disable_image_cache"`
}
// SBillingChargeTypeBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SBillingChargeTypeBase.
type SBillingChargeTypeBase struct {
// 计费类型: 流量、带宽
// example: bandwidth
ChargeType string `json:"charge_type"`
}
// SBillingResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SBillingResourceBase.
type SBillingResourceBase struct {
// 计费类型, 按量、包年包月
// example: postpaid
BillingType string `json:"billing_type"`
// 过期时间
SBillingTypeBase
// 包年包月到期时间
ExpiredAt time.Time `json:"expired_at"`
// 到期释放时间
ReleaseAt time.Time `json:"release_at"`
// 计费周期
BillingCycle string `json:"billing_cycle"`
// 是否自动续费
@@ -120,11 +141,16 @@ type SBillingResourceBase struct {
// SBillingResourceCheck is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SBillingResourceCheck.
type SBillingResourceCheck struct {
apis.SResourceBase
ResourceId string `json:"resource_id"`
apis.SVirtualResourceBase
SBillingResourceBase
ResourceType string `json:"resource_type"`
AdvanceDays int `json:"advance_days"`
NotifyNumber int `json:"notify_number"`
}
// SBillingTypeBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SBillingTypeBase.
type SBillingTypeBase struct {
// 计费类型, 按量、包年包月
// example: prepaid, postpaid
BillingType string `json:"billing_type"`
}
// SBucket is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SBucket.
@@ -171,6 +197,16 @@ type SCDNDomain struct {
Referer *cloudprovider.SCDNReferer `json:"referer"`
// 浏览器缓存配置
MaxAge *cloudprovider.SCDNMaxAge `json:"max_age"`
// 是否启用DNSSEC
DNSSECEnabled bool `json:"dnssec_enabled"`
// SSL加密模式
SSLSetting string `json:"ssl_setting"`
// 是否启用HTTPS重写
HTTPSRewrites bool `json:"https_rewrites"`
// 缓存级别
CacheLevel string `json:"cache_level"`
// 浏览器缓存TTL
BrowserCacheTTL int `json:"browser_cache_ttl"`
}
// SCachedimage is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SCachedimage.
@@ -345,6 +381,7 @@ type SCloudregionResourceBase struct {
// SContainer is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SContainer.
type SContainer struct {
apis.SVirtualResourceBase
apis.SExternalizedResourceBase
// GuestId is also the pod id
GuestId string `json:"guest_id"`
// Spec stores all container running options
@@ -550,6 +587,8 @@ type SDisk struct {
SnapshotId string `json:"snapshot_id"`
// 备份Id
BackupId string `json:"backup_id"`
// 设备名称
Device string `json:"device"`
// 文件系统
FsFormat string `json:"fs_format"`
// 文件系统特性
@@ -625,8 +664,11 @@ type SDnsZone struct {
apis.SEnabledResourceBase
apis.SExternalizedResourceBase
SManagedResourceBase
ZoneType string `json:"zone_type"`
ProductType string `json:"product_type"`
NameServers *SNameServers `json:"name_servers"`
OriginalNameServers *SNameServers `json:"original_name_servers"`
ZoneType string `json:"zone_type"`
Registrar string `json:"registrar"`
ProductType string `json:"product_type"`
}
// SDnsZoneResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SDnsZoneResourceBase.
@@ -890,9 +932,10 @@ type SElasticip struct {
AssociateId string `json:"associate_id"`
// 带宽大小
Bandwidth int `json:"bandwidth"`
SBillingChargeTypeBase
// 计费类型: 流量、带宽
// example: bandwidth
ChargeType string `json:"charge_type"`
// ChargeType billing_api.TNetChargeType `width:"64" name:"charge_type" list:"user" create:"required"`
// 线路类型
BgpType string `json:"bgp_type"`
// 是否跟随主机删除而自动释放
@@ -1061,10 +1104,14 @@ type SGuest struct {
QgaStatus string `json:"qga_status"`
// power_states limit in [on, off, unknown]
PowerStates string `json:"power_states"`
// 健康状态, 仅开机中火运行中有效, 目前只支持阿里云
HealthStatus string `json:"health_status"`
// Used for guest rescue
RescueMode bool `json:"rescue_mode"`
// 上次开机时间
LastStartAt time.Time `json:"last_start_at"`
// 资源池,仅vmware指定调度标签时内部使用
ResourcePool string `json:"resource_pool"`
}
// SGuestJointsBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SGuestJointsBase.
@@ -1073,6 +1120,43 @@ type SGuestJointsBase struct {
GuestId string `json:"guest_id"`
}
// SGuestNetworkTrafficLog is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SGuestNetworkTrafficLog.
type SGuestNetworkTrafficLog struct {
apis.SLogBase
apis.SProjectizedResourceBase
SGuestResourceBase
// IPv4地址
IpAddr string `json:"ip_addr"`
// IPv6地址
Ip6Addr string `json:"ip6_addr"`
RowId int64 `json:"row_id"`
// 下行流量,单位 bytes
RxBytes int64 `json:"rx_bytes"`
// 上行流量,单位 bytes
TxBytes int64 `json:"tx_bytes"`
ReportAt time.Time `json:"report_at"`
State string `json:"state"`
}
// SGuestResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SGuestResourceBase.
type SGuestResourceBase struct {
GuestId string `json:"guest_id"`
}
// SGuestScreenDump is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SGuestScreenDump.
/* type SGuestScreenDump struct {
apis.SResourceBase
RowId int64 `json:"row_id"`
GuestId string `json:"guest_id"`
Name string `json:"name"`
// s3 config
S3AccessKey string `json:"s3_access_key"`
S3SecretKey string `json:"s3_secret_key"`
S3Endpoint string `json:"s3_endpoint"`
S3BucketName string `json:"s3_bucket_name"`
S3UseSsl bool `json:"s3_use_ssl"`
} */
// SGuestTemplate is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SGuestTemplate.
type SGuestTemplate struct {
apis.SSharableVirtualResourceBase
@@ -1154,12 +1238,16 @@ type SGuestnetwork struct {
TeamWith string `json:"team_with"`
// IPv4映射地址当子网属于私有云vpc的时候分配用于访问外网
MappedIpAddr string `json:"mapped_ip_addr"`
// IPv6映射地址当子网属于私有云vpc的时候分配用于访问外网
MappedIp6Addr string `json:"mapped_ip6_addr"`
// 网卡关联的Eip实例
EipId string `json:"eip_id"`
// 是否为缺省路由
IsDefault bool `json:"is_default"`
// 端口映射
PortMappings []*GuestPortMapping `json:"port_mappings"`
SBillingTypeBase
SBillingChargeTypeBase
}
// SGuestsecgroup is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SGuestsecgroup.
@@ -1208,6 +1296,8 @@ type SHost struct {
CpuMicrocode string `json:"cpu_microcode"`
// CPU架构
CpuArchitecture string `json:"cpu_architecture"`
// KVM CAP VCPU MAX
KvmCapMaxVcpu int `json:"kvm_cap_max_vcpu"`
// 内存大小,单位Mb
MemSize int `json:"mem_size"`
// 预留内存大小
@@ -1215,7 +1305,8 @@ type SHost struct {
// 内存超分比
MemCmtbound float32 `json:"mem_cmtbound"`
// 页大小
PageSizeKB int `json:"page_size_kb"`
PageSizeKB int `json:"page_size_kb"`
// scheduler cpu-node/numa allocate
EnableNumaAllocate bool `json:"enable_numa_allocate"`
// 存储大小,单位Mb
StorageSize int64 `json:"storage_size"`
@@ -1224,7 +1315,10 @@ type SHost struct {
// 存储驱动类型
StorageDriver string `json:"storage_driver"`
// 存储详情
StorageInfo jsonutils.JSONObject `json:"storage_info"`
StorageInfo jsonutils.JSONObject `json:"storage_info"`
RootPartitionUsedCapacityMb int `json:"root_partition_used_capacity_mb"`
MemoryUsedMb int `json:"memory_used_mb"`
CpuUsagePercent float64 `json:"cpu_usage_percent"`
// IPMI地址
IpmiIp string `json:"ipmi_ip"`
// IPMI详情
@@ -1255,6 +1349,8 @@ type SHost struct {
BootMode string `json:"boot_mode"`
// IPv4地址作为私有云vpc访问外网时的网关
OvnMappedIpAddr string `json:"ovn_mapped_ip_addr"`
// IPv6地址作为私有云vpc访问外网时的网关
OvnMappedIp6Addr string `json:"ovn_mapped_ip6_addr"`
// UEFI详情
UefiInfo jsonutils.JSONObject `json:"uefi_info"`
// 公网Ip地址
@@ -1270,6 +1366,12 @@ type SHostBackupstorage struct {
BackupstorageId string `json:"backupstorage_id"`
}
// SHostDmesgLog is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SHostDmesgLog.
type SHostDmesgLog struct {
apis.SOpsLog
LogLevel string `json:"log_level"`
}
// SHostFile is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SHostFile.
type SHostFile struct {
apis.SInfrasResourceBase
@@ -1309,6 +1411,8 @@ type SHostnetwork struct {
NetworkId string `json:"network_id"`
// IP地址
IpAddr string `json:"ip_addr"`
// IPv6地址
Ip6Addr string `json:"ip6_addr"`
// MAC地址
MacAddr string `json:"mac_addr"`
// VLAN
@@ -1425,7 +1529,7 @@ type SInstanceSnapshot struct {
// 是否保存内存
WithMemory bool `json:"with_memory"`
// 内存文件大小
MemorySizeMB int `json:"memory_size_mb"`
MemorySizeKB int `json:"memory_size_kb"`
// 内存文件所在宿主机
MemoryFileHostId string `json:"memory_file_host_id"`
// 内存文件路径
@@ -1497,6 +1601,10 @@ type SIsolatedDevice struct {
CardPath string `json:"card_path"`
// GPU render path, like /dev/dri/renderDX
RenderPath string `json:"render_path"`
// Nvidia GPU index
Index int `json:"index"`
// Nvidia GPU minor number, parsing from /proc/driver/nvidia/gpus/*/information
DeviceMinor int `json:"device_minor"`
// Is vgpu physical funcion, That means it cannot be attached to guest
// VGPUPhysicalFunction bool `nullable:"true" default:"false" list:"domain" create:"domain_optional"`
// nvidia vgpu config
@@ -1764,7 +1872,9 @@ type SLoadbalancerBackendGroup struct {
apis.SStatusStandaloneResourceBase
apis.SExternalizedResourceBase
SLoadbalancerResourceBase
Type string `json:"type"`
LoadbalancerHealthCheckId string `json:"loadbalancer_health_check_id"`
Scheduler string `json:"scheduler"`
Type string `json:"type"`
}
// SLoadbalancerBackendgroupResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SLoadbalancerBackendgroupResourceBase.
@@ -1813,35 +1923,39 @@ type SLoadbalancerClusterResourceBase struct {
// SLoadbalancerHTTPListener is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SLoadbalancerHTTPListener.
type SLoadbalancerHTTPListener struct {
StickySession string `json:"sticky_session"`
// 会话保持开启状态 on|off
StickySessionType string `json:"sticky_session_type"`
StickySession string `json:"sticky_session"`
// Cookie处理方式 insert(植入cookie)|server(重写cookie)
StickySessionCookie string `json:"sticky_session_cookie"`
StickySessionType string `json:"sticky_session_type"`
// Cookie名称
StickySessionCookieTimeout int `json:"sticky_session_cookie_timeout"`
XForwardedFor bool `json:"xforwarded_for"`
StickySessionCookie string `json:"sticky_session_cookie"`
// 会话超时时间
StickySessionCookieTimeout int `json:"sticky_session_cookie_timeout"`
// 获取客户端真实IP
XForwardedFor bool `json:"xforwarded_for"`
// Gzip数据压缩
Gzip bool `json:"gzip"`
}
// SLoadbalancerHTTPRateLimiter is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SLoadbalancerHTTPRateLimiter.
type SLoadbalancerHTTPRateLimiter struct {
HTTPRequestRate int `json:"http_request_rate"`
// 限定监听接收请示速率
HTTPRequestRate int `json:"http_request_rate"`
// 源IP监听请求最大速率
HTTPRequestRatePerSrc int `json:"http_request_rate_per_src"`
}
// SLoadbalancerHTTPRedirect is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SLoadbalancerHTTPRedirect.
type SLoadbalancerHTTPRedirect struct {
Redirect string `json:"redirect"`
// 跳转类型
RedirectCode int `json:"redirect_code"`
Redirect string `json:"redirect"`
// 跳转HTTP code
RedirectScheme string `json:"redirect_scheme"`
RedirectCode int `json:"redirect_code"`
// 跳转uri scheme
RedirectHost string `json:"redirect_host"`
RedirectScheme string `json:"redirect_scheme"`
// 跳转时变更Host
RedirectHost string `json:"redirect_host"`
// 跳转时变更Path
RedirectPath string `json:"redirect_path"`
}
@@ -1854,23 +1968,40 @@ type SLoadbalancerHTTPSListener struct {
// SLoadbalancerHealthCheck is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SLoadbalancerHealthCheck.
type SLoadbalancerHealthCheck struct {
HealthCheck string `json:"health_check"`
apis.SVirtualResourceBase
apis.SExternalizedResourceBase
SManagedResourceBase
SCloudregionResourceBase
SLoadbalancerHealthChecker
}
// SLoadbalancerHealthChecker is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SLoadbalancerHealthChecker.
type SLoadbalancerHealthChecker struct {
// 健康检查开启状态 on|off
HealthCheckType string `json:"health_check_type"`
HealthCheckDomain string `json:"health_check_domain"`
HealthCheck string `json:"health_check"`
// 健康检查协议 HTTP|TCP
HealthCheckType string `json:"health_check_type"`
// 健康检查域名 yunion.cn
HealthCheckURI string `json:"health_check_uri"`
HealthCheckDomain string `json:"health_check_domain"`
// 健康检查路径 /
HealthCheckURI string `json:"health_check_uri"`
// HTTP正常状态码 http_2xx,http_3xx
HealthCheckHttpCode string `json:"health_check_http_code"`
HealthCheckRise int `json:"health_check_rise"`
// 健康检查方法 GET|POST|HEAD
HealthCheckMethod string `json:"health_check_method"`
// 健康检查端口 80
HealthCheckPort int `json:"health_check_port"`
// 健康检查健康阈值 3秒
HealthCheckFall int `json:"health_check_fall"`
HealthCheckRise int `json:"health_check_rise"`
// 健康检查不健康阈值 15秒
HealthCheckTimeout int `json:"health_check_timeout"`
HealthCheckFall int `json:"health_check_fall"`
// 健康检查超时时间 10秒
HealthCheckInterval int `json:"health_check_interval"`
HealthCheckReq string `json:"health_check_req"`
HealthCheckTimeout int `json:"health_check_timeout"`
// 健康检查间隔时间 5秒
HealthCheckInterval int `json:"health_check_interval"`
// UDP监听健康检查的请求串
HealthCheckReq string `json:"health_check_req"`
// UDP监听健康检查的响应串
HealthCheckExp string `json:"health_check_exp"`
}
@@ -1879,18 +2010,19 @@ type SLoadbalancerListener struct {
apis.SStatusStandaloneResourceBase
apis.SExternalizedResourceBase
SLoadbalancerResourceBase
ListenerType string `json:"listener_type"`
ListenerPort int `json:"listener_port"`
BackendGroupId string `json:"backend_group_id"`
BackendServerPort int `json:"backend_server_port"`
Scheduler string `json:"scheduler"`
SendProxy string `json:"send_proxy"`
ClientRequestTimeout int `json:"client_request_timeout"`
ListenerType string `json:"listener_type"`
ListenerPort int `json:"listener_port"`
BackendGroupId string `json:"backend_group_id"`
BackendServerPort int `json:"backend_server_port"`
Scheduler string `json:"scheduler"`
SendProxy string `json:"send_proxy"`
// 连接请求超时时间
ClientIdleTimeout int `json:"client_idle_timeout"`
ClientRequestTimeout int `json:"client_request_timeout"`
// 连接空闲超时时间
BackendConnectTimeout int `json:"backend_connect_timeout"`
ClientIdleTimeout int `json:"client_idle_timeout"`
// 后端连接超时时间
BackendConnectTimeout int `json:"backend_connect_timeout"`
// 后端连接空闲时间
BackendIdleTimeout int `json:"backend_idle_timeout"`
AclStatus string `json:"acl_status"`
AclType string `json:"acl_type"`
@@ -1900,7 +2032,7 @@ type SLoadbalancerListener struct {
SLoadbalancerUDPListener
SLoadbalancerHTTPListener
SLoadbalancerHTTPSListener
SLoadbalancerHealthCheck
SLoadbalancerHealthChecker
SLoadbalancerHTTPRateLimiter
SLoadbalancerHTTPRedirect
}
@@ -1915,14 +2047,20 @@ type SLoadbalancerListenerResourceBase struct {
type SLoadbalancerListenerRule struct {
apis.SStatusStandaloneResourceBase
apis.SExternalizedResourceBase
SLoadbalancerCertificateResourceBase
SLoadbalancerListenerResourceBase
// 默认转发策略目前只有aws用到其它云都是false
IsDefault bool `json:"is_default"`
IsDefault bool `json:"is_default"`
// 默认后端服务器组
BackendGroupId string `json:"backend_group_id"`
Domain string `json:"domain"`
Path string `json:"path"`
Condition string `json:"condition"`
SLoadbalancerHealthCheck
// 后端服务器组列表
BackendGroups *ListenerRuleBackendGroups `json:"backend_groups"`
// 域名
Domain string `json:"domain"`
Path string `json:"path"`
Condition string `json:"condition"`
RedirectPool *ListenerRuleRedirectPool `json:"redirect_pool"`
SLoadbalancerHealthChecker
// 目前只有腾讯云HTTP、HTTPS类型的健康检查是和规则绑定的。
SLoadbalancerHTTPRateLimiter
SLoadbalancerHTTPRedirect
@@ -2215,10 +2353,7 @@ type SNetwork struct {
GuestIp6Mask byte `json:"guest_ip6_mask"`
// IPv6网关
GuestGateway6 string `json:"guest_gateway6"`
// IPv6域名服务器
GuestDns6 string `json:"guest_dns6"`
GuestDomain6 string `json:"guest_domain6"`
VlanId int `json:"vlan_id"`
VlanId int `json:"vlan_id"`
// 服务器类型
// example: server
ServerType string `json:"server_type"`
@@ -2392,6 +2527,7 @@ type SSSLCertificate struct {
apis.SVirtualResourceBase
apis.SExternalizedResourceBase
SManagedResourceBase
SDnsZoneResourceBase
SDeletePreventableResourceBase
Sans string `json:"sans"`
StartDate time.Time `json:"start_date"`
@@ -2399,7 +2535,6 @@ type SSSLCertificate struct {
Common string `json:"common"`
Country string `json:"country"`
Issuer string `json:"issuer"`
Expired bool `json:"expired"`
IsUpload bool `json:"is_upload"`
EndDate time.Time `json:"end_date"`
Fingerprint string `json:"fingerprint"`
@@ -2664,10 +2799,18 @@ type SSnapshotPolicy struct {
apis.SExternalizedResourceBase
SManagedResourceBase
SCloudregionResourceBase
// 快照保留天数, -1: 表示永久保留
RetentionDays int `json:"retention_days"`
// 1~7, 1 is Monday
// 快照保留数量, 优先级高于 RetentionDays, 且仅对本地IDC资源有效
RetentionCount int `json:"retention_count"`
// 快照类型, 目前支持 disk, server
// disk: 自动磁盘快照策略, 只能关联磁盘
// server: 自动主机快照策略, 只能关联主机
Type string `json:"type"`
// 1~7, 1 is Monday, 7 is Sunday
RepeatWeekdays []int `json:"repeat_weekdays"`
// 0~23
// 0~23, 每小时
// 创建自动快照策略的时间必须与 RepeatWeekdays 对应的创建周期相一致
TimePoints []int `json:"time_points"`
}
@@ -2678,6 +2821,14 @@ type SSnapshotPolicyDisk struct {
SDiskResourceBase
}
// SSnapshotPolicyResource is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SSnapshotPolicyResource.
type SSnapshotPolicyResource struct {
apis.SResourceBase
SnapshotpolicyId string `json:"snapshotpolicy_id"`
ResourceId string `json:"resource_id"`
ResourceType string `json:"resource_type"`
}
// SStorage is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SStorage.
type SStorage struct {
apis.SEnabledStatusInfrasResourceBase
@@ -2876,7 +3027,7 @@ type SWafRegexSet struct {
// SWafRule is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SWafRule.
type SWafRule struct {
apis.SStatusStandaloneResourceBase
apis.SEnabledStatusStandaloneResourceBase
apis.SExternalizedResourceBase
// 规则优先级
Priority int `json:"priority"`
@@ -2884,6 +3035,12 @@ type SWafRule struct {
Action *cloudprovider.DefaultAction `json:"action"`
// 条件
StatementConditon string `json:"statement_conditon"`
// 条件表达式
Expression string `json:"expression"`
// 规则类型
Type string `json:"type"`
// 规则配置
Config jsonutils.JSONObject `json:"config"`
// 规则组的id
WafRuleGroupId string `json:"waf_rule_group_id"`
// 所属waf实例id

View File

@@ -151,14 +151,16 @@ const (
const (
OS_ARCH_ALL = "all"
OS_ARCH_X86 = "x86"
OS_ARCH_ARM = "arm"
OS_ARCH_X86 = "x86"
OS_ARCH_ARM = "arm"
OS_ARCH_RISCV = "riscv"
OS_ARCH_I386 = "i386"
OS_ARCH_X86_32 = "x86_32"
OS_ARCH_X86_64 = "x86_64"
OS_ARCH_AARCH32 = "aarch32"
OS_ARCH_AARCH64 = "aarch64"
OS_ARCH_RISCV32 = "riscv32"
OS_ARCH_RISCV64 = "riscv64"
)
@@ -174,6 +176,11 @@ var (
OS_ARCH_AARCH32,
OS_ARCH_AARCH64,
}
ARCH_RISCV = []string{
OS_ARCH_RISCV,
OS_ARCH_RISCV32,
OS_ARCH_RISCV64,
}
)
func IsARM(osArch string) bool {
@@ -184,6 +191,10 @@ func IsX86(osArch string) bool {
return utils.IsInStringArray(osArch, ARCH_X86)
}
func IsRISCV(osArch string) bool {
return utils.IsInStringArray(osArch, ARCH_RISCV)
}
func IsIllegalSearchDomain(domain string) bool {
switch domain {
case "cloud.onecloud.io":
@@ -202,5 +213,8 @@ func IsSameArch(arch1, arch2 string) bool {
if IsX86(arch1) && IsX86(arch2) {
return true
}
if IsRISCV(arch1) && IsRISCV(arch2) {
return true
}
return false
}

View File

@@ -22,8 +22,18 @@ import (
)
type ContainerKeyValue struct {
Key string `json:"key"`
Value string `json:"value"`
Key string `json:"key"`
Value string `json:"value"`
ValueFrom *ContainerValueSource `json:"value_from"`
}
type ContainerValueSource struct {
Credential *ContainerValueSourceCredential `json:"credential"`
}
type ContainerValueSourceCredential struct {
Id string `json:"id"`
Key string `json:"key"`
}
type ContainerLifecyleHandlerType string
@@ -272,6 +282,22 @@ type ContainerVolumeMountDiskPostImageOverlay struct {
PathMap map[string]string `json:"path_map"`
// 宿主机底层目录映射, key 为 PathMap 的 keyvalue 为 overlay lower 格式,多目录以 ":" 分隔
HostLowerMap map[string]*HostLowerPath `json:"host_lower_map"`
UpperConfig *PostOverlayUpperConfig `json:"upper_config"`
}
type PostOverlayUpperConfigType string
const (
PostOverlayUpperConfigTypeDisk PostOverlayUpperConfigType = "disk"
)
type PostOverlayUpperConfigDisk struct {
SubPath string `json:"sub_path"`
}
type PostOverlayUpperConfig struct {
Type PostOverlayUpperConfigType `json:"type"`
Disk *PostOverlayUpperConfigDisk `json:"disk"`
}
type ContainerVolumeMountDiskPostImageOverlayUnpacker ContainerVolumeMountDiskPostImageOverlay
@@ -285,6 +311,7 @@ func (ov *ContainerVolumeMountDiskPostImageOverlay) UnmarshalJSON(data []byte) e
// 防止 PathMap 被合并,总是用 Unarmshal data 里面的 path_map
ov.PathMap = nov.PathMap
ov.HostLowerMap = nov.HostLowerMap
ov.UpperConfig = nov.UpperConfig
return nil
}
@@ -298,6 +325,8 @@ const (
type ContainerVolumeMountDiskPostOverlay struct {
// 宿主机底层目录
HostLowerDir []string `json:"host_lower_dir"`
// 宿主机上层目录
HostUpperDir string `json:"host_upper_dir"`
// 合并后要挂载到容器的目录
ContainerTargetDir string `json:"container_target_dir"`
Image *ContainerVolumeMountDiskPostImageOverlay `json:"image"`

View File

@@ -73,6 +73,7 @@ type ContainerVolumeMount struct {
type ContainerSpec struct {
apis.ContainerSpec
ImageCredentialToken string `json:"image_credential_token"`
SecretCredentials map[string]string `json:"secret_credentials"`
Rootfs *ContainerRootfs `json:"rootfs"`
VolumeMounts []*ContainerVolumeMount `json:"volume_mounts"`
Devices []*ContainerDevice `json:"devices"`

View File

@@ -19,9 +19,17 @@ type GuestMemorySnapshotRequest struct {
}
type GuestMemorySnapshotResponse struct {
// 内存快照文件路径
MemorySnapshotPath string `json:"memory_snapshot_path"`
SizeMB int64 `json:"size_mb"`
Checksum string `json:"checksum"`
// @deprecated
// swagger:ignore
SizeMB int64 `json:"size_mb" yunion-deprecated-by:"size_kb"`
// 内存快照文件大小, KB
SizeKB int64 `json:"size_kb"`
// 内存快照文件校验和
Checksum string `json:"checksum"`
}
type GuestMemorySnapshotDeleteRequest struct {

View File

@@ -27,6 +27,7 @@ const (
OIDC_CREDENTIAL_TYPE = "oidc"
ENCRYPT_KEY_TYPE = "enc_key"
CONTAINER_IMAGE_TYPE = "container_image"
CONTAINER_SECRET_TYPE = "container_secret"
)
type SAccessKeySecretBlob struct {

View File

@@ -31,6 +31,13 @@ type CredentialUpdateInput struct {
// enabled
Enabled *bool `json:"enabled"`
// 更新 blob 内容(明文,服务端加密后写入 encrypted_blob
Blob string `json:"blob"`
// 由 ValidateUpdateData 在提供 blob 时填充,不允许客户端直接传入
EncryptedBlob string `json:"encrypted_blob"`
KeyHash string `json:"key_hash"`
}
type CredentialCreateInput struct {

View File

@@ -355,10 +355,16 @@ type SUser struct {
// 显示名称,用户登录后显示在右上角菜单入口
Displayname string `json:"displayname"`
// 上次登录时间
// deprecated
// swagger:ignore
LastActiveAt time.Time `json:"last_active_at"`
// 上次用户登录IP
// deprecated
// swagger:ignore
LastLoginIp string `json:"last_login_ip"`
// 上次用户登录方式可能值有webweb控制台cli命令行climcAPIapi
// deprecated
// swagger:ignore
LastLoginSource string `json:"last_login_source"`
// 是否为系统账号,系统账号不会检查密码复杂度,默认不在列表显示
IsSystemAccount *bool `json:"is_system_account,omitempty"`
@@ -370,6 +376,8 @@ type SUser struct {
EnableMfa *bool `json:"enable_mfa,omitempty"`
// 用户的默认语言设置默认是zh_CN
Lang string `json:"lang"`
// 过期时间
ExpiredAt time.Time `json:"expired_at"`
}
// SUserOption is an autogenerated struct via yunion.io/x/onecloud/pkg/keystone/models.SUserOption.

View File

@@ -60,6 +60,8 @@ const (
IMAGE_OS_DISTRO = "os_distribution"
IMAGE_OS_TYPE = "os_type"
IMAGE_OS_VERSION = "os_version"
IMAGE_OS_LANGUAGE = "os_language"
IMAGE_OS_CURRENT_VERSION = "os_current_version"
IMAGE_DISK_FORMAT = "disk_format"
IMAGE_UEFI_SUPPORT = "uefi_support"
IMAGE_BIOS_SUPPORT = "bios_support"

View File

@@ -0,0 +1,24 @@
package llm
const (
LLM_COMFYUI_BASE_PATH = "/root/ComfyUI"
LLM_COMFYUI_MODELS_PATH = LLM_COMFYUI_BASE_PATH + "/models"
LLM_COMFYUI_HF_ENDPOINT = LLM_VLLM_HF_ENDPOINT
LLM_COMFYUI_CHECKPOINTS_DIR = "checkpoints"
LLM_COMFYUI_LORAS_DIR = "loras"
LLM_COMFYUI_VAE_DIR = "vae"
LLM_COMFYUI_CONTROLNET_DIR = "controlnet"
LLM_COMFYUI_CLIP_DIR = "clip"
LLM_COMFYUI_TEXT_ENCODERS_DIR = "text_encoders"
LLM_COMFYUI_CLIP_VISION_DIR = "clip_vision"
LLM_COMFYUI_DIFFUSION_MODELS_DIR = "diffusion_models"
LLM_COMFYUI_EMBEDDINGS_DIR = "embeddings"
LLM_COMFYUI_IPADAPTER_DIR = "ipadapter"
LLM_COMFYUI_STYLE_MODELS_DIR = "style_models"
LLM_COMFYUI_UNET_DIR = "unet"
LLM_COMFYUI_UPSCALE_MODELS_DIR = "upscale_models"
LLM_COMFYUI_HF_MODELS_DIR = LLM_COMFYUI_CHECKPOINTS_DIR
LLM_COMFYUI_HF_MODELS_PATH = LLM_COMFYUI_MODELS_PATH + "/" + LLM_COMFYUI_HF_MODELS_DIR
LLM_COMFYUI_MODELS_VOLUME_SUBDIR = "storage-models/models"
LLM_COMFYUI_STORAGE_VOLUME_SUBDIR = "storage"
)

77
pkg/apis/llm/host_path.go Normal file
View File

@@ -0,0 +1,77 @@
package llm
import (
"fmt"
"reflect"
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/gotypes"
"yunion.io/x/onecloud/pkg/apis"
)
func init() {
gotypes.RegisterSerializable(reflect.TypeOf(&HostPath{}), func() gotypes.ISerializable {
return &HostPath{}
})
gotypes.RegisterSerializable(reflect.TypeOf(&HostPaths{}), func() gotypes.ISerializable {
return &HostPaths{}
})
gotypes.RegisterSerializable(reflect.TypeOf(&ContainerHostPathRelations{}), func() gotypes.ISerializable {
return &ContainerHostPathRelations{}
})
}
type ContainerHostPathRelation struct {
MountPath string `json:"mount_path"`
ReadOnly bool `json:"read_only"`
Propagation apis.ContainerMountPropagation `json:"propagation,omitempty"`
FsUser *int64 `json:"fs_user"`
FsGroup *int64 `json:"fs_group"`
}
// key is string format of integer
type ContainerHostPathRelations map[string]*ContainerHostPathRelation
func (s ContainerHostPathRelations) String() string {
return jsonutils.Marshal(s).String()
}
func (s ContainerHostPathRelations) IsZero() bool {
return len(s) == 0
}
type HostPath struct {
Type apis.ContainerVolumeMountHostPathType `json:"type"`
Path string `json:"path"`
AutoCreate bool `json:"auto_create"`
AutoCreateConfig *apis.ContainerVolumeMountHostPathAutoCreateConfig `json:"auto_create_config,omitempty"`
// Container index to mount path relation
Containers ContainerHostPathRelations `json:"containers"`
}
func (s HostPath) String() string {
return jsonutils.Marshal(s).String()
}
func (s HostPath) IsZero() bool {
return len(s.Path) == 0
}
func (s HostPath) GetHostPathByContainer(containerIndex int) *ContainerHostPathRelation {
if len(s.Containers) == 0 {
return nil
}
key := fmt.Sprintf("%d", containerIndex)
return s.Containers[key]
}
type HostPaths []HostPath
func (s HostPaths) String() string {
return jsonutils.Marshal(s).String()
}
func (s HostPaths) IsZero() bool {
return len(s) == 0
}

View File

@@ -9,14 +9,24 @@ import (
type LLMImageType string
const (
LLM_IMAGE_TYPE_OLLAMA LLMImageType = "ollama"
LLM_IMAGE_TYPE_DIFY LLMImageType = "dify"
LLM_IMAGE_TYPE_OLLAMA LLMImageType = "ollama"
LLM_IMAGE_TYPE_VLLM LLMImageType = "vllm"
LLM_IMAGE_TYPE_SGLANG LLMImageType = "sglang"
LLM_IMAGE_TYPE_DIFY LLMImageType = "dify"
LLM_IMAGE_TYPE_COMFYUI LLMImageType = "comfyui"
LLM_IMAGE_TYPE_OPENCLAW LLMImageType = "openclaw"
LLM_IMAGE_TYPE_HERMES_AGENT LLMImageType = "hermes-agent"
)
var (
LLM_IMAGE_TYPES = sets.NewString(
string(LLM_IMAGE_TYPE_OLLAMA),
string(LLM_IMAGE_TYPE_VLLM),
string(LLM_IMAGE_TYPE_SGLANG),
string(LLM_IMAGE_TYPE_DIFY),
string(LLM_IMAGE_TYPE_COMFYUI),
string(LLM_IMAGE_TYPE_OPENCLAW),
string(LLM_IMAGE_TYPE_HERMES_AGENT),
)
)

View File

@@ -4,6 +4,10 @@ import (
"yunion.io/x/onecloud/pkg/apis"
)
const (
InstantModelSourceHuggingFace = "huggingface"
)
type InstantModelListInput struct {
apis.SharableVirtualResourceListInput
apis.EnabledResourceBaseListInput
@@ -11,6 +15,7 @@ type InstantModelListInput struct {
ModelName string `json:"model_name"`
ModelTag string `json:"model_tag"`
ModelId string `json:"model_id"`
LlmType string `json:"llm_type"`
Image string `json:"image"`
Mounts string `json:"mounts"`
@@ -22,6 +27,9 @@ type InstantModelImportInput struct {
ModelName string `json:"model_name"`
ModelTag string `json:"model_tag"`
LlmType LLMContainerType `json:"llm_type"`
Source string `json:"source,omitempty"`
RepoId string `json:"repo_id,omitempty"`
Revision string `json:"revision,omitempty"`
}
type InstantModelCreateInput struct {
@@ -31,6 +39,9 @@ type InstantModelCreateInput struct {
LlmType LLMContainerType `json:"llm_type"`
ModelName string `json:"model_name"`
ModelTag string `json:"model_tag"`
Source string `json:"source,omitempty"`
RepoId string `json:"repo_id,omitempty"`
Revision string `json:"revision,omitempty"`
ImageId string `json:"image_id"`
Size int64 `json:"size"`
ModelId string `json:"model_id"`

View File

@@ -0,0 +1,52 @@
package llm
type InstantModelHuggingFaceSearchInput struct {
Q string `json:"q"`
Author string `json:"author,omitempty"`
Filter []string `json:"filter,omitempty"`
Limit int `json:"limit,omitempty"`
Sort string `json:"sort,omitempty"`
Cursor string `json:"cursor,omitempty"`
}
type InstantModelHuggingFaceSearchOutput struct {
Data []InstantModelHuggingFaceSearchResult `json:"data"`
NextCursor string `json:"next_cursor,omitempty"`
HasMore bool `json:"has_more"`
}
type InstantModelHuggingFaceRepoInfoInput struct {
RepoId string `json:"repo_id"`
Revision string `json:"revision,omitempty"`
}
type InstantModelHuggingFaceSearchResult struct {
RepoId string `json:"repo_id"`
Author string `json:"author,omitempty"`
Sha string `json:"sha,omitempty"`
LastModified string `json:"last_modified,omitempty"`
Downloads int64 `json:"downloads,omitempty"`
Likes int64 `json:"likes,omitempty"`
PipelineTag string `json:"pipeline_tag,omitempty"`
Tags []string `json:"tags,omitempty"`
Private bool `json:"private,omitempty"`
Gated bool `json:"gated,omitempty"`
Disabled bool `json:"disabled,omitempty"`
Supported bool `json:"supported"`
UnsupportedReason string `json:"unsupported_reason,omitempty"`
}
type InstantModelHuggingFaceRepoInfo struct {
RepoId string `json:"repo_id"`
RequestedRevision string `json:"requested_revision,omitempty"`
ResolvedRevision string `json:"resolved_revision,omitempty"`
Siblings []string `json:"siblings,omitempty"`
ConfigPresent bool `json:"config_present"`
SafetensorsPresent bool `json:"safetensors_present"`
GgufPresent bool `json:"gguf_present"`
ReadmePresent bool `json:"readme_present"`
SizeBytes int64 `json:"size_bytes,omitempty"`
Supported bool `json:"supported"`
UnsupportedReason string `json:"unsupported_reason,omitempty"`
ImportMode string `json:"import_mode,omitempty"`
}

View File

@@ -4,6 +4,7 @@ import (
"time"
"yunion.io/x/onecloud/pkg/apis"
computeapi "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudcommon/db/taskman"
)
@@ -47,15 +48,17 @@ type LLMBaseListDetails struct {
type MountedModelInfo struct {
FullName string `json:"fullname"` // 模型全名,如: qwen3:8b
Id string `json:"id"` // 模型ID如: 500a1f067a9f
ModelId string `json:"model_id"` // 模型ID如: 500a1f067a9f
Id string `json:"id"` // 秒装包的 ID 主键
}
type LLMListDetails struct {
LLMBaseListDetails
LLMSku string
LLMSku string `json:"llm_sku"`
LLMType string `json:"llm_type"`
MountedModels []MountedModelInfo
MountedModelInfos []MountedModelInfo `json:"mounted_model_infos"`
}
type LLMBaseCreateInput struct {
@@ -64,8 +67,7 @@ type LLMBaseCreateInput struct {
PreferHost string `json:"prefer_host"`
AutoStart bool `json:"auto_start"`
NetworkType string `json:"network_type"`
NetworkId string `json:"network_id"`
Nets []*computeapi.NetworkConfig `json:"nets"`
BandwidthMB int `json:"bandwidth_mb"`
DebugMode bool `json:"debug_mode"`
@@ -74,9 +76,30 @@ type LLMBaseCreateInput struct {
type LLMCreateInput struct {
LLMBaseCreateInput
// MountedModels overrides the SKU's mounted_models when non-empty.
MountedModelResourceCreateInput
LLMSkuId string
LLMImageId string
LLMSkuId string `json:"llm_sku_id"`
LLMImageId string `json:"llm_image_id"`
LLMSpec *LLMSpec `json:"llm_spec,omitempty"`
// Devices/HostPaths override the corresponding sku fields when set.
HostPaths *HostPaths `json:"host_paths,omitempty"`
Devices *Devices `json:"devices,omitempty"`
}
// LLMUpdateInput is the request body for updating an LLM (including llm_spec overrides).
type LLMUpdateInput struct {
apis.VirtualResourceBaseUpdateInput
// MountedModels overrides the SKU's mounted_models when non-empty.
MountedModelResourceUpdateInput
InstantModelQuotaGb *int `json:"instant_model_quota_gb,omitempty"`
LLMSpec *LLMSpec `json:"llm_spec,omitempty"`
// Devices/HostPaths override the corresponding sku fields when set.
HostPaths *HostPaths `json:"host_paths,omitempty"`
Devices *Devices `json:"devices,omitempty"`
}
type LLMBaseListInput struct {
@@ -99,8 +122,10 @@ type LLMBaseListInput struct {
type LLMListInput struct {
LLMBaseListInput
LLMSku string `json:"llm_sku"`
LLMImage string `json:"llm_image"`
LLMSku string `json:"llm_sku"`
LLMImage string `json:"llm_image"`
LLMTypes []string `json:"llm_types"` // filter by linked SKU's llm_types (e.g. [dify, openclaw])
LLMType string `json:"llm_type"` // filter by linked SKU's llm_type (e.g. dify)
}
type ModelInfo struct {
@@ -171,3 +196,56 @@ func (info LLMMountDirInfo) ToOverlay() apis.ContainerVolumeMountDiskPostOverlay
type LLMSyncStatusInput struct {
}
type LLMRestartInput struct {
}
type LLMRestartTaskInput struct {
LLMId string
ResetDataDisk bool
LLMStatus string
SkuId string
ImageId string
BackupName string
Property []string
RebindVolumeId string
OnlyStop bool
}
type LLMChangeNetworkInput struct {
BandwidthMb int `json:"bandwidth_mb"`
WhitePrefxies []string `json:"white_prefxies"`
}
type LLMVolumeInput struct {
LLMId string `json:"llm_id"`
VolumeId string `json:"volume_id"`
AutoStart bool `json:"auto_start"`
}
type LLMAccessUrlInfo struct {
LoginUrl string `json:"login_url"`
PublicUrl string `json:"public_url"`
InternalUrl string `json:"internal_url"`
}
// LLMAccessInfo is the response for GET /llms/<id>/login-info: login URL and credentials.
type LLMAccessInfo struct {
LLMAccessUrlInfo
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Extra map[string]string `json:"extra,omitempty"`
}
type LLMProviderModelsInput struct {
URL string `json:"url"`
ProviderType LLMClientType `json:"provider_type"`
}
type LLMProviderModelsOutput struct {
ProviderType LLMClientType `json:"provider_type"`
URL string `json:"url"`
Models []string `json:"models"`
}

View File

@@ -33,15 +33,39 @@ const (
/* 运行 */
LLM_STATUS_RUNNING = "running"
/* 开始解绑磁盘 */
LLM_STATUS_START_UNBIND = "start_unbind"
/* 正在解绑磁盘 */
LLM_STATUS_UNBINDING = "unbinding"
/* 解绑磁盘失败 */
LLM_STATUS_UNBIND_FAIL = "unbind_fail"
/* 开始挂载磁盘 */
LLM_STATUS_START_BIND = "start_bind"
/* 正在挂载磁盘 */
LLM_STATUS_BINDING = "binding"
/* 挂载磁盘失败 */
LLM_STATUS_BIND_FAIL = "bind_fail"
/* 开始重启 */
LLM_STATUS_START_RESTART = "start_restart"
/* 正在重启 */
LLM_STATUS_RESTARTING = "restarting"
/* 重启失败 */
LLM_STATUS_RESTART_FAILED = "restart_fail"
/* 开始删除 */
LLM_STATUS_START_DELETE = "start_delete"
/* 正在删除 */
LLM_STATUS_DELETING = "deleting"
/* 删除失败 */
LLM_STATUS_DELETE_FAILED = "delete_fail"
/* 删除 */
LLM_STATUS_DELETED = "deleted"
LLM_LLM_STATUS_NO_SERVER = "no_server"
LLM_LLM_STATUS_NO_CONTAINER = "no_container"
LLM_STATUS_START_DELETE = "start_delete"
LLM_STATUS_DELETING = "deleting"
LLM_STATUS_DELETE_FAILED = "delete_fail"
)
type TQuickModelMethod string
@@ -55,3 +79,5 @@ const (
const (
LLM_PROBE_INSTANT_MODEl_INTERVAL_SECOND = 120 // 2 minute
)
type LLMEnvKey string

View File

@@ -9,12 +9,31 @@ import (
type LLMContainerType string
const (
LLM_CONTAINER_OLLAMA LLMContainerType = "ollama"
LLM_CONTAINER_OLLAMA LLMContainerType = "ollama"
LLM_CONTAINER_VLLM LLMContainerType = "vllm"
LLM_CONTAINER_SGLANG LLMContainerType = "sglang"
LLM_CONTAINER_DIFY LLMContainerType = "dify"
LLM_CONTAINER_COMFYUI LLMContainerType = "comfyui"
LLM_CONTAINER_OPENCLAW LLMContainerType = "openclaw"
LLM_CONTAINER_HERMES_AGENT LLMContainerType = "hermes-agent"
)
var (
LLM_CONTAINER_TYPES = sets.NewString(
string(LLM_CONTAINER_OLLAMA),
string(LLM_CONTAINER_VLLM),
string(LLM_CONTAINER_SGLANG),
string(LLM_CONTAINER_DIFY),
string(LLM_CONTAINER_COMFYUI),
string(LLM_CONTAINER_OPENCLAW),
string(LLM_CONTAINER_HERMES_AGENT),
)
LLM_INSTANT_MODEL_TYPES = sets.NewString(
string(LLM_CONTAINER_OLLAMA),
string(LLM_CONTAINER_VLLM),
string(LLM_CONTAINER_SGLANG),
string(LLM_CONTAINER_COMFYUI),
string(LLM_CONTAINER_OPENCLAW),
)
)
@@ -22,6 +41,18 @@ func IsLLMContainerType(t string) bool {
return LLM_CONTAINER_TYPES.Has(t)
}
func IsLLMInstantModelType(t string) bool {
return LLM_INSTANT_MODEL_TYPES.Has(t)
}
func GetLLMInstantModelContainerType(t LLMContainerType) LLMContainerType {
return t
}
func IsLLMInstantModelCompatible(instantModelType LLMContainerType, containerType LLMContainerType) bool {
return GetLLMInstantModelContainerType(instantModelType) == containerType
}
type LLMContainerCreateInput struct {
apis.VirtualResourceCreateInput
LLMId string `json:"llm_id"`

View File

@@ -8,14 +8,18 @@ type LLMInternalInstantMdlInfo struct {
Tag string `json:"tag"`
Size int64 `json:"size"`
// Modified string `json:"modified"`
Blobs []string `json:"blobs"`
Blobs []string `json:"blobs"`
Mounts []string `json:"mounts,omitempty"`
ModelType string `json:"model_type,omitempty"`
}
type LLMSaveInstantModelInput struct {
apis.ProjectizedResourceCreateInput
ModelId string `json:"model_id"`
ModelFullName string `json:"model_full_name"`
ModelId string `json:"model_id"`
Name string `json:"name"`
ModelFullName string `json:"model_full_name"`
Mounts []string `json:"mounts"`
InstantModelId string `json:"instant_model_id"`

202
pkg/apis/llm/llm_spec.go Normal file
View File

@@ -0,0 +1,202 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package llm
import (
"reflect"
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/gotypes"
)
// LLMSpec is the flat spec for LLM SKU: optional ollama/vllm/dify payload. Type is on LLMSku.LLMType.
type LLMSpec struct {
Ollama *LLMSpecOllama `json:"ollama,omitempty"`
Vllm *LLMSpecVllm `json:"vllm,omitempty"`
SGLang *LLMSpecSGLang `json:"sglang,omitempty"`
Dify *LLMSpecDify `json:"dify,omitempty"`
ComfyUI *LLMSpecComfyUI `json:"comfyui,omitempty"`
OpenClaw *LLMSpecOpenClaw `json:"openclaw,omitempty"`
HermesAgent *LLMSpecHermesAgent `json:"hermes_agent,omitempty"`
}
func (s *LLMSpec) String() string {
return jsonutils.Marshal(s).String()
}
func (s *LLMSpec) IsZero() bool {
if s == nil {
return true
}
return s.Ollama == nil && s.Vllm == nil && s.SGLang == nil && s.Dify == nil && s.ComfyUI == nil && s.OpenClaw == nil && s.HermesAgent == nil
}
// LLMSpecOllama holds type-specific fields for ollama SKUs.
type LLMSpecOllama struct {
}
func (s *LLMSpecOllama) String() string {
return jsonutils.Marshal(s).String()
}
func (s *LLMSpecOllama) IsZero() bool {
if s == nil {
return true
}
return false
}
// LLMSpecVllm holds type-specific fields for vllm SKUs (includes PreferredModel).
type LLMSpecVllm struct {
PreferredModel string `json:"preferred_model"`
// On update, a provided customized_args list replaces the previous list.
CustomizedArgs []*VllmCustomizedArg `json:"customized_args,omitempty"`
}
type VllmCustomizedArg struct {
Key string `json:"key"`
Value string `json:"value"`
}
func (s *LLMSpecVllm) String() string {
return jsonutils.Marshal(s).String()
}
func (s *LLMSpecVllm) IsZero() bool {
if s == nil {
return true
}
return s.PreferredModel == "" && len(s.CustomizedArgs) == 0
}
// LLMSpecSGLang holds type-specific fields for SGLang SKUs.
type LLMSpecSGLang struct {
PreferredModel string `json:"preferred_model"`
// On update, a provided customized_args list replaces the previous list.
CustomizedArgs []*SGLangCustomizedArg `json:"customized_args,omitempty"`
}
type SGLangCustomizedArg struct {
Key string `json:"key"`
Value string `json:"value"`
}
func (s *LLMSpecSGLang) String() string {
return jsonutils.Marshal(s).String()
}
func (s *LLMSpecSGLang) IsZero() bool {
if s == nil {
return true
}
return s.PreferredModel == "" && len(s.CustomizedArgs) == 0
}
// LLMSpecDify holds type-specific fields for Dify SKUs (multiple image ids + customized envs).
type LLMSpecDify struct {
PostgresImageId string `json:"postgres_image_id"`
RedisImageId string `json:"redis_image_id"`
NginxImageId string `json:"nginx_image_id"`
DifyApiImageId string `json:"dify_api_image_id"`
DifyPluginImageId string `json:"dify_plugin_image_id"`
DifyWebImageId string `json:"dify_web_image_id"`
DifySandboxImageId string `json:"dify_sandbox_image_id"`
DifySSRFImageId string `json:"dify_ssrf_image_id"`
DifyWeaviateImageId string `json:"dify_weaviate_image_id"`
CustomizedEnvs []*DifyCustomizedEnv `json:"customized_envs,omitempty"`
}
func (s *LLMSpecDify) String() string {
return jsonutils.Marshal(s).String()
}
func (s *LLMSpecDify) IsZero() bool {
if s == nil {
return true
}
return s.PostgresImageId == "" && s.RedisImageId == "" && s.NginxImageId == "" &&
s.DifyApiImageId == "" && s.DifyPluginImageId == "" && s.DifyWebImageId == "" &&
s.DifySandboxImageId == "" && s.DifySSRFImageId == "" && s.DifyWeaviateImageId == "" &&
len(s.CustomizedEnvs) == 0
}
type LLMSpecComfyUI struct {
}
func (s *LLMSpecComfyUI) String() string {
return jsonutils.Marshal(s).String()
}
func (s *LLMSpecComfyUI) IsZero() bool {
if s == nil {
return true
}
return false
}
type LLMSpecCredential struct {
Id string `json:"id"`
ExportKeys []string `json:"export_keys"`
}
type LLMSpecOpenClawProvider struct {
Name string `json:"name"`
Credential *LLMSpecCredential `json:"credential"`
}
type LLMSpecOpenClawChannel struct {
Name string `json:"name"`
Credential *LLMSpecCredential `json:"credential"`
}
type LLMSpecOpenClaw struct {
ManualConfig bool `json:"manual_config"`
Providers []*LLMSpecOpenClawProvider `json:"providers"`
Channels []*LLMSpecOpenClawChannel `json:"channels"`
WorkspaceTemplates *LLMSpecOpenClawWorkspaceTemplates `json:"workspace_templates"`
}
type LLMSpecOpenClawWorkspaceTemplates struct {
AgentsMD string `json:"agents_md"`
SoulMD string `json:"soul_md"`
UserMD string `json:"user_md"`
}
type LLMSpecHermesAgent struct {
// LLMId optionally points to a Cloudpods LLM instance; Hermes resolves its
// OpenAI-compatible base URL and model during create/update validation.
LLMId string `json:"llm_id,omitempty"`
LLMUrl string `json:"llm_url,omitempty"`
Model string `json:"model,omitempty"`
ApiKey string `json:"api_key,omitempty"`
ContextLength int `json:"context_length,omitempty"`
}
func (s *LLMSpecHermesAgent) String() string {
return jsonutils.Marshal(s).String()
}
func (s *LLMSpecHermesAgent) IsZero() bool {
if s == nil {
return true
}
return s.LLMId == "" && s.LLMUrl == "" && s.Model == "" && s.ApiKey == "" && s.ContextLength == 0
}
func init() {
gotypes.RegisterSerializable(reflect.TypeOf(new(LLMSpec)), func() gotypes.ISerializable {
return new(LLMSpec)
})
}

View File

@@ -60,36 +60,40 @@ func IsLLMClientType(t string) bool {
type MCPAgentListInput struct {
apis.SharableVirtualResourceListInput
LLMDriver string `json:"llm_driver"`
LLMDriver string `json:"llm_driver"`
DefaultAgent *bool `json:"default_agent,omitempty" help:"filter by default agent (true to get the default one)"`
}
type MCPAgentCreateInput struct {
apis.SharableVirtualResourceCreateInput
LLMId string `json:"llm_id" help:"LLM 实例 ID如果提供则自动获取 llm_url"`
LLMUrl string `json:"llm_url" help:"后端大模型的 base 请求地址"`
LLMDriver string `json:"llm_driver" help:"使用的大模型驱动,可以是 ollama 或 openai"`
Model string `json:"model" help:"使用的模型名称"`
ApiKey string `json:"api_key" help:"在 llm_driver 中需要用到的认证"`
McpServer string `json:"mcp_server" help:"mcp 服务器的后端地址"`
LLMId string `json:"llm_id" help:"LLM 实例 ID如果提供则自动获取 llm_url"`
LLMUrl string `json:"llm_url" help:"后端大模型的 base 请求地址"`
LLMDriver string `json:"llm_driver" help:"使用的大模型驱动,可以是 ollama 或 openai"`
Model string `json:"model" help:"使用的模型名称"`
ApiKey string `json:"api_key" help:"在 llm_driver 中需要用到的认证"`
McpServer string `json:"mcp_server" help:"mcp 服务器的后端地址"`
DefaultAgent *bool `json:"default_agent,omitempty" help:"set as default MCP agent (only one can be true globally)"`
}
type MCPAgentUpdateInput struct {
apis.SharableVirtualResourceCreateInput
LLMId *string `json:"llm_id,omitempty" help:"LLM 实例 ID如果提供则自动获取 llm_url"`
LLMUrl *string `json:"llm_url,omitempty" help:"后端大模型的 base 请求地址"`
LLMDriver *string `json:"llm_driver,omitempty" help:"使用的大模型驱动,可以是 ollama 或 openai"`
Model *string `json:"model,omitempty" help:"使用的模型名称"`
ApiKey *string `json:"api_key,omitempty" help:"在 llm_driver 中需要用到的认证"`
McpServer *string `json:"mcp_server,omitempty" help:"mcp 服务器的后端地址"`
LLMId *string `json:"llm_id,omitempty" help:"LLM 实例 ID如果提供则自动获取 llm_url"`
LLMUrl *string `json:"llm_url,omitempty" help:"后端大模型的 base 请求地址"`
LLMDriver *string `json:"llm_driver,omitempty" help:"使用的大模型驱动,可以是 ollama 或 openai"`
Model *string `json:"model,omitempty" help:"使用的模型名称"`
ApiKey *string `json:"api_key,omitempty" help:"在 llm_driver 中需要用到的认证"`
McpServer *string `json:"mcp_server,omitempty" help:"mcp 服务器的后端地址"`
DefaultAgent *bool `json:"default_agent,omitempty" help:"set as default MCP agent (only one can be true globally)"`
}
type MCPAgentDetails struct {
apis.SharableVirtualResourceDetails
LLMId string `json:"llm_id"`
LLMName string `json:"llm_name"`
LLMId string `json:"llm_id"`
LLMName string `json:"llm_name"`
DefaultAgent bool `json:"default_agent"`
}
type LLMToolRequestInput struct {
@@ -98,7 +102,14 @@ type LLMToolRequestInput struct {
}
type LLMMCPAgentRequestInput struct {
Message string `json:"message" help:"message to send to MCP agent"`
Message string `json:"message" help:"message to send to MCP agent"`
History []MCPAgentChatMessage `json:"history" help:"chat history"`
}
type MCPAgentChatMessage struct {
Role string `json:"role"`
Content string `json:"content"`
// ToolCalls []MCPAgentToolCallRecord `json:"tool_calls,omitempty"`
}
// MCPAgentResponse 表示 Agent 响应
@@ -115,6 +126,7 @@ type MCPAgentResponse struct {
// MCPAgentToolCallRecord 记录工具调用
type MCPAgentToolCallRecord struct {
Id string `json:"id,omitempty"`
ToolName string `json:"tool_name"`
Arguments map[string]interface{} `json:"arguments"`
Result string `json:"result"`

View File

@@ -17,10 +17,10 @@ const (
LLM_OLLAMA_HOST_MANIFESTS_DIR = "/manifests"
LLM_OLLAMA_CACHE_DIR = "/.llm_ollama_cache"
LLM_OLLAMA_CACHE_MOUNT_PATH = "/usr/local"
LLM_OLLAMA_LIBRARY_BASE_URL = `https://registry.ollama.ai/v2/library/%s`
LLM_OLLAMA_LIBRARY_BASE_URL = `https://registry.ollama.ai/v2/%s`
LLM_OLLAMA_BASE_PATH = "/root/.ollama/models"
LLM_OLLAMA_BLOBS_DIR = "/blobs"
LLM_OLLAMA_MANIFESTS_BASE_PATH = "/manifests/registry.ollama.ai/library"
LLM_OLLAMA_MANIFESTS_BASE_PATH = "/manifests/registry.ollama.ai"
)
const (

47
pkg/apis/llm/openclaw.go Normal file
View File

@@ -0,0 +1,47 @@
package llm
const (
LLM_OPENCLAW_GATEWAY_TOKEN = LLMEnvKey("OPENCLAW_GATEWAY_TOKEN")
LLM_OPENCLAW_CUSTOM_CONFIG = LLMEnvKey("OPENCLAW_CUSTOM_CONFIG")
LLM_OPENCLAW_MANUAL_CONFIG = LLMEnvKey("OPENCLAW_MANUAL_CONFIG")
LLM_OPENCLAW_CUSTOM_CONFIG_FILE = "/opt/openclaw_base_config.json"
// templates
LLM_OPENCLAW_TEMPLATE_AGENTS_MD_B64 = LLMEnvKey("OPENCLAW_TEMPLATE_AGENTS_MD_B64")
LLM_OPENCLAW_TEMPLATE_SOUL_MD_B64 = LLMEnvKey("OPENCLAW_TEMPLATE_SOUL_MD_B64")
LLM_OPENCLAW_TEMPLATE_USER_MD_B64 = LLMEnvKey("OPENCLAW_TEMPLATE_USER_MD_B64")
)
const (
LLM_DESKTOP_DEFAULT_PORT = 3001
LLM_DESKTOP_AUTH_USERNAME = LLMEnvKey("AUTH_USERNAME")
LLM_DESKTOP_CUSTOM_USER = LLMEnvKey("CUSTOM_USER")
LLM_DESKTOP_AUTH_PASSWORD = LLMEnvKey("AUTH_PASSWORD")
LLM_DESKTOP_PASSWORD = LLMEnvKey("PASSWORD")
)
type OpenClawConfig struct {
Browser *OpenClawConfigBrowser `json:"browser"`
Agents *OpenClawConfigAgents `json:"agents"`
}
type OpenClawConfigAgents map[string]*OpenClawConfigAgent
type OpenClawConfigAgent struct {
Model *OpenClawConfigAgentModel `json:"model"`
ImageModel *OpenClawConfigAgentModel `json:"imageModel"`
Workspace string `json:"workspace"`
}
type OpenClawConfigAgentModel struct {
Primary string `json:"primary"`
}
// ref: https://docs.openclaw.ai/tools/browser#configuration
type OpenClawConfigBrowser struct {
Enabled bool `json:"enabled"`
SSRFPolicy map[string]interface{} `json:"ssrfPolicy"`
DefaultProfile string `json:"defaultProfile"`
Headless bool `json:"headless"`
NoSandbox bool `json:"noSandbox"`
}

View File

@@ -0,0 +1,12 @@
package llm
const (
LLM_SGLANG = "sglang"
LLM_SGLANG_DEFAULT_PORT = 30000
LLM_SGLANG_EXEC_PATH = "python3 -m sglang.launch_server"
LLM_SGLANG_HF_ENDPOINT = LLM_VLLM_HF_ENDPOINT
LLM_SGLANG_CACHE_DIR = "/root/.cache/huggingface"
LLM_SGLANG_BASE_PATH = "/data/models"
LLM_SGLANG_MODELS_PATH = "/data/models/huggingface"
)

View File

@@ -116,7 +116,14 @@ type LLMSkuDetails struct {
ImageLabel string
ImageName string
MountedModelDetails []MountedModelInfo `json:"mounted_model_details"`
Template string `json:"template"`
// LLMType 为 SKU 类型ollama/vllm/dify与 llm_spec 一起带出
LLMType string `json:"llm_type"`
// LLMSpec 从 SKU 持久化字段带出,保证 list/show 与 create 一致
LLMSpec *LLMSpec `json:"llm_spec,omitempty"`
}
type MountedAppResourceDetails struct {
@@ -131,6 +138,7 @@ type LLMSKuBaseCreateInput struct {
Bandwidth int `json:"bandwidth"`
Volumes *Volumes `json:"volumes"`
HostPaths *HostPaths `json:"host_paths"`
PortMappings *PortMappings `json:"port_mappings"`
Devices *Devices `json:"devices"`
Envs *Envs `json:"envs"`
@@ -145,10 +153,12 @@ type LLMSkuBaseUpdateInput struct {
// RequstSyncImage *bool `json:"request_sync_image"`
DiskSizeMB *int `json:"disk_size_mb"`
TemplateId *string `json:"template_id"`
StorageType *string `json:"storage_type"`
Volumes *Volumes `json:"volumes"`
DiskSize *int `json:"disk_size" yunion-deprecated-by:"disk_size_mb"`
DiskSizeMB *int `json:"disk_size_mb"`
TemplateId *string `json:"template_id"`
StorageType *string `json:"storage_type"`
Volumes *Volumes `json:"volumes"`
HostPaths *HostPaths `json:"host_paths"`
Bandwidth *int `json:"bandwidth"`
PortMappings *PortMappings `json:"port_mappings"`
@@ -161,23 +171,33 @@ type LLMSkuListInput struct {
apis.SharableVirtualResourceListInput
MountedModelResourceListInput
LLMType string `json:"llm_type"`
LLMType string `json:"llm_type"`
LLMTypes []string `json:"llm_types"`
}
type LLMSkuCreateInput struct {
LLMSKuBaseCreateInput
MountedModelResourceCreateInput
LLMImageId string `json:"llm_image_id"`
LLMType string `json:"llm_type"`
LLMModelName string `json:"llm_model_name"`
LLMImageId string `json:"llm_image_id"`
LLMType string `json:"llm_type"`
// LLMSpec:
// - ollama/vllm: backend builds llm_spec from llm_image_id + mounted_models; for vllm preferred model should be set in llm_spec.vllm.preferred_model.
// - dify: client must send llm_spec with type "dify" and dify payload.
LLMSpec *LLMSpec `json:"llm_spec,omitempty"`
}
type LLMSkuUpdateInput struct {
LLMSkuBaseUpdateInput
MountedModelResourceUpdateInput
LLMImageId string `json:"llm_image_id"`
LLMModelName string `json:"llm_model_name"`
LLMImageId string `json:"llm_image_id"`
// LLMSpec:
// - dify: send full spec to update image ids.
// - ollama/vllm: backend may build from llm_image_id/mounted_models; for vllm preferred model should be set in llm_spec.vllm.preferred_model.
LLMSpec *LLMSpec `json:"llm_spec,omitempty"`
}
// type LLMModelCloneInput struct {
@@ -188,35 +208,35 @@ type LLMSkuUpdateInput struct {
// Request bool `json:"request"`
// }
type DifySkulListInput struct {
apis.SharableVirtualResourceListInput
MountedModelResourceListInput
}
// type DifySkulListInput struct {
// apis.SharableVirtualResourceListInput
// MountedModelResourceListInput
// }
type DifySkuCreateInput struct {
LLMSKuBaseCreateInput
// type DifySkuCreateInput struct {
// LLMSKuBaseCreateInput
PostgresImageId string `json:"postgres_image_id"`
RedisImageId string `json:"redis_image_id"`
NginxImageId string `json:"nginx_image_id"`
DifyApiImageId string `json:"dify_api_image_id"`
DifyPluginImageId string `json:"dify_plugin_image_id"`
DifyWebImageId string `json:"dify_web_image_id"`
DifySandboxImageId string `json:"dify_sandbox_image_id"`
DifySSRFImageId string `json:"dify_ssrf_image_id"`
DifyWeaviateImageId string `json:"dify_weaviate_image_id"`
}
// PostgresImageId string `json:"postgres_image_id"`
// RedisImageId string `json:"redis_image_id"`
// NginxImageId string `json:"nginx_image_id"`
// DifyApiImageId string `json:"dify_api_image_id"`
// DifyPluginImageId string `json:"dify_plugin_image_id"`
// DifyWebImageId string `json:"dify_web_image_id"`
// DifySandboxImageId string `json:"dify_sandbox_image_id"`
// DifySSRFImageId string `json:"dify_ssrf_image_id"`
// DifyWeaviateImageId string `json:"dify_weaviate_image_id"`
// }
type DifySkuUpdateInput struct {
LLMSkuBaseUpdateInput
// type DifySkuUpdateInput struct {
// LLMSkuBaseUpdateInput
PostgresImageId string `json:"postgres_image_id"`
RedisImageId string `json:"redis_image_id"`
NginxImageId string `json:"nginx_image_id"`
DifyApiImageId string `json:"dify_api_image_id"`
DifyPluginImageId string `json:"dify_plugin_image_id"`
DifyWebImageId string `json:"dify_web_image_id"`
DifySandboxImageId string `json:"dify_sandbox_image_id"`
DifySSRFImageId string `json:"dify_ssrf_image_id"`
DifyWeaviateImageId string `json:"dify_weaviate_image_id"`
}
// PostgresImageId string `json:"postgres_image_id"`
// RedisImageId string `json:"redis_image_id"`
// NginxImageId string `json:"nginx_image_id"`
// DifyApiImageId string `json:"dify_api_image_id"`
// DifyPluginImageId string `json:"dify_plugin_image_id"`
// DifyWebImageId string `json:"dify_web_image_id"`
// DifySandboxImageId string `json:"dify_sandbox_image_id"`
// DifySSRFImageId string `json:"dify_ssrf_image_id"`
// DifyWeaviateImageId string `json:"dify_weaviate_image_id"`
// }

View File

@@ -0,0 +1,12 @@
package llm
const (
LLM_VLLM = "vllm"
LLM_VLLM_DEFAULT_PORT = 8000
LLM_VLLM_EXEC_PATH = "vllm serve"
LLM_VLLM_HF_ENDPOINT = "https://hf-mirror.com"
LLM_VLLM_CACHE_DIR = "/root/.cache/huggingface"
LLM_VLLM_BASE_PATH = "/data/models"
LLM_VLLM_MODELS_PATH = "/data/models/huggingface"
)

View File

@@ -141,6 +141,7 @@ type AlertCreateInput struct {
UsedBy string `json:"used_by"`
// customize info
CustomizeConfig jsonutils.JSONObject `json:"customize_config"`
Reason string `json:"reason"`
}
type MeterCustomizeConfig struct {
@@ -168,6 +169,8 @@ type AlertUpdateInput struct {
NoDataState string `json:"no_data_state"`
// 报警执行错误将当前报警状态设置为对应的状态
ExecutionErrorState string `json:"execution_error_state"`
// 报警原因
Reason string `json:"reason"`
}
type AlertListInput struct {

Some files were not shown because too many files have changed in this diff Show More