From f68eb2cca298e1118e3379eef3f6e777a69eaa1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Tue, 9 Oct 2012 13:59:08 +0200
Subject: [PATCH] Minimise modification during slapformat.

---
 .../portal_skins/vifib_slap/Computer_updateFromDict.xml  | 9 +++++----
 master/bt5/vifib_slap/bt/revision                        | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Computer_updateFromDict.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Computer_updateFromDict.xml
index bcc9a3f7a..5dfbefa6f 100644
--- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Computer_updateFromDict.xml
+++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Computer_updateFromDict.xml
@@ -89,9 +89,9 @@ for c in context.contentValues(portal_type="Computer Partition"):\n
   existing_partition_dict[c.getReference()] = c\n
 \n
 # update computer data\n
-context.edit(\n
-  quantity = len(computer_dict[\'partition_list\']),\n
-)\n
+quantity = len(computer_dict[\'partition_list\'])\n
+if context.getQuantity() != quantity:\n
+  context.edit(quantity=quantity)\n
 \n
 compareAndUpdateAddressList(context, [{\'addr\': computer_dict[\'address\'], \'netmask\': computer_dict[\'netmask\']}])\n
 expected_partition_dict = {}\n
@@ -108,7 +108,8 @@ for send_partition in computer_dict[\'partition_list\']:\n
 \n
   if partition.getValidationState() == "invalidated":\n
     partition.validate(comment="Reactivated by slapformat")\n
-  partition.edit(reference=send_partition[\'reference\'])\n
+  if partition.getReference() != send_partition[\'reference\']:\n
+    partition.edit(reference=send_partition[\'reference\'])\n
   network_interface = send_partition[\'tap\'][\'name\']\n
   compareAndUpdateAddressList(partition, send_partition[\'address_list\'], {\'network_interface\': network_interface})\n
 \n
diff --git a/master/bt5/vifib_slap/bt/revision b/master/bt5/vifib_slap/bt/revision
index 189296e61..779a8736e 100644
--- a/master/bt5/vifib_slap/bt/revision
+++ b/master/bt5/vifib_slap/bt/revision
@@ -1 +1 @@
-825
\ No newline at end of file
+826
\ No newline at end of file
-- 
2.30.9