Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
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
Administrator
pve-manager
Commits
996d34c3
Commit
996d34c3
authored
Jan 30, 2012
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
render resource pools
parent
f4b4dd12
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
6 deletions
+62
-6
Cluster.pm
PVE/API2/Cluster.pm
+40
-6
ext-pve.css
www/css/ext-pve.css
+8
-0
Makefile
www/images/Makefile
+1
-0
connect_established.png
www/images/connect_established.png
+0
-0
ResourceStore.js
www/manager/data/ResourceStore.js
+9
-0
ResourceTree.js
www/manager/tree/ResourceTree.js
+4
-0
No files found.
PVE/API2/Cluster.pm
View file @
996d34c3
...
...
@@ -143,7 +143,8 @@ __PACKAGE__->register_method({
my
(
$param
)
=
@_
;
my
$rpcenv
=
PVE::RPCEnvironment::
get
();
my
$user
=
$rpcenv
->
get_user
();
my
$authuser
=
$rpcenv
->
get_user
();
my
$usercfg
=
$rpcenv
->
{
user_cfg
};
my
$res
=
[]
;
...
...
@@ -155,6 +156,24 @@ __PACKAGE__->register_method({
my
$vmlist
=
PVE::Cluster::
get_vmlist
()
||
{};
my
$idlist
=
$vmlist
->
{
ids
}
||
{};
my
$pooldata
=
{};
if
(
!
$param
->
{
type
}
||
$param
->
{
type
}
eq
'
pool
')
{
foreach
my
$pool
(
keys
%
{
$usercfg
->
{
pools
}})
{
my
$d
=
$usercfg
->
{
pools
}
->
{
$pool
};
next
if
!
$rpcenv
->
check
(
$authuser
,
"
/pool/
$pool
",
[
'
VM.Audit
'
],
1
);
my
$entry
=
{
id
=>
"
/pool/
$pool
",
pool
=>
$pool
,
type
=>
'
pool
',
};
$pooldata
->
{
$pool
}
=
$entry
;
push
@$res
,
$entry
;
}
}
# we try to generate 'numbers' by using "$X + 0"
if
(
!
$param
->
{
type
}
||
$param
->
{
type
}
eq
'
vm
')
{
...
...
@@ -162,7 +181,7 @@ __PACKAGE__->register_method({
my
$data
=
$idlist
->
{
$vmid
};
next
if
!
$rpcenv
->
check
(
$user
,
"
/vms/
$vmid
",
[
'
VM.Audit
'
],
1
);
next
if
!
$rpcenv
->
check
(
$
auth
user
,
"
/vms/
$vmid
",
[
'
VM.Audit
'
],
1
);
my
$entry
=
{
id
=>
"
$data
->{type}/
$vmid
",
...
...
@@ -182,7 +201,22 @@ __PACKAGE__->register_method({
$entry
->
{
mem
}
=
(
$d
->
[
6
]
||
0
)
+
0
;
$entry
->
{
maxdisk
}
=
(
$d
->
[
7
]
||
0
)
+
0
;
$entry
->
{
disk
}
=
(
$d
->
[
8
]
||
0
)
+
0
;
if
(
my
$pool
=
$usercfg
->
{
vms
}
->
{
$vmid
})
{
if
(
my
$pe
=
$pooldata
->
{
$pool
})
{
$pe
->
{
uptime
}
=
$entry
->
{
uptime
}
if
!
$pe
->
{
uptime
}
||
$entry
->
{
uptime
}
>
$pe
->
{
uptime
};
$pe
->
{
mem
}
=
0
if
!
$pe
->
{
mem
};
$pe
->
{
mem
}
+=
$entry
->
{
mem
};
$pe
->
{
maxmem
}
=
0
if
!
$pe
->
{
maxmem
};
$pe
->
{
maxmem
}
+=
$entry
->
{
maxmem
};
$pe
->
{
cpu
}
=
0
if
!
$pe
->
{
cpu
};
$pe
->
{
cpu
}
+=
$entry
->
{
cpu
};
$pe
->
{
maxcpu
}
=
0
if
!
$pe
->
{
maxcpu
};
$pe
->
{
maxcpu
}
+=
$entry
->
{
maxcpu
};
}
}
}
push
@$res
,
$entry
;
}
...
...
@@ -221,7 +255,7 @@ __PACKAGE__->register_method({
foreach
my
$storeid
(
@sids
)
{
my
$scfg
=
PVE::Storage::
storage_config
(
$cfg
,
$storeid
);
next
if
!
$rpcenv
->
check
(
$user
,
"
/storage/
$storeid
",
[
'
Datastore.Audit
'
],
1
);
next
if
!
$rpcenv
->
check
(
$
auth
user
,
"
/storage/
$storeid
",
[
'
Datastore.Audit
'
],
1
);
# we create a entry for each node
foreach
my
$node
(
@$nodelist
)
{
next
if
!
PVE::Storage::
storage_check_enabled
(
$cfg
,
$storeid
,
$node
,
1
);
...
...
@@ -268,7 +302,7 @@ __PACKAGE__->register_method({
my
(
$param
)
=
@_
;
my
$rpcenv
=
PVE::RPCEnvironment::
get
();
my
$user
=
$rpcenv
->
get_user
();
my
$
auth
user
=
$rpcenv
->
get_user
();
my
$tlist
=
PVE::Cluster::
get_tasklist
();
...
...
@@ -276,10 +310,10 @@ __PACKAGE__->register_method({
return
$res
if
!
$tlist
;
my
$all
=
$rpcenv
->
check
(
$user
,
"
/
",
[
'
Sys.Audit
'
],
1
);
my
$all
=
$rpcenv
->
check
(
$
auth
user
,
"
/
",
[
'
Sys.Audit
'
],
1
);
foreach
my
$task
(
@$tlist
)
{
push
@$res
,
$task
if
$all
||
(
$task
->
{
user
}
eq
$user
);
push
@$res
,
$task
if
$all
||
(
$task
->
{
user
}
eq
$
auth
user
);
}
return
$res
;
...
...
www/css/ext-pve.css
View file @
996d34c3
...
...
@@ -27,6 +27,7 @@
.pve-itype-icon-node
,
.pve-itype-icon-node-running
,
.pve-itype-icon-storage
,
.pve-itype-icon-pool
,
.pve-itype-icon-itype
{
background-repeat
:
no-repeat
;
...
...
@@ -83,6 +84,13 @@
background-image
:
url(../images/drive-harddisk.png)
;
}
.pve-itype-icon-pool
,
.x-tree-node-pool
,
.x-grid-tree-pool-expanded
.x-tree-node-pool
{
background-image
:
url(../images/connect_established.png)
;
}
.pve-itype-icon-itype
{
background-image
:
url(../ext4/resources/themes/images/default/tree/folder.gif)
;
...
...
www/images/Makefile
View file @
996d34c3
...
...
@@ -13,6 +13,7 @@ GNOME_IMAGES = \
network.png
\
drive-harddisk.png
\
network-server.png
\
connect_established.png
\
computer.png
IMAGES
=
${
GNOME_IMAGES
}
\
...
...
www/images/connect_established.png
0 → 100644
View file @
996d34c3
704 Bytes
www/manager/data/ResourceStore.js
View file @
996d34c3
...
...
@@ -72,6 +72,8 @@ Ext.define('PVE.data.ResourceStore', {
if
(
info
.
type
===
'
node
'
)
{
text
=
info
.
node
;
}
else
if
(
info
.
type
===
'
pool
'
)
{
text
=
info
.
pool
;
}
else
if
(
info
.
type
===
'
storage
'
)
{
text
=
info
.
storage
+
'
(
'
+
info
.
node
+
'
)
'
;
}
else
if
(
info
.
type
===
'
qemu
'
||
info
.
type
===
'
openvz
'
)
{
...
...
@@ -162,6 +164,13 @@ Ext.define('PVE.data.ResourceStore', {
hidden
:
true
,
sortable
:
true
,
width
:
110
},
pool
:
{
header
:
gettext
(
'
Pool
'
),
type
:
'
text
'
,
hidden
:
true
,
sortable
:
true
,
width
:
110
}
};
...
...
www/manager/tree/ResourceTree.js
View file @
996d34c3
...
...
@@ -12,6 +12,10 @@ Ext.define('PVE.tree.ResourceTree', {
iconCls
:
'
x-tree-node-server
'
,
text
:
gettext
(
'
Node list
'
)
},
pool
:
{
iconCls
:
'
x-tree-node-pool
'
,
text
:
gettext
(
'
Resource Pool
'
)
},
storage
:
{
iconCls
:
'
x-tree-node-harddisk
'
,
text
:
gettext
(
'
Storage list
'
)
...
...
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