'Sync the content from device dictionary to device object.
The resource tracker updates the available devices periodically.
To avoid meaningless syncs with the database, we update the device
object only if a value changed.'

def update_device(self, dev_dict):

    no_changes = ('status', 'instance_uuid', 'id', 'extra_info')
    for key in no_changes:
        dev_dict.pop(key, None)
    dev_dict.setdefault('parent_addr')
    for (k, v) in dev_dict.items():
        if (k in self.fields.keys()):
            setattr(self, k, v)
        else:
            extra_info = self.extra_info
            data = (v if isinstance(v, six.string_types) else jsonutils.dumps(v))
            extra_info.update({k: data})
            self.extra_info = extra_info
