WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Added getVCpuCount to XendDomainInfo and use that and ge

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Added getVCpuCount to XendDomainInfo and use that and getName, getDomain,
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 Sep 2005 13:26:15 +0000
Delivery-date: Mon, 19 Sep 2005 13:25:28 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@ewan
# Node ID b75771a12f79bd6a9d65885b5a3fdb8e7e481f40
# Parent  adbf85204d290bae437f681400f0a7703f479d91
Added getVCpuCount to XendDomainInfo and use that and getName, getDomain, 
getTargetMemory inside image.py to decouple the latter from the internals of
the former.  Move the definition of xc inside image.py to please pylint.

Signed-off-by: Ewan Mellor<ewan@xxxxxxxxxxxxx>

diff -r adbf85204d29 -r b75771a12f79 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Sat Sep 17 15:11:49 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py   Sat Sep 17 16:34:58 2005
@@ -333,6 +333,9 @@
 
     def getName(self):
         return self.name
+
+    def getVCpuCount(self):
+        return self.vcpus
 
     def getSsidref(self):
         return self.ssidref
diff -r adbf85204d29 -r b75771a12f79 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Sat Sep 17 15:11:49 2005
+++ b/tools/python/xen/xend/image.py    Sat Sep 17 16:34:58 2005
@@ -18,7 +18,7 @@
 import os, string
 import re
 
-import xen.lowlevel.xc; xc = xen.lowlevel.xc.new()
+import xen.lowlevel.xc
 from xen.xend import sxp
 from xen.xend.XendError import VmError
 from xen.xend.XendLogging import log
@@ -26,6 +26,10 @@
 from xen.xend.xenstore.xstransact import xstransact
 
 from xen.xend.server import channel
+
+
+xc = xen.lowlevel.xc.new()
+
 
 MAX_GUEST_CMDLINE = 1024
 
@@ -155,7 +159,8 @@
                 self.unlink(self.kernel)
                 self.unlink(self.ramdisk)
             if dom <= 0:
-                raise VmError('Creating domain failed: name=%s' % self.vm.name)
+                raise VmError('Creating domain failed: name=%s' %
+                              self.vm.getName())
         log.debug("initDomain: cpu=%d mem_kb=%d ssidref=%d dom=%d", cpu, 
mem_kb, ssidref, dom)
         xc.domain_setcpuweight(dom, cpu_weight)
         xc.domain_setmaxmem(dom, mem_kb)
@@ -190,14 +195,15 @@
         if self.ramdisk and not os.path.isfile(self.ramdisk):
             raise VmError('Kernel ramdisk does not exist: %s' % self.ramdisk)
         if len(self.cmdline) >= MAX_GUEST_CMDLINE:
-            log.warning('kernel cmdline too long, domain %d', self.vm.domid)
+            log.warning('kernel cmdline too long, domain %d',
+                        self.vm.getDomain())
         
         log.info("buildDomain os=%s dom=%d vcpus=%d", self.ostype,
-                 self.vm.domid, self.vm.vcpus)
+                 self.vm.getDomain(), self.vm.getVCpuCount())
         err = self.buildDomain()
         if err != 0:
             raise VmError('Building domain failed: ostype=%s dom=%d err=%d'
-                          % (self.ostype, self.vm.domid, err))
+                          % (self.ostype, self.vm.getDomain(), err))
 
     def getDomainMemory(self, mem_mb):
         """Memory (in KB) the domain will need for mem_mb (in MB)."""
@@ -237,23 +243,23 @@
         else:
             console_evtchn = 0
 
-        log.debug("dom            = %d", self.vm.domid)
+        log.debug("dom            = %d", self.vm.getDomain())
         log.debug("image          = %s", self.kernel)
         log.debug("store_evtchn   = %d", store_evtchn)
         log.debug("console_evtchn = %d", console_evtchn)
         log.debug("cmdline        = %s", self.cmdline)
         log.debug("ramdisk        = %s", self.ramdisk)
         log.debug("flags          = %d", self.flags)
-        log.debug("vcpus          = %d", self.vm.vcpus)
-
-        ret = xc.linux_build(dom            = self.vm.domid,
+        log.debug("vcpus          = %d", self.vm.getVCpuCount())
+
+        ret = xc.linux_build(dom            = self.vm.getDomain(),
                              image          = self.kernel,
                              store_evtchn   = store_evtchn,
                              console_evtchn = console_evtchn,
                              cmdline        = self.cmdline,
                              ramdisk        = self.ramdisk,
                              flags          = self.flags,
-                             vcpus          = self.vm.vcpus)
+                             vcpus          = self.vm.getVCpuCount())
         if isinstance(ret, dict):
             self.set_vminfo(ret)
             return 0
@@ -297,22 +303,22 @@
 
     def buildDomain(self):
         # Create an event channel
-        self.device_channel = channel.eventChannel(0, self.vm.domid)
+        self.device_channel = channel.eventChannel(0, self.vm.getDomain())
         log.info("VMX device model port: %d", self.device_channel.port2)
         if self.vm.store_channel:
             store_evtchn = self.vm.store_channel.port2
         else:
             store_evtchn = 0
-        ret = xc.vmx_build(dom            = self.vm.domid,
+        ret = xc.vmx_build(dom            = self.vm.getDomain(),
                            image          = self.kernel,
                            control_evtchn = self.device_channel.port2,
                            store_evtchn   = store_evtchn,
-                           memsize        = self.vm.memory,
+                           memsize        = self.vm.getTargetMemory(),
                            memmap         = self.memmap_value,
                            cmdline        = self.cmdline,
                            ramdisk        = self.ramdisk,
                            flags          = self.flags,
-                           vcpus          = self.vm.vcpus)
+                           vcpus          = self.vm.getVCpuCount())
         if isinstance(ret, dict):
             self.set_vminfo(ret)
             return 0
@@ -391,7 +397,7 @@
         elif vnc:
             ret = ret + ['-vnc', '-k', 'en-us']
         if vnc:
-            vncport = int(self.vm.domid) + 5900
+            vncport = int(self.vm.getDomain()) + 5900
             ret = ret + ['-vncport', '%d' % vncport]
         return ret
 
@@ -405,9 +411,9 @@
         vnc = self.vncParams()
         if len(vnc):
             args = args + vnc
-        args = args + ([ "-d",  "%d" % self.vm.domid,
+        args = args + ([ "-d",  "%d" % self.vm.getDomain(),
                   "-p", "%d" % self.device_channel.port1,
-                  "-m", "%s" % self.vm.memory ])
+                  "-m", "%s" % self.vm.getTargetMemory() ])
         args = args + self.dmargs
         env = dict(os.environ)
         env['DISPLAY'] = self.display

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Added getVCpuCount to XendDomainInfo and use that and getName, getDomain,, Xen patchbot -unstable <=