Trigger an error when hotfix is not installed or password is wrong

Hotfix XS65ESP1013 is to fix Cinder volume when iSCSI is used. It
is necessary to check whether this hotfix is installed and exit
deployment if not. And docs are also updated to make sure user will
do so in advance.

Besides, if password of XenServer is wrong, an alert with error
message will also be needed.

Change-Id: I2b7d5b1b127e8a0e232537a4baa5f401f9be0854
Closes-Bug: #1508474
Closes-Bug: #1508996
This commit is contained in:
John Hua 2015-11-03 15:43:12 +08:00
parent 5379a66552
commit c80ded539c
5 changed files with 51 additions and 41 deletions

View File

@ -35,10 +35,12 @@ def execute(*cmd, **kwargs):
if out: if out:
debug(out) debug(out)
if err:
warning(err)
return (out, err) if proc.returncode != 0:
warning(err)
raise Exception(err)
return out
def ssh(host, username, password, *cmd, **kwargs): def ssh(host, username, password, *cmd, **kwargs):
@ -102,8 +104,8 @@ def init_eth():
the IP addresses of local host and XenServer. the IP addresses of local host and XenServer.
""" """
domid, err = execute('xenstore-read', 'domid') domid = execute('xenstore-read', 'domid')
himn_mac, err = execute( himn_mac = execute(
'xenstore-read', 'xenstore-read',
'/local/domain/%s/vm-data/himn_mac' % domid) '/local/domain/%s/vm-data/himn_mac' % domid)
info('himn_mac: %s' % himn_mac) info('himn_mac: %s' % himn_mac)
@ -144,6 +146,13 @@ def init_eth():
return None, None, None return None, None, None
def check_hotfix_exists(himn, username, password, hotfix):
out = ssh(himn_xs, username, password,
'xe patch-list name-label=%s' % hotfix)
if not out:
raise Exception('Hotfix %s has not been installed' % hotfix)
def install_xenapi_sdk(): def install_xenapi_sdk():
"""Install XenAPI Python SDK""" """Install XenAPI Python SDK"""
execute('cp', 'XenAPI.py', '/usr/lib/python2.7/dist-packages/') execute('cp', 'XenAPI.py', '/usr/lib/python2.7/dist-packages/')
@ -177,7 +186,7 @@ def restart_nova_services():
def route_to_compute(endpoints, himn_xs, himn_local, username, password): def route_to_compute(endpoints, himn_xs, himn_local, username, password):
"""Route storage/mgmt requests to compute nodes. """ """Route storage/mgmt requests to compute nodes. """
(out, err) = ssh(himn_xs, username, password, 'route', '-n') out = ssh(himn_xs, username, password, 'route', '-n')
_net = lambda ip: '.'.join(ip.split('.')[:-1] + ['0']) _net = lambda ip: '.'.join(ip.split('.')[:-1] + ['0'])
_mask = lambda cidr: inet_ntoa(pack( _mask = lambda cidr: inet_ntoa(pack(
'>I', 0xffffffff ^ (1 << 32 - int(cidr)) - 1)) '>I', 0xffffffff ^ (1 << 32 - int(cidr)) - 1))
@ -208,7 +217,7 @@ def install_suppack(himn, username, password):
"""Install xapi driver supplemental pack. """ """Install xapi driver supplemental pack. """
# TODO: check if installed # TODO: check if installed
scp(himn, username, password, '/tmp/', 'novaplugins.iso') scp(himn, username, password, '/tmp/', 'novaplugins.iso')
(out, err) = ssh( out = ssh(
himn, username, password, 'xe-install-supplemental-pack', himn, username, password, 'xe-install-supplemental-pack',
'/tmp/novaplugins.iso', prompt='Y\n') '/tmp/novaplugins.iso', prompt='Y\n')
ssh(himn, username, password, 'rm', '/tmp/novaplugins.iso') ssh(himn, username, password, 'rm', '/tmp/novaplugins.iso')
@ -245,6 +254,7 @@ if __name__ == '__main__':
endpoints = get_endpoints(astute) endpoints = get_endpoints(astute)
eth, himn_local, himn_xs = init_eth() eth, himn_local, himn_xs = init_eth()
if username and password and endpoints and himn_local and himn_xs: if username and password and endpoints and himn_local and himn_xs:
check_hotfix_exists(himn_xs, username, password, 'XS65ESP1013')
route_to_compute( route_to_compute(
endpoints, himn_xs, himn_local, username, password) endpoints, himn_xs, himn_local, username, password)
if install_xapi: if install_xapi:

View File

@ -22,13 +22,13 @@ guide
Requirements Requirements
------------ ------------
========================= =============== ========================= ============================
Requirement Version/Comment Requirement Version/Comment
========================= =============== ========================= ============================
Fuel 6.1 Fuel 6.1
XenServer 6.5 SP1 XenServer 6.5 SP1 + Hotfix XS65ESP1013
XenServer plugin for Fuel 1.0.1 XenServer plugin for Fuel 1.0.1
========================= =============== ========================= ============================
* This plugin will not install XenServer or configure the Virtual * This plugin will not install XenServer or configure the Virtual
Machines used to run the OpenStack services. Installation of Machines used to run the OpenStack services. Installation of

View File

@ -18,7 +18,7 @@ Prepare infrastructure
- Other service nodes (e.g. storage node) can also be created as virtual machines, but this is not required - Other service nodes (e.g. storage node) can also be created as virtual machines, but this is not required
2. Download and install XenServer 6.5 with SP1 and HIMN tool, a XenServer plugin, as install guide mentioned. Use it for future VM creation and network configuration. 2. Download and install XenServer 6.5 with SP1, Hotfix XS65ESP1013 and HIMN tool, a XenServer plugin, as install guide mentioned. Use it for future VM creation and network configuration.
3. While many networking setups are expected to work, the following setup is known to work: 3. While many networking setups are expected to work, the following setup is known to work:

View File

@ -91,7 +91,7 @@ endobj
<< /A << /S /URI /Type /Action /URI (https://docs.mirantis.com/openstack/fuel/fuel-6.1/user-guide.html#deploy-changes) >> /Border [ 0 0 0 ] /Rect [ 114.0329 184.5972 178.5129 196.5972 ] /Subtype /Link /Type /Annot >> << /A << /S /URI /Type /Action /URI (https://docs.mirantis.com/openstack/fuel/fuel-6.1/user-guide.html#deploy-changes) >> /Border [ 0 0 0 ] /Rect [ 114.0329 184.5972 178.5129 196.5972 ] /Subtype /Link /Type /Annot >>
endobj endobj
25 0 obj 25 0 obj
<< /Annots [ 21 0 R 23 0 R 24 0 R ] /Contents 54 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 50 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] /XObject << /FormXob.49af0aa469f423c70d1893d8d0633831 22 0 R /FormXob.8909a9f6b77b93d0a2fc2662d6d8986a 20 0 R >> >> /Rotate 0 << /Annots [ 21 0 R 23 0 R 24 0 R ] /Contents 54 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 50 0 R /Resources << /Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] /XObject << /FormXob.4118656348dff8d472d16e794f00da0c 20 0 R /FormXob.49af0aa469f423c70d1893d8d0633831 22 0 R >> >> /Rotate 0
/Trans << >> /Type /Page >> /Trans << >> /Type /Page >>
endobj endobj
26 0 obj 26 0 obj
@ -123,7 +123,7 @@ endobj
<< /Outlines 35 0 R /PageLabels 56 0 R /PageMode /UseNone /Pages 50 0 R /Type /Catalog >> << /Outlines 35 0 R /PageLabels 56 0 R /PageMode /UseNone /Pages 50 0 R /Type /Catalog >>
endobj endobj
34 0 obj 34 0 obj
<< /Author () /CreationDate (D:20151009094416+00'00') /Creator (\(unspecified\)) /Keywords () /Producer (ReportLab PDF Library - www.reportlab.com) /Subject (\(unspecified\)) << /Author () /CreationDate (D:20151102161017-08'00') /Creator (\(unspecified\)) /Keywords () /Producer (ReportLab PDF Library - www.reportlab.com) /Subject (\(unspecified\))
/Title () >> /Title () >>
endobj endobj
35 0 obj 35 0 obj
@ -179,7 +179,7 @@ endobj
<< /Count 5 /Kids [ 8 0 R 15 0 R 19 0 R 25 0 R 32 0 R ] /Type /Pages >> << /Count 5 /Kids [ 8 0 R 15 0 R 19 0 R 25 0 R 32 0 R ] /Type /Pages >>
endobj endobj
51 0 obj 51 0 obj
<< /Length 7458 >> << /Length 7479 >>
stream stream
1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q q
@ -259,22 +259,22 @@ q
1 0 0 1 6 57 cm 1 0 0 1 6 57 cm
q q
.960784 .960784 .862745 rg .960784 .960784 .862745 rg
n 0 0 281.6811 12 re f* n 0 0 209.6461 12 re f*
Q Q
q q
0 0 0 rg 0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 112.2206 0 Td (Requirement) Tj T* -112.2206 0 Td ET BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 76.20306 0 Td (Requirement) Tj T* -76.20306 0 Td ET
Q Q
Q Q
q q
1 0 0 1 299.6811 57 cm 1 0 0 1 227.6461 57 cm
q q
.960784 .960784 .862745 rg .960784 .960784 .862745 rg
n 0 0 164.2087 12 re f* n 0 0 236.2436 12 re f*
Q Q
q q
0 0 0 rg 0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 42.09433 0 Td (Version/Comment) Tj T* -42.09433 0 Td ET BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL 78.11182 0 Td (Version/Comment) Tj T* -78.11182 0 Td ET
Q Q
Q Q
0 0 0 rg 0 0 0 rg
@ -286,7 +286,7 @@ BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (Fuel) Tj T* ET
Q Q
Q Q
q q
1 0 0 1 299.6811 39 cm 1 0 0 1 227.6461 39 cm
q q
0 0 0 rg 0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (6.1) Tj T* ET BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (6.1) Tj T* ET
@ -300,10 +300,10 @@ BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (XenServer) Tj T* ET
Q Q
Q Q
q q
1 0 0 1 299.6811 21 cm 1 0 0 1 227.6461 21 cm
q q
0 0 0 rg 0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (6.5 SP1) Tj T* ET BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (6.5 SP1 + Hotfix XS65ESP1013) Tj T* ET
Q Q
Q Q
q q
@ -314,7 +314,7 @@ BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (XenServer plugin for Fuel) Tj T* ET
Q Q
Q Q
q q
1 0 0 1 299.6811 3 cm 1 0 0 1 227.6461 3 cm
q q
0 0 0 rg 0 0 0 rg
BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (1.0.1) Tj T* ET BT 1 0 0 1 0 2 Tm /F1 10 Tf 12 TL (1.0.1) Tj T* ET
@ -328,7 +328,7 @@ q
n 0 54 m 469.8898 54 l S n 0 54 m 469.8898 54 l S
n 0 36 m 469.8898 36 l S n 0 36 m 469.8898 36 l S
n 0 18 m 469.8898 18 l S n 0 18 m 469.8898 18 l S
n 293.6811 0 m 293.6811 72 l S n 221.6461 0 m 221.6461 72 l S
n 0 72 m 469.8898 72 l S n 0 72 m 469.8898 72 l S
n 0 0 m 469.8898 0 l S n 0 0 m 469.8898 0 l S
n 0 0 m 0 72 l S n 0 0 m 0 72 l S
@ -528,7 +528,7 @@ Q
endstream endstream
endobj endobj
52 0 obj 52 0 obj
<< /Length 9384 >> << /Length 9404 >>
stream stream
1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET 1 0 0 1 0 0 cm BT /F1 12 Tf 14.4 TL ET
q q
@ -959,7 +959,7 @@ q
1 0 0 1 23 -3 cm 1 0 0 1 23 -3 cm
q q
0 0 0 rg 0 0 0 rg
BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.113318 Tw (Download and install XenServer 6.5 with SP1 and HIMN tool, a XenServer plugin, as install guide) Tj T* 0 Tw (mentioned. Use it for future VM creation and network configuration.) Tj T* ET BT 1 0 0 1 0 14 Tm /F1 10 Tf 12 TL 1.326905 Tw (Download and install XenServer 6.5 with SP1, Hotfix XS65ESP1013 and HIMN tool, a XenServer) Tj T* 0 Tw (plugin, as install guide mentioned. Use it for future VM creation and network configuration.) Tj T* ET
Q Q
Q Q
q q
@ -1359,7 +1359,7 @@ q
1 0 0 1 20 0 cm 1 0 0 1 20 0 cm
q q
341.5118 0 0 256.5273 0 0 cm 341.5118 0 0 256.5273 0 0 cm
/FormXob.8909a9f6b77b93d0a2fc2662d6d8986a Do /FormXob.4118656348dff8d472d16e794f00da0c Do
Q Q
Q Q
q q
@ -1765,21 +1765,21 @@ xref
0000170133 00000 n 0000170133 00000 n
0000170252 00000 n 0000170252 00000 n
0000170343 00000 n 0000170343 00000 n
0000177858 00000 n 0000177879 00000 n
0000187299 00000 n 0000187340 00000 n
0000190791 00000 n 0000190832 00000 n
0000195089 00000 n 0000195130 00000 n
0000197796 00000 n 0000197837 00000 n
0000197876 00000 n 0000197917 00000 n
0000197913 00000 n 0000197954 00000 n
0000197950 00000 n 0000197991 00000 n
0000197987 00000 n 0000198028 00000 n
0000198024 00000 n 0000198065 00000 n
trailer trailer
<< /ID << /ID
% ReportLab generated PDF document -- digest (http://www.reportlab.com) % ReportLab generated PDF document -- digest (http://www.reportlab.com)
[(\376\224.\177.\266\365\210\305 \351\235\030*\350\277) (\376\224.\177.\266\365\210\305 \351\235\030*\350\277)] [(\030\251%g\212r\235\223\331pU\307\370OzV) (\030\251%g\212r\235\223\331pU\307\370OzV)]
/Info 34 0 R /Root 33 0 R /Size 62 >> /Info 34 0 R /Root 33 0 R /Size 62 >>
startxref startxref
198061 198102
%%EOF %%EOF

View File

@ -3,7 +3,7 @@ name: fuel-plugin-xenserver
# Human-readable name for your plugin # Human-readable name for your plugin
title: XenServer Plugin title: XenServer Plugin
# Plugin version # Plugin version
version: '1.0.1' version: '1.0.2'
# Description # Description
description: Enable Mirantis OpenStack to integrate with Xenserver description: Enable Mirantis OpenStack to integrate with Xenserver
# Required fuel version # Required fuel version