Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[求助/Help]2层网络没有子网导致创建虚拟机时无法选择子网 #21059

Open
ollylu opened this issue Aug 19, 2024 · 28 comments
Open
Labels
question Further information is requested stale state/awaiting processing

Comments

@ollylu
Copy link

ollylu commented Aug 19, 2024

我关联了vware虚拟机,2层网络如下,但是该网络下没有任何子网 如图1,导致我无法创建虚拟机,如图2
image

image

请问这个问题应该如何解决

@ollylu ollylu added the question Further information is requested label Aug 19, 2024
@ollylu
Copy link
Author

ollylu commented Aug 19, 2024

似乎需要在这个2层网络下创建子网才能创建虚拟机

@ollylu
Copy link
Author

ollylu commented Aug 19, 2024

请问这个2层网络下 关联的子网如何创建?

@swordqiu
Copy link
Member

@ollylu 请参考 https://www.cloudpods.org/docs/guides/cmp/vmware/vmware_net

需要在二层网络创建IP子网。二层网络对应vmware的端口组,因此IP子网需要和你在vmware里端口组规划的IP网段一致。

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

需要在二层网络创建IP子网 ---- 这个是在 cloudpod上创建吗? 还是在vmware上创建 ?

@swordqiu
Copy link
Member

@ollylu IP子网是在cloudpods里创建,但是要和vmware里对应上。比如你在vmware里给某个端口组分配了10.168.1.0/24的IP地址,则需要在cloudpods里创建一个10.168.1.0/24的IP子网。一方面是从vmware同步过来的虚拟机就能识别出对接到这个IP子网,另一方面是如果在cloudpods里新建的虚拟机,如果选择了这个IP子网,则会在vmware里自动把网卡加入对应的端口组,这样网络才能通。
这么设计是因为vmware不具备IP地址管理的能力,cloudpods没法从vmware同步过来IP子网的配置,所以在cloudpods里创建IP子网。虽然cloudpods把IP地址管理做了,但是还需要跟vmware的端口组对应上,不然新建的vmware网络也不通。

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

按照您的介绍我 创建了子网, 现在在创建阶段 报错,似乎是没有权限 访问Datacenter吗, (但是我的资源是可以同步的)
以下是esxi agent的报错日志
[I 2024-08-20 14:51:18 appsrv.(*Application).ServeHTTP(appsrv.go:289)] 4bI2BymTiDczigoe2TADnS6O6vY= 200 ecde54-9edd03-343387 POST /disks/agent/deploy (172.16.18.242:58612:region) 0.52ms
[D 2024-08-20 14:51:18 esxi.(*SManagedObject).findInParents(mobase.go:94)] find HostSystem want Datacenter
[D 2024-08-20 14:51:18 esxi.(*SManagedObject).findInParents(mobase.go:94)] find ComputeResource want Datacenter
[D 2024-08-20 14:51:18 esxi.(*SManagedObject).findInParents(mobase.go:94)] find Folder want Datacenter
[D 2024-08-20 14:51:18 esxi.(*SESXiClient).fetchDatacenters(manager.go:403)] cli.fetchDatacentersFromHosts fail v.Retrieve Datacenter: NoPermission, try cli.fetchFakeDatacenter
[D 2024-08-20 14:51:18 esxi.(*SManagedObject).findInParents(mobase.go:94)] find VirtualMachine want Datacenter
[D 2024-08-20 14:51:18 esxi.(*SManagedObject).findInParents(mobase.go:94)] find Folder want Datacenter
[E 2024-08-20 14:51:18 workmanager.(*workerTask).Run.func1(manager.go:74)] DelayTask panic: runtime error: invalid memory address or nil pointer dereference
goroutine 425 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x19
yunion.io/x/onecloud/pkg/cloudcommon/workmanager.(*workerTask).Run.func1()
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1896280-353721/pkg/cloudcommon/workmanager/manager.go:76 +0x1d3
panic({0x17401a0, 0x2d805e0})
/usr/local/go/src/runtime/panic.go:884 +0x212
github.com/vmware/govmomi/object.(*Datacenter).Folders(0x0, {0x1dc37d0, 0xc0012c07b0})
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1896280-353721/vendor/github.com/vmware/govmomi/object/datacenter.go:50 +0xcb
yunion.io/x/cloudmux/pkg/multicloud/esxi.(*SHost).CloneVM(, {, _}, _, , , {{0xc0013d9510, 0x9}, {0x0, 0x0}, ...})
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1896280-353721/vendor/yunion.io/x/cloudmux/pkg/multicloud/esxi/host.go:1264 +0xcd3
yunion.io/x/cloudmux/pkg/multicloud/esxi.(*SHost).CreateVM2(
, {
, _}, _, {{0xc0013d9510, 0x9}, {0x0, 0x0}, {0xc001212810, 0x24}, ...})
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1896280-353721/vendor/yunion.io/x/cloudmux/pkg/multicloud/esxi/host.go:843 +0x1dd
yunion.io/x/onecloud/pkg/hostman/storageman.(*SAgentStorage).agentCreateGuest(0xc0003a1480?, {0x1dc37d0, 0xc0012c07b0}, 0xc?)
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1896280-353721/pkg/hostman/storageman/storage_agent.go:169 +0x258
yunion.io/x/onecloud/pkg/hostman/storageman.(*SAgentStorage).AgentDeployGuest(0x1db54e0?, {0x1dc37d0, 0xc0012c07b0}, {0x1a53120?, 0xc000d82240})
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1896280-353721/pkg/hostman/storageman/storage_agent.go:240 +0x145
yunion.io/x/onecloud/pkg/cloudcommon/workmanager.(*workerTask).Run(0xc0012c07e0)
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1896280-353721/pkg/cloudcommon/workmanager/manager.go:94 +0xce
yunion.io/x/onecloud/pkg/appsrv.execCallback(0x0?)
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1896280-353721/pkg/appsrv/workers.go:275 +0x58
yunion.io/x/onecloud/pkg/appsrv.(*SWorker).run(0xc0012c0810)
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1896280-353721/pkg/appsrv/workers.go:110 +0x18a
created by yunion.io/x/onecloud/pkg/appsrv.(*SWorkerManager).scheduleWithLock
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1896280-353721/pkg/appsrv/workers.go:294 +0x165

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

image
是在这个地方获取失败,是因为权限问题 还是?

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

cli.fetchDatacentersFromHosts fail v.Retrieve Datacenter: NoPermission, try cli.fetchFakeDatacenter ----- 这个日志似乎显示没有权限获取数据中心

@swordqiu
Copy link
Member

@ollylu 嗯,是否可以先解决权限问题

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

img_v3_02du_26a261a2-7c90-4c24-a48d-ffafe655e54g

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

但是我已经给这个账号开了管理员权限了
还有什么需要添加的吗

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

@swordqiu 请问有账号权限的参考配置吗

@ioito
Copy link
Collaborator

ioito commented Aug 20, 2024

先用root账号试下,我们没有vmware的权限文档,一般都是直接用root账号

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

[D 2024-08-20 16:35:32 esxi.(*SManagedObject).findInParents(mobase.go:94)] find HostSystem:host-3519 want Datacenter
[D 2024-08-20 16:35:32 esxi.(*SManagedObject).findInParents(mobase.go:94)] find ComputeResource:domain-s3517 want Datacenter
[D 2024-08-20 16:35:32 esxi.(*SManagedObject).findInParents(mobase.go:94)] find Folder:group-h2578 want Datacenter
[I 2024-08-20 16:35:32 esxi.(*SManagedObject).fetchDatacenter(mobase.go:106)] !!!!!!!!!esxi.fetchDatacenter!!!!!!!datacenter-2576 : Datacenter

目前来看似乎是获取datacenter 递归不正确导致,请问是什么原因

@ioito
Copy link
Collaborator

ioito commented Aug 20, 2024

./_output/bin/esxicli --help 有帮助信息,可以看下 --host 后面跟vmware的ip地址

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

/usr/bin/cloudpods/esxi-agent --host 172.16.31.99 --username XXXXXl --password XXX dc-list

goroutine 1 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x19
yunion.io/x/log.Fatalf({0x1b14f30, 0x19}, {0xc0004f7d38, 0x1, 0x1})
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1899397-523374/vendor/yunion.io/x/log/log.go:138 +0x32
yunion.io/x/onecloud/pkg/cloudcommon/options.parseOptions({0x1771780, 0x2dc7b20}, {0xc00003e080, 0x8, 0x8}, {0x1aee63a, 0xe}, {0x1ae28f3?, 0xc0004f7ef8?}, 0x0)
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1899397-523374/pkg/cloudcommon/options/options.go:300 +0x29b
yunion.io/x/onecloud/pkg/cloudcommon/options.ParseOptions(...)
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1899397-523374/pkg/cloudcommon/options/options.go:278
yunion.io/x/onecloud/pkg/esxi/service.(*SExsiAgentService).StartService(0xc0004f7f70?)
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1899397-523374/pkg/esxi/service/esxi_agent_service.go:47 +0x71
main.main()
/data/coding-build/tools/jenkins_home/workspace/8647-cci-1899397-523374/cmd/esxi-agent/main.go:30 +0xb6
[F 240820 17:27:47 options.parseOptions(options.go:300)] Parse arguments error: strconv.ParseInt: parsing "172.16.31.99": invalid syntax

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

似乎这个命令有问题

@ioito
Copy link
Collaborator

ioito commented Aug 20, 2024

esxicli 不是 esxi-agent
image

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

image

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

这个是不是代表没权限

@ioito
Copy link
Collaborator

ioito commented Aug 20, 2024

这个正常,执行其他命令试下,例如 host-list

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

[D 240820 17:39:10 esxi.(*SESXiClient).fetchDatacenters(manager.go:403)] cli.fetchDatacentersFromHosts fail v.Retrieve Datacenter: NoPermission, try cli.fetchFakeDatacenter

@ioito
Copy link
Collaborator

ioito commented Aug 20, 2024

看起来就是没权限,你换root账号试下,我对vmware权限体系也不熟

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

esxi-default-datacenter 这个是因为获取不到,这段代码创建的
image

@ollylu
Copy link
Author

ollylu commented Aug 20, 2024

好的 我先用root用户尝试下

@github-actions github-actions bot added the stale label Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested stale state/awaiting processing
Projects
None yet
Development

No branches or pull requests

3 participants