mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Pedantic: make sure Idle-PC is spelled that way.
This commit is contained in:
parent
3b3c47c858
commit
666c8ea922
@ -667,17 +667,17 @@ class VM(object):
|
|||||||
@IModule.route("dynamips.vm.idlepcs")
|
@IModule.route("dynamips.vm.idlepcs")
|
||||||
def vm_idlepcs(self, request):
|
def vm_idlepcs(self, request):
|
||||||
"""
|
"""
|
||||||
Get idle-pc proposals.
|
Get Idle-PC proposals.
|
||||||
|
|
||||||
Mandatory request parameters:
|
Mandatory request parameters:
|
||||||
- id (vm identifier)
|
- id (vm identifier)
|
||||||
|
|
||||||
Optional request parameters:
|
Optional request parameters:
|
||||||
- compute (returns previously compute idle-pc values if False)
|
- compute (returns previously compute Idle-PC values if False)
|
||||||
|
|
||||||
Response parameters:
|
Response parameters:
|
||||||
- id (vm identifier)
|
- id (vm identifier)
|
||||||
- idlepcs (idle-pc values in an array)
|
- idlepcs (Idle-PC values in an array)
|
||||||
|
|
||||||
:param request: JSON request
|
:param request: JSON request
|
||||||
"""
|
"""
|
||||||
@ -695,7 +695,7 @@ class VM(object):
|
|||||||
if "compute" in request and request["compute"] == False:
|
if "compute" in request and request["compute"] == False:
|
||||||
idlepcs = router.show_idle_pc_prop()
|
idlepcs = router.show_idle_pc_prop()
|
||||||
else:
|
else:
|
||||||
# reset the current idle-pc value before calculating a new one
|
# reset the current Idle-PC value before calculating a new one
|
||||||
router.idlepc = "0x0"
|
router.idlepc = "0x0"
|
||||||
idlepcs = router.get_idle_pc_prop()
|
idlepcs = router.get_idle_pc_prop()
|
||||||
except DynamipsError as e:
|
except DynamipsError as e:
|
||||||
@ -709,7 +709,7 @@ class VM(object):
|
|||||||
@IModule.route("dynamips.vm.auto_idlepc")
|
@IModule.route("dynamips.vm.auto_idlepc")
|
||||||
def vm_auto_idlepc(self, request):
|
def vm_auto_idlepc(self, request):
|
||||||
"""
|
"""
|
||||||
Auto idle-pc calculation.
|
Auto Idle-PC calculation.
|
||||||
|
|
||||||
Mandatory request parameters:
|
Mandatory request parameters:
|
||||||
- id (vm identifier)
|
- id (vm identifier)
|
||||||
@ -717,7 +717,7 @@ class VM(object):
|
|||||||
Response parameters:
|
Response parameters:
|
||||||
- id (vm identifier)
|
- id (vm identifier)
|
||||||
- logs (logs for the calculation)
|
- logs (logs for the calculation)
|
||||||
- idlepc (idle-pc value)
|
- idlepc (Idle-PC value)
|
||||||
|
|
||||||
:param request: JSON request
|
:param request: JSON request
|
||||||
"""
|
"""
|
||||||
@ -732,7 +732,7 @@ class VM(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
router.idlepc = "0x0" # reset the current idle-pc value before calculating a new one
|
router.idlepc = "0x0" # reset the current Idle-PC value before calculating a new one
|
||||||
was_auto_started = False
|
was_auto_started = False
|
||||||
if router.get_status() != "running":
|
if router.get_status() != "running":
|
||||||
router.start()
|
router.start()
|
||||||
@ -743,11 +743,11 @@ class VM(object):
|
|||||||
validated_idlepc = "0x0"
|
validated_idlepc = "0x0"
|
||||||
idlepcs = router.get_idle_pc_prop()
|
idlepcs = router.get_idle_pc_prop()
|
||||||
if not idlepcs:
|
if not idlepcs:
|
||||||
logs.append("No idle-pc values found")
|
logs.append("No Idle-PC values found")
|
||||||
|
|
||||||
for idlepc in idlepcs:
|
for idlepc in idlepcs:
|
||||||
router.idlepc = idlepc.split()[0]
|
router.idlepc = idlepc.split()[0]
|
||||||
logs.append("Trying idle-pc value {}".format(router.idlepc))
|
logs.append("Trying Idle-PC value {}".format(router.idlepc))
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
initial_cpu_usage = router.get_cpu_usage()
|
initial_cpu_usage = router.get_cpu_usage()
|
||||||
logs.append("Initial CPU usage = {}%".format(initial_cpu_usage))
|
logs.append("Initial CPU usage = {}%".format(initial_cpu_usage))
|
||||||
|
@ -804,10 +804,10 @@ class Router(object):
|
|||||||
# router is not running
|
# router is not running
|
||||||
raise DynamipsError("router {name} is not running".format(name=self._name))
|
raise DynamipsError("router {name} is not running".format(name=self._name))
|
||||||
|
|
||||||
log.info("router {name} [id={id}] has started calculating idle-pc values".format(name=self._name, id=self._id))
|
log.info("router {name} [id={id}] has started calculating Idle-PC values".format(name=self._name, id=self._id))
|
||||||
begin = time.time()
|
begin = time.time()
|
||||||
idlepcs = self._hypervisor.send("vm get_idle_pc_prop {} 0".format(self._name))
|
idlepcs = self._hypervisor.send("vm get_idle_pc_prop {} 0".format(self._name))
|
||||||
log.info("router {name} [id={id}] has finished calculating idle-pc values after {time:.4f} seconds".format(name=self._name,
|
log.info("router {name} [id={id}] has finished calculating Idle-PC values after {time:.4f} seconds".format(name=self._name,
|
||||||
id=self._id,
|
id=self._id,
|
||||||
time=time.time() - begin))
|
time=time.time() - begin))
|
||||||
return idlepcs
|
return idlepcs
|
||||||
|
@ -200,7 +200,7 @@ VM_UPDATE_SCHEMA = {
|
|||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"idlepc": {
|
"idlepc": {
|
||||||
"description": "idle-pc value",
|
"description": "Idle-PC value",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": "^(0x[0-9a-fA-F]+)?$"
|
"pattern": "^(0x[0-9a-fA-F]+)?$"
|
||||||
},
|
},
|
||||||
@ -471,7 +471,7 @@ VM_EXPORT_CONFIG_SCHEMA = {
|
|||||||
|
|
||||||
VM_IDLEPCS_SCHEMA = {
|
VM_IDLEPCS_SCHEMA = {
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"description": "Request validation to calculate or show idle-pcs for VM instance",
|
"description": "Request validation to calculate or show Idle-PCs for VM instance",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
@ -479,7 +479,7 @@ VM_IDLEPCS_SCHEMA = {
|
|||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
"compute": {
|
"compute": {
|
||||||
"description": "indicates to compute new idle-pc values",
|
"description": "indicates to compute new Idle-PC values",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -489,7 +489,7 @@ VM_IDLEPCS_SCHEMA = {
|
|||||||
|
|
||||||
VM_AUTO_IDLEPC_SCHEMA = {
|
VM_AUTO_IDLEPC_SCHEMA = {
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"description": "Request an auto idle-pc calculation for this VM instance",
|
"description": "Request an auto Idle-PC calculation for this VM instance",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
|
Loading…
Reference in New Issue
Block a user