mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
xenserver: In xsconsole plugin, log via XSConsoleLog module.
Part of a patch from Ian Campbell <ian.campbell@citrix.com>.
This commit is contained in:
@@ -7,9 +7,7 @@
|
|||||||
|
|
||||||
# Copyright (c) 2009 Nicira Networks.
|
# Copyright (c) 2009 Nicira Networks.
|
||||||
|
|
||||||
import logging
|
from XSConsoleLog import *
|
||||||
log = logging.getLogger("vswitch-cfg-update")
|
|
||||||
logging.basicConfig(filename="/var/log/vswitch-xsplugin.log", level=logging.DEBUG)
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
@@ -36,7 +34,7 @@ class VSwitchService:
|
|||||||
try:
|
try:
|
||||||
output = ShellPipe(["service", self.name, "version"]).Stdout()
|
output = ShellPipe(["service", self.name, "version"]).Stdout()
|
||||||
except StandardError, e:
|
except StandardError, e:
|
||||||
log.error("version retrieval error: " + str(e))
|
XSLogError("vswitch version retrieval error: " + str(e))
|
||||||
return "<unknown>"
|
return "<unknown>"
|
||||||
for line in output:
|
for line in output:
|
||||||
if self.processname in line:
|
if self.processname in line:
|
||||||
@@ -47,7 +45,7 @@ class VSwitchService:
|
|||||||
try:
|
try:
|
||||||
output = ShellPipe(["service", self.name, "status"]).Stdout()
|
output = ShellPipe(["service", self.name, "status"]).Stdout()
|
||||||
except StandardError, e:
|
except StandardError, e:
|
||||||
log.error("status retrieval error: " + str(e))
|
XSLogError("vswitch status retrieval error: " + str(e))
|
||||||
return "<unknown>"
|
return "<unknown>"
|
||||||
if len(output) == 0:
|
if len(output) == 0:
|
||||||
return "<unknown>"
|
return "<unknown>"
|
||||||
@@ -66,7 +64,7 @@ class VSwitchService:
|
|||||||
try:
|
try:
|
||||||
ShellPipe(["service", self.name, "restart"]).Call()
|
ShellPipe(["service", self.name, "restart"]).Call()
|
||||||
except StandardError, e:
|
except StandardError, e:
|
||||||
log.error("restart error: " + str(e))
|
XSLogError("vswitch restart error: " + str(e))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def Inst(cls, name, processname=None):
|
def Inst(cls, name, processname=None):
|
||||||
@@ -85,7 +83,7 @@ class VSwitchConfig:
|
|||||||
output = ShellPipe([cfg_mod, "-vANY:console:emer", "-F",
|
output = ShellPipe([cfg_mod, "-vANY:console:emer", "-F",
|
||||||
vswitchd_cfg_filename, "-q", key]).Stdout()
|
vswitchd_cfg_filename, "-q", key]).Stdout()
|
||||||
except StandardError, e:
|
except StandardError, e:
|
||||||
log.error("config retrieval error: " + str(e))
|
XSLogError("config retrieval error: " + str(e))
|
||||||
return "<unknown>"
|
return "<unknown>"
|
||||||
|
|
||||||
if len(output) == 0:
|
if len(output) == 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user