zig libvirt: add most function names
This commit is contained in:
parent
30fcde4b5b
commit
60364765be
1 changed files with 350 additions and 33 deletions
|
@ -426,35 +426,73 @@ pub const Pool = struct {
|
||||||
self.arena.deinit();
|
self.arena.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getName(self: *const Pool) ![]const u8 {
|
pub fn findStoragePoolSources() void {}
|
||||||
|
pub fn getStoragePoolCapabilities() void {}
|
||||||
|
pub fn listAllStoragePools() void {}
|
||||||
|
pub fn listDefinedStoragePools() void {}
|
||||||
|
pub fn listStoragePools() void {}
|
||||||
|
pub fn numOfDefinedStoragePools() void {}
|
||||||
|
pub fn numOfStoragePools() void {}
|
||||||
|
// TODO event handling callbacks
|
||||||
|
|
||||||
|
pub fn build() void {}
|
||||||
|
pub fn create() void {}
|
||||||
|
pub fn createXML() void {}
|
||||||
|
pub fn defineXML() void {}
|
||||||
|
pub fn delete() void {}
|
||||||
|
pub fn destroy() void {}
|
||||||
|
pub fn free() void {}
|
||||||
|
|
||||||
|
pub fn getAutostart() void {}
|
||||||
|
pub fn getConnect() void {}
|
||||||
|
pub fn getInfo() void {}
|
||||||
|
pub fn getName(self: *const Pool) VirError![]const u8 {
|
||||||
const name = c.virStoragePoolGetName(self.ptr);
|
const name = c.virStoragePoolGetName(self.ptr);
|
||||||
// defer std.c.free(name);
|
|
||||||
const str = string(name);
|
const str = string(name);
|
||||||
return if (str.len == 0) handleError() else str;
|
return if (str.len == 0) handleError() else str;
|
||||||
// return if (str.len == 0) handleError() else try self.arena.allocator().dupe(u8, str);
|
|
||||||
}
|
}
|
||||||
|
pub fn getUUID() void {}
|
||||||
|
pub fn getUUIDString() void {}
|
||||||
|
pub fn getXMLDesc() void {}
|
||||||
|
|
||||||
pub fn createVolume(self: *const Pool, xml: String, flags: []const Volume.CreateFlags) !Volume {
|
pub fn isActive() void {}
|
||||||
const volume = c.virStorageVolCreateXML(self.ptr, @ptrCast(xml.str), intFromFlags(Volume.CreateFlags, flags));
|
pub fn isPersistent() void {}
|
||||||
return if (volume) |v| Volume.init(v, self.arena.allocator()) else handleError();
|
pub fn listAllVolumes() void {}
|
||||||
}
|
pub fn listVolumes() void {}
|
||||||
|
|
||||||
pub fn lookupVolumeByName(self: *const Pool, name: []const u8) !Volume {
|
pub fn lookupByName() void {}
|
||||||
const volume = c.virStorageVolLookupByName(self.ptr, @ptrCast(name));
|
pub fn lookupByTargetPath() void {}
|
||||||
return if (volume) |v| Volume.init(v, self.arena.allocator()) else handleError();
|
pub fn lookupByUUID() void {}
|
||||||
}
|
pub fn lookupByUUIDString() void {}
|
||||||
|
pub fn lookupByVolume() void {}
|
||||||
|
|
||||||
pub fn iterateVolumes(self: *const Pool, flags: []const ListFlags) Volume.VolumeIterator {
|
pub fn numOfVolumes() void {}
|
||||||
return Volume.VolumeIterator.init(
|
pub fn ref() void {}
|
||||||
c.virStorageVolumePtr,
|
pub fn refresh() void {}
|
||||||
Pool,
|
pub fn setAutostart() void {}
|
||||||
Volume.ListFlags,
|
pub fn undefine() void {}
|
||||||
self,
|
|
||||||
flags,
|
// pub fn createVolume(self: *const Pool, xml: String, flags: []const Volume.CreateFlags) !Volume {
|
||||||
self.arena.allocator(),
|
// const volume = c.virStorageVolCreateXML(self.ptr, @ptrCast(xml.str), intFromFlags(Volume.CreateFlags, flags));
|
||||||
c.virStoragePoolListAllVolumes,
|
// return if (volume) |v| Volume.init(v, self.arena.allocator()) else handleError();
|
||||||
);
|
// }
|
||||||
}
|
|
||||||
|
// pub fn lookupVolumeByName(self: *const Pool, name: []const u8) !Volume {
|
||||||
|
// const volume = c.virStorageVolLookupByName(self.ptr, @ptrCast(name));
|
||||||
|
// return if (volume) |v| Volume.init(v, self.arena.allocator()) else handleError();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// pub fn iterateVolumes(self: *const Pool, flags: []const ListFlags) Volume.VolumeIterator {
|
||||||
|
// return Volume.VolumeIterator.init(
|
||||||
|
// c.virStorageVolumePtr,
|
||||||
|
// Pool,
|
||||||
|
// Volume.ListFlags,
|
||||||
|
// self,
|
||||||
|
// flags,
|
||||||
|
// self.arena.allocator(),
|
||||||
|
// c.virStoragePoolListAllVolumes,
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
pub const ListFlags = enum(c_uint) {
|
pub const ListFlags = enum(c_uint) {
|
||||||
Inactive = c.VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE,
|
Inactive = c.VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE,
|
||||||
|
@ -530,12 +568,29 @@ pub const Pool = struct {
|
||||||
self.arena.deinit();
|
self.arena.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getName(self: *const Volume) ![]const u8 {
|
pub fn createXML() void {}
|
||||||
const name = c.virStorageVolGetName(self.ptr);
|
pub fn createXMLFrom() void {}
|
||||||
// defer std.c.free(name);
|
pub fn delete() void {}
|
||||||
const str = string(name);
|
pub fn download() void {}
|
||||||
return if (str.len == 0) handleError() else str;
|
pub fn free() void {}
|
||||||
}
|
|
||||||
|
pub fn getConnect() void {}
|
||||||
|
pub fn getInfo() void {}
|
||||||
|
pub fn getInfoFlags() void {}
|
||||||
|
pub fn getKey() void {}
|
||||||
|
pub fn getName() void {}
|
||||||
|
pub fn getPath() void {}
|
||||||
|
pub fn getXMLDesc() void {}
|
||||||
|
|
||||||
|
pub fn lookupByKey() void {}
|
||||||
|
pub fn lookupByName() void {}
|
||||||
|
pub fn lookupByPath() void {}
|
||||||
|
|
||||||
|
pub fn ref() void {}
|
||||||
|
pub fn resize() void {}
|
||||||
|
pub fn upload() void {}
|
||||||
|
pub fn wipe() void {}
|
||||||
|
pub fn wipePattern() void {}
|
||||||
|
|
||||||
pub const ListFlags = enum(c_uint) {};
|
pub const ListFlags = enum(c_uint) {};
|
||||||
pub const CreateFlags = enum(c_uint) {
|
pub const CreateFlags = enum(c_uint) {
|
||||||
|
@ -608,15 +663,195 @@ pub const Domain = struct {
|
||||||
self.arena.deinit();
|
self.arena.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getName(self: *const Domain) []const u8 {
|
// TODO event handling callbacks
|
||||||
const name = c.virDomainGetName(self.ptr);
|
|
||||||
return mem.span(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn isActive(self: *const Domain) bool {
|
pub fn xmlFromNative() void {}
|
||||||
|
pub fn xmlToNative() void {}
|
||||||
|
pub fn getAllDomainStats() void {}
|
||||||
|
pub fn getDomainCapabilities() void {}
|
||||||
|
pub fn listAllDomains() void {}
|
||||||
|
pub fn listDefinedDomains() void {}
|
||||||
|
pub fn listDomains() void {}
|
||||||
|
pub fn numOfDefinedDomains() void {}
|
||||||
|
pub fn numOfDomains() void {}
|
||||||
|
|
||||||
|
pub fn abortJob() void {}
|
||||||
|
pub fn abortJobFlags() void {}
|
||||||
|
pub fn addIOThread() void {}
|
||||||
|
pub fn agentSetResponseTimeout() void {}
|
||||||
|
pub fn attachDevice() void {}
|
||||||
|
pub fn attachDeviceFlags() void {}
|
||||||
|
pub fn authorizedSSHKeysSet() void {}
|
||||||
|
pub fn backupBegin() void {}
|
||||||
|
pub fn backupGetXMLDesc() void {}
|
||||||
|
pub fn blockCommit() void {}
|
||||||
|
pub fn blockCopy() void {}
|
||||||
|
pub fn blockJobAbort() void {}
|
||||||
|
pub fn blockJobSetSpeed() void {}
|
||||||
|
pub fn blockPeek() void {}
|
||||||
|
pub fn blockPull() void {}
|
||||||
|
pub fn blockRebase() void {}
|
||||||
|
pub fn blockResize() void {}
|
||||||
|
pub fn blockStats() void {}
|
||||||
|
pub fn blockStatsFlags() void {}
|
||||||
|
pub fn coreDump() void {}
|
||||||
|
pub fn coreDumpWithFormat() void {}
|
||||||
|
|
||||||
|
pub fn create() void {}
|
||||||
|
pub fn createLinux() void {}
|
||||||
|
pub fn createWithFiles() void {}
|
||||||
|
pub fn createWithFlags() void {}
|
||||||
|
pub fn createXML() void {}
|
||||||
|
pub fn createXMLWithFiles() void {}
|
||||||
|
pub fn defineXML() void {}
|
||||||
|
pub fn defineXMLFlags() void {}
|
||||||
|
pub fn delIOThread() void {}
|
||||||
|
pub fn destroy() void {}
|
||||||
|
pub fn destroyFlags() void {}
|
||||||
|
pub fn detachDevice() void {}
|
||||||
|
pub fn detachDeviceAlias() void {}
|
||||||
|
pub fn detachDeviceFlags() void {}
|
||||||
|
pub fn fdAssociate() void {}
|
||||||
|
pub fn fsFreeze() void {}
|
||||||
|
pub fn fsInfoFree() void {}
|
||||||
|
pub fn fsThaw() void {}
|
||||||
|
pub fn fsTrim() void {}
|
||||||
|
pub fn free() void {}
|
||||||
|
|
||||||
|
pub fn getAutostart() void {}
|
||||||
|
pub fn getBlkioParameters() void {}
|
||||||
|
pub fn getBlockInfo() void {}
|
||||||
|
pub fn getBlockIoTune() void {}
|
||||||
|
pub fn getBlockJobInfo() void {}
|
||||||
|
pub fn getCPUStats() void {}
|
||||||
|
pub fn getConnect() void {}
|
||||||
|
pub fn getControlInfo() void {}
|
||||||
|
pub fn getDiskErrors() void {}
|
||||||
|
pub fn getEmulatorPinInfo() void {}
|
||||||
|
pub fn getFSInfo() void {}
|
||||||
|
pub fn getGuestInfo() void {}
|
||||||
|
pub fn getGuestVcpus() void {}
|
||||||
|
pub fn getHostname() void {}
|
||||||
|
pub fn getID() void {}
|
||||||
|
pub fn getIOThreadInfo() void {}
|
||||||
|
pub fn getInfo() void {}
|
||||||
|
pub fn getInterfaceParameters() void {}
|
||||||
|
pub fn getJobInfo() void {}
|
||||||
|
pub fn getJobStats() void {}
|
||||||
|
pub fn getLaunchSecurityInfo() void {}
|
||||||
|
pub fn getMaxMemory() void {}
|
||||||
|
pub fn getMaxVcpus() void {}
|
||||||
|
pub fn getMemoryParameters() void {}
|
||||||
|
pub fn getMessages() void {}
|
||||||
|
pub fn getMetadata() void {}
|
||||||
|
pub fn getName(self: *const Domain) VirError![]const u8 {
|
||||||
|
const name = c.virDomainGetName(self.ptr);
|
||||||
|
const str = string(name);
|
||||||
|
return if (str.len == 0) handleError() else str;
|
||||||
|
}
|
||||||
|
pub fn getNumaParameters() void {}
|
||||||
|
pub fn getOSType() void {}
|
||||||
|
pub fn getPerfEvents() void {}
|
||||||
|
pub fn getSchedulerParameters() void {}
|
||||||
|
pub fn getSchedulerParametersFlags() void {}
|
||||||
|
pub fn getSchedulerType() void {}
|
||||||
|
pub fn getSecurityLabel() void {}
|
||||||
|
pub fn getSecurityLabelList() void {}
|
||||||
|
pub fn getState() void {}
|
||||||
|
pub fn getTime() void {}
|
||||||
|
pub fn getUUID() void {}
|
||||||
|
pub fn getUUIDString() void {}
|
||||||
|
pub fn getVcpuPinInfo() void {}
|
||||||
|
pub fn getVcpus() void {}
|
||||||
|
pub fn getVpusFlags() void {}
|
||||||
|
pub fn getXMLDesc() void {}
|
||||||
|
|
||||||
|
pub fn graphicsReload() void {}
|
||||||
|
pub fn hasManagedSaveImage() void {}
|
||||||
|
pub fn ioThreadInfoFree() void {}
|
||||||
|
pub fn injectNMI() void {}
|
||||||
|
pub fn interfaceAddresses() void {}
|
||||||
|
pub fn interfaceFree() void {}
|
||||||
|
pub fn interfaceStats() void {}
|
||||||
|
|
||||||
|
pub fn isActive(self: *const Domain) void {
|
||||||
const active = c.virDomainIsActive(self.ptr);
|
const active = c.virDomainIsActive(self.ptr);
|
||||||
return if (active == 0) false else true;
|
return if (active == 0) false else true;
|
||||||
}
|
}
|
||||||
|
pub fn isPersistent() void {}
|
||||||
|
pub fn isUpdated() void {}
|
||||||
|
pub fn listGetStats() void {}
|
||||||
|
pub fn lookupByID() void {}
|
||||||
|
pub fn lookupByUUID() void {}
|
||||||
|
pub fn lookupByUUIDString() void {}
|
||||||
|
|
||||||
|
pub fn managedSave() void {}
|
||||||
|
pub fn managedSaveDefineXML() void {}
|
||||||
|
pub fn managedSaveGetXMLDesc() void {}
|
||||||
|
pub fn managedSaveRemove() void {}
|
||||||
|
pub fn memoryPeek() void {}
|
||||||
|
pub fn memoryStats() void {}
|
||||||
|
|
||||||
|
// TODO virDomainMigrate*
|
||||||
|
|
||||||
|
pub fn openChannel() void {}
|
||||||
|
pub fn openConsole() void {}
|
||||||
|
pub fn openGraphics() void {}
|
||||||
|
pub fn openGraphicsFD() void {}
|
||||||
|
pub fn pmSuspendForDuration() void {}
|
||||||
|
pub fn pmWakeup() void {}
|
||||||
|
pub fn pinEmulator() void {}
|
||||||
|
pub fn pinIOThread() void {}
|
||||||
|
pub fn pinVcpu() void {}
|
||||||
|
pub fn pinVcpuFlags() void {}
|
||||||
|
|
||||||
|
pub fn reboot() void {}
|
||||||
|
pub fn ref() void {}
|
||||||
|
pub fn rename() void {}
|
||||||
|
pub fn reset() void {}
|
||||||
|
pub fn restore() void {}
|
||||||
|
pub fn restoreFlags() void {}
|
||||||
|
pub fn restoreParams() void {}
|
||||||
|
pub fn @"resume"() void {}
|
||||||
|
pub fn save() void {}
|
||||||
|
pub fn saveFlags() void {}
|
||||||
|
pub fn saveImageDefineXML() void {}
|
||||||
|
pub fn saveImageGetXMLDesc() void {}
|
||||||
|
pub fn saveParams() void {}
|
||||||
|
pub fn screenshot() void {}
|
||||||
|
pub fn sendKey() void {}
|
||||||
|
pub fn sendProcessSignal() void {}
|
||||||
|
|
||||||
|
pub fn setAutostart() void {}
|
||||||
|
pub fn setBlkioParameters() void {}
|
||||||
|
pub fn setBlockIoTune() void {}
|
||||||
|
pub fn setBlockThreshold() void {}
|
||||||
|
pub fn setGuestVcpus() void {}
|
||||||
|
pub fn setIOThreadParams() void {}
|
||||||
|
pub fn setInterfaceParameters() void {}
|
||||||
|
pub fn setLaunchSecurityState() void {}
|
||||||
|
pub fn setLifecycleAction() void {}
|
||||||
|
pub fn setMaxMemory() void {}
|
||||||
|
pub fn setMemory() void {}
|
||||||
|
pub fn setMemoryFlags() void {}
|
||||||
|
pub fn setMemoryParameters() void {}
|
||||||
|
pub fn setMemoryStatsPeriod() void {}
|
||||||
|
pub fn setMetadata() void {}
|
||||||
|
pub fn setNumaParameters() void {}
|
||||||
|
pub fn setPerfEvents() void {}
|
||||||
|
pub fn setSchedulerParameters() void {}
|
||||||
|
pub fn setSchedulerParametersFlags() void {}
|
||||||
|
pub fn setTime() void {}
|
||||||
|
pub fn setUserPassword() void {}
|
||||||
|
pub fn setVcpu() void {}
|
||||||
|
pub fn setVcpus() void {}
|
||||||
|
pub fn setVpusFlags() void {}
|
||||||
|
|
||||||
|
pub fn shutdown() void {}
|
||||||
|
pub fn @"suspend"() void {}
|
||||||
|
pub fn undefine() void {}
|
||||||
|
pub fn undefineFlags() void {}
|
||||||
|
pub fn updateDeviceFlags() void {}
|
||||||
|
|
||||||
pub const ListFlags = enum(c_uint) {
|
pub const ListFlags = enum(c_uint) {
|
||||||
Active = c.VIR_CONNECT_LIST_DOMAINS_ACTIVE,
|
Active = c.VIR_CONNECT_LIST_DOMAINS_ACTIVE,
|
||||||
|
@ -667,4 +902,86 @@ pub const Domain = struct {
|
||||||
// TODO rest
|
// TODO rest
|
||||||
|
|
||||||
pub const DomainIterator = Iterator(Domain, c.virDomainPtr, c.virDomainFree);
|
pub const DomainIterator = Iterator(Domain, c.virDomainPtr, c.virDomainFree);
|
||||||
|
|
||||||
|
pub const Snapshot = struct {
|
||||||
|
ptr: c.virDomainSnapshotPtr,
|
||||||
|
arena: *heap.ArenaAllocator,
|
||||||
|
|
||||||
|
pub fn init(ptr: c.virDomainSnapshotPtr, allocator: mem.Allocator) Snapshot {
|
||||||
|
var arena = heap.ArenaAllocator.init(allocator);
|
||||||
|
return .{
|
||||||
|
.ptr = ptr,
|
||||||
|
.arena = &arena,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
pub fn deinit(self: *const Snapshot) void {
|
||||||
|
self.arena.deinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn hasCurrentSnapshot() void {}
|
||||||
|
pub fn listAllSnapshots() void {}
|
||||||
|
pub fn revertToSnapshot() void {}
|
||||||
|
pub fn createXML() void {}
|
||||||
|
pub fn current() void {}
|
||||||
|
|
||||||
|
pub fn delete() void {}
|
||||||
|
pub fn free() void {}
|
||||||
|
pub fn getConnect() void {}
|
||||||
|
pub fn getDomain() void {}
|
||||||
|
pub fn getName() void {}
|
||||||
|
pub fn getParent() void {}
|
||||||
|
pub fn getXMLDesc() void {}
|
||||||
|
pub fn hasMetadata() void {}
|
||||||
|
pub fn isCurrent() void {}
|
||||||
|
|
||||||
|
pub fn listAllChildren() void {}
|
||||||
|
pub fn listChildrenNames() void {}
|
||||||
|
pub fn listNames() void {}
|
||||||
|
|
||||||
|
pub fn lookupByName() void {}
|
||||||
|
pub fn num() void {}
|
||||||
|
pub fn numChildren() void {}
|
||||||
|
pub fn ref() void {}
|
||||||
|
|
||||||
|
pub const ListFlags = enum(c_uint) {
|
||||||
|
Descendants = c.VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS,
|
||||||
|
Roots = c.VIR_DOMAIN_SNAPSHOT_LIST_ROOTS,
|
||||||
|
Metadata = c.VIR_DOMAIN_SNAPSHOT_LIST_METADATA,
|
||||||
|
Leaves = c.VIR_DOMAIN_SNAPSHOT_LIST_LEAVES,
|
||||||
|
NoLeaves = c.VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES,
|
||||||
|
NoMetadata = c.VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA,
|
||||||
|
Inactive = c.VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE,
|
||||||
|
Active = c.VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE,
|
||||||
|
DiskOnly = c.VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY,
|
||||||
|
Internal = c.VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL,
|
||||||
|
External = c.VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL,
|
||||||
|
Topological = c.VIR_DOMAIN_SNAPSHOT_LIST_TOPOLOGICAL,
|
||||||
|
};
|
||||||
|
pub const CreateFlags = enum(c_uint) {
|
||||||
|
Redefine = c.VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE,
|
||||||
|
Current = c.VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT,
|
||||||
|
NoMetadata = c.VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA,
|
||||||
|
Halt = c.VIR_DOMAIN_SNAPSHOT_CREATE_HALT,
|
||||||
|
DiskOnly = c.VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY,
|
||||||
|
ReuseExt = c.VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT,
|
||||||
|
Quiesce = c.VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE,
|
||||||
|
Atomic = c.VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC,
|
||||||
|
Live = c.VIR_DOMAIN_SNAPSHOT_CREATE_LIVE,
|
||||||
|
Validate = c.VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE,
|
||||||
|
};
|
||||||
|
pub const DeleteFlags = enum(c_uint) {
|
||||||
|
Children = c.VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN,
|
||||||
|
MetadataOnly = c.VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY,
|
||||||
|
ChildrenOnly = c.VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY,
|
||||||
|
};
|
||||||
|
pub const RevertFlags = enum(c_uint) {
|
||||||
|
Running = c.VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING,
|
||||||
|
Paused = c.VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED,
|
||||||
|
Force = c.VIR_DOMAIN_SNAPSHOT_REVERT_FORCE,
|
||||||
|
ResetNvram = c.VIR_DOMAIN_SNAPSHOT_REVERT_RESET_NVRAM,
|
||||||
|
};
|
||||||
|
pub const XMLFlags = enum(c_uint) {
|
||||||
|
Secure = c.VIR_DOMAIN_XML_SECURE,
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue