def connect(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) rsp = ConnectResponse() # page table extension if shell.run('lscpu | grep -q -w GenuineIntel') == 0: new_ept = False if cmd.pageTableExtensionDisabled else True rsp.error = self._set_intel_ept(new_ept) if rsp.error is not None: rsp.success = False return jsonobject.dumps(rsp) self.host_uuid = cmd.hostUuid self.config[kvmagent.HOST_UUID] = self.host_uuid self.config[kvmagent.SEND_COMMAND_URL] = cmd.sendCommandUrl Report.serverUuid = self.host_uuid Report.url = cmd.sendCommandUrl logger.debug(http.path_msg(self.CONNECT_PATH, 'host[uuid: %s] connected' % cmd.hostUuid)) rsp.libvirtVersion = self.libvirt_version rsp.qemuVersion = self.qemu_version # create udev rule self.handle_usb_device_events() ignore_msrs = 1 if cmd.ignoreMsrs else 0 shell.run("/bin/echo %s > /sys/module/kvm/parameters/ignore_msrs" % ignore_msrs) vm_plugin.cleanup_stale_vnc_iptable_chains() apply_iptables_result = self.apply_iptables_rules(cmd.iptablesRules) rsp.iptablesSucc = apply_iptables_result return jsonobject.dumps(rsp)
def connect(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) self.host_uuid = cmd.hostUuid self.config[kvmagent.HOST_UUID] = self.host_uuid self.config[kvmagent.SEND_COMMAND_URL] = cmd.sendCommandUrl logger.debug(http.path_msg(self.CONNECT_PATH, 'host[uuid: %s] connected' % cmd.hostUuid)) rsp = ConnectResponse() rsp.libvirtVersion = self.libvirt_version rsp.qemuVersion = self.qemu_version vm_plugin.cleanup_stale_vnc_iptable_chains() return jsonobject.dumps(rsp)
def connect(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) self.host_uuid = cmd.hostUuid self.config[kvmagent.HOST_UUID] = self.host_uuid self.config[kvmagent.SEND_COMMAND_URL] = cmd.sendCommandUrl logger.debug(http.path_msg(self.CONNECT_PATH, 'host[uuid: %s] connected' % cmd.hostUuid)) rsp = ConnectResponse() rsp.libvirtVersion = self.libvirt_version rsp.qemuVersion = self.qemu_version vm_plugin.cleanup_stale_vnc_iptable_chains() return jsonobject.dumps(rsp)
def connect(self, req): cmd = jsonobject.loads(req[http.REQUEST_BODY]) self.host_uuid = cmd.hostUuid self.config[kvmagent.HOST_UUID] = self.host_uuid self.config[kvmagent.SEND_COMMAND_URL] = cmd.sendCommandUrl Report.serverUuid = self.host_uuid Report.url = cmd.sendCommandUrl logger.debug( http.path_msg(self.CONNECT_PATH, 'host[uuid: %s] connected' % cmd.hostUuid)) rsp = ConnectResponse() rsp.libvirtVersion = self.libvirt_version rsp.qemuVersion = self.qemu_version # create udev rule self.handle_usb_device_events() vm_plugin.cleanup_stale_vnc_iptable_chains() apply_iptables_result = self.apply_iptables_rules(cmd.iptablesRules) rsp.iptablesSucc = apply_iptables_result return jsonobject.dumps(rsp)
def start(self): self.host_uuid = None http_server = kvmagent.get_http_server() http_server.register_sync_uri(self.CONNECT_PATH, self.connect) http_server.register_async_uri(self.PING_PATH, self.ping) http_server.register_sync_uri(self.CAPACITY_PATH, self.capacity) http_server.register_sync_uri(self.ECHO_PATH, self.echo) http_server.register_async_uri( self.SETUP_MOUNTABLE_PRIMARY_STORAGE_HEARTBEAT, self.setup_heartbeat_file) http_server.register_async_uri(self.FACT_PATH, self.fact) self.heartbeat_timer = {} self.libvirt_version = self._get_libvirt_version() self.qemu_version = self._get_qemu_version() filepath = r'/etc/libvirt/qemu/networks/autostart/default.xml' if os.path.exists(filepath): os.unlink(filepath) vm_plugin.cleanup_stale_vnc_iptable_chains()