def _create_vm(self, pod_namespace, pod_id, pod_name, labels, proj_uuid): cluster_name = vnc_kube_config.cluster_name() vm_name = VncCommon.make_name(cluster_name, pod_namespace, pod_name) display_name = vm_name self._check_pod_uuid_change(pod_id, vm_name) perms2 = PermType2() perms2.owner = proj_uuid perms2.owner_access = cfgm_common.PERMS_RWX vm_obj = VirtualMachine(name=vm_name, perms2=perms2, display_name=display_name) vm_obj.uuid = pod_id vm_obj.set_server_type("container") VirtualMachineKM.add_annotations(self, vm_obj, pod_namespace, pod_name, k8s_uuid=str(pod_id), labels=json.dumps(labels)) try: self._vnc_lib.virtual_machine_create(vm_obj) except RefsExistError: vm_obj = self._vnc_lib.virtual_machine_read(id=pod_id) VirtualMachineKM.locate(vm_obj.uuid) return vm_obj
def _create_vm(self, pod_namespace, pod_id, pod_name, labels): vm_name = VncCommon.make_name(pod_name, pod_id) display_name = VncCommon.make_display_name(pod_namespace, pod_name) vm_obj = VirtualMachine(name=vm_name, display_name=display_name) vm_obj.uuid = pod_id VirtualMachineKM.add_annotations(self, vm_obj, pod_namespace, pod_name, k8s_uuid=str(pod_id), labels=json.dumps(labels)) try: self._vnc_lib.virtual_machine_create(vm_obj) except RefsExistError: vm_obj = self._vnc_lib.virtual_machine_read(id=pod_id) VirtualMachineKM.locate(vm_obj.uuid) return vm_obj
def _create_vm(self, pod_namespace, pod_id, pod_name, labels): vm_name = VncCommon.make_name(pod_name, pod_id) display_name = VncCommon.make_display_name(pod_namespace, pod_name) vm_obj = VirtualMachine(name=vm_name, display_name=display_name) vm_obj.uuid = pod_id VirtualMachineKM.add_annotations(self, vm_obj, pod_namespace, pod_name, k8s_uuid=str(pod_id), labels=json.dumps(labels)) try: self._vnc_lib.virtual_machine_create(vm_obj) except RefsExistError: vm_obj = self._vnc_lib.virtual_machine_read(id=pod_id) VirtualMachineKM.locate(vm_obj.uuid) return vm_obj