direct-io.hg

changeset 1525:1e52f4f43daa

bitkeeper revision 1.990.2.7 (40d6e824hB2u1UturpvFrAcgmJLBwA)

Remove obsolete api. Move domain control api onto xend.
author mjw@wray-m-3.hpl.hp.com
date Mon Jun 21 13:52:36 2004 +0000 (2004-06-21)
parents 63778f2314cb
children 025909f2f72d
files tools/xenmgr/lib/XendClient.py tools/xenmgr/lib/XendDomain.py tools/xenmgr/lib/server/SrvConsoleServer.py
line diff
     1.1 --- a/tools/xenmgr/lib/XendClient.py	Mon Jun 21 13:45:04 2004 +0000
     1.2 +++ b/tools/xenmgr/lib/XendClient.py	Mon Jun 21 13:52:36 2004 +0000
     1.3 @@ -244,29 +244,12 @@ class Xend:
     1.4          return xend_get(self.domainurl(id),
     1.5                          { 'op'      : 'vifs' })
     1.6      
     1.7 -    def xend_domain_vif_stats(self, id, vif):
     1.8 -        return xend_get(self.domainurl(id),
     1.9 -                        { 'op'      : 'vif_stats',
    1.10 -                          'vif'     : vif})
    1.11 -
    1.12      def xend_domain_vif_ip_add(self, id, vif, ipaddr):
    1.13          return xend_call(self.domainurl(id),
    1.14                           {'op'      : 'vif_ip_add',
    1.15                            'vif'     : vif,
    1.16                            'ip'      : ipaddr })
    1.17          
    1.18 -    def xend_domain_vif_scheduler_set(id, vif, bytes, usecs):
    1.19 -        return xend_call(self.domainurl(id),
    1.20 -                         {'op'      : 'vif_scheduler_set',
    1.21 -                          'vif'     : vif,
    1.22 -                          'bytes'   : bytes,
    1.23 -                          'usecs'   : usecs })
    1.24 -
    1.25 -    def xend_domain_vif_scheduler_get(id, vif):
    1.26 -        return xend_get(self.domainurl(id),
    1.27 -                         {'op'      : 'vif_scheduler_get',
    1.28 -                          'vif'     : vif})
    1.29 -
    1.30      def xend_domain_vbds(self, id):
    1.31          return xend_get(self.domainurl(id),
    1.32                          {'op'       : 'vbds'})
    1.33 @@ -276,18 +259,6 @@ class Xend:
    1.34                          {'op'       : 'vbd',
    1.35                           'vbd'      : vbd})
    1.36  
    1.37 -##     def xend_domain_vbd_add(self, id, uname, dev, mode):
    1.38 -##         return xend_call(self.domainurl(id),
    1.39 -##                          {'op'      : 'vbd_add',
    1.40 -##                           'uname'   : uname,
    1.41 -##                           'dev'     : dev,
    1.42 -##                           'mode'    : mode})
    1.43 -
    1.44 -##     def xend_domain_vbd_remove(self, id, dev):
    1.45 -##         return xend_call(self.domainurl(id),
    1.46 -##                          {'op'      : 'vbd_remove',
    1.47 -##                           'dev'     : dev})
    1.48 -
    1.49      def xend_consoles(self):
    1.50          return xend_get(self.consoleurl())
    1.51  
     2.1 --- a/tools/xenmgr/lib/XendDomain.py	Mon Jun 21 13:45:04 2004 +0000
     2.2 +++ b/tools/xenmgr/lib/XendDomain.py	Mon Jun 21 13:52:36 2004 +0000
     2.3 @@ -251,21 +251,6 @@ class XendDomain:
     2.4          self._add_domain(dominfo.id, dominfo)
     2.5          return dominfo
     2.6      
     2.7 -    def domain_device_add(self, id, info):
     2.8 -        """Add a device to a domain.
     2.9 -        """
    2.10 -        pass
    2.11 -    
    2.12 -    def domain_device_remove(self, id, dev):
    2.13 -        """Delete a device from a domain.
    2.14 -        """
    2.15 -        pass
    2.16 -    
    2.17 -    def domain_device_configure(self, id, dev, info):
    2.18 -        """Configure a domain device.
    2.19 -        """
    2.20 -        pass
    2.21 -
    2.22      #============================================================================
    2.23      # Backward compatibility stuff from here on.
    2.24  
    2.25 @@ -301,23 +286,10 @@ class XendDomain:
    2.26          if not dominfo: return None
    2.27          return dominfo.get_device_by_index(vif)
    2.28  
    2.29 -    def domain_vif_stats(self, dom, vif):
    2.30 -        dom = int(dom)
    2.31 -        return xc.vif_stats_get(dom=dom, vif=vif)
    2.32 -
    2.33      def domain_vif_ip_add(self, dom, vif, ip):
    2.34          dom = int(dom)
    2.35          return xenctl.ip.setup_vfr_rules_for_vif(dom, vif, ip)
    2.36  
    2.37 -    def domain_vif_scheduler_set(self, dom, vif, bytes, usecs):
    2.38 -        dom = int(dom)
    2.39 -        return xc.xc_vif_scheduler_set(dom=dom, vif=vif,
    2.40 -                                       credit_bytes=bytes, credit_usecs=usecs)
    2.41 -
    2.42 -    def domain_vif_scheduler_get(self, dom, vif):
    2.43 -        dom = int(dom)
    2.44 -        return xc.vif_scheduler_get(dom=dom, vif=vif)
    2.45 -
    2.46      def domain_vbd_ls(self, dom):
    2.47          dominfo = self.domain_get(dom)
    2.48          if not dominfo: return []
    2.49 @@ -333,19 +305,6 @@ class XendDomain:
    2.50                  return v
    2.51          return None
    2.52  
    2.53 -##     def domain_vbd_add(self, dom, uname, dev, mode):
    2.54 -##         dom = int(dom)
    2.55 -##         vbd = vm.make_disk(dom, uname, dev, mode)
    2.56 -##         return vbd
    2.57 -
    2.58 -##     def domain_vbd_remove(self, dom, dev):
    2.59 -##         dom = int(dom)
    2.60 -##         vbd = xenctl.vdisk.blkdev_name_to_number(dev)
    2.61 -##         if vbd < 0: return vbd
    2.62 -##         err = xc.vbd_destroy(dom, vbd)
    2.63 -##         if err < 0: return err
    2.64 -##         return vbd
    2.65 -
    2.66      def domain_shadow_control(self, dom, op):
    2.67          dom = int(dom)
    2.68          return xc.shadow_control(dom, op)
     3.1 --- a/tools/xenmgr/lib/server/SrvConsoleServer.py	Mon Jun 21 13:45:04 2004 +0000
     3.2 +++ b/tools/xenmgr/lib/server/SrvConsoleServer.py	Mon Jun 21 13:52:36 2004 +0000
     3.3 @@ -21,6 +21,8 @@ from twisted.internet import protocol
     3.4  from twisted.internet import abstract
     3.5  from twisted.internet import defer
     3.6  
     3.7 +import Xc; xc = Xc.new()
     3.8 +
     3.9  import xend.utils
    3.10  
    3.11  from xenmgr import sxp
    3.12 @@ -559,6 +561,16 @@ class Daemon:
    3.13          reactor.diconnectAll()
    3.14          sys.exit(0)
    3.15  
    3.16 +    def blkif_set_control_domain(self, dom):
    3.17 +        """Set the block device backend control domain.
    3.18 +        """
    3.19 +        return self.blkifCF.setControlDomain(dom)
    3.20 +    
    3.21 +    def blkif_get_control_domain(self, dom):
    3.22 +        """Get the block device backend control domain.
    3.23 +        """
    3.24 +        return self.blkifCF.getControlDomain()
    3.25 +    
    3.26      def blkif_create(self, dom):
    3.27          """Create a block device interface controller.
    3.28          
    3.29 @@ -579,6 +591,16 @@ class Daemon:
    3.30          d = ctrl.attach_device(vdev, mode, segment)
    3.31          return d
    3.32  
    3.33 +    def netif_set_control_domain(self, dom):
    3.34 +        """Set the network interface backend control domain.
    3.35 +        """
    3.36 +        return self.netifCF.setControlDomain(dom)
    3.37 +
    3.38 +    def netif_get_control_domain(self, dom):
    3.39 +        """Get the network interface backend control domain.
    3.40 +        """
    3.41 +        return self.netifCF.getControlDomain()
    3.42 +    
    3.43      def netif_create(self, dom):
    3.44          """Create a network interface controller.
    3.45          
    3.46 @@ -622,6 +644,28 @@ class Daemon:
    3.47          if console.conn:
    3.48              console.conn.loseConnection()
    3.49  
    3.50 +    def domain_start(self, id):
    3.51 +        """Start domain running.
    3.52 +        """
    3.53 +        dom = int(id)
    3.54 +        if dom <= 0: return 0
    3.55 +        return xc.domain_start(dom=dom)
    3.56 +        
    3.57 +    def domain_stop(self, id):
    3.58 +        """Stop domain running.
    3.59 +        """
    3.60 +        dom = int(id)
    3.61 +        if dom <= 0: return 0 
    3.62 +        xc.domain_stop(dom=dom)
    3.63 +
    3.64 +    def domain_destroy(self, id, force=0):
    3.65 +        """Destroy a domain. Shutdown if force=0, terminate immediately if force=1.
    3.66 +        """
    3.67 +        dom = int(id)
    3.68 +        if dom <= 0: return 0 
    3.69 +        return xc.domain_destroy(dom=dom, force=0)
    3.70 +    
    3.71 +
    3.72  def instance():
    3.73      global inst
    3.74      try: