Code Monkey home page Code Monkey logo

libvirt-php's Introduction

libvirt-php

About this forked repository

Seems like the official libvirt-php isn't being maintenanced by anyone, contributions sent to libvirt-list was ignored, so this repository appeared.

Additional functions

resource libvirt_domain_snapshot_create_xml(resource $domain, string $xml, int $flags = 0)
bool libvirt_domain_undefine_flags(resource $domain, int $flags = 0)
bool libvirt_domain_reset(resource $domain, int $flags = 0)

int libvirt_get_last_error_code()
int libvirt_get_last_error_domain()

array libvirt_network_get_dhcp_leases(string $mac = null, int $flags = 0)
array libvirt_domain_get_cpu_total_stats()

Additional constants

enum virDomainUndefineFlagsValues {
    VIR_DOMAIN_UNDEFINE_MANAGED_SAVE	=	1 (0x1; 1 << 0)	
    Also remove any managed save
    
    VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA	=	2 (0x2; 1 << 1)	
    If last use of domain, then also remove any snapshot metadata
    
    VIR_DOMAIN_UNDEFINE_NVRAM	=	4 (0x4; 1 << 2)	
    Also remove any nvram file
    
    VIR_DOMAIN_UNDEFINE_KEEP_NVRAM	=	8 (0x8; 1 << 3)	
    Keep nvram file Future undefine control flags should come here.
}

enum virStorageVolDeleteFlags {
    VIR_STORAGE_VOL_DELETE_NORMAL	=	0 (0x0)	
    Delete metadata only (fast)
    VIR_STORAGE_VOL_DELETE_ZEROED	=	1 (0x1; 1 << 0)	
    Clear all data to zeros (slow)
    VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS	=	2 (0x2; 1 << 1)	
    Force removal of volume, even if in use
}

Origin README content

Bugfix libvirt-php required for KnightSwarm/Squire

Fixes:

  1. Fix libvirt_domain_update_device not being properly defined. 8bb78b3cfb

  2. Fix libvirt_storagepool_get_xml_desc requiring OPTIONAL second parameter for xPath. f89fb516ad

libvirt-php's People

Contributors

zippy2 avatar mignov avatar maners avatar berrange avatar yzslab avatar remicollet avatar tucksaun avatar andreabolognani avatar vtolstov avatar kkoukiou avatar pipo avatar austinkregel avatar dev-zero avatar inode64 avatar eskultety avatar slowbro avatar veillard avatar conan-kudo avatar cmp167 avatar cfergeau avatar eschultz avatar janotomko avatar nertpinx avatar pavel-odintsov avatar phillipbenner avatar shaunr avatar i-pear avatar warpkwd avatar

Watchers

James Cloos avatar

libvirt-php's Issues

Getting screenshots

I couldn't find too much about it, but I put together this little route to convert the output from the libvirt api directly since the libvirt_domain_get_screenshot function wasn't working for me

Route::get('kvm', function () {
    $vmName = 'ubuntu22.04';

    $libvirt = libvirt_connect('qemu:///system', false);
    $domain = libvirt_domain_lookup_by_name($libvirt, $vmName);
    $data = libvirt_domain_get_screenshot_api($domain, 0);
    $filePath = $data['file'];

    $img = new \Imagick($filePath);
    $img->readImage($filePath);
    $img->setImageFormat('jpeg');
    $img->setImageCompressionQuality(90);
    $img->writeImageFile(fopen($filePath.'.jpg', 'w'));

    try {
        return response(file_get_contents($filePath . '.jpg'), 200, [
            'Content-Type' => 'image/jpeg',
        ]);
    } finally {
        unlink($filePath);
        unlink($filePath.'.jpg');
    }
});

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.