1
0

xen.rst 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. ===========================
  2. Getting Started With Xen
  3. ===========================
  4. The Xen cloud driver works with Citrix XenServer.
  5. It can be used with a single XenServer or a XenServer resource pool.
  6. Setup Dependencies
  7. ==================
  8. This driver requires a copy of the freely available ``XenAPI.py`` Python module.
  9. Information about the Xen API Python module in the XenServer SDK
  10. can be found at https://xenserver.org/partners/developing-products-for-xenserver.html
  11. Place a copy of this module on your system. For example, it can
  12. be placed in the `site packages` location on your system.
  13. The location of `site packages` can be determined by running:
  14. .. code-block:: bash
  15. python -m site --user-site
  16. Provider Configuration
  17. ======================
  18. Xen requires login credentials to a XenServer.
  19. Set up the provider cloud configuration file at ``/etc/salt/cloud.providers`` or
  20. ``/etc/salt/cloud.providers.d/*.conf``.
  21. .. code-block:: yaml
  22. # /etc/salt/cloud.providers.d/myxen.conf
  23. myxen:
  24. driver: xen
  25. url: https://10.0.0.120
  26. user: root
  27. password: p@ssw0rd
  28. url:
  29. The ``url`` option supports both ``http`` and ``https`` uri prefixes.
  30. user:
  31. A valid user id to login to the XenServer host.
  32. password:
  33. The associated password for the user.
  34. .. note::
  35. .. versionchanged:: 2015.8.0
  36. The ``provider`` parameter in cloud provider definitions was renamed to ``driver``. This
  37. change was made to avoid confusion with the ``provider`` parameter that is used in cloud profile
  38. definitions. Cloud provider definitions now use ``driver`` to refer to the Salt cloud module that
  39. provides the underlying functionality to connect to a cloud host, while cloud profiles continue
  40. to use ``provider`` to refer to provider configurations that you define.
  41. Profile Configuration
  42. =====================
  43. Xen profiles require a ``provider`` and ``image``.
  44. provider:
  45. This will be the name of your defined provider.
  46. image:
  47. The name of the VM template used to clone or copy.
  48. clone:
  49. The default behavior is to clone a template or VM. This is very fast,
  50. but requires the source template or VM to be in the same storage
  51. repository of the new target system. If the source and target are in
  52. different storage repositories then you must copy the source and not
  53. clone it by setting ``clone: False``.
  54. deploy:
  55. The provisioning process will attempt to install the Salt minion
  56. service on the new target system by default. This will require login
  57. credentials for Salt cloud to login via ssh to it. The ``user`` and
  58. ``password`` options are required. If ``deploy`` is set to ``False``
  59. then these options are not needed.
  60. resource_pool:
  61. The name of the resource pool used for this profile.
  62. storage_repo:
  63. The name of the storage repository for the target system.
  64. ipv4_cidr:
  65. If template is Windows, and running guest tools then a static
  66. ip address can be set.
  67. ipv4_gw:
  68. If template is Windows, and running guest tools then a gateway
  69. can be set.
  70. Set up an initial profile
  71. at ``/etc/salt/cloud.profiles`` or in the ``/etc/salt/cloud.profiles.d/`` directory:
  72. .. code-block:: yaml
  73. # file: /etc/salt/cloud.profiles.d/xenprofiles.conf
  74. sles:
  75. provider: myxen
  76. deploy: False
  77. image: sles12sp2-template
  78. suse:
  79. user: root
  80. password: p@ssw0rd
  81. provider: myxen
  82. image: opensuseleap42_2-template
  83. storage_repo: 'Local storage'
  84. clone: False
  85. minion:
  86. master: 10.0.0.20
  87. w2k12:
  88. provider: myxen
  89. image: w2k12svr-template
  90. clone: True
  91. userdata_file: /srv/salt/win/files/windows-firewall.ps1
  92. win_installer: /srv/salt/win/files/Salt-Minion-2016.11.3-AMD64-Setup.exe
  93. win_username: Administrator
  94. win_password: p@ssw0rd
  95. use_winrm: False
  96. ipv4_cidr: 10.0.0.215/24
  97. ipv4_gw: 10.0.0.1
  98. minion:
  99. master: 10.0.0.21
  100. The first example will create a clone of the sles12sp2-template in the
  101. same storage repository without deploying the Salt minion.
  102. The second example will make a copy of the image and deploy a new
  103. suse VM with the Salt minion installed.
  104. The third example will create a clone of the Windows 2012 template
  105. and deploy the Salt minion.
  106. The profile can be used with a salt command:
  107. .. code-block:: bash
  108. salt-cloud -p suse xenvm02
  109. This will create an salt minion instance named ``xenvm02`` in Xen. If the command was
  110. executed on the salt-master, its Salt key will automatically be signed on the master.
  111. Once the instance has been created with a salt-minion installed, connectivity to
  112. it can be verified with Salt:
  113. .. code-block:: bash
  114. salt xenvm02 test.version
  115. Listing Sizes
  116. -------------
  117. Sizes can be obtained using the ``--list-sizes`` option for the ``salt-cloud``
  118. command:
  119. .. code-block:: bash
  120. # salt-cloud --list-sizes myxen
  121. .. note:: Since size information is build in a template this command
  122. is not implemented.
  123. Listing Images
  124. --------------
  125. Images can be obtained using the ``--list-images`` option for the ``salt-cloud``
  126. command:
  127. .. code-block:: bash
  128. # salt-cloud --list-images myxen
  129. This command will return a list of templates with details.
  130. Listing Locations
  131. -----------------
  132. Locations can be obtained using the ``--list-locations`` option for the ``salt-cloud``
  133. command:
  134. .. code-block:: bash
  135. # salt-cloud --list-locations myxen
  136. Returns a list of resource pools.