ia64/xen-unstable

changeset 17713:33a6590ba948

Add -s --ssl option to xm migrate

This patch adds -s --ssl option to xm migrate. It will override
xend-relocation-ssl setting in /etc/xen/xend-config.sxp.

When mix deploy xen 3.2 and xen 3.3 servers, it's convenient to have a
command line option rather than modify /etc/xen/xend-config.sxp every
time.

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri May 23 10:42:11 2008 +0100 (2008-05-23)
parents 91a9e28aed46
children 9469ad6e2634
files tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/server/SrvDomain.py tools/python/xen/xm/migrate.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Fri May 23 10:41:44 2008 +0100
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Fri May 23 10:42:11 2008 +0100
     1.3 @@ -1762,9 +1762,10 @@ class XendAPI(object):
     1.4          resource = other_config.get("resource", 0)
     1.5          port = other_config.get("port", 0)
     1.6          node = other_config.get("node", 0)
     1.7 +        ssl = other_config.get("ssl", 0)
     1.8          
     1.9          xendom.domain_migrate(xeninfo.getDomid(), destination_url,
    1.10 -                              bool(live), resource, port, node)
    1.11 +                              bool(live), resource, port, node, ssl)
    1.12          return xen_api_success_void()
    1.13  
    1.14      def VM_save(self, _, vm_ref, dest, checkpoint):
     2.1 --- a/tools/python/xen/xend/XendDomain.py	Fri May 23 10:41:44 2008 +0100
     2.2 +++ b/tools/python/xen/xend/XendDomain.py	Fri May 23 10:42:11 2008 +0100
     2.3 @@ -1258,7 +1258,7 @@ class XendDomain:
     2.4  
     2.5          return val       
     2.6  
     2.7 -    def domain_migrate(self, domid, dst, live=False, port=0, node=-1):
     2.8 +    def domain_migrate(self, domid, dst, live=False, port=0, node=-1, ssl=None):
     2.9          """Start domain migration.
    2.10          
    2.11          @param domid: Domain ID or Name
    2.12 @@ -1269,6 +1269,8 @@ class XendDomain:
    2.13          @type port: int        
    2.14          @keyword live: Live migration
    2.15          @type live: bool
    2.16 +        @keyword ssl: use ssl connection
    2.17 +        @type ssl: bool
    2.18          @rtype: None
    2.19          @keyword node: use node number for target
    2.20          @rtype: int 
    2.21 @@ -1294,7 +1296,9 @@ class XendDomain:
    2.22              """ Make sure there's memory free for enabling shadow mode """
    2.23              dominfo.checkLiveMigrateMemory()
    2.24  
    2.25 -        ssl = xoptions.get_xend_relocation_ssl()
    2.26 +        if ssl is None:
    2.27 +            ssl = xoptions.get_xend_relocation_ssl()
    2.28 +
    2.29          if ssl:
    2.30              from OpenSSL import SSL
    2.31              from xen.web import connection
     3.1 --- a/tools/python/xen/xend/server/SrvDomain.py	Fri May 23 10:41:44 2008 +0100
     3.2 +++ b/tools/python/xen/xend/server/SrvDomain.py	Fri May 23 10:42:11 2008 +0100
     3.3 @@ -115,7 +115,8 @@ class SrvDomain(SrvDir):
     3.4                      [['dom',         'int'],
     3.5                       ['destination', 'str'],
     3.6                       ['live',        'int'],
     3.7 -                     ['port',        'int']])
     3.8 +                     ['port',        'int'],
     3.9 +                     ['ssl',         'int']])
    3.10          return fn(req.args, {'dom': self.dom.domid})
    3.11  
    3.12      def op_pincpu(self, _, req):
     4.1 --- a/tools/python/xen/xm/migrate.py	Fri May 23 10:41:44 2008 +0100
     4.2 +++ b/tools/python/xen/xm/migrate.py	Fri May 23 10:42:11 2008 +0100
     4.3 @@ -47,6 +47,10 @@ gopts.opt('node', short='n', val='nodenu
     4.4            fn=set_int, default=-1,
     4.5            use="Use specified NUMA node on target.")
     4.6  
     4.7 +gopts.opt('ssl', short='s',
     4.8 +          fn=set_true, default=None,
     4.9 +          use="Use ssl connection for migration.")
    4.10 +
    4.11  def help():
    4.12      return str(gopts)
    4.13      
    4.14 @@ -65,11 +69,13 @@ def main(argv):
    4.15          vm_ref = get_single_vm(dom)
    4.16          other_config = {
    4.17              "port":     opts.vals.port,
    4.18 -            "node":     opts.vals.node
    4.19 +            "node":     opts.vals.node,
    4.20 +            "ssl":      opts.vals.ssl
    4.21              }
    4.22          server.xenapi.VM.migrate(vm_ref, dst, bool(opts.vals.live),
    4.23                                   other_config)
    4.24      else:
    4.25          server.xend.domain.migrate(dom, dst, opts.vals.live,
    4.26                                     opts.vals.port,
    4.27 -                                   opts.vals.node)
    4.28 +                                   opts.vals.node,
    4.29 +                                   opts.vals.ssl)