- /* make sure the VM of the same name does not exit */
- {
- simgrid::s4u::Host* ind_host_tmp = sg_host_by_name(name);
- if (ind_host_tmp != nullptr && sg_host_simix(ind_host_tmp) != nullptr) {
- XBT_ERROR("host %s already exits", name);
- return nullptr;
- }
- }
-
- /* Note: ind_vm and vm_workstation point to the same elm object. */
- /* Ask the SIMIX layer to create the surf vm resource */
- sg_host_t ind_vm_workstation = simcall_vm_create(name, ind_pm);
-
- msg_vm_t ind_vm = (msg_vm_t) __MSG_host_create(ind_vm_workstation);
+ xbt_assert(sg_host_by_name(name) == nullptr,
+ "Cannot create a VM named %s: this name is already used by an host or a VM", name);