def add_subnet(self, subnet, sync=True):
        """
        add a subnet to this OS instance.
        :param subnet: the subnet to add on this OS instance
        :param sync: If sync=True(default) synchronize with Ariane server. If sync=False,
        add the subnet object on list to be added on next save().
        :return:
        """
        LOGGER.debug("OSInstance.add_subnet")
        if not sync:
            self.subnets_2_add.append(subnet)
        else:
            if subnet.id is None:
                subnet.save()
            if self.id is not None and subnet.id is not None:
                params = {
                    'id': self.id,
                    'subnetID': subnet.id
                }
                args = {'http_operation': 'GET', 'operation_path': 'update/subnets/add', 'parameters': params}
                response = OSInstanceService.requester.call(args)
                if response.rc != 0:
                    LOGGER.warning(
                        'OSInstance.add_subnet - Problem while updating OS instance ' + self.name +
                        '. Reason: ' + str(response.response_content) + '-' + str(response.error_message) +
                        " (" + str(response.rc) + ")"
                    )
                else:
                    self.subnet_ids.append(subnet.id)
                    subnet.osi_ids.append(self.id)
            else:
                LOGGER.warning(
                    'OSInstance.add_subnet - Problem while updating OS instance ' + self.name + '. Reason: subnet ' +
                    subnet.name + ' id is None'
                )