Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hashrate-Node
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanjinfei
hashrate-Node
Commits
8c6594e2
Commit
8c6594e2
authored
Aug 31, 2023
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix get qemu list
parent
002f71b5
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
21 deletions
+25
-21
contractEventHandler.go
asyncLog/contractEventHandler.go
+5
-6
event.go
common/event.go
+2
-1
app.conf
conf/app.conf
+1
-1
pveRequest.go
models/pveRequest.go
+1
-1
pveResponse.go
models/pveResponse.go
+4
-4
pveApi.go
pveApi/pveApi.go
+12
-8
No files found.
asyncLog/contractEventHandler.go
View file @
8c6594e2
...
...
@@ -47,11 +47,10 @@ func VmCreateContractHandler(vLog types.Log) error {
case
hashrateCommon
.
VmCreateEvent
:
{
rp
,
err
:=
stakeAbiInfo
.
Unpack
(
"AddCreateVMInfoEvent"
,
vLog
.
Data
)
sockets
,
_
:=
new
(
big
.
Int
)
.
SetString
(
rp
[
4
]
.
(
string
),
10
)
cores
,
_
:=
new
(
big
.
Int
)
.
SetString
(
rp
[
5
]
.
(
string
),
10
)
gpuNum
,
_
:=
new
(
big
.
Int
)
.
SetString
(
rp
[
7
]
.
(
string
),
10
)
memory
,
_
:=
new
(
big
.
Int
)
.
SetString
(
rp
[
8
]
.
(
string
),
10
)
osType
,
_
:=
new
(
big
.
Int
)
.
SetString
(
rp
[
9
]
.
(
string
),
10
)
sockets
:=
new
(
big
.
Int
)
.
SetUint64
(
rp
[
4
]
.
(
uint64
))
cores
:=
new
(
big
.
Int
)
.
SetUint64
(
rp
[
5
]
.
(
uint64
))
gpuNum
:=
new
(
big
.
Int
)
.
SetUint64
(
rp
[
7
]
.
(
uint64
))
memory
:=
new
(
big
.
Int
)
.
SetUint64
(
rp
[
8
]
.
(
uint64
))
vmCreateEvent
:=
&
models
.
VmConfig
{
TaskId
:
rp
[
0
]
.
(
string
),
Owner
:
rp
[
1
]
.
(
common
.
Address
),
...
...
@@ -62,7 +61,7 @@ func VmCreateContractHandler(vLog types.Log) error {
Gpu
:
rp
[
6
]
.
(
string
),
GpuNum
:
gpuNum
,
Memory
:
memory
,
OsType
:
osType
,
OsType
:
rp
[
9
]
.
(
string
)
,
Disk
:
bighundred
,
}
//vmCreateEvent := &models.VmConfig{}
...
...
common/event.go
View file @
8c6594e2
...
...
@@ -12,5 +12,6 @@ const (
// VmCreateContract 虚拟机创建合约
const
(
VmCreateContract
=
"0xFAbE2869D0E0a13b6776C31bD78505Ed9c2FAbec"
//VmCreateContract = "0xCE80565919c846F87328bFA54bC7443aC07C7fFE"
VmContract
=
"0x15A5aac5D5bc2B7D0389a1054701a6583169FB00"
)
conf/app.conf
View file @
8c6594e2
...
...
@@ -31,6 +31,6 @@ access_prefix = "PVEAuthCookie="
# redis config
[
cache
]
collectionName
=
redis
conn
=
1
92
.
168
.
1
.
109
:
6379
conn
=
1
27
.
0
.
0
.
1
:
6379
dbNum
=
1
password
=
123456
\ No newline at end of file
models/pveRequest.go
View file @
8c6594e2
...
...
@@ -32,7 +32,7 @@ type VmConfig struct {
Cores
*
big
.
Int
`json:"cores"`
// 设置每个CPU插槽中的核心数量。
Sockets
*
big
.
Int
`json:"sockets"`
// 设置CPU插槽的数量。
Memory
*
big
.
Int
`json:"memory"`
// 设置虚拟机的内存大小。
OsType
*
big
.
Int
`json:"osType"`
// 客户操作系统的类型。
OsType
string
`json:"osType"`
// 客户操作系统的类型。
Gpu
string
`json:"gpu"`
// 指定虚拟GPU的类型、特性和配置。
GpuNum
*
big
.
Int
`json:"gpuNum"`
// 设置虚拟机的Gpu数量。
StartDate
time
.
Time
`json:"startDate"`
// 设置虚拟机的初始日期和时间。
...
...
models/pveResponse.go
View file @
8c6594e2
...
...
@@ -21,9 +21,9 @@ type ResponseStr struct {
type
QemuList
struct
{
Cpus
int64
`json:"cpus"`
VmId
int64
`json:"vmid"`
Pid
int64
`json:"pid"`
//
Pid int64 `json:"pid"`
MaxMem
*
big
.
Int
`json:"maxMem"`
Template
int64
`json:"template"`
Template
int64
`json:"template"
default:"0"
`
}
type
NetWorkResult
struct
{
...
...
pveApi/pveApi.go
View file @
8c6594e2
...
...
@@ -146,15 +146,19 @@ func GetQemuList(headerInfo *models.HeaderInfo) ([]*models.QemuList, error) {
if
err
!=
nil
||
!
isSuccess
{
return
nil
,
err
}
qemuList
:=
make
([]
*
models
.
QemuList
,
0
)
respMarshal
,
err
:=
json
.
Marshal
(
responseArr
)
qemuList
:=
make
([]
*
models
.
QemuList
,
len
(
responseArr
))
for
i
,
resp
:=
range
responseArr
{
qemu
:=
&
models
.
QemuList
{}
respMarshal
,
err
:=
json
.
Marshal
(
resp
)
if
err
!=
nil
{
return
nil
,
err
}
if
err
:=
json
.
Unmarshal
(
respMarshal
,
qemuList
);
err
!=
nil
{
fmt
.
Println
(
"JSON解析错误:"
,
err
)
if
err
:=
json
.
Unmarshal
(
respMarshal
,
qemu
);
err
!=
nil
{
log
.
Error
(
"JSON解析错误:"
,
err
)
return
nil
,
err
}
qemuList
[
i
]
=
qemu
}
return
qemuList
,
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment