UNPKG

@vmngr/libvirt

Version:

Libvirt bindings for Node.js®

166 lines (165 loc) 4.02 kB
declare const _default: any; export default _default; export declare interface IHypervisorOptions { uri: string; } export declare class Hypervisor { constructor(options: IHypervisorOptions); connectOpen(): Promise<void>; connectClose(): Promise<void>; connectListAllDomains(flags?: ConnectListAllDomainsFlags): Promise<Domain[]>; connectListDomains(): Promise<number[]>; connectListDefinedDomains(): Promise<string[]>; connectGetMaxVcpus(type?: string): Promise<number>; connectGetHostname(): Promise<string>; domainCreateXML(xml: string): Promise<Domain>; domainDefineXML(xml: string): Promise<Domain>; domainGetInfo(domain: Domain): Promise<DomainInfo>; domainGetID(domain: Domain): Promise<number | null>; domainGetName(domain: Domain): Promise<string>; domainGetUUIDString(domain: Domain): Promise<string>; domainLookupByID(id: number): Promise<Domain>; domainLookupByName(name: string): Promise<Domain>; domainLookupByUUIDString(uuid: string): Promise<Domain>; domainSave(domain: Domain, filename: string): Promise<void>; domainRestore(filename: string): Promise<void>; domainCreate(domain: Domain): Promise<void>; domainShutdown(domain: Domain): Promise<void>; domainGetXMLDesc(domain: Domain, flags?: DomainGetXMLDescFlags): Promise<string>; nodeGetInfo(): Promise<NodeInfo>; } export declare const enum ConnectListAllDomainsFlags { ACTIVE = 1, INACTIVE = 2, PERSISTENT = 4, TRANSIENT = 8, RUNNING = 16, PAUSED = 32, SHUTOFF = 64, OTHER = 128, MANAGEDSAVE = 256, NO_MANAGEDSAVE = 512, AUTOSTART = 1024, NO_AUTOSTART = 2048, HAS_SNAPSHOT = 4096, NO_SNAPSHOT = 8192, HAS_CHECKPOINT = 16384, NO_CHECKPOINT = 32768 } export declare const enum DomainGetXMLDescFlags { SECURE = 1, INACTIVE = 2, UPDATE_CPU = 4, MIGRATABLE = 8 } export declare class Domain { } export declare const enum DomainState { NOSTATE = 0, RUNNING = 1, BLOCKED = 2, PAUSED = 3, SHUTDOWN = 4, SHUTOFF = 5, CRASHED = 6, PMSUSPENDED = 7 } export declare interface DomainInfo { state: DomainState; maxMem: number; memory: number; nrVirtCpu: number; cpuTime: number; } export declare interface NodeInfo { model: string; memory: number; cpus: number; mhz: number; nodes: number; sockets: number; cores: number; threads: number; } export declare interface IDomainOsDesc { type?: { arch?: string; machine?: string; value?: string; }; boot?: { dev?: string; }; } export declare interface IDomainDiskDesc { type?: "file"; device?: "disk"; driver?: { name?: "qemu"; type?: "qcow2"; }; source?: { file?: string; }; target?: { dev?: string; bus?: "virtio"; }; } export declare interface IDomainInterfaceDesc { type?: "network"; source?: { network?: string; }; mac?: { address?: string; }; model?: { type?: "virtio"; }; } export declare interface IDomainGraphicsDesc { type?: "vnc"; port?: number; listen?: string; passwd?: string; } export declare interface DomainDesc { type?: "kvm"; id?: number; name?: string; uuid?: string; memory?: { unit?: "KiB"; value?: number; }; currentMemory?: { unit?: "KiB"; value?: number; }; vcpu?: { placement?: "static"; value?: number; }; os?: IDomainOsDesc; devices: Array<{ type: "emulator"; emulator: { value?: string; }; } | { type: "disk"; disk: IDomainDiskDesc; } | { type: "interface"; interface: IDomainInterfaceDesc; } | { type: "console"; console: { type?: "pty"; }; } | { type: "graphics"; graphics: IDomainGraphicsDesc; }>; }