# HG changeset patch
# User awilliam@xxxxxxxxxxxx
# Date 1175019708 21600
# Node ID 14aeb7981e4ebbbdc2d7d171a2b55b79642bc0a1
# Parent 2c59917255f7f41952bd522a20f3ea022d67f2c4
# Parent 10fcea8f51cd28bd7970efb561da9fba879b151f
merge with xen-unstable.hg
---
.hgignore | 1
tools/python/xen/xend/XendDomainInfo.py | 29 ++-
tools/security/python/xensec_gen/main.py | 226 +++++++++++++++----------------
xen/arch/x86/hvm/pmtimer.c | 2
xen/include/public/hvm/save.h | 2
5 files changed, 131 insertions(+), 129 deletions(-)
diff -r 2c59917255f7 -r 14aeb7981e4e .hgignore
--- a/.hgignore Tue Mar 27 09:07:51 2007 -0600
+++ b/.hgignore Tue Mar 27 12:21:48 2007 -0600
@@ -18,6 +18,7 @@
^cscope.*$
^[^/]*\.bz2$
^\.config$
+^\.pc
^TAGS$
^tags$
^build.*$
diff -r 2c59917255f7 -r 14aeb7981e4e tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Tue Mar 27 09:07:51 2007 -0600
+++ b/tools/python/xen/xend/XendDomainInfo.py Tue Mar 27 12:21:48 2007 -0600
@@ -556,7 +556,8 @@ class XendDomainInfo:
return self.getDeviceController(deviceClass).destroyDevice(devid,
force)
def getDeviceSxprs(self, deviceClass):
- if self.state == DOM_STATE_RUNNING:
+ if self.state == DOM_STATE_RUNNING \
+ or self.state == DOM_STATE_PAUSED:
return self.getDeviceController(deviceClass).sxprs()
else:
sxprs = []
@@ -572,8 +573,8 @@ class XendDomainInfo:
"""Set the memory target of this domain.
@param target: In MiB.
"""
- log.debug("Setting memory target of domain %s (%d) to %d MiB.",
- self.info['name_label'], self.domid, target)
+ log.debug("Setting memory target of domain %s (%s) to %d MiB.",
+ self.info['name_label'], str(self.domid), target)
if target <= 0:
raise XendError('Invalid memory size')
@@ -585,29 +586,28 @@ class XendDomainInfo:
if self.domid >= 0:
self.storeVm("memory", target)
self.storeDom("memory/target", target << 10)
- else:
- xen.xend.XendDomain.instance().managed_config_save(self)
+ xen.xend.XendDomain.instance().managed_config_save(self)
def setMemoryMaximum(self, limit):
"""Set the maximum memory limit of this domain
@param limit: In MiB.
"""
- log.debug("Setting memory maximum of domain %s (%d) to %d MiB.",
- self.info['name_label'], self.domid, limit)
+ log.debug("Setting memory maximum of domain %s (%s) to %d MiB.",
+ self.info['name_label'], str(self.domid), limit)
if limit <= 0:
raise XendError('Invalid memory size')
- self.info['memory_static_max'] = limit
+ MiB = 1024 * 1024
+ self.info['memory_static_max'] = limit * MiB
+
if self.domid >= 0:
maxmem = int(limit) * 1024
try:
return xc.domain_setmaxmem(self.domid, maxmem)
except Exception, ex:
raise XendError(str(ex))
- else:
- self.info['memory_dynamic_max'] = limit
- xen.xend.XendDomain.instance().managed_config_save(self)
+ xen.xend.XendDomain.instance().managed_config_save(self)
def getVCPUInfo(self):
@@ -2302,8 +2302,8 @@ class XendDomainInfo:
if not dev_uuid:
raise XendError('Failed to create device')
- if self.state == XEN_API_VM_POWER_STATE_RUNNING:
-
+ if self.state == XEN_API_VM_POWER_STATE_RUNNING or \
+ self.state == XEN_API_VM_POWER_STATE_PAUSED:
_, config = self.info['devices'][dev_uuid]
if vdi_image_path.startswith('tap'):
@@ -2409,7 +2409,8 @@ class XendDomainInfo:
raise XendError('Device does not exist')
try:
- if self.state == XEN_API_VM_POWER_STATE_RUNNING:
+ if self.state == XEN_API_VM_POWER_STATE_RUNNING \
+ or self.state == XEN_API_VM_POWER_STATE_PAUSED:
_, config = self.info['devices'][dev_uuid]
devid = config.get('devid')
if devid != None:
diff -r 2c59917255f7 -r 14aeb7981e4e tools/security/python/xensec_gen/main.py
--- a/tools/security/python/xensec_gen/main.py Tue Mar 27 09:07:51 2007 -0600
+++ b/tools/security/python/xensec_gen/main.py Tue Mar 27 12:21:48 2007 -0600
@@ -39,147 +39,147 @@ gGroup = 'nobody'
gGroup = 'nobody'
def usage( ):
- print >>sys.stderr, 'Usage: ' + sys.argv[0] + ' [OPTIONS]'
- print >>sys.stderr, ' OPTIONS:'
- print >>sys.stderr, ' -p, --httpport'
- print >>sys.stderr, ' The port on which the http server is to
listen'
- print >>sys.stderr, ' (default: ' + str( gHttpPort ) + ')'
- print >>sys.stderr, ' -d, --httpdir'
- print >>sys.stderr, ' The directory where the http server is to
serve pages from'
- print >>sys.stderr, ' (default: ' + gHttpDir + ')'
- print >>sys.stderr, ' -l, --logfile'
- print >>sys.stderr, ' The file in which to log messages generated
by this command'
- print >>sys.stderr, ' (default: ' + gLogFile + ')'
- print >>sys.stderr, ' -u, --user'
- print >>sys.stderr, ' The user under which this command is to run.
This parameter'
- print >>sys.stderr, ' is only used when invoked under the "root"
user'
- print >>sys.stderr, ' (default: ' + gUser + ')'
- print >>sys.stderr, ' -g, --group'
- print >>sys.stderr, ' The group under which this command is to run.
This parameter'
- print >>sys.stderr, ' is only used when invoked under the "root"
user'
- print >>sys.stderr, ' (default: ' + gGroup + ')'
- print >>sys.stderr, ' -f'
- print >>sys.stderr, ' Run the command in the foreground. The
logfile option will be'
- print >>sys.stderr, ' ignored and all output will be directed to
stdout and stderr.'
- print >>sys.stderr, ' -h, --help'
- print >>sys.stderr, ' Display the command usage information'
+ print >>sys.stderr, 'Usage: ' + sys.argv[0] + ' [OPTIONS]'
+ print >>sys.stderr, ' OPTIONS:'
+ print >>sys.stderr, ' -p, --httpport'
+ print >>sys.stderr, ' The port on which the http server is to listen'
+ print >>sys.stderr, ' (default: ' + str( gHttpPort ) + ')'
+ print >>sys.stderr, ' -d, --httpdir'
+ print >>sys.stderr, ' The directory where the http server is to serve
pages from'
+ print >>sys.stderr, ' (default: ' + gHttpDir + ')'
+ print >>sys.stderr, ' -l, --logfile'
+ print >>sys.stderr, ' The file in which to log messages generated by
this command'
+ print >>sys.stderr, ' (default: ' + gLogFile + ')'
+ print >>sys.stderr, ' -u, --user'
+ print >>sys.stderr, ' The user under which this command is to run.
This parameter'
+ print >>sys.stderr, ' is only used when invoked under the "root" user'
+ print >>sys.stderr, ' (default: ' + gUser + ')'
+ print >>sys.stderr, ' -g, --group'
+ print >>sys.stderr, ' The group under which this command is to run.
This parameter'
+ print >>sys.stderr, ' is only used when invoked under the "root" user'
+ print >>sys.stderr, ' (default: ' + gGroup + ')'
+ print >>sys.stderr, ' -f'
+ print >>sys.stderr, ' Run the command in the foreground. The logfile
option will be'
+ print >>sys.stderr, ' ignored and all output will be directed to
stdout and stderr.'
+ print >>sys.stderr, ' -h, --help'
+ print >>sys.stderr, ' Display the command usage information'
def runServer( aServerPort,
aServerClass = BaseHTTPServer.HTTPServer,
aHandlerClass = CGIHTTPServer.CGIHTTPRequestHandler ):
- serverAddress = ( '', aServerPort )
- httpd = aServerClass( serverAddress, aHandlerClass )
- httpd.serve_forever( )
+ serverAddress = ( '', aServerPort )
+ httpd = aServerClass( serverAddress, aHandlerClass )
+ httpd.serve_forever( )
def daemonize( aHttpDir, aLogFile, aUser, aGroup, aFork = 'true' ):
- # Do some pre-daemon activities
- os.umask( 027 )
- if os.getuid( ) == 0:
- # If we are running as root, we will change that
- uid = pwd.getpwnam( aUser )[2]
- gid = grp.getgrnam( aGroup )[2]
+ # Do some pre-daemon activities
+ os.umask( 027 )
+ if os.getuid( ) == 0:
+ # If we are running as root, we will change that
+ uid = pwd.getpwnam( aUser )[2]
+ gid = grp.getgrnam( aGroup )[2]
- if aFork == 'true':
- # Change the owner of the log file to the user/group
- # under which the daemon is to run
- flog = open( aLogFile, 'a' )
- flog.close( )
- os.chown( aLogFile, uid, gid )
+ if aFork == 'true':
+ # Change the owner of the log file to the user/group
+ # under which the daemon is to run
+ flog = open( aLogFile, 'a' )
+ flog.close( )
+ os.chown( aLogFile, uid, gid )
- # Change the uid/gid of the process
- os.setgid( gid )
- os.setuid( uid )
+ # Change the uid/gid of the process
+ os.setgid( gid )
+ os.setuid( uid )
- # Change to the HTTP directory
- os.chdir( aHttpDir )
+ # Change to the HTTP directory
+ os.chdir( aHttpDir )
- if aFork == 'true':
- # Do first fork
- try:
- pid = os.fork( )
- if pid:
- # Parent process
- return pid
+ if aFork == 'true':
+ # Do first fork
+ try:
+ pid = os.fork( )
+ if pid:
+ # Parent process
+ return pid
- except OSError, e:
- raise Exception, e
+ except OSError, e:
+ raise Exception, e
- # First child process, create a new session
- os.setsid( )
+ # First child process, create a new session
+ os.setsid( )
- # Do second fork
- try:
- pid = os.fork( )
- if pid:
- # Parent process
- os._exit( 0 )
+ # Do second fork
+ try:
+ pid = os.fork( )
+ if pid:
+ # Parent process
+ os._exit( 0 )
- except OSError, e:
- raise Exception, e
+ except OSError, e:
+ raise Exception, e
- # Reset stdin/stdout/stderr
- fin = open( '/dev/null', 'r' )
- flog = open( aLogFile, 'a' )
- os.dup2( fin.fileno( ), sys.stdin.fileno( ) )
- os.dup2( flog.fileno( ), sys.stdout.fileno( ) )
- os.dup2( flog.fileno( ), sys.stderr.fileno( ) )
+ # Reset stdin/stdout/stderr
+ fin = open( '/dev/null', 'r' )
+ flog = open( aLogFile, 'a' )
+ os.dup2( fin.fileno( ), sys.stdin.fileno( ) )
+ os.dup2( flog.fileno( ), sys.stdout.fileno( ) )
+ os.dup2( flog.fileno( ), sys.stderr.fileno( ) )
def main( ):
- httpPort = gHttpPort
- httpDir = gHttpDir
- logFile = gLogFile
- user = gUser
- group = gGroup
- doFork = 'true'
+ httpPort = gHttpPort
+ httpDir = gHttpDir
+ logFile = gLogFile
+ user = gUser
+ group = gGroup
+ doFork = 'true'
- shortOpts = 'd:p:l:u:g:fh'
- longOpts = [ 'httpdir=', 'httpport=', 'logfile=', 'user=', 'group=',
'help' ]
- try:
- opts, args = getopt.getopt( sys.argv[1:], shortOpts, longOpts )
+ shortOpts = 'd:p:l:u:g:fh'
+ longOpts = [ 'httpdir=', 'httpport=', 'logfile=', 'user=', 'group=',
'help' ]
+ try:
+ opts, args = getopt.getopt( sys.argv[1:], shortOpts, longOpts )
- except getopt.GetoptError, e:
- print >>sys.stderr, e
- usage( )
- sys.exit( )
+ except getopt.GetoptError, e:
+ print >>sys.stderr, e
+ usage( )
+ sys.exit( )
- if len( args ) != 0:
- print >>sys.stderr, 'Error: command arguments are not supported'
- usage( )
- sys.exit( )
+ if len( args ) != 0:
+ print >>sys.stderr, 'Error: command arguments are not supported'
+ usage( )
+ sys.exit( )
- for opt, opt_value in opts:
- if opt in ( '-h', '--help' ):
- usage( )
- sys.exit( )
+ for opt, opt_value in opts:
+ if opt in ( '-h', '--help' ):
+ usage( )
+ sys.exit( )
- if opt in ( '-d', '--httpdir' ):
- httpDir = opt_value
+ if opt in ( '-d', '--httpdir' ):
+ httpDir = opt_value
- if opt in ( '-p', '--httpport' ):
- try:
- httpPort = int( opt_value )
- except:
- print >>sys.stderr, 'Error: HTTP port is not
valid'
- usage( )
- sys.exit( )
+ if opt in ( '-p', '--httpport' ):
+ try:
+ httpPort = int( opt_value )
+ except:
+ print >>sys.stderr, 'Error: HTTP port is not valid'
+ usage( )
+ sys.exit( )
- if opt in ( '-l', '--logfile' ):
- logFile = opt_value
+ if opt in ( '-l', '--logfile' ):
+ logFile = opt_value
- if opt in ( '-u', '--user' ):
- user = opt_value
+ if opt in ( '-u', '--user' ):
+ user = opt_value
- if opt in ( '-g', '--group' ):
- group = opt_value
+ if opt in ( '-g', '--group' ):
+ group = opt_value
- if opt in ( '-f' ):
- doFork = 'false'
+ if opt in ( '-f' ):
+ doFork = 'false'
- pid = daemonize( httpDir, logFile, user, group, doFork )
- if pid > 0:
- sys.exit( )
+ pid = daemonize( httpDir, logFile, user, group, doFork )
+ if pid > 0:
+ sys.exit( )
- runServer( httpPort )
+ runServer( httpPort )
if __name__ == '__main__':
- main( )
+ main( )
diff -r 2c59917255f7 -r 14aeb7981e4e xen/arch/x86/hvm/pmtimer.c
--- a/xen/arch/x86/hvm/pmtimer.c Tue Mar 27 09:07:51 2007 -0600
+++ b/xen/arch/x86/hvm/pmtimer.c Tue Mar 27 12:21:48 2007 -0600
@@ -27,7 +27,7 @@
#define PM1a_EN_ADDR (ACPI_PM1A_EVT_BLK_ADDRESS + 2)
#define TMR_VAL_ADDR (ACPI_PM_TMR_BLK_ADDRESS)
-/* The interesting bit of the PM1a_STS register */
+/* The interesting bits of the PM1a_STS register */
#define TMR_STS (1 << 0)
#define PWRBTN_STS (1 << 5)
#define GBL_STS (1 << 8)
diff -r 2c59917255f7 -r 14aeb7981e4e xen/include/public/hvm/save.h
--- a/xen/include/public/hvm/save.h Tue Mar 27 09:07:51 2007 -0600
+++ b/xen/include/public/hvm/save.h Tue Mar 27 12:21:48 2007 -0600
@@ -392,7 +392,7 @@ DECLARE_HVM_SAVE_TYPE(HPET, 12, struct h
*/
struct hvm_hw_pmtimer {
- uint32_t tmr_val; /* PM_TMR_BLK.TMR_VAL: 24bit free-running counter */
+ uint32_t tmr_val; /* PM_TMR_BLK.TMR_VAL: 32bit free-running counter */
uint16_t pm1a_sts; /* PM1a_EVT_BLK.PM1a_STS: status register */
uint16_t pm1a_en; /* PM1a_EVT_BLK.PM1a_EN: enable register */
};
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|