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
52815271
Commit
52815271
authored
Oct 05, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ressource editor for openvz
parent
74d235cb
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
204 additions
and
46 deletions
+204
-46
OpenVZ.pm
PVE/API2/OpenVZ.pm
+4
-3
Makefile
www/manager/Makefile
+2
-0
Config.js
www/manager/openvz/Config.js
+5
-0
CreateWizard.js
www/manager/openvz/CreateWizard.js
+1
-43
RessourceEdit.js
www/manager/openvz/RessourceEdit.js
+73
-0
RessourceView.js
www/manager/openvz/RessourceView.js
+119
-0
No files found.
PVE/API2/OpenVZ.pm
View file @
52815271
...
...
@@ -415,14 +415,15 @@ __PACKAGE__->register_method({
}
$conf
->
{
memory
}
=
$veconf
->
{
physpages
}
->
{
lim
}
?
int
(
$veconf
->
{
physpages
}
->
{
lim
}
*
4096
)
:
512
*
1024
*
1024
;
int
(
(
$veconf
->
{
physpages
}
->
{
lim
}
*
4
)
/
1024
)
:
512
;
$conf
->
{
swap
}
=
$veconf
->
{
swappages
}
->
{
lim
}
?
int
(
$veconf
->
{
swappages
}
->
{
lim
}
*
4096
)
:
0
;
int
((
$veconf
->
{
swappages
}
->
{
lim
}
*
4
)
/
1024
)
:
0
;
my
$diskspace
=
$veconf
->
{
diskspace
}
->
{
bar
}
||
LONG_MAX
;
if
(
$diskspace
==
LONG_MAX
)
{
$conf
->
{
disk
}
=
0
;
}
else
{
$conf
->
{
disk
}
=
int
(
$diskspace
*
1024
);
$conf
->
{
disk
}
=
$diskspace
/
(
1024
*
1024
);
}
return
$conf
;
}});
...
...
www/manager/Makefile
View file @
52815271
...
...
@@ -82,6 +82,8 @@ JSSRC= \
qemu/CreateWizard.js
\
openvz/StatusView.js
\
openvz/Summary.js
\
openvz/RessourceEdit.js
\
openvz/RessourceView.js
\
openvz/Config.js
\
openvz/CreateWizard.js
\
storage/ContentView.js
\
...
...
www/manager/openvz/Config.js
View file @
52815271
...
...
@@ -27,6 +27,11 @@ Ext.define('PVE.openvz.Config', {
xtype
:
'
pveOpenVZSummary
'
,
itemId
:
'
summary
'
,
},
{
title
:
'
Ressources
'
,
itemId
:
'
ressources
'
,
xtype
:
'
pveOpenVZRessourceView
'
},
{
title
:
'
Options
'
,
itemId
:
'
options
'
,
...
...
www/manager/openvz/CreateWizard.js
View file @
52815271
...
...
@@ -124,50 +124,8 @@ Ext.define('PVE.openvz.CreateWizard', {
items
:
tmplsel
},
{
xtype
:
'
inputp
anel
'
,
xtype
:
'
pveOpenVZResourceInputP
anel
'
,
title
:
'
Resources
'
,
column1
:
[
{
xtype
:
'
numberfield
'
,
name
:
'
memory
'
,
minValue
:
32
,
maxValue
:
128
*
1024
,
value
:
'
512
'
,
step
:
32
,
fieldLabel
:
'
Memory (MB)
'
,
allowBlank
:
false
},
{
xtype
:
'
numberfield
'
,
name
:
'
swap
'
,
minValue
:
0
,
maxValue
:
128
*
1024
,
value
:
'
512
'
,
step
:
32
,
fieldLabel
:
'
Swap (MB)
'
,
allowBlank
:
false
}
],
column2
:
[
{
xtype
:
'
numberfield
'
,
name
:
'
disk
'
,
minValue
:
0.5
,
value
:
'
4
'
,
step
:
1
,
fieldLabel
:
'
Disk space (GB)
'
,
allowBlank
:
false
},
{
xtype
:
'
numberfield
'
,
name
:
'
cpus
'
,
minValue
:
1
,
value
:
'
1
'
,
step
:
1
,
fieldLabel
:
'
CPUs
'
,
allowBlank
:
false
}
]
},
{
xtype
:
'
inputpanel
'
,
...
...
www/manager/openvz/RessourceEdit.js
0 → 100644
View file @
52815271
Ext
.
define
(
'
PVE.openvz.RessourceInputPanel
'
,
{
extend
:
'
PVE.panel.InputPanel
'
,
alias
:
'
widget.pveOpenVZResourceInputPanel
'
,
insideWizard
:
false
,
initComponent
:
function
()
{
var
me
=
this
;
me
.
column1
=
[
{
xtype
:
'
numberfield
'
,
name
:
'
memory
'
,
minValue
:
32
,
maxValue
:
128
*
1024
,
value
:
'
512
'
,
step
:
32
,
fieldLabel
:
'
Memory (MB)
'
,
allowBlank
:
false
},
{
xtype
:
'
numberfield
'
,
name
:
'
swap
'
,
minValue
:
0
,
maxValue
:
128
*
1024
,
value
:
'
512
'
,
step
:
32
,
fieldLabel
:
'
Swap (MB)
'
,
allowBlank
:
false
}
];
me
.
column2
=
[
{
xtype
:
'
numberfield
'
,
name
:
'
disk
'
,
minValue
:
0.5
,
value
:
'
4
'
,
step
:
1
,
fieldLabel
:
'
Disk space (GB)
'
,
allowBlank
:
false
},
{
xtype
:
'
numberfield
'
,
name
:
'
cpus
'
,
minValue
:
1
,
value
:
'
1
'
,
step
:
1
,
fieldLabel
:
'
CPUs
'
,
allowBlank
:
false
}
];
me
.
callParent
();
}
});
Ext
.
define
(
'
PVE.openvz.RessourceEdit
'
,
{
extend
:
'
PVE.window.Edit
'
,
initComponent
:
function
()
{
var
me
=
this
;
Ext
.
apply
(
me
,
{
title
:
"
Edit ressource settings
"
,
items
:
Ext
.
create
(
'
PVE.openvz.RessourceInputPanel
'
)
});
me
.
callParent
();
me
.
load
();
}
});
\ No newline at end of file
www/manager/openvz/RessourceView.js
0 → 100644
View file @
52815271
// fixme: howto avoid jslint type confusion?
/*jslint confusion: true */
Ext
.
define
(
'
PVE.openvz.RessourceView
'
,
{
extend
:
'
PVE.grid.ObjectGrid
'
,
alias
:
[
'
widget.pveOpenVZRessourceView
'
],
initComponent
:
function
()
{
var
me
=
this
;
var
i
,
confid
;
var
nodename
=
me
.
pveSelNode
.
data
.
node
;
if
(
!
nodename
)
{
throw
"
no node name specified
"
;
}
var
vmid
=
me
.
pveSelNode
.
data
.
vmid
;
if
(
!
vmid
)
{
throw
"
no VM ID specified
"
;
}
var
rows
=
{
memory
:
{
header
:
'
Memory
'
,
editor
:
'
PVE.openvz.RessourceEdit
'
,
never_delete
:
true
,
renderer
:
function
(
value
)
{
return
PVE
.
Utils
.
format_size
(
value
*
1024
*
1024
);
}
},
swap
:
{
header
:
'
Swap
'
,
editor
:
'
PVE.openvz.RessourceEdit
'
,
never_delete
:
true
,
renderer
:
function
(
value
)
{
return
PVE
.
Utils
.
format_size
(
value
*
1024
*
1024
);
}
},
cpus
:
{
header
:
'
Processors
'
,
never_delete
:
true
,
editor
:
'
PVE.openvz.RessourceEdit
'
,
defaultValue
:
1
,
},
disk
:
{
header
:
'
Disk space
'
,
editor
:
'
PVE.openvz.RessourceEdit
'
,
never_delete
:
true
,
renderer
:
function
(
value
)
{
return
PVE
.
Utils
.
format_size
(
value
*
1024
*
1024
*
1024
);
}
}
};
var
reload
=
function
()
{
me
.
rstore
.
load
();
};
var
baseurl
=
'
nodes/
'
+
nodename
+
'
/openvz/
'
+
vmid
+
'
/config
'
;
var
run_editor
=
function
()
{
var
sm
=
me
.
getSelectionModel
();
var
rec
=
sm
.
getSelection
()[
0
];
if
(
!
rec
)
{
return
;
}
var
rowdef
=
rows
[
rec
.
data
.
key
];
if
(
!
rowdef
.
editor
)
{
return
;
}
var
editor
=
rowdef
.
editor
;
var
win
=
Ext
.
create
(
editor
,
{
pveSelNode
:
me
.
pveSelNode
,
confid
:
rec
.
data
.
key
,
url
:
'
/api2/extjs/
'
+
baseurl
});
win
.
show
();
win
.
on
(
'
destroy
'
,
reload
);
};
var
edit_btn
=
new
Ext
.
Button
({
text
:
'
Edit
'
,
disabled
:
true
,
handler
:
run_editor
});
var
set_button_status
=
function
()
{
var
sm
=
me
.
getSelectionModel
();
var
rec
=
sm
.
getSelection
()[
0
];
if
(
!
rec
)
{
edit_btn
.
disable
();
return
;
}
var
rowdef
=
rows
[
rec
.
data
.
key
];
edit_btn
.
setDisabled
(
!
rowdef
.
editor
);
};
Ext
.
applyIf
(
me
,
{
url
:
'
/api2/json/
'
+
baseurl
,
cwidth1
:
170
,
tbar
:
[
edit_btn
],
rows
:
rows
,
listeners
:
{
show
:
reload
,
itemdblclick
:
run_editor
,
selectionchange
:
set_button_status
}
});
me
.
callParent
();
}
});
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