Skip to content

Commit b5391d3

Browse files
author
Jon Ludlam
committed
More fixes for port locking.
The script 'common.py' reads the config from xenopsd's database directly. The past few commits made sure the on-disk database was up-to-date after API calls to mutate various fields. However, there is also some further modification of some of the fields done by the xc driver - for example, the 'extra_private_fields' string -> string map is augmented with some extra kvs derived from other fields. In particular, the ipv4_allowed and ipv6_allowed keys are derived from the locking_mode parameter. These keys ended up in xenstore but not in the on-disk json representation of the VIF. The same happened for the network-backend field - added by xenopsd to the same map, and thus not in the on-disk json. This was fixed in a xen-api commit by explicitly adding it in xapi, which was a bit of a hack. Signed-off-by: Jon Ludlam <[email protected]>
1 parent ed0a9b8 commit b5391d3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ def get_words(value, separator):
204204
private = self.json["extra_private_keys"]
205205
if "locking_mode" in self.json:
206206
if type(self.json["locking_mode"]) is list:
207+
# Must be type=locked here
207208
results["locking_mode"] = self.json["locking_mode"][0].lower()
209+
locked_params=self.json["locking_mode"][1]
210+
results["ipv4_allowed"] = locked_params["ipv4"]
211+
results["ipv6_allowed"] = locked_params["ipv6"]
208212
else:
209213
results["locking_mode"] = self.json["locking_mode"].lower()
210-
if "ipv4-allowed" in private:
211-
results["ipv4_allowed"] = get_words(private["ipv4-allowed"].lower(), ",")
212-
if "ipv6-allowed" in private:
213-
results["ipv6_allowed"] = get_words(private["ipv6-allowed"].lower(), ",")
214214
send_to_syslog("Got locking config: %s" % (repr(results)))
215215
return results
216216

0 commit comments

Comments
 (0)