From 3244d21185e8c826886dd3f21bffc349e12c40c8 Mon Sep 17 00:00:00 2001 From: Sharad Yadav Date: Thu, 25 May 2017 05:35:23 +0100 Subject: [PATCH 1/2] CA-255099: Fix firstboot management.conf during Pool.eject Write the firstboot parameters with values in single quote. This must align with `xe-reset-networking` and `host installer` updating management.conf This will fix xe-reset-networking to take default vlan value correctly, tried after Pool.eject Signed-off-by: Sharad Yadav --- ocaml/xapi/xapi_pool.ml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ocaml/xapi/xapi_pool.ml b/ocaml/xapi/xapi_pool.ml index 4ea6145e1f2..e3566bef416 100644 --- a/ocaml/xapi/xapi_pool.ml +++ b/ocaml/xapi/xapi_pool.ml @@ -1072,16 +1072,16 @@ let eject ~__context ~host = let vlan_id = Int64.to_int pif.API.pIF_VLAN in let config_base = [ sprintf "LABEL='%s'" management_device - ; sprintf "MODE=%s" mode + ; sprintf "MODE='%s'" mode ] in let config_static = if mode <> "static" then [] else - [ sprintf "IP=%s" pif.API.pIF_IP - ; sprintf "NETMASK=%s" pif.API.pIF_netmask - ; sprintf "GATEWAY=%s" pif.API.pIF_gateway - ; sprintf "DNS=%s" pif.API.pIF_DNS + [ sprintf "IP='%s'" pif.API.pIF_IP + ; sprintf "NETMASK='%s'" pif.API.pIF_netmask + ; sprintf "GATEWAY='%s'" pif.API.pIF_gateway + ; sprintf "DNS='%s'" pif.API.pIF_DNS ] in let config_vlan = if vlan_id = -1 then [] else - [ sprintf "VLAN=%d" vlan_id + [ sprintf "VLAN='%d'" vlan_id ] in let configuration_file = List.concat From cec8fc1aee71efef0ccfa5c3bca0ed2271168f2f Mon Sep 17 00:00:00 2001 From: Sharad Yadav Date: Thu, 25 May 2017 06:52:58 +0100 Subject: [PATCH 2/2] CA-255099: Fix management.conf read in reset-networking Use strip() rather than string indexing to read params from management.conf file Signed-off-by: Sharad Yadav --- scripts/xe-reset-networking | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/xe-reset-networking b/scripts/xe-reset-networking index 6a82c1b37a7..6ba59bb325e 100644 --- a/scripts/xe-reset-networking +++ b/scripts/xe-reset-networking @@ -32,7 +32,7 @@ def read_dict_file(fname): d = {} for l in f.readlines(): kv = l.split('=') - d[kv[0]] = kv[1][1:-2] + d[kv[0].strip()] = kv[1].strip().strip("'") return d def read_inventory():