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
7e8270c1
Commit
7e8270c1
authored
Oct 05, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement openvz option view/edit
parent
52815271
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
225 additions
and
7 deletions
+225
-7
OpenVZ.pm
PVE/API2/OpenVZ.pm
+5
-1
OpenVZ.pm
PVE/OpenVZ.pm
+5
-5
Makefile
www/manager/Makefile
+1
-0
Config.js
www/manager/openvz/Config.js
+1
-1
Options.js
www/manager/openvz/Options.js
+213
-0
No files found.
PVE/API2/OpenVZ.pm
View file @
7e8270c1
...
@@ -372,7 +372,7 @@ __PACKAGE__->register_method({
...
@@ -372,7 +372,7 @@ __PACKAGE__->register_method({
path
=>
'
{vmid}/config
',
path
=>
'
{vmid}/config
',
method
=>
'
GET
',
method
=>
'
GET
',
proxyto
=>
'
node
',
proxyto
=>
'
node
',
description
=>
"
Get
virtual machine
configuration.
",
description
=>
"
Get
container
configuration.
",
parameters
=>
{
parameters
=>
{
additionalProperties
=>
0
,
additionalProperties
=>
0
,
properties
=>
{
properties
=>
{
...
@@ -397,6 +397,10 @@ __PACKAGE__->register_method({
...
@@ -397,6 +397,10 @@ __PACKAGE__->register_method({
# we only return selected/converted values
# we only return selected/converted values
my
$conf
=
{
digest
=>
$veconf
->
{
digest
}
};
my
$conf
=
{
digest
=>
$veconf
->
{
digest
}
};
if
(
$veconf
->
{
ostemplate
}
&&
$veconf
->
{
ostemplate
}
->
{
value
})
{
$conf
->
{
ostemplate
}
=
$veconf
->
{
ostemplate
}
->
{
value
};
}
my
$properties
=
PVE::OpenVZ::
json_config_properties
();
my
$properties
=
PVE::OpenVZ::
json_config_properties
();
foreach
my
$k
(
keys
%
$properties
)
{
foreach
my
$k
(
keys
%
$properties
)
{
...
...
PVE/OpenVZ.pm
View file @
7e8270c1
...
@@ -74,7 +74,7 @@ sub vmstatus {
...
@@ -74,7 +74,7 @@ sub vmstatus {
my
$cfspath
=
cfs_config_path
(
$vmid
);
my
$cfspath
=
cfs_config_path
(
$vmid
);
if
(
my
$conf
=
PVE::Cluster::
cfs_read_file
(
$cfspath
))
{
if
(
my
$conf
=
PVE::Cluster::
cfs_read_file
(
$cfspath
))
{
$d
->
{
name
}
=
$conf
->
{
hostname
}
->
{
value
}
||
"
VM
$vmid
";
$d
->
{
name
}
=
$conf
->
{
hostname
}
->
{
value
}
||
"
CT
$vmid
";
$d
->
{
name
}
=~
s/[\s]//g
;
$d
->
{
name
}
=~
s/[\s]//g
;
$d
->
{
cpus
}
=
$conf
->
{
cpus
}
->
{
value
}
||
1
;
$d
->
{
cpus
}
=
$conf
->
{
cpus
}
->
{
value
}
||
1
;
...
@@ -552,8 +552,8 @@ sub parse_res_ignore_pages {
...
@@ -552,8 +552,8 @@ sub parse_res_ignore_pages {
sub
parse_boolean
{
sub
parse_boolean
{
my
(
$key
,
$text
)
=
@_
;
my
(
$key
,
$text
)
=
@_
;
return
{
value
=>
"
yes
"
}
if
$text
=~
m/^(yes|true|on|1)$/i
;
return
{
value
=>
1
}
if
$text
=~
m/^(yes|true|on|1)$/i
;
return
{
value
=>
"
no
"
}
if
$text
=~
m/^(no|false|off|0)$/i
;
return
{
value
=>
0
}
if
$text
=~
m/^(no|false|off|0)$/i
;
return
undef
;
return
undef
;
};
};
...
@@ -843,11 +843,11 @@ sub update_ovz_config {
...
@@ -843,11 +843,11 @@ sub update_ovz_config {
return
if
!
defined
(
$param
->
{
$name
});
return
if
!
defined
(
$param
->
{
$name
});
my
$newvalue
=
$param
->
{
$name
}
?
'
yes
'
:
'
no
'
;
my
$newvalue
=
$param
->
{
$name
}
?
1
:
0
;
my
$oldvalue
=
$veconf
->
{
$name
}
->
{
value
};
my
$oldvalue
=
$veconf
->
{
$name
}
->
{
value
};
if
(
!
defined
(
$oldvalue
)
||
(
$oldvalue
ne
$newvalue
))
{
if
(
!
defined
(
$oldvalue
)
||
(
$oldvalue
ne
$newvalue
))
{
$veconf
->
{
$name
}
->
{
value
}
=
$newvalue
;
$veconf
->
{
$name
}
->
{
value
}
=
$newvalue
;
push
@$changes
,
"
--
$name
",
$newvalue
;
push
@$changes
,
"
--
$name
",
$newvalue
?
'
yes
'
:
'
no
'
;
}
}
};
};
...
...
www/manager/Makefile
View file @
7e8270c1
...
@@ -84,6 +84,7 @@ JSSRC= \
...
@@ -84,6 +84,7 @@ JSSRC= \
openvz/Summary.js
\
openvz/Summary.js
\
openvz/RessourceEdit.js
\
openvz/RessourceEdit.js
\
openvz/RessourceView.js
\
openvz/RessourceView.js
\
openvz/Options.js
\
openvz/Config.js
\
openvz/Config.js
\
openvz/CreateWizard.js
\
openvz/CreateWizard.js
\
storage/ContentView.js
\
storage/ContentView.js
\
...
...
www/manager/openvz/Config.js
View file @
7e8270c1
...
@@ -35,7 +35,7 @@ Ext.define('PVE.openvz.Config', {
...
@@ -35,7 +35,7 @@ Ext.define('PVE.openvz.Config', {
{
{
title
:
'
Options
'
,
title
:
'
Options
'
,
itemId
:
'
options
'
,
itemId
:
'
options
'
,
html
:
'
OpenVZ options - not inplemented!
'
xtype
:
'
pveOpenVZOptions
'
},
},
{
{
xtype
:
'
pveOpenVZConsole
'
,
xtype
:
'
pveOpenVZConsole
'
,
...
...
www/manager/openvz/Options.js
0 → 100644
View file @
7e8270c1
/*jslint confusion: true */
Ext
.
define
(
'
PVE.openvz.Options
'
,
{
extend
:
'
PVE.grid.ObjectGrid
'
,
alias
:
[
'
widget.pveOpenVZOptions
'
],
initComponent
:
function
()
{
var
me
=
this
;
var
i
;
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
=
{
hostname
:
{
required
:
true
,
defaultValue
:
me
.
pveSelNode
.
data
.
name
,
header
:
'
Hostname
'
,
editor
:
{
xtype
:
'
pveWindowEdit
'
,
title
:
'
Container Hostname
'
,
items
:
{
xtype
:
'
textfield
'
,
name
:
'
hostname
'
,
value
:
''
,
fieldLabel
:
'
Hostname
'
,
allowBlank
:
true
,
emptyText
:
me
.
pveSelNode
.
data
.
name
}
}
},
onboot
:
{
header
:
'
Start at boot
'
,
defaultValue
:
''
,
renderer
:
PVE
.
Utils
.
format_boolean
,
editor
:
{
xtype
:
'
pveWindowEdit
'
,
title
:
'
Start at boot
'
,
items
:
{
xtype
:
'
pvecheckbox
'
,
name
:
'
onboot
'
,
uncheckedValue
:
0
,
defaultValue
:
0
,
fieldLabel
:
'
Start at boot
'
}
}
},
searchdomain
:
{
header
:
'
DNS domain
'
,
defaultValue
:
''
,
editor
:
{
xtype
:
'
pveWindowEdit
'
,
title
:
'
DNS domain
'
,
items
:
{
xtype
:
'
pvetextfield
'
,
name
:
'
searchdomain
'
,
fieldLabel
:
'
DNS domain
'
,
allowBlank
:
false
}
}
},
nameserver
:
{
header
:
'
DNS servers
'
,
defaultValue
:
''
,
editor
:
{
xtype
:
'
pveWindowEdit
'
,
title
:
'
DNS servers
'
,
items
:
{
xtype
:
'
pvetextfield
'
,
name
:
'
nameserver
'
,
fieldLabel
:
'
DNS servers
'
,
allowBlank
:
false
}
}
},
ostemplate
:
{
header
:
'
Template
'
,
defaultValue
:
'
no set
'
},
cpuunits
:
{
header
:
'
CPU units
'
,
defaultValue
:
'
1000
'
,
editor
:
{
xtype
:
'
pveWindowEdit
'
,
title
:
'
CPU units
'
,
items
:
{
xtype
:
'
numberfield
'
,
name
:
'
cpuunits
'
,
fieldLabel
:
'
CPU units
'
,
minValue
:
8
,
maxValue
:
500000
,
allowBlank
:
false
}
}
},
quotaugidlimit
:
{
header
:
'
Quota UGID limit
'
,
defaultValue
:
'
0
'
,
renderer
:
function
(
value
)
{
if
(
value
==
0
)
{
return
'
User quotas disabled.
'
}
return
value
;
},
editor
:
{
xtype
:
'
pveWindowEdit
'
,
title
:
'
Quota UGID limit (0 to disable user quotas)
'
,
items
:
{
xtype
:
'
numberfield
'
,
name
:
'
quotaugidlimit
'
,
fieldLabel
:
'
UGID limit
'
,
minValue
:
0
,
allowBlank
:
false
}
}
},
quotatime
:
{
header
:
'
Quota Grace period
'
,
defaultValue
:
'
0
'
,
editor
:
{
xtype
:
'
pveWindowEdit
'
,
title
:
'
Quota Grace period (seconds)
'
,
items
:
{
xtype
:
'
numberfield
'
,
name
:
'
quotatime
'
,
minValue
:
0
,
allowBlank
:
false
,
fieldLabel
:
'
Grace period
'
}
}
}
};
var
baseurl
=
'
nodes/
'
+
nodename
+
'
/openvz/
'
+
vmid
+
'
/config
'
;
var
reload
=
function
()
{
me
.
rstore
.
load
();
};
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
win
;
if
(
Ext
.
isString
(
rowdef
.
editor
))
{
win
=
Ext
.
create
(
rowdef
.
editor
,
{
pveSelNode
:
me
.
pveSelNode
,
confid
:
rec
.
data
.
key
,
url
:
'
/api2/extjs/
'
+
baseurl
});
}
else
{
var
config
=
Ext
.
apply
({
pveSelNode
:
me
.
pveSelNode
,
confid
:
rec
.
data
.
key
,
url
:
'
/api2/extjs/
'
+
baseurl
},
rowdef
.
editor
);
win
=
Ext
.
createWidget
(
rowdef
.
editor
.
xtype
,
config
);
win
.
load
();
}
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/nodes/
"
+
nodename
+
"
/openvz/
"
+
vmid
+
"
/config
"
,
cwidth1
:
150
,
tbar
:
[
edit_btn
],
rows
:
rows
,
listeners
:
{
itemdblclick
:
run_editor
,
selectionchange
:
set_button_status
}
});
me
.
callParent
();
me
.
on
(
'
show
'
,
reload
);
}
});
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