def _set_machine_id(self, client_factory, instance, network_info):
        vm_ref = self._get_vm_ref_from_the_name(instance.name)
        if vm_ref is None:
            raise exception.InstanceNotFound(instance_id=instance.id)

        machine_id_str = ''
        for (network, info) in network_info:
            # TODO(vish): add support for dns2
            # TODO(sateesh): add support for injection of ipv6 configuration
            ip_v4 = ip_v6 = None
            if 'ips' in info and len(info['ips']) > 0:
                ip_v4 = info['ips'][0]
            if 'ip6s' in info and len(info['ip6s']) > 0:
                ip_v6 = info['ip6s'][0]
            if len(info['dns']) > 0:
                dns = info['dns'][0]
            else:
                dns = ''

            interface_str = "%s;%s;%s;%s;%s;%s" % \
                                            (info['mac'],
                                             ip_v4 and ip_v4['ip'] or '',
                                             ip_v4 and ip_v4['netmask'] or '',
                                             info['gateway'],
                                             info['broadcast'],
                                             dns)
            machine_id_str = machine_id_str + interface_str + '#'

        machine_id_change_spec = \
            vm_util.get_machine_id_change_spec(client_factory, machine_id_str)

        LOG.debug(_("Reconfiguring VM instance %(name)s to set the machine id "
                  "with ip - %(ip_addr)s") %
                  ({'name': instance.name,
                   'ip_addr': ip_v4['ip']}))
        reconfig_task = self._session._call_method(self._session._get_vim(),
                           "ReconfigVM_Task", vm_ref,
                           spec=machine_id_change_spec)
        self._session._wait_for_task(instance.id, reconfig_task)
        LOG.debug(_("Reconfigured VM instance %(name)s to set the machine id "
                  "with ip - %(ip_addr)s") %
                  ({'name': instance.name,
                   'ip_addr': ip_v4['ip']}))
Set the machine id of the VM for guest tools to pick up and reconfigure
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/virt/vmwareapi/vmops.py/VMWareVMOps._set_machine_id