/usr/lib/python3/dist-packages/libvirt.py is in python3-libvirt 4.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 | #
# WARNING WARNING WARNING WARNING
#
# This file is automatically written by generator.py. Any changes
# made here will be lost.
#
# To change the manually written methods edit libvirt-override.py
# To change the automatically written methods edit generator.py
#
# WARNING WARNING WARNING WARNING
#
#
# Manually written part of python bindings for libvirt
#
# On cygwin, the DLL is called cygvirtmod.dll
import sys
try:
import libvirtmod
except ImportError:
lib_e = sys.exc_info()[1]
try:
import cygvirtmod as libvirtmod
except ImportError:
cyg_e = sys.exc_info()[1]
if str(cyg_e).count("No module named"):
raise lib_e
import types
# The root of all libvirt errors.
class libvirtError(Exception):
def __init__(self, defmsg, conn=None, dom=None, net=None, pool=None, vol=None):
# Never call virConnGetLastError().
# virGetLastError() is now thread local
err = libvirtmod.virGetLastError()
if err is None:
msg = defmsg
else:
msg = err[2]
Exception.__init__(self, msg)
self.err = err
def get_error_code(self):
if self.err is None:
return None
return self.err[0]
def get_error_domain(self):
if self.err is None:
return None
return self.err[1]
def get_error_message(self):
if self.err is None:
return None
return self.err[2]
def get_error_level(self):
if self.err is None:
return None
return self.err[3]
def get_str1(self):
if self.err is None:
return None
return self.err[4]
def get_str2(self):
if self.err is None:
return None
return self.err[5]
def get_str3(self):
if self.err is None:
return None
return self.err[6]
def get_int1(self):
if self.err is None:
return None
return self.err[7]
def get_int2(self):
if self.err is None:
return None
return self.err[8]
#
# register the libvirt global error handler
#
def registerErrorHandler(f, ctx):
"""Register a Python function for error reporting.
The function is called back as f(ctx, error), with error
being a list of information about the error being raised.
Returns 1 in case of success."""
return libvirtmod.virRegisterErrorHandler(f,ctx)
def openAuth(uri, auth, flags=0):
ret = libvirtmod.virConnectOpenAuth(uri, auth, flags)
if ret is None:raise libvirtError('virConnectOpenAuth() failed')
return virConnect(_obj=ret)
#
# Return library version.
#
def getVersion (name = None):
"""If no name parameter is passed (or name is None) then the
version of the libvirt library is returned as an integer.
If a name is passed and it refers to a driver linked to the
libvirt library, then this returns a tuple of (library version,
driver version).
If the name passed refers to a non-existent driver, then you
will get the exception 'no support for hypervisor'.
Versions numbers are integers: 1000000*major + 1000*minor + release."""
if name is None:
ret = libvirtmod.virGetVersion ()
else:
ret = libvirtmod.virGetVersion (name)
if ret is None: raise libvirtError ("virGetVersion() failed")
return ret
#
# Invoke an EventHandle callback
#
def _eventInvokeHandleCallback(watch, fd, event, opaque, opaquecompat=None):
"""
Invoke the Event Impl Handle Callback in C
"""
# libvirt 0.9.2 and earlier required custom event loops to know
# that opaque=(cb, original_opaque) and pass the values individually
# to this wrapper. This should handle the back compat case, and make
# future invocations match the virEventHandleCallback prototype
if opaquecompat:
callback = opaque
opaque = opaquecompat
else:
callback = opaque[0]
opaque = opaque[1]
libvirtmod.virEventInvokeHandleCallback(watch, fd, event, callback, opaque)
#
# Invoke an EventTimeout callback
#
def _eventInvokeTimeoutCallback(timer, opaque, opaquecompat=None):
"""
Invoke the Event Impl Timeout Callback in C
"""
# libvirt 0.9.2 and earlier required custom event loops to know
# that opaque=(cb, original_opaque) and pass the values individually
# to this wrapper. This should handle the back compat case, and make
# future invocations match the virEventTimeoutCallback prototype
if opaquecompat:
callback = opaque
opaque = opaquecompat
else:
callback = opaque[0]
opaque = opaque[1]
libvirtmod.virEventInvokeTimeoutCallback(timer, callback, opaque)
def _dispatchEventHandleCallback(watch, fd, events, cbData):
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(watch, fd, events, opaque)
return 0
def _dispatchEventTimeoutCallback(timer, cbData):
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(timer, opaque)
return 0
def virEventAddHandle(fd, events, cb, opaque):
"""
register a callback for monitoring file handle events
@fd: file handle to monitor for events
@events: bitset of events to watch from virEventHandleType constants
@cb: callback to invoke when an event occurs
@opaque: user data to pass to callback
Example callback prototype is:
def cb(watch, # int id of the handle
fd, # int file descriptor the event occurred on
events, # int bitmap of events that have occurred
opaque): # opaque data passed to eventAddHandle
"""
cbData = {"cb" : cb, "opaque" : opaque}
ret = libvirtmod.virEventAddHandle(fd, events, cbData)
if ret == -1: raise libvirtError ('virEventAddHandle() failed')
return ret
def virEventAddTimeout(timeout, cb, opaque):
"""
register a callback for a timer event
@timeout: time between events in milliseconds
@cb: callback to invoke when an event occurs
@opaque: user data to pass to callback
Setting timeout to -1 will disable the timer. Setting the timeout
to zero will cause it to fire on every event loop iteration.
Example callback prototype is:
def cb(timer, # int id of the timer
opaque): # opaque data passed to eventAddTimeout
"""
cbData = {"cb" : cb, "opaque" : opaque}
ret = libvirtmod.virEventAddTimeout(timeout, cbData)
if ret == -1: raise libvirtError ('virEventAddTimeout() failed')
return ret
#
# a caller for the ff callbacks for custom event loop implementations
#
def virEventInvokeFreeCallback(opaque):
"""
Execute callback which frees the opaque buffer
@opaque: the opaque object passed to addHandle or addTimeout
WARNING: This function should not be called from any call by libvirt's
core. It will most probably cause deadlock in C-level libvirt code.
Instead it should be scheduled and called from implementation's stack.
See https://libvirt.org/html/libvirt-libvirt-event.html#virEventAddHandleFunc
for more information.
This function is not dependent on any event loop implementation.
"""
libvirtmod.virEventInvokeFreeCallback(opaque[2], opaque[1])
#
# WARNING WARNING WARNING WARNING
#
# Automatically written part of python bindings for libvirt
#
# WARNING WARNING WARNING WARNING
#
# Functions from module libvirt-host
#
def open(name=None):
"""This function should be called first to get a connection to the
Hypervisor and xen store
If @name is None, if the LIBVIRT_DEFAULT_URI environment variable is set,
then it will be used. Otherwise if the client configuration file
has the "uri_default" parameter set, then it will be used. Finally
probing will be done to determine a suitable default driver to activate.
This involves trying each hypervisor in turn until one successfully opens.
If connecting to an unprivileged hypervisor driver which requires
the libvirtd daemon to be active, it will automatically be launched
if not already running. This can be prevented by setting the
environment variable LIBVIRT_AUTOSTART=0
URIs are documented at http://libvirt.org/uri.html
virConnectClose should be used to release the resources after the connection
is no longer needed. """
ret = libvirtmod.virConnectOpen(name)
if ret is None:raise libvirtError('virConnectOpen() failed')
return virConnect(_obj=ret)
def openReadOnly(name=None):
"""This function should be called first to get a restricted connection to the
library functionalities. The set of APIs usable are then restricted
on the available methods to control the domains.
See virConnectOpen for notes about environment variables which can
have an effect on opening drivers and freeing the connection resources
URIs are documented at http://libvirt.org/uri.html """
ret = libvirtmod.virConnectOpenReadOnly(name)
if ret is None:raise libvirtError('virConnectOpenReadOnly() failed')
return virConnect(_obj=ret)
#
# Functions from module libvirt-event
#
def virEventRegisterDefaultImpl():
"""Registers a default event implementation based on the
poll() system call. This is a generic implementation
that can be used by any client application which does
not have a need to integrate with an external event
loop impl.
For proper event handling, it is important that the event implementation
is registered before a connection to the Hypervisor is opened.
Once registered, the application has to invoke virEventRunDefaultImpl() in
a loop to process events. Failure to do so may result in connections being
closed unexpectedly as a result of keepalive timeout. The default
event loop fully supports handle and timeout events, but only
wakes up on events registered by libvirt API calls such as
virEventAddHandle() or virConnectDomainEventRegisterAny(). """
ret = libvirtmod.virEventRegisterDefaultImpl()
if ret == -1: raise libvirtError ('virEventRegisterDefaultImpl() failed')
return ret
def virEventRegisterImpl(addHandle, updateHandle, removeHandle, addTimeout, updateTimeout, removeTimeout):
"""Registers an event implementation, to allow integration
with an external event loop. Applications would use this
to integrate with the libglib2 event loop, or libevent
or the QT event loop.
For proper event handling, it is important that the event implementation
is registered before a connection to the Hypervisor is opened.
Use of the virEventAddHandle() and similar APIs require that the
corresponding handler is registered. Use of the
virConnectDomainEventRegisterAny() and similar APIs requires that
the three timeout handlers are registered. Likewise, the three
timeout handlers must be registered if the remote server has been
configured to send keepalive messages, or if the client intends
to call virConnectSetKeepAlive(), to avoid either side from
unexpectedly closing the connection due to inactivity.
If an application does not need to integrate with an
existing event loop implementation, then the
virEventRegisterDefaultImpl() method can be used to setup
the generic libvirt implementation. """
libvirtmod.virEventRegisterImpl(addHandle, updateHandle, removeHandle, addTimeout, updateTimeout, removeTimeout)
def virEventRemoveHandle(watch):
"""Unregister a callback from a file handle. This function
requires that an event loop has previously been registered with
virEventRegisterImpl() or virEventRegisterDefaultImpl(). """
ret = libvirtmod.virEventRemoveHandle(watch)
if ret == -1: raise libvirtError ('virEventRemoveHandle() failed')
return ret
def virEventRemoveTimeout(timer):
"""Unregister a callback for a timer. This function
requires that an event loop has previously been registered with
virEventRegisterImpl() or virEventRegisterDefaultImpl(). """
ret = libvirtmod.virEventRemoveTimeout(timer)
if ret == -1: raise libvirtError ('virEventRemoveTimeout() failed')
return ret
def virEventRunDefaultImpl():
"""Run one iteration of the event loop. Applications
will generally want to have a thread which invokes
this method in an infinite loop. Furthermore, it is wise
to set up a pipe-to-self handler (via virEventAddHandle())
or a timeout (via virEventAddTimeout()) before calling this
function, as it will block forever if there are no
registered events.
static bool quit;
while (!quit) {
if (virEventRunDefaultImpl() < 0)
...print error...
} """
ret = libvirtmod.virEventRunDefaultImpl()
if ret == -1: raise libvirtError ('virEventRunDefaultImpl() failed')
return ret
def virEventUpdateHandle(watch, events):
"""Change event set for a monitored file handle. This function
requires that an event loop has previously been registered with
virEventRegisterImpl() or virEventRegisterDefaultImpl().
Will not fail if fd exists. """
libvirtmod.virEventUpdateHandle(watch, events)
def virEventUpdateTimeout(timer, timeout):
"""Change frequency for a timer. This function
requires that an event loop has previously been registered with
virEventRegisterImpl() or virEventRegisterDefaultImpl().
Setting frequency to -1 will disable the timer. Setting the frequency
to zero will cause it to fire on every event loop iteration.
Will not fail if timer exists. """
libvirtmod.virEventUpdateTimeout(timer, timeout)
#
# Functions from module virterror
#
def virGetLastError():
"""Provide a pointer to the last error caught at the library level
The error object is kept in thread local storage, so separate
threads can safely access this concurrently. """
ret = libvirtmod.virGetLastError()
return ret
def virGetLastErrorMessage():
"""Get the most recent error message """
ret = libvirtmod.virGetLastErrorMessage()
if ret is None: raise libvirtError ('virGetLastErrorMessage() failed')
return ret
#
# Functions from module libvirt-host
#
def virInitialize():
"""Initialize the library.
This method is invoked automatically by any of the virConnectOpen() API
calls, and by virGetVersion(). Since release 1.0.0, there is no need to
call this method even in a multithreaded application, since
initialization is performed in a thread safe manner; but applications
using an older version of the library should manually call this before
setting up competing threads that attempt virConnectOpen in parallel.
The only other time it would be necessary to call virInitialize is if the
application did not invoke virConnectOpen as its first API call, such
as when calling virEventRegisterImpl() before setting up connections,
or when using virSetErrorFunc() to alter error reporting of the first
connection attempt. """
ret = libvirtmod.virInitialize()
if ret == -1: raise libvirtError ('virInitialize() failed')
return ret
#
# Functions from module virterror
#
def virResetLastError():
"""Reset the last error caught at the library level.
The error object is kept in thread local storage, so separate
threads can safely access this concurrently, only resetting
their own error object. """
libvirtmod.virResetLastError()
class virDomain(object):
def __init__(self, conn, _obj=None):
self._conn = conn
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def __del__(self):
if self._o is not None:
libvirtmod.virDomainFree(self._o)
self._o = None
def connect(self):
return self._conn
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virDomain_pointer(self._o)
#
# virDomain functions from module libvirt-domain
#
def ID(self):
"""Get the hypervisor ID number for the domain """
ret = libvirtmod.virDomainGetID(self._o)
return ret
def OSType(self):
"""Get the type of domain operation system. """
ret = libvirtmod.virDomainGetOSType(self._o)
if ret is None: raise libvirtError ('virDomainGetOSType() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def UUID(self):
"""Extract the UUID unique Identifier of a domain. """
ret = libvirtmod.virDomainGetUUID(self._o)
if ret is None: raise libvirtError ('virDomainGetUUID() failed', dom=self)
return ret
def UUIDString(self):
"""Fetch globally unique ID of the domain as a string. """
ret = libvirtmod.virDomainGetUUIDString(self._o)
if ret is None: raise libvirtError ('virDomainGetUUIDString() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def XMLDesc(self, flags=0):
"""Provide an XML description of the domain. The description may be reused
later to relaunch the domain with virDomainCreateXML().
No security-sensitive data will be included unless @flags contains
VIR_DOMAIN_XML_SECURE; this flag is rejected on read-only
connections. If @flags includes VIR_DOMAIN_XML_INACTIVE, then the
XML represents the configuration that will be used on the next boot
of a persistent domain; otherwise, the configuration represents the
currently running domain. If @flags contains
VIR_DOMAIN_XML_UPDATE_CPU, then the portion of the domain XML
describing CPU capabilities is modified to match actual
capabilities of the host. """
ret = libvirtmod.virDomainGetXMLDesc(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetXMLDesc() failed', dom=self)
return ret
def abortJob(self):
"""Requests that the current background job be aborted at the
soonest opportunity. In case the job is a migration in a post-copy mode,
virDomainAbortJob will report an error (see virDomainMigrateStartPostCopy
for more details). """
ret = libvirtmod.virDomainAbortJob(self._o)
if ret == -1: raise libvirtError ('virDomainAbortJob() failed', dom=self)
return ret
def addIOThread(self, iothread_id, flags=0):
"""Dynamically add an IOThread to the domain. It is left up to the
underlying virtual hypervisor to determine the valid range for an
@iothread_id and determining whether the @iothread_id already exists.
Note that this call can fail if the underlying virtualization hypervisor
does not support it or if growing the number is arbitrarily limited.
This function requires privileged access to the hypervisor.
@flags may include VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG.
Both flags may be set.
If VIR_DOMAIN_AFFECT_LIVE is set, the change affects a running domain
and may fail if domain is not alive.
If VIR_DOMAIN_AFFECT_CONFIG is set, the change affects persistent state,
and will fail for transient domains. If neither flag is specified (that is,
@flags is VIR_DOMAIN_AFFECT_CURRENT), then an inactive domain modifies
persistent setup, while an active domain is hypervisor-dependent on whether
just live or both live and persistent state is changed. """
ret = libvirtmod.virDomainAddIOThread(self._o, iothread_id, flags)
if ret == -1: raise libvirtError ('virDomainAddIOThread() failed', dom=self)
return ret
def attachDevice(self, xml):
"""Create a virtual device attachment to backend. This function,
having hotplug semantics, is only allowed on an active domain.
For compatibility, this method can also be used to change the media
in an existing CDROM/Floppy device, however, applications are
recommended to use the virDomainUpdateDeviceFlag method instead.
Be aware that hotplug changes might not persist across a domain going
into S4 state (also known as hibernation) unless you also modify the
persistent domain definition. """
ret = libvirtmod.virDomainAttachDevice(self._o, xml)
if ret == -1: raise libvirtError ('virDomainAttachDevice() failed', dom=self)
return ret
def attachDeviceFlags(self, xml, flags=0):
"""Attach a virtual device to a domain, using the flags parameter
to control how the device is attached. VIR_DOMAIN_AFFECT_CURRENT
specifies that the device allocation is made based on current domain
state. VIR_DOMAIN_AFFECT_LIVE specifies that the device shall be
allocated to the active domain instance only and is not added to the
persisted domain configuration. VIR_DOMAIN_AFFECT_CONFIG
specifies that the device shall be allocated to the persisted domain
configuration only. Note that the target hypervisor must return an
error if unable to satisfy flags. E.g. the hypervisor driver will
return failure if LIVE is specified but it only supports modifying the
persisted device allocation.
For compatibility, this method can also be used to change the media
in an existing CDROM/Floppy device, however, applications are
recommended to use the virDomainUpdateDeviceFlag method instead.
Be aware that hotplug changes might not persist across a domain going
into S4 state (also known as hibernation) unless you also modify the
persistent domain definition. """
ret = libvirtmod.virDomainAttachDeviceFlags(self._o, xml, flags)
if ret == -1: raise libvirtError ('virDomainAttachDeviceFlags() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def autostart(self):
"""Extract the autostart flag for a domain """
ret = libvirtmod.virDomainGetAutostart(self._o)
if ret == -1: raise libvirtError ('virDomainGetAutostart() failed', dom=self)
return ret
def blkioParameters(self, flags=0):
"""Get the blkio parameters """
ret = libvirtmod.virDomainGetBlkioParameters(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetBlkioParameters() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def blockCommit(self, disk, base, top, bandwidth=0, flags=0):
"""Commit changes that were made to temporary top-level files within a disk
image backing file chain into a lower-level base file. In other words,
take all the difference between @base and @top, and update @base to contain
that difference; after the commit, any portion of the chain that previously
depended on @top will now depend on @base, and all files after @base up
to and including @top will now be invalidated. A typical use of this
command is to reduce the length of a backing file chain after taking an
external disk snapshot. To move data in the opposite direction, see
virDomainBlockPull().
This command starts a long-running commit block job, whose status may
be tracked by virDomainBlockJobInfo() with a job type of
VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT, and the operation can be aborted with
virDomainBlockJobAbort(). When finished, an asynchronous event is
raised to indicate the final status, and the job no longer exists. If
the job is aborted, it is up to the hypervisor whether starting a new
job will resume from the same point, or start over.
As a special case, if @top is the active image (or None), and @flags
includes VIR_DOMAIN_BLOCK_COMMIT_ACTIVE, the block job will have a type
of VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT, and operates in two phases.
In the first phase, the contents are being committed into @base, and the
job can only be canceled. The job transitions to the second phase when
the job info states cur == end, and remains alive to keep all further
changes to @top synchronized into @base; an event with status
VIR_DOMAIN_BLOCK_JOB_READY is also issued to mark the job transition.
Once in the second phase, the user must choose whether to cancel the job
(keeping @top as the active image, but now containing only the changes
since the time the job ended) or to pivot the job (adjusting to @base as
the active image, and invalidating @top).
Be aware that this command may invalidate files even if it is aborted;
the user is cautioned against relying on the contents of invalidated
intermediate files such as @top (when @top is not the active image)
without manually rebasing those files to use a backing file of a
read-only copy of @base prior to the point where the commit operation
was started (and such a rebase cannot be safely done until the commit
has successfully completed). However, the domain itself will not have
any issues; the active layer remains valid throughout the entire commit
operation.
Some hypervisors may support a shortcut where if @flags contains
VIR_DOMAIN_BLOCK_COMMIT_DELETE, then this command will unlink all files
that were invalidated, after the commit successfully completes.
If @flags contains VIR_DOMAIN_BLOCK_COMMIT_RELATIVE, the name recorded
into the overlay of the @top image (if there is such image) as the
path to the new backing file will be kept relative to other images.
The operation will fail if libvirt can't infer the name.
By default, if @base is None, the commit target will be the bottom of
the backing chain; if @flags contains VIR_DOMAIN_BLOCK_COMMIT_SHALLOW,
then the immediate backing file of @top will be used instead. If @top
is None, the active image at the top of the chain will be used. Some
hypervisors place restrictions on how much can be committed, and might
fail if @base is not the immediate backing file of @top, or if @top is
the active layer in use by a running domain but @flags did not include
VIR_DOMAIN_BLOCK_COMMIT_ACTIVE, or if @top is not the top-most file;
restrictions may differ for online vs. offline domains.
The @disk parameter is either an unambiguous source name of the
block device (the <source file='...'/> sub-element, such as
"/path/to/image"), or the device target shorthand (the
<target dev='...'/> sub-element, such as "vda"). Valid names
can be found by calling virDomainGetXMLDesc() and inspecting
elements within //domain/devices/disk.
The @base and @top parameters can be either paths to files within the
backing chain, or the device target shorthand (the <target dev='...'/>
sub-element, such as "vda") followed by an index to the backing chain
enclosed in square brackets. Backing chain indexes can be found by
inspecting //disk//backingStore/@index in the domain XML. Thus, for
example, "vda[3]" refers to the backing store with index equal to "3"
in the chain of disk "vda".
The maximum bandwidth that will be used to do the commit can be
specified with the @bandwidth parameter. If set to 0, there is no
limit. If @flags includes VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES,
@bandwidth is in bytes/second; otherwise, it is in MiB/second.
Values larger than 2^52 bytes/sec may be rejected due to overflow
considerations based on the word size of both client and server,
and values larger than 2^31 bytes/sec may cause overflow problems
if later queried by virDomainGetBlockJobInfo() without scaling.
Hypervisors may further restrict the range of valid bandwidth
values. Some hypervisors do not support this feature and will
return an error if bandwidth is not 0; in this case, it might still
be possible for a later call to virDomainBlockJobSetSpeed() to
succeed. The actual speed can be determined with
virDomainGetBlockJobInfo(). """
ret = libvirtmod.virDomainBlockCommit(self._o, disk, base, top, bandwidth, flags)
if ret == -1: raise libvirtError ('virDomainBlockCommit() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def blockCopy(self, disk, destxml, params=None, flags=0):
"""Copy the guest-visible contents of a disk image to a new file described by destxml """
ret = libvirtmod.virDomainBlockCopy(self._o, disk, destxml, params, flags)
if ret == -1: raise libvirtError ('virDomainBlockCopy() failed', dom=self)
return ret
def blockInfo(self, path, flags=0):
"""Extract information about a domain block device size """
ret = libvirtmod.virDomainGetBlockInfo(self._o, path, flags)
if ret is None: raise libvirtError ('virDomainGetBlockInfo() failed', dom=self)
return ret
def blockIoTune(self, disk, flags=0):
"""Get the I/O tunables for a block device """
ret = libvirtmod.virDomainGetBlockIoTune(self._o, disk, flags)
if ret is None: raise libvirtError ('virDomainGetBlockIoTune() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def blockJobAbort(self, disk, flags=0):
"""Cancel the active block job on the given disk.
The @disk parameter is either an unambiguous source name of the
block device (the <source file='...'/> sub-element, such as
"/path/to/image"), or (since 0.9.5) the device target shorthand
(the <target dev='...'/> sub-element, such as "vda"). Valid names
can be found by calling virDomainGetXMLDesc() and inspecting
elements within //domain/devices/disk.
If the current block job for @disk is VIR_DOMAIN_BLOCK_JOB_TYPE_PULL, then
by default, this function performs a synchronous operation and the caller
may assume that the operation has completed when 0 is returned. However,
BlockJob operations may take a long time to cancel, and during this time
further domain interactions may be unresponsive. To avoid this problem,
pass VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC in the @flags argument to enable
asynchronous behavior, returning as soon as possible. When the job has
been canceled, a BlockJob event will be emitted, with status
VIR_DOMAIN_BLOCK_JOB_CANCELED (even if the ABORT_ASYNC flag was not
used); it is also possible to poll virDomainBlockJobInfo() to see if
the job cancellation is still pending. This type of job can be restarted
to pick up from where it left off.
If the current block job for @disk is VIR_DOMAIN_BLOCK_JOB_TYPE_COPY, then
the default is to abort the mirroring and revert to the source disk;
likewise, if the current job is VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT,
the default is to abort without changing the active layer of @disk.
Adding @flags of VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT causes this call to
fail with VIR_ERR_BLOCK_COPY_ACTIVE if the copy or commit is not yet
ready; otherwise it will swap the disk over to the new active image
to end the mirroring or active commit. An event will be issued when the
job is ended, and it is possible to use VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC
to control whether this command waits for the completion of the job.
Restarting a copy or active commit job requires starting over from the
beginning of the first phase. """
ret = libvirtmod.virDomainBlockJobAbort(self._o, disk, flags)
if ret == -1: raise libvirtError ('virDomainBlockJobAbort() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def blockJobInfo(self, path, flags=0):
"""Get progress information for a block job """
ret = libvirtmod.virDomainGetBlockJobInfo(self._o, path, flags)
if ret is None: raise libvirtError ('virDomainGetBlockJobInfo() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def blockJobSetSpeed(self, disk, bandwidth, flags=0):
"""Set the maximimum allowable bandwidth that a block job may consume. If
bandwidth is 0, the limit will revert to the hypervisor default of
unlimited.
If @flags contains VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES, @bandwidth
is in bytes/second; otherwise, it is in MiB/second. Values larger than
2^52 bytes/sec may be rejected due to overflow considerations based on
the word size of both client and server, and values larger than 2^31
bytes/sec may cause overflow problems if later queried by
virDomainGetBlockJobInfo() without scaling. Hypervisors may further
restrict the range of valid bandwidth values.
The @disk parameter is either an unambiguous source name of the
block device (the <source file='...'/> sub-element, such as
"/path/to/image"), or (since 0.9.5) the device target shorthand
(the <target dev='...'/> sub-element, such as "vda"). Valid names
can be found by calling virDomainGetXMLDesc() and inspecting
elements within //domain/devices/disk. """
ret = libvirtmod.virDomainBlockJobSetSpeed(self._o, disk, bandwidth, flags)
if ret == -1: raise libvirtError ('virDomainBlockJobSetSpeed() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def blockPeek(self, disk, offset, size, flags=0):
"""Read the contents of domain's disk device """
ret = libvirtmod.virDomainBlockPeek(self._o, disk, offset, size, flags)
if ret is None: raise libvirtError ('virDomainBlockPeek() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def blockPull(self, disk, bandwidth=0, flags=0):
"""Populate a disk image with data from its backing image. Once all data from
its backing image has been pulled, the disk no longer depends on a backing
image. This function pulls data for the entire device in the background.
Progress of the operation can be checked with virDomainGetBlockJobInfo() and
the operation can be aborted with virDomainBlockJobAbort(). When finished,
an asynchronous event is raised to indicate the final status. To move
data in the opposite direction, see virDomainBlockCommit().
The @disk parameter is either an unambiguous source name of the
block device (the <source file='...'/> sub-element, such as
"/path/to/image"), or (since 0.9.5) the device target shorthand
(the <target dev='...'/> sub-element, such as "vda"). Valid names
can be found by calling virDomainGetXMLDesc() and inspecting
elements within //domain/devices/disk.
The maximum bandwidth that will be used to do the copy can be
specified with the @bandwidth parameter. If set to 0, there is no
limit. If @flags includes VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES,
@bandwidth is in bytes/second; otherwise, it is in MiB/second.
Values larger than 2^52 bytes/sec may be rejected due to overflow
considerations based on the word size of both client and server,
and values larger than 2^31 bytes/sec may cause overflow problems
if later queried by virDomainGetBlockJobInfo() without scaling.
Hypervisors may further restrict the range of valid bandwidth
values. Some hypervisors do not support this feature and will
return an error if bandwidth is not 0; in this case, it might still
be possible for a later call to virDomainBlockJobSetSpeed() to
succeed. The actual speed can be determined with
virDomainGetBlockJobInfo().
This is shorthand for virDomainBlockRebase() with a None base. """
ret = libvirtmod.virDomainBlockPull(self._o, disk, bandwidth, flags)
if ret == -1: raise libvirtError ('virDomainBlockPull() failed', dom=self)
return ret
def blockRebase(self, disk, base, bandwidth=0, flags=0):
"""Populate a disk image with data from its backing image chain, and
setting the backing image to @base, or alternatively copy an entire
backing chain to a new file @base.
When @flags is 0, this starts a pull, where @base must be the absolute
path of one of the backing images further up the chain, or None to
convert the disk image so that it has no backing image. Once all
data from its backing image chain has been pulled, the disk no
longer depends on those intermediate backing images. This function
pulls data for the entire device in the background. Progress of
the operation can be checked with virDomainGetBlockJobInfo() with a
job type of VIR_DOMAIN_BLOCK_JOB_TYPE_PULL, and the operation can be
aborted with virDomainBlockJobAbort(). When finished, an asynchronous
event is raised to indicate the final status, and the job no longer
exists. If the job is aborted, a new one can be started later to
resume from the same point.
If @flags contains VIR_DOMAIN_BLOCK_REBASE_RELATIVE, the name recorded
into the active disk as the location for @base will be kept relative.
The operation will fail if libvirt can't infer the name.
When @flags includes VIR_DOMAIN_BLOCK_REBASE_COPY, this starts a copy,
where @base must be the name of a new file to copy the chain to. By
default, the copy will pull the entire source chain into the destination
file, but if @flags also contains VIR_DOMAIN_BLOCK_REBASE_SHALLOW, then
only the top of the source chain will be copied (the source and
destination have a common backing file). By default, @base will be
created with the same file format as the source, but this can be altered
by adding VIR_DOMAIN_BLOCK_REBASE_COPY_RAW to force the copy to be raw
(does not make sense with the shallow flag unless the source is also raw),
or by using VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT to reuse an existing file
which was pre-created with the correct format and metadata and sufficient
size to hold the copy. In case the VIR_DOMAIN_BLOCK_REBASE_SHALLOW flag
is used the pre-created file has to exhibit the same guest visible contents
as the backing file of the original image. This allows a management app to
pre-create files with relative backing file names, rather than the default
of absolute backing file names; as a security precaution, you should
generally only use reuse_ext with the shallow flag and a non-raw
destination file. By default, the copy destination will be treated as
type='file', but using VIR_DOMAIN_BLOCK_REBASE_COPY_DEV treats the
destination as type='block' (affecting how virDomainGetBlockInfo() will
report allocation after pivoting).
A copy job has two parts; in the first phase, the @bandwidth parameter
affects how fast the source is pulled into the destination, and the job
can only be canceled by reverting to the source file; progress in this
phase can be tracked via the virDomainBlockJobInfo() command, with a
job type of VIR_DOMAIN_BLOCK_JOB_TYPE_COPY. The job transitions to the
second phase when the job info states cur == end, and remains alive to
mirror all further changes to both source and destination. The user
must call virDomainBlockJobAbort() to end the mirroring while choosing
whether to revert to source or pivot to the destination. An event is
issued when the job ends, and depending on the hypervisor, an event may
also be issued when the job transitions from pulling to mirroring. If
the job is aborted, a new job will have to start over from the beginning
of the first phase.
Some hypervisors will restrict certain actions, such as virDomainSave()
or virDomainDetachDevice(), while a copy job is active; they may
also restrict a copy job to transient domains.
The @disk parameter is either an unambiguous source name of the
block device (the <source file='...'/> sub-element, such as
"/path/to/image"), or the device target shorthand (the
<target dev='...'/> sub-element, such as "vda"). Valid names
can be found by calling virDomainGetXMLDesc() and inspecting
elements within //domain/devices/disk.
The @base parameter can be either a path to a file within the backing
chain, or the device target shorthand (the <target dev='...'/>
sub-element, such as "vda") followed by an index to the backing chain
enclosed in square brackets. Backing chain indexes can be found by
inspecting //disk//backingStore/@index in the domain XML. Thus, for
example, "vda[3]" refers to the backing store with index equal to "3"
in the chain of disk "vda".
The maximum bandwidth that will be used to do the copy can be
specified with the @bandwidth parameter. If set to 0, there is no
limit. If @flags includes VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES,
@bandwidth is in bytes/second; otherwise, it is in MiB/second.
Values larger than 2^52 bytes/sec may be rejected due to overflow
considerations based on the word size of both client and server,
and values larger than 2^31 bytes/sec may cause overflow problems
if later queried by virDomainGetBlockJobInfo() without scaling.
Hypervisors may further restrict the range of valid bandwidth
values. Some hypervisors do not support this feature and will
return an error if bandwidth is not 0; in this case, it might still
be possible for a later call to virDomainBlockJobSetSpeed() to
succeed. The actual speed can be determined with
virDomainGetBlockJobInfo().
When @base is None and @flags is 0, this is identical to
virDomainBlockPull(). When @flags contains VIR_DOMAIN_BLOCK_REBASE_COPY,
this command is shorthand for virDomainBlockCopy() where the destination
XML encodes @base as a <disk type='file'>, @bandwidth is properly scaled
and passed as a typed parameter, the shallow and reuse external flags
are preserved, and remaining flags control whether the XML encodes a
destination format of raw instead of leaving the destination identical
to the source format or probed from the reused file. """
ret = libvirtmod.virDomainBlockRebase(self._o, disk, base, bandwidth, flags)
if ret == -1: raise libvirtError ('virDomainBlockRebase() failed', dom=self)
return ret
def blockResize(self, disk, size, flags=0):
"""Resize a block device of domain while the domain is running. If
@flags is 0, then @size is in kibibytes (blocks of 1024 bytes);
since 0.9.11, if @flags includes VIR_DOMAIN_BLOCK_RESIZE_BYTES,
@size is in bytes instead. @size is taken directly as the new
size. Depending on the file format, the hypervisor may round up
to the next alignment boundary.
The @disk parameter is either an unambiguous source name of the
block device (the <source file='...'/> sub-element, such as
"/path/to/image"), or (since 0.9.5) the device target shorthand
(the <target dev='...'/> sub-element, such as "vda"). Valid names
can be found by calling virDomainGetXMLDesc() and inspecting
elements within //domain/devices/disk.
Note that this call may fail if the underlying virtualization hypervisor
does not support it; this call requires privileged access to the
hypervisor. """
ret = libvirtmod.virDomainBlockResize(self._o, disk, size, flags)
if ret == -1: raise libvirtError ('virDomainBlockResize() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def blockStats(self, path):
"""Extracts block device statistics for a domain """
ret = libvirtmod.virDomainBlockStats(self._o, path)
if ret is None: raise libvirtError ('virDomainBlockStats() failed', dom=self)
return ret
def blockStatsFlags(self, path, flags=0):
"""Extracts block device statistics parameters of a running domain """
ret = libvirtmod.virDomainBlockStatsFlags(self._o, path, flags)
if ret is None: raise libvirtError ('virDomainBlockStatsFlags() failed', dom=self)
return ret
def controlInfo(self, flags=0):
"""Extract details about current state of control interface to a domain. """
ret = libvirtmod.virDomainGetControlInfo(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetControlInfo() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def coreDump(self, to, flags=0):
"""This method will dump the core of a domain on a given file for analysis.
Note that for remote Xen Daemon the file path will be interpreted in
the remote host. Hypervisors may require the user to manually ensure
proper permissions on the file named by @to.
If @flags includes VIR_DUMP_CRASH, then leave the guest shut off with
a crashed state after the dump completes. If @flags includes
VIR_DUMP_LIVE, then make the core dump while continuing to allow
the guest to run; otherwise, the guest is suspended during the dump.
VIR_DUMP_RESET flag forces reset of the guest after dump.
The above three flags are mutually exclusive.
Additionally, if @flags includes VIR_DUMP_BYPASS_CACHE, then libvirt
will attempt to bypass the file system cache while creating the file,
or fail if it cannot do so for the given system; this can allow less
pressure on file system cache, but also risks slowing saves to NFS.
For more control over the output format, see virDomainCoreDumpWithFormat(). """
ret = libvirtmod.virDomainCoreDump(self._o, to, flags)
if ret == -1: raise libvirtError ('virDomainCoreDump() failed', dom=self)
return ret
def coreDumpWithFormat(self, to, dumpformat, flags=0):
"""This method will dump the core of a domain on a given file for analysis.
Note that for remote Xen Daemon the file path will be interpreted in
the remote host. Hypervisors may require the user to manually ensure
proper permissions on the file named by @to.
@dumpformat controls which format the dump will have; use of
VIR_DOMAIN_CORE_DUMP_FORMAT_RAW mirrors what virDomainCoreDump() will
perform. Not all hypervisors are able to support all formats.
If @flags includes VIR_DUMP_CRASH, then leave the guest shut off with
a crashed state after the dump completes. If @flags includes
VIR_DUMP_LIVE, then make the core dump while continuing to allow
the guest to run; otherwise, the guest is suspended during the dump.
VIR_DUMP_RESET flag forces reset of the guest after dump.
The above three flags are mutually exclusive.
Additionally, if @flags includes VIR_DUMP_BYPASS_CACHE, then libvirt
will attempt to bypass the file system cache while creating the file,
or fail if it cannot do so for the given system; this can allow less
pressure on file system cache, but also risks slowing saves to NFS. """
ret = libvirtmod.virDomainCoreDumpWithFormat(self._o, to, dumpformat, flags)
if ret == -1: raise libvirtError ('virDomainCoreDumpWithFormat() failed', dom=self)
return ret
def create(self):
"""Launch a defined domain. If the call succeeds the domain moves from the
defined to the running domains pools. The domain will be paused only
if restoring from managed state created from a paused domain. For more
control, see virDomainCreateWithFlags(). """
ret = libvirtmod.virDomainCreate(self._o)
if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
return ret
def createWithFlags(self, flags=0):
"""Launch a defined domain. If the call succeeds the domain moves from the
defined to the running domains pools.
If the VIR_DOMAIN_START_PAUSED flag is set, or if the guest domain
has a managed save image that requested paused state (see
virDomainManagedSave()) the guest domain will be started, but its
CPUs will remain paused. The CPUs can later be manually started
using virDomainResume(). In all other cases, the guest domain will
be running.
If the VIR_DOMAIN_START_AUTODESTROY flag is set, the guest
domain will be automatically destroyed when the virConnectPtr
object is finally released. This will also happen if the
client application crashes / loses its connection to the
libvirtd daemon. Any domains marked for auto destroy will
block attempts at migration, save-to-file, or snapshots.
If the VIR_DOMAIN_START_BYPASS_CACHE flag is set, and there is a
managed save file for this domain (created by virDomainManagedSave()),
then libvirt will attempt to bypass the file system cache while restoring
the file, or fail if it cannot do so for the given system; this can allow
less pressure on file system cache, but also risks slowing loads from NFS.
If the VIR_DOMAIN_START_FORCE_BOOT flag is set, then any managed save
file for this domain is discarded, and the domain boots from scratch. """
ret = libvirtmod.virDomainCreateWithFlags(self._o, flags)
if ret == -1: raise libvirtError ('virDomainCreateWithFlags() failed', dom=self)
return ret
def delIOThread(self, iothread_id, flags=0):
"""Dynamically delete an IOThread from the domain. The @iothread_id to be
deleted must not have a resource associated with it and can be any of
the currently valid IOThread ID's.
Note that this call can fail if the underlying virtualization hypervisor
does not support it or if reducing the number is arbitrarily limited.
This function requires privileged access to the hypervisor.
@flags may include VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG.
Both flags may be set.
If VIR_DOMAIN_AFFECT_LIVE is set, the change affects a running domain
and may fail if domain is not alive.
If VIR_DOMAIN_AFFECT_CONFIG is set, the change affects persistent state,
and will fail for transient domains. If neither flag is specified (that is,
@flags is VIR_DOMAIN_AFFECT_CURRENT), then an inactive domain modifies
persistent setup, while an active domain is hypervisor-dependent on whether
just live or both live and persistent state is changed. """
ret = libvirtmod.virDomainDelIOThread(self._o, iothread_id, flags)
if ret == -1: raise libvirtError ('virDomainDelIOThread() failed', dom=self)
return ret
def destroy(self):
"""Destroy the domain object. The running instance is shutdown if not down
already and all resources used by it are given back to the hypervisor. This
does not free the associated virDomainPtr object.
This function may require privileged access.
virDomainDestroy first requests that a guest terminate
(e.g. SIGTERM), then waits for it to comply. After a reasonable
timeout, if the guest still exists, virDomainDestroy will
forcefully terminate the guest (e.g. SIGKILL) if necessary (which
may produce undesirable results, for example unflushed disk cache
in the guest). To avoid this possibility, it's recommended to
instead call virDomainDestroyFlags, sending the
VIR_DOMAIN_DESTROY_GRACEFUL flag.
If the domain is transient and has any snapshot metadata (see
virDomainSnapshotNum()), then that metadata will automatically
be deleted when the domain quits. """
ret = libvirtmod.virDomainDestroy(self._o)
if ret == -1: raise libvirtError ('virDomainDestroy() failed', dom=self)
return ret
def destroyFlags(self, flags=0):
"""Destroy the domain object. The running instance is shutdown if not down
already and all resources used by it are given back to the hypervisor.
This does not free the associated virDomainPtr object.
This function may require privileged access.
Calling this function with no @flags set (equal to zero) is
equivalent to calling virDomainDestroy, and after a reasonable
timeout will forcefully terminate the guest (e.g. SIGKILL) if
necessary (which may produce undesirable results, for example
unflushed disk cache in the guest). Including
VIR_DOMAIN_DESTROY_GRACEFUL in the flags will prevent the forceful
termination of the guest, and virDomainDestroyFlags will instead
return an error if the guest doesn't terminate by the end of the
timeout; at that time, the management application can decide if
calling again without VIR_DOMAIN_DESTROY_GRACEFUL is appropriate.
Another alternative which may produce cleaner results for the
guest's disks is to use virDomainShutdown() instead, but that
depends on guest support (some hypervisor/guest combinations may
ignore the shutdown request). """
ret = libvirtmod.virDomainDestroyFlags(self._o, flags)
if ret == -1: raise libvirtError ('virDomainDestroyFlags() failed', dom=self)
return ret
def detachDevice(self, xml):
"""This is an equivalent of virDomainDetachDeviceFlags() when called with
@flags parameter set to VIR_DOMAIN_AFFECT_LIVE.
See virDomainDetachDeviceFlags() for more details. """
ret = libvirtmod.virDomainDetachDevice(self._o, xml)
if ret == -1: raise libvirtError ('virDomainDetachDevice() failed', dom=self)
return ret
def detachDeviceFlags(self, xml, flags=0):
"""Detach a virtual device from a domain, using the flags parameter
to control how the device is detached. VIR_DOMAIN_AFFECT_CURRENT
specifies that the device allocation is removed based on current domain
state. VIR_DOMAIN_AFFECT_LIVE specifies that the device shall be
deallocated from the active domain instance only and is not from the
persisted domain configuration. VIR_DOMAIN_AFFECT_CONFIG
specifies that the device shall be deallocated from the persisted domain
configuration only. Note that the target hypervisor must return an
error if unable to satisfy flags. E.g. the hypervisor driver will
return failure if LIVE is specified but it only supports removing the
persisted device allocation.
Some hypervisors may prevent this operation if there is a current
block copy operation on the device being detached; in that case,
use virDomainBlockJobAbort() to stop the block copy first.
Beware that depending on the hypervisor and device type, detaching a device
from a running domain may be asynchronous. That is, calling
virDomainDetachDeviceFlags may just request device removal while the device
is actually removed later (in cooperation with a guest OS). Previously,
this fact was ignored and the device could have been removed from domain
configuration before it was actually removed by the hypervisor causing
various failures on subsequent operations. To check whether the device was
successfully removed, either recheck domain configuration using
virDomainGetXMLDesc() or add a handler for the VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED
event. In case the device is already gone when virDomainDetachDeviceFlags
returns, the event is delivered before this API call ends. To help existing
clients work better in most cases, this API will try to transform an
asynchronous device removal that finishes shortly after the request into
a synchronous removal. In other words, this API may wait a bit for the
removal to complete in case it was not synchronous.
Be aware that hotplug changes might not persist across a domain going
into S4 state (also known as hibernation) unless you also modify the
persistent domain definition.
The supplied XML description of the device should be as specific
as its definition in the domain XML. The set of attributes used
to match the device are internal to the drivers. Using a partial definition,
or attempting to detach a device that is not present in the domain XML,
but shares some specific attributes with one that is present,
may lead to unexpected results. """
ret = libvirtmod.virDomainDetachDeviceFlags(self._o, xml, flags)
if ret == -1: raise libvirtError ('virDomainDetachDeviceFlags() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def diskErrors(self, flags=0):
"""Extract errors on disk devices. """
ret = libvirtmod.virDomainGetDiskErrors(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetDiskErrors() failed', dom=self)
return ret
def emulatorPinInfo(self, flags=0):
"""Query the CPU affinity setting of the emulator process of domain """
ret = libvirtmod.virDomainGetEmulatorPinInfo(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetEmulatorPinInfo() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def fSTrim(self, mountPoint, minimum, flags=0):
"""Calls FITRIM within the guest (hence guest agent may be
required depending on hypervisor used). Either call it on each
mounted filesystem (@mountPoint is None) or just on specified
@mountPoint. @minimum hints that free ranges smaller than this
may be ignored (this is a hint and the guest may not respect
it). By increasing this value, the fstrim operation will
complete more quickly for filesystems with badly fragmented
free space, although not all blocks will be discarded.
If @minimum is not zero, the command may fail. """
ret = libvirtmod.virDomainFSTrim(self._o, mountPoint, minimum, flags)
if ret == -1: raise libvirtError ('virDomainFSTrim() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def fsInfo(self, flags=0):
"""Get a list of mapping information for each mounted file systems within the specified guest and the disks. """
ret = libvirtmod.virDomainGetFSInfo(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetFSInfo() failed', dom=self)
return ret
def getCPUStats(self, total, flags=0):
"""Extracts CPU statistics for a running domain. On success it will
return a list of data of dictionary type. If boolean total is False or 0, the
first element of the list refers to CPU0 on the host, second element is
CPU1, and so on. The format of data struct is as follows:
[{cpu_time:xxx}, {cpu_time:xxx}, ...]
If it is True or 1, it returns total domain CPU statistics in the format of
[{cpu_time:xxx, user_time:xxx, system_time:xxx}] """
ret = libvirtmod.virDomainGetCPUStats(self._o, total, flags)
if ret is None: raise libvirtError ('virDomainGetCPUStats() failed', dom=self)
return ret
def guestVcpus(self, flags=0):
"""returns a dictionary containing information regarding guest vcpus """
ret = libvirtmod.virDomainGetGuestVcpus(self._o, flags)
if ret == -1: raise libvirtError ('virDomainGetGuestVcpus() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain-snapshot
#
def hasCurrentSnapshot(self, flags=0):
"""Determine if the domain has a current snapshot. """
ret = libvirtmod.virDomainHasCurrentSnapshot(self._o, flags)
if ret == -1: raise libvirtError ('virDomainHasCurrentSnapshot() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def hasManagedSaveImage(self, flags=0):
"""Check if a domain has a managed save image as created by
virDomainManagedSave(). Note that any running domain should not have
such an image, as it should have been removed on restart. """
ret = libvirtmod.virDomainHasManagedSaveImage(self._o, flags)
if ret == -1: raise libvirtError ('virDomainHasManagedSaveImage() failed', dom=self)
return ret
def hostname(self, flags=0):
"""Get the hostname for that domain.
Dependent on hypervisor used, this may require a guest agent to be
available. """
ret = libvirtmod.virDomainGetHostname(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetHostname() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def info(self):
"""Extract information about a domain. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted. """
ret = libvirtmod.virDomainGetInfo(self._o)
if ret is None: raise libvirtError ('virDomainGetInfo() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def injectNMI(self, flags=0):
"""Send NMI to the guest """
ret = libvirtmod.virDomainInjectNMI(self._o, flags)
if ret == -1: raise libvirtError ('virDomainInjectNMI() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def interfaceAddresses(self, source, flags=0):
"""returns a dictionary of domain interfaces along with their MAC and IP addresses """
ret = libvirtmod.virDomainInterfaceAddresses(self._o, source, flags)
if ret is None: raise libvirtError ('virDomainInterfaceAddresses() failed', dom=self)
return ret
def interfaceParameters(self, device, flags=0):
"""Get the bandwidth tunables for a interface device """
ret = libvirtmod.virDomainGetInterfaceParameters(self._o, device, flags)
if ret is None: raise libvirtError ('virDomainGetInterfaceParameters() failed', dom=self)
return ret
def interfaceStats(self, path):
"""Extracts interface device statistics for a domain """
ret = libvirtmod.virDomainInterfaceStats(self._o, path)
if ret is None: raise libvirtError ('virDomainInterfaceStats() failed', dom=self)
return ret
def ioThreadInfo(self, flags=0):
"""Query the CPU affinity setting of the IOThreads of the domain """
ret = libvirtmod.virDomainGetIOThreadInfo(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetIOThreadInfo() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def isActive(self):
"""Determine if the domain is currently running """
ret = libvirtmod.virDomainIsActive(self._o)
if ret == -1: raise libvirtError ('virDomainIsActive() failed', dom=self)
return ret
def isPersistent(self):
"""Determine if the domain has a persistent configuration
which means it will still exist after shutting down """
ret = libvirtmod.virDomainIsPersistent(self._o)
if ret == -1: raise libvirtError ('virDomainIsPersistent() failed', dom=self)
return ret
def isUpdated(self):
"""Determine if the domain has been updated. """
ret = libvirtmod.virDomainIsUpdated(self._o)
if ret == -1: raise libvirtError ('virDomainIsUpdated() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def jobInfo(self):
"""Extract information about an active job being processed for a domain. """
ret = libvirtmod.virDomainGetJobInfo(self._o)
if ret is None: raise libvirtError ('virDomainGetJobInfo() failed', dom=self)
return ret
def jobStats(self, flags=0):
"""Extract information about an active job being processed for a domain. """
ret = libvirtmod.virDomainGetJobStats(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetJobStats() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def managedSave(self, flags=0):
"""This method will suspend a domain and save its memory contents to
a file on disk. After the call, if successful, the domain is not
listed as running anymore.
The difference from virDomainSave() is that libvirt is keeping track of
the saved state itself, and will reuse it once the domain is being
restarted (automatically or via an explicit libvirt call).
As a result any running domain is sure to not have a managed saved image.
This also implies that managed save only works on persistent domains,
since the domain must still exist in order to use virDomainCreate() to
restart it.
If @flags includes VIR_DOMAIN_SAVE_BYPASS_CACHE, then libvirt will
attempt to bypass the file system cache while creating the file, or
fail if it cannot do so for the given system; this can allow less
pressure on file system cache, but also risks slowing saves to NFS.
Normally, the managed saved state will remember whether the domain
was running or paused, and start will resume to the same state.
Specifying VIR_DOMAIN_SAVE_RUNNING or VIR_DOMAIN_SAVE_PAUSED in
@flags will override the default saved into the file. These two
flags are mutually exclusive. """
ret = libvirtmod.virDomainManagedSave(self._o, flags)
if ret == -1: raise libvirtError ('virDomainManagedSave() failed', dom=self)
return ret
def managedSaveRemove(self, flags=0):
"""Remove any managed save image for this domain. """
ret = libvirtmod.virDomainManagedSaveRemove(self._o, flags)
if ret == -1: raise libvirtError ('virDomainManagedSaveRemove() failed', dom=self)
return ret
def maxMemory(self):
"""Retrieve the maximum amount of physical memory allocated to a
domain. If domain is None, then this get the amount of memory reserved
to Domain0 i.e. the domain where the application runs. """
ret = libvirtmod.virDomainGetMaxMemory(self._o)
if ret == 0: raise libvirtError ('virDomainGetMaxMemory() failed', dom=self)
return ret
def maxVcpus(self):
"""Provides the maximum number of virtual CPUs supported for
the guest VM. If the guest is inactive, this is basically
the same as virConnectGetMaxVcpus(). If the guest is running
this will reflect the maximum number of virtual CPUs the
guest was booted with. For more details, see virDomainGetVcpusFlags(). """
ret = libvirtmod.virDomainGetMaxVcpus(self._o)
if ret == -1: raise libvirtError ('virDomainGetMaxVcpus() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def memoryParameters(self, flags=0):
"""Get the memory parameters """
ret = libvirtmod.virDomainGetMemoryParameters(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetMemoryParameters() failed', dom=self)
return ret
def memoryPeek(self, start, size, flags=0):
"""Read the contents of domain's memory """
ret = libvirtmod.virDomainMemoryPeek(self._o, start, size, flags)
if ret is None: raise libvirtError ('virDomainMemoryPeek() failed', dom=self)
return ret
def memoryStats(self):
"""Extracts memory statistics for a domain """
ret = libvirtmod.virDomainMemoryStats(self._o)
if ret is None: raise libvirtError ('virDomainMemoryStats() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def metadata(self, type, uri, flags=0):
"""Retrieves the appropriate domain element given by @type.
If VIR_DOMAIN_METADATA_ELEMENT is requested parameter @uri
must be set to the name of the namespace the requested elements
belong to, otherwise must be None.
If an element of the domain XML is not present, the resulting
error will be VIR_ERR_NO_DOMAIN_METADATA. This method forms
a shortcut for seeing information from virDomainSetMetadata()
without having to go through virDomainGetXMLDesc().
@flags controls whether the live domain or persistent
configuration will be queried. """
ret = libvirtmod.virDomainGetMetadata(self._o, type, uri, flags)
if ret is None: raise libvirtError ('virDomainGetMetadata() failed', dom=self)
return ret
def migrate(self, dconn, flags=0, dname=None, uri=None, bandwidth=0):
"""Migrate the domain object from its current host to the destination
host given by dconn (a connection to the destination host).
This function is similar to virDomainMigrate3, but it only supports a fixed
set of parameters: @dname corresponds to VIR_MIGRATE_PARAM_DEST_NAME, @uri
is VIR_MIGRATE_PARAM_URI, and @bandwidth is VIR_MIGRATE_PARAM_BANDWIDTH.
virDomainFree should be used to free the resources after the
returned domain object is no longer needed. """
if dconn is None: dconn__o = None
else: dconn__o = dconn._o
ret = libvirtmod.virDomainMigrate(self._o, dconn__o, flags, dname, uri, bandwidth)
if ret is None:raise libvirtError('virDomainMigrate() failed', dom=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
def migrate2(self, dconn, dxml=None, flags=0, dname=None, uri=None, bandwidth=0):
"""Migrate the domain object from its current host to the destination
host given by dconn (a connection to the destination host).
This function is similar to virDomainMigrate3, but it only supports a fixed
set of parameters: @dxml corresponds to VIR_MIGRATE_PARAM_DEST_XML, @dname
is VIR_MIGRATE_PARAM_DEST_NAME, @uri is VIR_MIGRATE_PARAM_URI, and
@bandwidth is VIR_MIGRATE_PARAM_BANDWIDTH.
virDomainFree should be used to free the resources after the
returned domain object is no longer needed. """
if dconn is None: dconn__o = None
else: dconn__o = dconn._o
ret = libvirtmod.virDomainMigrate2(self._o, dconn__o, dxml, flags, dname, uri, bandwidth)
if ret is None:raise libvirtError('virDomainMigrate2() failed', dom=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
#
# virDomain functions from module python
#
def migrate3(self, dconn, params, flags=0):
"""Migrate the domain object from its current host to the destination host
given by dconn (a connection to the destination host). """
if dconn is None: dconn__o = None
else: dconn__o = dconn._o
ret = libvirtmod.virDomainMigrate3(self._o, dconn__o, params, flags)
if ret is None:raise libvirtError('virDomainMigrate3() failed', dom=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
def migrateGetCompressionCache(self, flags=0):
"""Get current size of the cache (in bytes) used for compressing
repeatedly transferred memory pages during live migration. """
ret = libvirtmod.virDomainMigrateGetCompressionCache(self._o, flags)
return ret
def migrateGetMaxSpeed(self, flags=0):
"""Get currently configured maximum migration speed for a domain """
ret = libvirtmod.virDomainMigrateGetMaxSpeed(self._o, flags)
if ret == -1: raise libvirtError ('virDomainMigrateGetMaxSpeed() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def migrateSetCompressionCache(self, cacheSize, flags=0):
"""Sets size of the cache (in bytes) used for compressing repeatedly
transferred memory pages during live migration. It's supposed to be called
while the domain is being live-migrated as a reaction to migration progress
and increasing number of compression cache misses obtained from
virDomainGetJobStats. """
ret = libvirtmod.virDomainMigrateSetCompressionCache(self._o, cacheSize, flags)
if ret == -1: raise libvirtError ('virDomainMigrateSetCompressionCache() failed', dom=self)
return ret
def migrateSetMaxDowntime(self, downtime, flags=0):
"""Sets maximum tolerable time for which the domain is allowed to be paused
at the end of live migration. It's supposed to be called while the domain is
being live-migrated as a reaction to migration progress. """
ret = libvirtmod.virDomainMigrateSetMaxDowntime(self._o, downtime, flags)
if ret == -1: raise libvirtError ('virDomainMigrateSetMaxDowntime() failed', dom=self)
return ret
def migrateSetMaxSpeed(self, bandwidth, flags=0):
"""The maximum bandwidth (in MiB/s) that will be used to do migration
can be specified with the bandwidth parameter. Not all hypervisors
will support a bandwidth cap """
ret = libvirtmod.virDomainMigrateSetMaxSpeed(self._o, bandwidth, flags)
if ret == -1: raise libvirtError ('virDomainMigrateSetMaxSpeed() failed', dom=self)
return ret
def migrateStartPostCopy(self, flags=0):
"""Starts post-copy migration. This function has to be called while
migration (initiated with VIR_MIGRATE_POSTCOPY flag) is in progress.
Traditional pre-copy migration iteratively walks through guest memory
pages and migrates those that changed since the previous iteration. The
iterative phase stops when the number of dirty pages is low enough so that
the virtual CPUs can be paused, all dirty pages transferred to the
destination, where the virtual CPUs are unpaused, and all this can happen
within a predefined downtime period. It's clear that this process may never
converge if downtime is too short and/or the guest keeps changing a lot of
memory pages.
When migration is switched to post-copy mode, the virtual CPUs are paused
immediately, only a minimum set of pages is transferred, and the CPUs are
unpaused on destination. The source keeps sending all remaining memory pages
to the destination while the guest is already running there. Whenever the
guest tries to read a memory page which has not been migrated yet, the
hypervisor has to tell the source to transfer that page in a priority
channel. To minimize such page faults, it is a good idea to run at least one
iteration of pre-copy migration before switching to post-copy.
Post-copy migration is guaranteed to converge since each page is transferred
at most once no matter how fast it changes. On the other hand once the
guest is running on the destination host, the migration can no longer be
rolled back because none of the hosts has complete state. If this happens,
libvirt will leave the domain paused on both hosts with
VIR_DOMAIN_PAUSED_POSTCOPY_FAILED reason. It's up to the upper layer to
decide what to do in such case. Because of this, libvirt will refuse to
cancel post-copy migration via virDomainAbortJob.
The following domain life cycle events are emitted during post-copy
migration:
VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY (on the source) -- migration entered
post-copy mode.
VIR_DOMAIN_EVENT_RESUMED_POSTCOPY (on the destination) -- the guest is
running on the destination host while some of its memory pages still
remain on the source host; neither the source nor the destination host
contain a complete guest state from this point until migration
finishes.
VIR_DOMAIN_EVENT_RESUMED_MIGRATED (on the destination),
VIR_DOMAIN_EVENT_STOPPED_MIGRATED (on the source) -- migration finished
successfully and the destination host holds a complete guest state.
VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED (on the destination) -- emitted
when migration fails in post-copy mode and it's unclear whether any
of the hosts has a complete guest state.
The progress of a post-copy migration can be monitored normally using
virDomainGetJobStats on the source host. Fetching statistics of a completed
post-copy migration can also be done on the source host (by calling
virDomainGetJobStats or listening to VIR_DOMAIN_EVENT_ID_JOB_COMPLETED
event, but (in contrast to pre-copy migration) the statistics are not
available on the destination host. Thus, VIR_DOMAIN_EVENT_ID_JOB_COMPLETED
event is the only way of getting statistics of a completed post-copy
migration of a transient domain (because the domain is removed after
migration and there's no domain to run virDomainGetJobStats on). """
ret = libvirtmod.virDomainMigrateStartPostCopy(self._o, flags)
if ret == -1: raise libvirtError ('virDomainMigrateStartPostCopy() failed', dom=self)
return ret
def migrateToURI(self, duri, flags=0, dname=None, bandwidth=0):
"""Migrate the domain object from its current host to the destination
host given by duri.
This function is similar to virDomainMigrateToURI3, but it only supports a
fixed set of parameters: @dname corresponds to VIR_MIGRATE_PARAM_DEST_NAME,
and @bandwidth corresponds to VIR_MIGRATE_PARAM_BANDWIDTH.
The operation of this API hinges on the VIR_MIGRATE_PEER2PEER flag.
If the VIR_MIGRATE_PEER2PEER flag IS set, the @duri parameter must be a
valid libvirt connection URI, by which the source libvirt driver can connect
to the destination libvirt. In other words, @duri corresponds to @dconnuri
of virDomainMigrateToURI3.
If the VIR_MIGRATE_PEER2PEER flag is NOT set, the @duri parameter takes a
hypervisor specific URI used to initiate the migration. In this case @duri
corresponds to VIR_MIGRATE_PARAM_URI of virDomainMigrateToURI3. """
ret = libvirtmod.virDomainMigrateToURI(self._o, duri, flags, dname, bandwidth)
if ret == -1: raise libvirtError ('virDomainMigrateToURI() failed', dom=self)
return ret
def migrateToURI2(self, dconnuri=None, miguri=None, dxml=None, flags=0, dname=None, bandwidth=0):
"""Migrate the domain object from its current host to the destination
host given by @dconnuri.
This function is similar to virDomainMigrateToURI3, but it only supports a
fixed set of parameters: @miguri corresponds to VIR_MIGRATE_PARAM_URI, @dxml
is VIR_MIGRATE_PARAM_DEST_XML, @dname is VIR_MIGRATE_PARAM_DEST_NAME, and
@bandwidth corresponds to VIR_MIGRATE_PARAM_BANDWIDTH.
The operation of this API hinges on the VIR_MIGRATE_PEER2PEER flag.
If the VIR_MIGRATE_PEER2PEER flag IS set, the @dconnuri parameter must be a
valid libvirt connection URI, by which the source libvirt driver can connect
to the destination libvirt. In other words, @dconnuri has the same semantics
as in virDomainMigrateToURI3.
If the VIR_MIGRATE_PEER2PEER flag is NOT set, the @dconnuri must be None
and the @miguri parameter takes a hypervisor specific URI used to initiate
the migration. In this case @miguri corresponds to VIR_MIGRATE_PARAM_URI of
virDomainMigrateToURI3. """
ret = libvirtmod.virDomainMigrateToURI2(self._o, dconnuri, miguri, dxml, flags, dname, bandwidth)
if ret == -1: raise libvirtError ('virDomainMigrateToURI2() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def migrateToURI3(self, dconnuri, params, flags=0):
"""Migrate the domain object from its current host to the destination host
given by URI. """
ret = libvirtmod.virDomainMigrateToURI3(self._o, dconnuri, params, flags)
if ret == -1: raise libvirtError ('virDomainMigrateToURI3() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def name(self):
"""Get the public name for that domain """
ret = libvirtmod.virDomainGetName(self._o)
return ret
#
# virDomain functions from module python
#
def numaParameters(self, flags=0):
"""Get the NUMA parameters """
ret = libvirtmod.virDomainGetNumaParameters(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetNumaParameters() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def openChannel(self, name, st, flags=0):
"""This opens the host interface associated with a channel device on a
guest, if the host interface is supported. If @name is given, it
can match either the device alias (e.g. "channel0"), or the virtio
target name (e.g. "org.qemu.guest_agent.0"). If @name is omitted,
then the first channel is opened. The channel is associated with
the passed in @st stream, which should have been opened in
non-blocking mode for bi-directional I/O.
By default, when @flags is 0, the open will fail if libvirt detects
that the channel is already in use by another client; passing
VIR_DOMAIN_CHANNEL_FORCE will cause libvirt to forcefully remove the
other client prior to opening this channel. """
if st is None: st__o = None
else: st__o = st._o
ret = libvirtmod.virDomainOpenChannel(self._o, name, st__o, flags)
if ret == -1: raise libvirtError ('virDomainOpenChannel() failed', dom=self)
return ret
def openConsole(self, dev_name, st, flags=0):
"""This opens the backend associated with a console, serial or
parallel port device on a guest, if the backend is supported.
If the @dev_name is omitted, then the first console or serial
device is opened. The console is associated with the passed
in @st stream, which should have been opened in non-blocking
mode for bi-directional I/O.
By default, when @flags is 0, the open will fail if libvirt
detects that the console is already in use by another client;
passing VIR_DOMAIN_CONSOLE_FORCE will cause libvirt to forcefully
remove the other client prior to opening this console.
If flag VIR_DOMAIN_CONSOLE_SAFE the console is opened only in the
case where the hypervisor driver supports safe (mutually exclusive)
console handling.
Older servers did not support either flag, and also did not forbid
simultaneous clients on a console, with potentially confusing results.
When passing @flags of 0 in order to support a wider range of server
versions, it is up to the client to ensure mutual exclusion. """
if st is None: st__o = None
else: st__o = st._o
ret = libvirtmod.virDomainOpenConsole(self._o, dev_name, st__o, flags)
if ret == -1: raise libvirtError ('virDomainOpenConsole() failed', dom=self)
return ret
def openGraphics(self, idx, fd, flags=0):
"""This will attempt to connect the file descriptor @fd, to
the graphics backend of @dom. If @dom has multiple graphics
backends configured, then @idx will determine which one is
opened, starting from @idx 0.
To disable any authentication, pass the VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH
constant for @flags.
The caller should use an anonymous socketpair to open
@fd before invocation.
This method can only be used when connected to a local
libvirt hypervisor, over a UNIX domain socket. Attempts
to use this method over a TCP connection will always fail """
ret = libvirtmod.virDomainOpenGraphics(self._o, idx, fd, flags)
if ret == -1: raise libvirtError ('virDomainOpenGraphics() failed', dom=self)
return ret
def openGraphicsFD(self, idx, flags=0):
"""This will create a socket pair connected to the graphics backend of @dom.
One end of the socket will be returned on success, and the other end is
handed to the hypervisor.
If @dom has multiple graphics backends configured, then @idx will determine
which one is opened, starting from @idx 0.
To disable any authentication, pass the VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH
constant for @flags.
This method can only be used when connected to a local
libvirt hypervisor, over a UNIX domain socket. Attempts
to use this method over a TCP connection will always fail. """
ret = libvirtmod.virDomainOpenGraphicsFD(self._o, idx, flags)
if ret == -1: raise libvirtError ('virDomainOpenGraphicsFD() failed', dom=self)
return ret
def pMSuspendForDuration(self, target, duration, flags=0):
"""Attempt to have the guest enter the given @target power management
suspension level. If @duration is non-zero, also schedule the guest to
resume normal operation after that many seconds, if nothing else has
resumed it earlier. Some hypervisors require that @duration be 0, for
an indefinite suspension.
Dependent on hypervisor used, this may require a
guest agent to be available, e.g. QEMU.
Beware that at least for QEMU, the domain's process will be terminated
when VIR_NODE_SUSPEND_TARGET_DISK is used and a new process will be
launched when libvirt is asked to wake up the domain. As a result of
this, any runtime changes, such as device hotplug or memory settings,
are lost unless such changes were made with VIR_DOMAIN_AFFECT_CONFIG
flag. """
ret = libvirtmod.virDomainPMSuspendForDuration(self._o, target, duration, flags)
if ret == -1: raise libvirtError ('virDomainPMSuspendForDuration() failed', dom=self)
return ret
def pMWakeup(self, flags=0):
"""Inject a wakeup into the guest that previously used
virDomainPMSuspendForDuration, rather than waiting for the
previously requested duration (if any) to elapse. """
ret = libvirtmod.virDomainPMWakeup(self._o, flags)
if ret == -1: raise libvirtError ('virDomainPMWakeup() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def perfEvents(self, flags=0):
"""Get all perf events setting. """
ret = libvirtmod.virDomainGetPerfEvents(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetPerfEvents() failed', dom=self)
return ret
def pinEmulator(self, cpumap, flags=0):
"""Dynamically change the real CPUs which can be allocated to the emulator process of a domain.
This function requires privileged access to the hypervisor. """
ret = libvirtmod.virDomainPinEmulator(self._o, cpumap, flags)
if ret == -1: raise libvirtError ('virDomainPinEmulator() failed', dom=self)
return ret
def pinIOThread(self, iothread_val, cpumap, flags=0):
"""Dynamically change the real CPUs which can be allocated to an IOThread. This function requires privileged access to the hypervisor. """
ret = libvirtmod.virDomainPinIOThread(self._o, iothread_val, cpumap, flags)
if ret == -1: raise libvirtError ('virDomainPinIOThread() failed', dom=self)
return ret
def pinVcpu(self, vcpu, cpumap):
"""Dynamically change the real CPUs which can be allocated to a virtual CPU. This function requires privileged access to the hypervisor. """
ret = libvirtmod.virDomainPinVcpu(self._o, vcpu, cpumap)
if ret == -1: raise libvirtError ('virDomainPinVcpu() failed', dom=self)
return ret
def pinVcpuFlags(self, vcpu, cpumap, flags=0):
"""Dynamically change the real CPUs which can be allocated to a virtual CPU. This function requires privileged access to the hypervisor. """
ret = libvirtmod.virDomainPinVcpuFlags(self._o, vcpu, cpumap, flags)
if ret == -1: raise libvirtError ('virDomainPinVcpuFlags() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def reboot(self, flags=0):
"""Reboot a domain, the domain object is still usable thereafter, but
the domain OS is being stopped for a restart.
Note that the guest OS may ignore the request.
Additionally, the hypervisor may check and support the domain
'on_reboot' XML setting resulting in a domain that shuts down instead
of rebooting.
If @flags is set to zero, then the hypervisor will choose the
method of shutdown it considers best. To have greater control
pass one or more of the virDomainRebootFlagValues. The order
in which the hypervisor tries each shutdown method is undefined,
and a hypervisor is not required to support all methods.
To use guest agent (VIR_DOMAIN_REBOOT_GUEST_AGENT) the domain XML
must have <channel> configured.
Due to implementation limitations in some drivers (the qemu driver,
for instance) it is not advised to migrate or save a guest that is
rebooting as a result of this API. Migrating such a guest can lead
to a plain shutdown on the destination. """
ret = libvirtmod.virDomainReboot(self._o, flags)
if ret == -1: raise libvirtError ('virDomainReboot() failed', dom=self)
return ret
def rename(self, new_name, flags=0):
"""Rename a domain. New domain name is specified in the second
argument. Depending on each driver implementation it may be
required that domain is in a specific state.
There might be some attributes and/or elements in domain XML that if no
value provided at XML defining time, libvirt will derive their value from
the domain name. These are not updated by this API. Users are strongly
advised to change these after the rename was successful. """
ret = libvirtmod.virDomainRename(self._o, new_name, flags)
if ret == -1: raise libvirtError ('virDomainRename() failed', dom=self)
return ret
def reset(self, flags=0):
"""Reset a domain immediately without any guest OS shutdown.
Reset emulates the power reset button on a machine, where all
hardware sees the RST line set and reinitializes internal state.
Note that there is a risk of data loss caused by reset without any
guest OS shutdown. """
ret = libvirtmod.virDomainReset(self._o, flags)
if ret == -1: raise libvirtError ('virDomainReset() failed', dom=self)
return ret
def resume(self):
"""Resume a suspended domain, the process is restarted from the state where
it was frozen by calling virDomainSuspend().
This function may require privileged access
Moreover, resume may not be supported if domain is in some
special state like VIR_DOMAIN_PMSUSPENDED. """
ret = libvirtmod.virDomainResume(self._o)
if ret == -1: raise libvirtError ('virDomainResume() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def revertToSnapshot(self, snap, flags=0):
"""revert the domain to the given snapshot """
if snap is None: snap__o = None
else: snap__o = snap._o
ret = libvirtmod.virDomainRevertToSnapshot(self._o, snap__o, flags)
if ret == -1: raise libvirtError ('virDomainRevertToSnapshot() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def save(self, to):
"""This method will suspend a domain and save its memory contents to
a file on disk. After the call, if successful, the domain is not
listed as running anymore (this ends the life of a transient domain).
Use virDomainRestore() to restore a domain after saving.
See virDomainSaveFlags() for more control. Also, a save file can
be inspected or modified slightly with virDomainSaveImageGetXMLDesc()
and virDomainSaveImageDefineXML(). """
ret = libvirtmod.virDomainSave(self._o, to)
if ret == -1: raise libvirtError ('virDomainSave() failed', dom=self)
return ret
def saveFlags(self, to, dxml=None, flags=0):
"""This method will suspend a domain and save its memory contents to
a file on disk. After the call, if successful, the domain is not
listed as running anymore (this ends the life of a transient domain).
Use virDomainRestore() to restore a domain after saving.
If the hypervisor supports it, @dxml can be used to alter
host-specific portions of the domain XML that will be used when
restoring an image. For example, it is possible to alter the
backing filename that is associated with a disk device, in order to
prepare for file renaming done as part of backing up the disk
device while the domain is stopped.
If @flags includes VIR_DOMAIN_SAVE_BYPASS_CACHE, then libvirt will
attempt to bypass the file system cache while creating the file, or
fail if it cannot do so for the given system; this can allow less
pressure on file system cache, but also risks slowing saves to NFS.
Normally, the saved state file will remember whether the domain was
running or paused, and restore defaults to the same state.
Specifying VIR_DOMAIN_SAVE_RUNNING or VIR_DOMAIN_SAVE_PAUSED in
@flags will override what state gets saved into the file. These
two flags are mutually exclusive.
A save file can be inspected or modified slightly with
virDomainSaveImageGetXMLDesc() and virDomainSaveImageDefineXML().
Some hypervisors may prevent this operation if there is a current
block copy operation; in that case, use virDomainBlockJobAbort()
to stop the block copy first. """
ret = libvirtmod.virDomainSaveFlags(self._o, to, dxml, flags)
if ret == -1: raise libvirtError ('virDomainSaveFlags() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def schedulerParameters(self):
"""Get the scheduler parameters, the @params array will be filled with the values. """
ret = libvirtmod.virDomainGetSchedulerParameters(self._o)
if ret is None: raise libvirtError ('virDomainGetSchedulerParameters() failed', dom=self)
return ret
def schedulerParametersFlags(self, flags=0):
"""Get the scheduler parameters """
ret = libvirtmod.virDomainGetSchedulerParametersFlags(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetSchedulerParametersFlags() failed', dom=self)
return ret
def schedulerType(self):
"""Get the scheduler type. """
ret = libvirtmod.virDomainGetSchedulerType(self._o)
if ret is None: raise libvirtError ('virDomainGetSchedulerType() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def screenshot(self, stream, screen, flags=0):
"""Take a screenshot of current domain console as a stream. The image format
is hypervisor specific. Moreover, some hypervisors supports multiple
displays per domain. These can be distinguished by @screen argument.
This call sets up a stream; subsequent use of stream API is necessary
to transfer actual data, determine how much data is successfully
transferred, and detect any errors.
The screen ID is the sequential number of screen. In case of multiple
graphics cards, heads are enumerated before devices, e.g. having
two graphics cards, both with four heads, screen ID 5 addresses
the second head on the second card. """
if stream is None: stream__o = None
else: stream__o = stream._o
ret = libvirtmod.virDomainScreenshot(self._o, stream__o, screen, flags)
if ret is None: raise libvirtError ('virDomainScreenshot() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def securityLabel(self):
"""Extract information about the domain security label. Only the first label will be returned. """
ret = libvirtmod.virDomainGetSecurityLabel(self._o)
if ret is None: raise libvirtError ('virDomainGetSecurityLabel() failed', dom=self)
return ret
def securityLabelList(self):
"""Extract information about the domain security label. A list of all labels will be returned. """
ret = libvirtmod.virDomainGetSecurityLabelList(self._o)
if ret is None: raise libvirtError ('virDomainGetSecurityLabelList() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def sendKey(self, codeset, holdtime, keycodes, nkeycodes, flags=0):
"""Send key(s) to the guest. """
ret = libvirtmod.virDomainSendKey(self._o, codeset, holdtime, keycodes, nkeycodes, flags)
if ret == -1: raise libvirtError ('virDomainSendKey() failed', dom=self)
return ret
def sendProcessSignal(self, pid_value, signum, flags=0):
"""Send a signal to the designated process in the guest
The signal numbers must be taken from the virDomainProcessSignal
enum. These will be translated to the corresponding signal
number for the guest OS, by the guest agent delivering the
signal. If there is no mapping from virDomainProcessSignal to
the native OS signals, this API will report an error.
If @pid_value is an integer greater than zero, it is
treated as a process ID. If @pid_value is an integer
less than zero, it is treated as a process group ID.
All the @pid_value numbers are from the container/guest
namespace. The value zero is not valid.
Not all hypervisors will support sending signals to
arbitrary processes or process groups. If this API is
implemented the minimum requirement is to be able to
use @pid_value == 1 (i.e. kill init). No other value is
required to be supported.
If the @signum is VIR_DOMAIN_PROCESS_SIGNAL_NOP then this
API will simply report whether the process is running in
the container/guest. """
ret = libvirtmod.virDomainSendProcessSignal(self._o, pid_value, signum, flags)
if ret == -1: raise libvirtError ('virDomainSendProcessSignal() failed', dom=self)
return ret
def setAutostart(self, autostart):
"""Configure the domain to be automatically started
when the host machine boots. """
ret = libvirtmod.virDomainSetAutostart(self._o, autostart)
if ret == -1: raise libvirtError ('virDomainSetAutostart() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def setBlkioParameters(self, params, flags=0):
"""Change the blkio tunables """
ret = libvirtmod.virDomainSetBlkioParameters(self._o, params, flags)
if ret == -1: raise libvirtError ('virDomainSetBlkioParameters() failed', dom=self)
return ret
def setBlockIoTune(self, disk, params, flags=0):
"""Change the I/O tunables for a block device """
ret = libvirtmod.virDomainSetBlockIoTune(self._o, disk, params, flags)
if ret == -1: raise libvirtError ('virDomainSetBlockIoTune() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def setBlockThreshold(self, dev, threshold, flags=0):
"""Set the threshold level for delivering the
VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD if the device or backing chain element
described by @dev is written beyond the set threshold level. The threshold
level is unset once the event fires. The event might not be delivered at all
if libvirtd was not running at the moment when the threshold was reached.
Hypervisors report the last written sector of an image in the bulk stats API
(virConnectGetAllDomainStats/virDomainListGetStats) as
"block.<num>.allocation" in the VIR_DOMAIN_STATS_BLOCK group. The current
threshold value is reported as "block.<num>.threshold".
This event allows to use thin-provisioned storage which needs management
tools to grow it without the need for polling of the data. """
ret = libvirtmod.virDomainSetBlockThreshold(self._o, dev, threshold, flags)
if ret == -1: raise libvirtError ('virDomainSetBlockThreshold() failed', dom=self)
return ret
def setGuestVcpus(self, cpumap, state, flags=0):
"""Sets state of individual vcpus described by @cpumap via guest agent. Other
vcpus are not modified.
This API requires the VM to run. Various hypervisors or guest agent
implementation may limit to operate on just 1 vCPU per call.
@cpumap is a list of vCPU numbers. Its syntax is a comma separated list and
a special markup using '-' and '^' (ex. '0-4', '0-3,^2'). The '-' denotes
the range and the '^' denotes exclusive. The expression is sequentially
evaluated, so "0-15,^8" is identical to "9-14,0-7,15" but not identical to
"^8,0-15".
Note that OSes (notably Linux) may require vCPU 0 to stay online to support
low-level features a S3 sleep. """
ret = libvirtmod.virDomainSetGuestVcpus(self._o, cpumap, state, flags)
if ret == -1: raise libvirtError ('virDomainSetGuestVcpus() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def setInterfaceParameters(self, device, params, flags=0):
"""Change the bandwidth tunables for a interface device """
ret = libvirtmod.virDomainSetInterfaceParameters(self._o, device, params, flags)
if ret == -1: raise libvirtError ('virDomainSetInterfaceParameters() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def setMaxMemory(self, memory):
"""Dynamically change the maximum amount of physical memory allocated to a
domain. If domain is None, then this change the amount of memory reserved
to Domain0 i.e. the domain where the application runs.
This function may require privileged access to the hypervisor.
This command is hypervisor-specific for whether active, persistent,
or both configurations are changed; for more control, use
virDomainSetMemoryFlags(). """
ret = libvirtmod.virDomainSetMaxMemory(self._o, memory)
if ret == -1: raise libvirtError ('virDomainSetMaxMemory() failed', dom=self)
return ret
def setMemory(self, memory):
"""Dynamically change the target amount of physical memory allocated to a
domain. If domain is None, then this change the amount of memory reserved
to Domain0 i.e. the domain where the application runs.
This function may require privileged access to the hypervisor.
This command is hypervisor-specific for whether active, persistent,
or both configurations are changed; for more control, use
virDomainSetMemoryFlags(). """
ret = libvirtmod.virDomainSetMemory(self._o, memory)
if ret == -1: raise libvirtError ('virDomainSetMemory() failed', dom=self)
return ret
def setMemoryFlags(self, memory, flags=0):
"""Dynamically change the target amount of physical memory allocated to a
domain. If domain is None, then this change the amount of memory reserved
to Domain0 i.e. the domain where the application runs.
This function may require privileged access to the hypervisor.
@flags may include VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG.
Both flags may be set. If VIR_DOMAIN_AFFECT_LIVE is set, the change affects
a running domain and will fail if domain is not active.
If VIR_DOMAIN_AFFECT_CONFIG is set, the change affects persistent state,
and will fail for transient domains. If neither flag is specified
(that is, @flags is VIR_DOMAIN_AFFECT_CURRENT), then an inactive domain
modifies persistent setup, while an active domain is hypervisor-dependent
on whether just live or both live and persistent state is changed.
If VIR_DOMAIN_MEM_MAXIMUM is set, the change affects domain's maximum memory
size rather than current memory size.
Not all hypervisors can support all flag combinations. """
ret = libvirtmod.virDomainSetMemoryFlags(self._o, memory, flags)
if ret == -1: raise libvirtError ('virDomainSetMemoryFlags() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def setMemoryParameters(self, params, flags=0):
"""Change the memory tunables """
ret = libvirtmod.virDomainSetMemoryParameters(self._o, params, flags)
if ret == -1: raise libvirtError ('virDomainSetMemoryParameters() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def setMemoryStatsPeriod(self, period, flags=0):
"""Dynamically change the domain memory balloon driver statistics collection
period. Use 0 to disable and a positive value to enable.
@flags may include VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG.
Both flags may be set. If VIR_DOMAIN_AFFECT_LIVE is set, the change affects
a running domain and will fail if domain is not active.
If VIR_DOMAIN_AFFECT_CONFIG is set, the change affects persistent state,
and will fail for transient domains. If neither flag is specified
(that is, @flags is VIR_DOMAIN_AFFECT_CURRENT), then an inactive domain
modifies persistent setup, while an active domain is hypervisor-dependent
on whether just live or both live and persistent state is changed.
Not all hypervisors can support all flag combinations. """
ret = libvirtmod.virDomainSetMemoryStatsPeriod(self._o, period, flags)
if ret == -1: raise libvirtError ('virDomainSetMemoryStatsPeriod() failed', dom=self)
return ret
def setMetadata(self, type, metadata, key, uri, flags=0):
"""Sets the appropriate domain element given by @type to the
value of @metadata. A @type of VIR_DOMAIN_METADATA_DESCRIPTION
is free-form text; VIR_DOMAIN_METADATA_TITLE is free-form, but no
newlines are permitted, and should be short (although the length is
not enforced). For these two options @key and @uri are irrelevant and
must be set to None.
For type VIR_DOMAIN_METADATA_ELEMENT @metadata must be well-formed
XML belonging to namespace defined by @uri with local name @key.
Passing None for @metadata says to remove that element from the
domain XML (passing the empty string leaves the element present).
The resulting metadata will be present in virDomainGetXMLDesc(),
as well as quick access through virDomainGetMetadata().
@flags controls whether the live domain, persistent configuration,
or both will be modified. """
ret = libvirtmod.virDomainSetMetadata(self._o, type, metadata, key, uri, flags)
if ret == -1: raise libvirtError ('virDomainSetMetadata() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def setNumaParameters(self, params, flags=0):
"""Change the NUMA tunables """
ret = libvirtmod.virDomainSetNumaParameters(self._o, params, flags)
if ret == -1: raise libvirtError ('virDomainSetNumaParameters() failed', dom=self)
return ret
def setPerfEvents(self, params, flags=0):
"""Enable or disable the particular list of perf events """
ret = libvirtmod.virDomainSetPerfEvents(self._o, params, flags)
if ret == -1: raise libvirtError ('virDomainSetPerfEvents() failed', dom=self)
return ret
def setSchedulerParameters(self, params):
"""Change the scheduler parameters """
ret = libvirtmod.virDomainSetSchedulerParameters(self._o, params)
if ret == -1: raise libvirtError ('virDomainSetSchedulerParameters() failed', dom=self)
return ret
def setSchedulerParametersFlags(self, params, flags=0):
"""Change the scheduler parameters """
ret = libvirtmod.virDomainSetSchedulerParametersFlags(self._o, params, flags)
if ret == -1: raise libvirtError ('virDomainSetSchedulerParametersFlags() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def setUserPassword(self, user, password, flags=0):
"""Sets the @user password to the value specified by @password.
If @flags contain VIR_DOMAIN_PASSWORD_ENCRYPTED, the password
is assumed to be encrypted by the method required by the guest OS.
Please note that some hypervisors may require guest agent to
be configured and running in order to be able to run this API. """
ret = libvirtmod.virDomainSetUserPassword(self._o, user, password, flags)
if ret == -1: raise libvirtError ('virDomainSetUserPassword() failed', dom=self)
return ret
def setVcpu(self, vcpumap, state, flags=0):
"""Enables/disables individual vcpus described by @vcpumap in the hypervisor.
Various hypervisor implementations may limit to operate on just 1
hotpluggable entity (which may contain multiple vCPUs on certain platforms).
Note that OSes and hypervisors may require vCPU 0 to stay online. """
ret = libvirtmod.virDomainSetVcpu(self._o, vcpumap, state, flags)
if ret == -1: raise libvirtError ('virDomainSetVcpu() failed', dom=self)
return ret
def setVcpus(self, nvcpus):
"""Dynamically change the number of virtual CPUs used by the domain.
Note that this call may fail if the underlying virtualization hypervisor
does not support it or if growing the number is arbitrarily limited.
This function may require privileged access to the hypervisor.
Note that if this call is executed before the guest has finished booting,
the guest may fail to process the change.
This command only changes the runtime configuration of the domain,
so can only be called on an active domain. It is hypervisor-dependent
whether it also affects persistent configuration; for more control,
use virDomainSetVcpusFlags(). """
ret = libvirtmod.virDomainSetVcpus(self._o, nvcpus)
if ret == -1: raise libvirtError ('virDomainSetVcpus() failed', dom=self)
return ret
def setVcpusFlags(self, nvcpus, flags=0):
"""Dynamically change the number of virtual CPUs used by the domain.
Note that this call may fail if the underlying virtualization hypervisor
does not support it or if growing the number is arbitrarily limited.
This function may require privileged access to the hypervisor.
@flags may include VIR_DOMAIN_AFFECT_LIVE to affect a running
domain (which may fail if domain is not active), or
VIR_DOMAIN_AFFECT_CONFIG to affect the next boot via the XML
description of the domain. Both flags may be set.
If neither flag is specified (that is, @flags is VIR_DOMAIN_AFFECT_CURRENT),
then an inactive domain modifies persistent setup, while an active domain
is hypervisor-dependent on whether just live or both live and persistent
state is changed.
Note that if this call is executed before the guest has finished booting,
the guest may fail to process the change.
If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then
VIR_DOMAIN_AFFECT_LIVE must be clear, and only the maximum virtual
CPU limit is altered; generally, this value must be less than or
equal to virConnectGetMaxVcpus(). Otherwise, this call affects the
current virtual CPU limit, which must be less than or equal to the
maximum limit. Note that hypervisors may not allow changing the maximum
vcpu count if processor topology is specified.
If @flags includes VIR_DOMAIN_VCPU_GUEST, then the state of processors is
modified inside the guest instead of the hypervisor. This flag can only
be used with live guests and is incompatible with VIR_DOMAIN_VCPU_MAXIMUM.
The usage of this flag may require a guest agent configured.
Not all hypervisors can support all flag combinations. """
ret = libvirtmod.virDomainSetVcpusFlags(self._o, nvcpus, flags)
if ret == -1: raise libvirtError ('virDomainSetVcpusFlags() failed', dom=self)
return ret
def shutdown(self):
"""Shutdown a domain, the domain object is still usable thereafter, but
the domain OS is being stopped. Note that the guest OS may ignore the
request. Additionally, the hypervisor may check and support the domain
'on_poweroff' XML setting resulting in a domain that reboots instead of
shutting down. For guests that react to a shutdown request, the differences
from virDomainDestroy() are that the guests disk storage will be in a
stable state rather than having the (virtual) power cord pulled, and
this command returns as soon as the shutdown request is issued rather
than blocking until the guest is no longer running.
If the domain is transient and has any snapshot metadata (see
virDomainSnapshotNum()), then that metadata will automatically
be deleted when the domain quits. """
ret = libvirtmod.virDomainShutdown(self._o)
if ret == -1: raise libvirtError ('virDomainShutdown() failed', dom=self)
return ret
def shutdownFlags(self, flags=0):
"""Shutdown a domain, the domain object is still usable thereafter but
the domain OS is being stopped. Note that the guest OS may ignore the
request. Additionally, the hypervisor may check and support the domain
'on_poweroff' XML setting resulting in a domain that reboots instead of
shutting down. For guests that react to a shutdown request, the differences
from virDomainDestroy() are that the guest's disk storage will be in a
stable state rather than having the (virtual) power cord pulled, and
this command returns as soon as the shutdown request is issued rather
than blocking until the guest is no longer running.
If the domain is transient and has any snapshot metadata (see
virDomainSnapshotNum()), then that metadata will automatically
be deleted when the domain quits.
If @flags is set to zero, then the hypervisor will choose the
method of shutdown it considers best. To have greater control
pass one or more of the virDomainShutdownFlagValues. The order
in which the hypervisor tries each shutdown method is undefined,
and a hypervisor is not required to support all methods.
To use guest agent (VIR_DOMAIN_SHUTDOWN_GUEST_AGENT) the domain XML
must have <channel> configured. """
ret = libvirtmod.virDomainShutdownFlags(self._o, flags)
if ret == -1: raise libvirtError ('virDomainShutdownFlags() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain-snapshot
#
def snapshotCreateXML(self, xmlDesc, flags=0):
"""Creates a new snapshot of a domain based on the snapshot xml
contained in xmlDesc.
If @flags is 0, the domain can be active, in which case the
snapshot will be a system checkpoint (both disk state and runtime
VM state such as RAM contents), where reverting to the snapshot is
the same as resuming from hibernation (TCP connections may have
timed out, but everything else picks up where it left off); or
the domain can be inactive, in which case the snapshot includes
just the disk state prior to booting. The newly created snapshot
becomes current (see virDomainSnapshotCurrent()), and is a child
of any previous current snapshot.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, then this
is a request to reinstate snapshot metadata that was previously
discarded, rather than creating a new snapshot. This can be used
to recreate a snapshot hierarchy on a destination, then remove it
on the source, in order to allow migration (since migration
normally fails if snapshot metadata still remains on the source
machine). When redefining snapshot metadata, the current snapshot
will not be altered unless the VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT
flag is also present. It is an error to request the
VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT flag without
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE. On some hypervisors,
redefining an existing snapshot can be used to alter host-specific
portions of the domain XML to be used during revert (such as
backing filenames associated with disk devices), but must not alter
guest-visible layout. When redefining a snapshot name that does
not exist, the hypervisor may validate that reverting to the
snapshot appears to be possible (for example, disk images have
snapshot contents by the requested name). Not all hypervisors
support these flags.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, then the
domain's disk images are modified according to @xmlDesc, but then
the just-created snapshot has its metadata deleted. This flag is
incompatible with VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_HALT, then the domain
will be inactive after the snapshot completes, regardless of whether
it was active before; otherwise, a running domain will still be
running after the snapshot. This flag is invalid on transient domains,
and is incompatible with VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, then the domain
is not paused while creating the snapshot. This increases the size
of the memory dump file, but reduces downtime of the guest while
taking the snapshot. Some hypervisors only support this flag during
external checkpoints.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, then the
snapshot will be limited to the disks described in @xmlDesc, and no
VM state will be saved. For an active guest, the disk image may be
inconsistent (as if power had been pulled), and specifying this
with the VIR_DOMAIN_SNAPSHOT_CREATE_HALT flag risks data loss.
If @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE, then the
libvirt will attempt to use guest agent to freeze and thaw all
file systems in use within domain OS. However, if the guest agent
is not present, an error is thrown. Moreover, this flag requires
VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY to be passed as well.
By default, if the snapshot involves external files, and any of the
destination files already exist as a non-empty regular file, the
snapshot is rejected to avoid losing contents of those files.
However, if @flags includes VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT,
then the destination files must be pre-created manually with
the correct image format and metadata including backing store path
(this allows a management app to pre-create files with relative backing
file names, rather than the default of creating with absolute backing
file names). Note that only the file specified in the snapshot XML is
inserted as a snapshot thus setting incorrect metadata in the pre-created
image may lead to the VM being unable to start or other block jobs may fail.
Be aware that although libvirt prefers to report errors up front with
no other effect, some hypervisors have certain types of failures where
the overall command can easily fail even though the guest configuration
was partially altered (for example, if a disk snapshot request for two
disks fails on the second disk, but the first disk alteration cannot be
rolled back). If this API call fails, it is therefore normally
necessary to follow up with virDomainGetXMLDesc() and check each disk
to determine if any partial changes occurred. However, if @flags
contains VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC, then libvirt guarantees
that this command will not alter any disks unless the entire set of
changes can be done atomically, making failure recovery simpler (note
that it is still possible to fail after disks have changed, but only
in the much rarer cases of running out of memory or disk space).
Some hypervisors may prevent this operation if there is a current
block copy operation; in that case, use virDomainBlockJobAbort()
to stop the block copy first.
virDomainSnapshotFree should be used to free the resources after the
snapshot object is no longer needed. """
ret = libvirtmod.virDomainSnapshotCreateXML(self._o, xmlDesc, flags)
if ret is None:raise libvirtError('virDomainSnapshotCreateXML() failed', dom=self)
__tmp = virDomainSnapshot(self,_obj=ret)
return __tmp
def snapshotCurrent(self, flags=0):
"""Get the current snapshot for a domain, if any.
virDomainSnapshotFree should be used to free the resources after the
snapshot object is no longer needed. """
ret = libvirtmod.virDomainSnapshotCurrent(self._o, flags)
if ret is None:raise libvirtError('virDomainSnapshotCurrent() failed', dom=self)
__tmp = virDomainSnapshot(self,_obj=ret)
return __tmp
#
# virDomain functions from module python
#
def snapshotListNames(self, flags=0):
"""collect the list of snapshot names for the given domain """
ret = libvirtmod.virDomainSnapshotListNames(self._o, flags)
if ret is None: raise libvirtError ('virDomainSnapshotListNames() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain-snapshot
#
def snapshotLookupByName(self, name, flags=0):
"""Try to lookup a domain snapshot based on its name. """
ret = libvirtmod.virDomainSnapshotLookupByName(self._o, name, flags)
if ret is None:raise libvirtError('virDomainSnapshotLookupByName() failed', dom=self)
__tmp = virDomainSnapshot(self,_obj=ret)
return __tmp
def snapshotNum(self, flags=0):
"""Provides the number of domain snapshots for this domain.
By default, this command covers all snapshots; it is also possible to
limit things to just snapshots with no parents, when @flags includes
VIR_DOMAIN_SNAPSHOT_LIST_ROOTS. Additional filters are provided in
groups, where each group contains bits that describe mutually exclusive
attributes of a snapshot, and where all bits within a group describe
all possible snapshots. Some hypervisors might reject explicit bits
from a group where the hypervisor cannot make a distinction. For a
group supported by a given hypervisor, the behavior when no bits of a
group are set is identical to the behavior when all bits in that group
are set. When setting bits from more than one group, it is possible to
select an impossible combination, in that case a hypervisor may return
either 0 or an error.
The first group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_LEAVES and
VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, to filter based on snapshots that
have no further children (a leaf snapshot).
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_METADATA and
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, for filtering snapshots based on
whether they have metadata that would prevent the removal of the last
reference to a domain.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE,
VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, and VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY,
for filtering snapshots based on what domain state is tracked by the
snapshot.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL and
VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, for filtering snapshots based on
whether the snapshot is stored inside the disk images or as
additional files. """
ret = libvirtmod.virDomainSnapshotNum(self._o, flags)
if ret == -1: raise libvirtError ('virDomainSnapshotNum() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def state(self, flags=0):
"""Extract domain state. """
ret = libvirtmod.virDomainGetState(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetState() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def suspend(self):
"""Suspends an active domain, the process is frozen without further access
to CPU resources and I/O but the memory used by the domain at the
hypervisor level will stay allocated. Use virDomainResume() to reactivate
the domain.
This function may require privileged access.
Moreover, suspend may not be supported if domain is in some
special state like VIR_DOMAIN_PMSUSPENDED. """
ret = libvirtmod.virDomainSuspend(self._o)
if ret == -1: raise libvirtError ('virDomainSuspend() failed', dom=self)
return ret
def undefine(self):
"""Undefine a domain. If the domain is running, it's converted to
transient domain, without stopping it. If the domain is inactive,
the domain configuration is removed.
If the domain has a managed save image (see
virDomainHasManagedSaveImage()), or if it is inactive and has any
snapshot metadata (see virDomainSnapshotNum()), then the undefine will
fail. See virDomainUndefineFlags() for more control. """
ret = libvirtmod.virDomainUndefine(self._o)
if ret == -1: raise libvirtError ('virDomainUndefine() failed', dom=self)
return ret
def undefineFlags(self, flags=0):
"""Undefine a domain. If the domain is running, it's converted to
transient domain, without stopping it. If the domain is inactive,
the domain configuration is removed.
If the domain has a managed save image (see virDomainHasManagedSaveImage()),
then including VIR_DOMAIN_UNDEFINE_MANAGED_SAVE in @flags will also remove
that file, and omitting the flag will cause the undefine process to fail.
If the domain is inactive and has any snapshot metadata (see
virDomainSnapshotNum()), then including
VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA in @flags will also remove
that metadata. Omitting the flag will cause the undefine of an
inactive domain to fail. Active snapshots will retain snapshot
metadata until the (now-transient) domain halts, regardless of
whether this flag is present. On hypervisors where snapshots do
not use libvirt metadata, this flag has no effect.
If the domain has any nvram specified, the undefine process will fail
unless VIR_DOMAIN_UNDEFINE_KEEP_NVRAM is specified, or if
VIR_DOMAIN_UNDEFINE_NVRAM is specified to remove the nvram file. """
ret = libvirtmod.virDomainUndefineFlags(self._o, flags)
if ret == -1: raise libvirtError ('virDomainUndefineFlags() failed', dom=self)
return ret
def updateDeviceFlags(self, xml, flags=0):
"""Change a virtual device on a domain, using the flags parameter
to control how the device is changed. VIR_DOMAIN_AFFECT_CURRENT
specifies that the device change is made based on current domain
state. VIR_DOMAIN_AFFECT_LIVE specifies that the device shall be
changed on the active domain instance only and is not added to the
persisted domain configuration. VIR_DOMAIN_AFFECT_CONFIG
specifies that the device shall be changed on the persisted domain
configuration only. Note that the target hypervisor must return an
error if unable to satisfy flags. E.g. the hypervisor driver will
return failure if LIVE is specified but it only supports modifying the
persisted device allocation.
This method is used for actions such changing CDROM/Floppy device
media, altering the graphics configuration such as password,
reconfiguring the NIC device backend connectivity, etc. """
ret = libvirtmod.virDomainUpdateDeviceFlags(self._o, xml, flags)
if ret == -1: raise libvirtError ('virDomainUpdateDeviceFlags() failed', dom=self)
return ret
#
# virDomain functions from module python
#
def vcpuPinInfo(self, flags=0):
"""Query the CPU affinity setting of all virtual CPUs of domain """
ret = libvirtmod.virDomainGetVcpuPinInfo(self._o, flags)
if ret is None: raise libvirtError ('virDomainGetVcpuPinInfo() failed', dom=self)
return ret
def vcpus(self):
"""Extract information about virtual CPUs of domain, store it in info array and also in cpumaps. """
ret = libvirtmod.virDomainGetVcpus(self._o)
if ret is None: raise libvirtError ('virDomainGetVcpus() failed', dom=self)
return ret
#
# virDomain functions from module libvirt-domain
#
def vcpusFlags(self, flags=0):
"""Query the number of virtual CPUs used by the domain. Note that
this call may fail if the underlying virtualization hypervisor does
not support it. This function may require privileged access to the
hypervisor.
If @flags includes VIR_DOMAIN_AFFECT_LIVE, this will query a
running domain (which will fail if domain is not active); if
it includes VIR_DOMAIN_AFFECT_CONFIG, this will query the XML
description of the domain. It is an error to set both flags.
If neither flag is set (that is, VIR_DOMAIN_AFFECT_CURRENT),
then the configuration queried depends on whether the domain
is currently running.
If @flags includes VIR_DOMAIN_VCPU_MAXIMUM, then the maximum
virtual CPU limit is queried. Otherwise, this call queries the
current virtual CPU count.
If @flags includes VIR_DOMAIN_VCPU_GUEST, then the state of the processors
is queried in the guest instead of the hypervisor. This flag is only usable
on live domains. Guest agent may be needed for this flag to be available. """
ret = libvirtmod.virDomainGetVcpusFlags(self._o, flags)
if ret == -1: raise libvirtError ('virDomainGetVcpusFlags() failed', dom=self)
return ret
#
# virDomain methods from virDomain.py (hand coded)
#
def listAllSnapshots(self, flags=0):
"""List all snapshots and returns a list of snapshot objects"""
ret = libvirtmod.virDomainListAllSnapshots(self._o, flags)
if ret is None:
raise libvirtError("virDomainListAllSnapshots() failed", conn=self)
retlist = list()
for snapptr in ret:
retlist.append(virDomainSnapshot(self, _obj=snapptr))
return retlist
def createWithFiles(self, files, flags=0):
"""Launch a defined domain. If the call succeeds the domain moves from the
defined to the running domains pools.
@files provides an array of file descriptors which will be
made available to the 'init' process of the guest. The file
handles exposed to the guest will be renumbered to start
from 3 (ie immediately following stderr). This is only
supported for guests which use container based virtualization
technology.
If the VIR_DOMAIN_START_PAUSED flag is set, or if the guest domain
has a managed save image that requested paused state (see
virDomainManagedSave()) the guest domain will be started, but its
CPUs will remain paused. The CPUs can later be manually started
using virDomainResume(). In all other cases, the guest domain will
be running.
If the VIR_DOMAIN_START_AUTODESTROY flag is set, the guest
domain will be automatically destroyed when the virConnectPtr
object is finally released. This will also happen if the
client application crashes / loses its connection to the
libvirtd daemon. Any domains marked for auto destroy will
block attempts at migration, save-to-file, or snapshots.
If the VIR_DOMAIN_START_BYPASS_CACHE flag is set, and there is a
managed save file for this domain (created by virDomainManagedSave()),
then libvirt will attempt to bypass the file system cache while restoring
the file, or fail if it cannot do so for the given system; this can allow
less pressure on file system cache, but also risks slowing loads from NFS.
If the VIR_DOMAIN_START_FORCE_BOOT flag is set, then any managed save
file for this domain is discarded, and the domain boots from scratch. """
ret = libvirtmod.virDomainCreateWithFiles(self._o, files, flags)
if ret == -1: raise libvirtError ('virDomainCreateWithFiles() failed', dom=self)
return ret
def fsFreeze(self, mountpoints=None, flags=0):
"""Freeze specified filesystems within the guest """
ret = libvirtmod.virDomainFSFreeze(self._o, mountpoints, flags)
if ret == -1: raise libvirtError ('virDomainFSFreeze() failed', dom=self)
return ret
def fsThaw(self, mountpoints=None, flags=0):
"""Thaw specified filesystems within the guest """
ret = libvirtmod.virDomainFSThaw(self._o, mountpoints, flags)
if ret == -1: raise libvirtError ('virDomainFSThaw() failed', dom=self)
return ret
def getTime(self, flags=0):
"""Extract information about guest time """
ret = libvirtmod.virDomainGetTime(self._o, flags)
if ret == None: raise libvirtError ('virDomainGetTime() failed', dom=self)
return ret
def setTime(self, time=None, flags=0):
"""Set guest time to the given value. @time is a dict containing
'seconds' field for seconds and 'nseconds' field for nanoseconds """
ret = libvirtmod.virDomainSetTime(self._o, time, flags)
if ret == -1: raise libvirtError ('virDomainSetTime() failed', dom=self)
return ret
class virNetwork(object):
def __init__(self, conn, _obj=None):
self._conn = conn
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def __del__(self):
if self._o is not None:
libvirtmod.virNetworkFree(self._o)
self._o = None
def connect(self):
return self._conn
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virNetwork_pointer(self._o)
#
# virNetwork functions from module python
#
def DHCPLeases(self, mac=None, flags=0):
"""Returns a list of dhcp leases for interfaces connected to the given virtual network """
ret = libvirtmod.virNetworkGetDHCPLeases(self._o, mac, flags)
if ret is None: raise libvirtError ('virNetworkGetDHCPLeases() failed', net=self)
return ret
def UUID(self):
"""Extract the UUID unique Identifier of a network. """
ret = libvirtmod.virNetworkGetUUID(self._o)
if ret is None: raise libvirtError ('virNetworkGetUUID() failed', net=self)
return ret
def UUIDString(self):
"""Fetch globally unique ID of the network as a string. """
ret = libvirtmod.virNetworkGetUUIDString(self._o)
if ret is None: raise libvirtError ('virNetworkGetUUIDString() failed', net=self)
return ret
#
# virNetwork functions from module libvirt-network
#
def XMLDesc(self, flags=0):
"""Provide an XML description of the network. The description may be reused
later to relaunch the network with virNetworkCreateXML().
Normally, if a network included a physical function, the output includes
all virtual functions tied to that physical interface. If @flags includes
VIR_NETWORK_XML_INACTIVE, then the expansion of virtual interfaces is
not performed. """
ret = libvirtmod.virNetworkGetXMLDesc(self._o, flags)
if ret is None: raise libvirtError ('virNetworkGetXMLDesc() failed', net=self)
return ret
#
# virNetwork functions from module python
#
def autostart(self):
"""Extract the autostart flag for a network. """
ret = libvirtmod.virNetworkGetAutostart(self._o)
if ret == -1: raise libvirtError ('virNetworkGetAutostart() failed', net=self)
return ret
#
# virNetwork functions from module libvirt-network
#
def bridgeName(self):
"""Provides a bridge interface name to which a domain may connect
a network interface in order to join the network. """
ret = libvirtmod.virNetworkGetBridgeName(self._o)
if ret is None: raise libvirtError ('virNetworkGetBridgeName() failed', net=self)
return ret
def create(self):
"""Create and start a defined network. If the call succeed the network
moves from the defined to the running networks pools. """
ret = libvirtmod.virNetworkCreate(self._o)
if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self)
return ret
def destroy(self):
"""Destroy the network object. The running instance is shutdown if not down
already and all resources used by it are given back to the hypervisor. This
does not free the associated virNetworkPtr object.
This function may require privileged access """
ret = libvirtmod.virNetworkDestroy(self._o)
if ret == -1: raise libvirtError ('virNetworkDestroy() failed', net=self)
return ret
def isActive(self):
"""Determine if the network is currently running """
ret = libvirtmod.virNetworkIsActive(self._o)
if ret == -1: raise libvirtError ('virNetworkIsActive() failed', net=self)
return ret
def isPersistent(self):
"""Determine if the network has a persistent configuration
which means it will still exist after shutting down """
ret = libvirtmod.virNetworkIsPersistent(self._o)
if ret == -1: raise libvirtError ('virNetworkIsPersistent() failed', net=self)
return ret
def name(self):
"""Get the public name for that network """
ret = libvirtmod.virNetworkGetName(self._o)
return ret
def setAutostart(self, autostart):
"""Configure the network to be automatically started
when the host machine boots. """
ret = libvirtmod.virNetworkSetAutostart(self._o, autostart)
if ret == -1: raise libvirtError ('virNetworkSetAutostart() failed', net=self)
return ret
def undefine(self):
"""Undefine a network but does not stop it if it is running """
ret = libvirtmod.virNetworkUndefine(self._o)
if ret == -1: raise libvirtError ('virNetworkUndefine() failed', net=self)
return ret
def update(self, command, section, parentIndex, xml, flags=0):
"""Update the definition of an existing network, either its live
running state, its persistent configuration, or both. """
ret = libvirtmod.virNetworkUpdate(self._o, command, section, parentIndex, xml, flags)
if ret == -1: raise libvirtError ('virNetworkUpdate() failed', net=self)
return ret
class virInterface(object):
def __init__(self, conn, _obj=None):
self._conn = conn
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def __del__(self):
if self._o is not None:
libvirtmod.virInterfaceFree(self._o)
self._o = None
def connect(self):
return self._conn
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virInterface_pointer(self._o)
#
# virInterface functions from module libvirt-interface
#
def MACString(self):
"""Get the MAC for an interface as string. For more information about
MAC see RFC4122. """
ret = libvirtmod.virInterfaceGetMACString(self._o)
if ret is None: raise libvirtError ('virInterfaceGetMACString() failed', net=self)
return ret
def XMLDesc(self, flags=0):
"""VIR_INTERFACE_XML_INACTIVE - return the static configuration,
suitable for use redefining the
interface via virInterfaceDefineXML()
Provide an XML description of the interface. If
VIR_INTERFACE_XML_INACTIVE is set, the description may be reused
later to redefine the interface with virInterfaceDefineXML(). If it
is not set, the ip address and netmask will be the current live
setting of the interface, not the settings from the config files. """
ret = libvirtmod.virInterfaceGetXMLDesc(self._o, flags)
if ret is None: raise libvirtError ('virInterfaceGetXMLDesc() failed', net=self)
return ret
def create(self, flags=0):
"""Activate an interface (i.e. call "ifup").
If there was an open network config transaction at the time this
interface was defined (that is, if virInterfaceChangeBegin() had
been called), the interface will be brought back down (and then
undefined) if virInterfaceChangeRollback() is called. """
ret = libvirtmod.virInterfaceCreate(self._o, flags)
if ret == -1: raise libvirtError ('virInterfaceCreate() failed', net=self)
return ret
def destroy(self, flags=0):
"""deactivate an interface (ie call "ifdown")
This does not remove the interface from the config, and
does not free the associated virInterfacePtr object.
If there is an open network config transaction at the time this
interface is destroyed (that is, if virInterfaceChangeBegin() had
been called), and if the interface is later undefined and then
virInterfaceChangeRollback() is called, the restoral of the
interface definition will also bring the interface back up. """
ret = libvirtmod.virInterfaceDestroy(self._o, flags)
if ret == -1: raise libvirtError ('virInterfaceDestroy() failed', net=self)
return ret
def isActive(self):
"""Determine if the interface is currently running """
ret = libvirtmod.virInterfaceIsActive(self._o)
if ret == -1: raise libvirtError ('virInterfaceIsActive() failed', net=self)
return ret
def name(self):
"""Get the public name for that interface """
ret = libvirtmod.virInterfaceGetName(self._o)
return ret
def undefine(self):
"""Undefine an interface, ie remove it from the config.
This does not free the associated virInterfacePtr object.
Normally this change in the interface configuration is
permanent/persistent, but if virInterfaceChangeBegin() has been
previously called (i.e. if an interface config transaction is
open), the removal of the interface definition will only become
permanent if virInterfaceChangeCommit() is called prior to the next
reboot of the system running libvirtd. Prior to that time, the
definition can be explicitly restored using
virInterfaceChangeRollback(), or will be automatically restored
during the next reboot of the system running libvirtd. """
ret = libvirtmod.virInterfaceUndefine(self._o)
if ret == -1: raise libvirtError ('virInterfaceUndefine() failed', net=self)
return ret
class virStoragePool(object):
def __init__(self, conn, _obj=None):
self._conn = conn
if not isinstance(conn, virConnect):
self._conn = conn._conn
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def __del__(self):
if self._o is not None:
libvirtmod.virStoragePoolFree(self._o)
self._o = None
def connect(self):
return self._conn
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virStoragePool_pointer(self._o)
#
# virStoragePool functions from module python
#
def UUID(self):
"""Extract the UUID unique Identifier of a storage pool. """
ret = libvirtmod.virStoragePoolGetUUID(self._o)
if ret is None: raise libvirtError ('virStoragePoolGetUUID() failed', pool=self)
return ret
def UUIDString(self):
"""Fetch globally unique ID of the storage pool as a string. """
ret = libvirtmod.virStoragePoolGetUUIDString(self._o)
if ret is None: raise libvirtError ('virStoragePoolGetUUIDString() failed', pool=self)
return ret
#
# virStoragePool functions from module libvirt-storage
#
def XMLDesc(self, flags=0):
"""Fetch an XML document describing all aspects of the
storage pool. This is suitable for later feeding back
into the virStoragePoolCreateXML method. """
ret = libvirtmod.virStoragePoolGetXMLDesc(self._o, flags)
if ret is None: raise libvirtError ('virStoragePoolGetXMLDesc() failed', pool=self)
return ret
#
# virStoragePool functions from module python
#
def autostart(self):
"""Extract the autostart flag for a storage pool """
ret = libvirtmod.virStoragePoolGetAutostart(self._o)
if ret == -1: raise libvirtError ('virStoragePoolGetAutostart() failed', pool=self)
return ret
#
# virStoragePool functions from module libvirt-storage
#
def build(self, flags=0):
"""Currently only filesystem pool accepts flags VIR_STORAGE_POOL_BUILD_OVERWRITE
and VIR_STORAGE_POOL_BUILD_NO_OVERWRITE.
Build the underlying storage pool """
ret = libvirtmod.virStoragePoolBuild(self._o, flags)
if ret == -1: raise libvirtError ('virStoragePoolBuild() failed', pool=self)
return ret
def create(self, flags=0):
"""Starts an inactive storage pool """
ret = libvirtmod.virStoragePoolCreate(self._o, flags)
if ret == -1: raise libvirtError ('virStoragePoolCreate() failed', pool=self)
return ret
def createXML(self, xmlDesc, flags=0):
"""Create a storage volume within a pool based
on an XML description. Not all pools support
creation of volumes.
Since 1.0.1 VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA
in flags can be used to get higher performance with
qcow2 image files which don't support full preallocation,
by creating a sparse image file with metadata.
virStorageVolFree should be used to free the resources after the
storage volume object is no longer needed. """
ret = libvirtmod.virStorageVolCreateXML(self._o, xmlDesc, flags)
if ret is None:raise libvirtError('virStorageVolCreateXML() failed', pool=self)
__tmp = virStorageVol(self, _obj=ret)
return __tmp
def createXMLFrom(self, xmlDesc, clonevol, flags=0):
"""Create a storage volume in the parent pool, using the
'clonevol' volume as input. Information for the new
volume (name, perms) are passed via a typical volume
XML description.
Since 1.0.1 VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA
in flags can be used to get higher performance with
qcow2 image files which don't support full preallocation,
by creating a sparse image file with metadata.
virStorageVolFree should be used to free the resources after the
storage volume object is no longer needed. """
if clonevol is None: clonevol__o = None
else: clonevol__o = clonevol._o
ret = libvirtmod.virStorageVolCreateXMLFrom(self._o, xmlDesc, clonevol__o, flags)
if ret is None:raise libvirtError('virStorageVolCreateXMLFrom() failed', pool=self)
__tmp = virStorageVol(self, _obj=ret)
return __tmp
def delete(self, flags=0):
"""Delete the underlying pool resources. This is
a non-recoverable operation. The virStoragePoolPtr object
itself is not free'd. """
ret = libvirtmod.virStoragePoolDelete(self._o, flags)
if ret == -1: raise libvirtError ('virStoragePoolDelete() failed', pool=self)
return ret
def destroy(self):
"""Destroy an active storage pool. This will deactivate the
pool on the host, but keep any persistent config associated
with it. If it has a persistent config it can later be
restarted with virStoragePoolCreate(). This does not free
the associated virStoragePoolPtr object. """
ret = libvirtmod.virStoragePoolDestroy(self._o)
if ret == -1: raise libvirtError ('virStoragePoolDestroy() failed', pool=self)
return ret
#
# virStoragePool functions from module python
#
def info(self):
"""Extract information about a storage pool. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted. """
ret = libvirtmod.virStoragePoolGetInfo(self._o)
if ret is None: raise libvirtError ('virStoragePoolGetInfo() failed', pool=self)
return ret
#
# virStoragePool functions from module libvirt-storage
#
def isActive(self):
"""Determine if the storage pool is currently running """
ret = libvirtmod.virStoragePoolIsActive(self._o)
if ret == -1: raise libvirtError ('virStoragePoolIsActive() failed', pool=self)
return ret
def isPersistent(self):
"""Determine if the storage pool has a persistent configuration
which means it will still exist after shutting down """
ret = libvirtmod.virStoragePoolIsPersistent(self._o)
if ret == -1: raise libvirtError ('virStoragePoolIsPersistent() failed', pool=self)
return ret
#
# virStoragePool functions from module python
#
def listVolumes(self):
"""list the storage volumes, stores the pointers to the names in @names """
ret = libvirtmod.virStoragePoolListVolumes(self._o)
if ret is None: raise libvirtError ('virStoragePoolListVolumes() failed', pool=self)
return ret
#
# virStoragePool functions from module libvirt-storage
#
def name(self):
"""Fetch the locally unique name of the storage pool """
ret = libvirtmod.virStoragePoolGetName(self._o)
return ret
def numOfVolumes(self):
"""Fetch the number of storage volumes within a pool """
ret = libvirtmod.virStoragePoolNumOfVolumes(self._o)
if ret == -1: raise libvirtError ('virStoragePoolNumOfVolumes() failed', pool=self)
return ret
def refresh(self, flags=0):
"""Request that the pool refresh its list of volumes. This may
involve communicating with a remote server, and/or initializing
new devices at the OS layer """
ret = libvirtmod.virStoragePoolRefresh(self._o, flags)
if ret == -1: raise libvirtError ('virStoragePoolRefresh() failed', pool=self)
return ret
def setAutostart(self, autostart):
"""Sets the autostart flag """
ret = libvirtmod.virStoragePoolSetAutostart(self._o, autostart)
if ret == -1: raise libvirtError ('virStoragePoolSetAutostart() failed', pool=self)
return ret
def storageVolLookupByName(self, name):
"""Fetch a pointer to a storage volume based on its name
within a pool
virStorageVolFree should be used to free the resources after the
storage volume object is no longer needed. """
ret = libvirtmod.virStorageVolLookupByName(self._o, name)
if ret is None:raise libvirtError('virStorageVolLookupByName() failed', pool=self)
__tmp = virStorageVol(self, _obj=ret)
return __tmp
def undefine(self):
"""Undefine an inactive storage pool """
ret = libvirtmod.virStoragePoolUndefine(self._o)
if ret == -1: raise libvirtError ('virStoragePoolUndefine() failed', pool=self)
return ret
#
# virStoragePool methods from virStoragePool.py (hand coded)
#
def listAllVolumes(self, flags=0):
"""List all storage volumes and returns a list of storage volume objects"""
ret = libvirtmod.virStoragePoolListAllVolumes(self._o, flags)
if ret is None:
raise libvirtError("virStoragePoolListAllVolumes() failed", conn=self)
retlist = list()
for volptr in ret:
retlist.append(virStorageVol(self, _obj=volptr))
return retlist
class virStorageVol(object):
def __init__(self, conn, _obj=None):
self._conn = conn
if not isinstance(conn, virConnect):
self._conn = conn._conn
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def __del__(self):
if self._o is not None:
libvirtmod.virStorageVolFree(self._o)
self._o = None
def connect(self):
return self._conn
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virStorageVol_pointer(self._o)
#
# virStorageVol functions from module libvirt-storage
#
def XMLDesc(self, flags=0):
"""Fetch an XML document describing all aspects of
the storage volume """
ret = libvirtmod.virStorageVolGetXMLDesc(self._o, flags)
if ret is None: raise libvirtError ('virStorageVolGetXMLDesc() failed', vol=self)
return ret
def delete(self, flags=0):
"""Delete the storage volume from the pool """
ret = libvirtmod.virStorageVolDelete(self._o, flags)
if ret == -1: raise libvirtError ('virStorageVolDelete() failed', vol=self)
return ret
def download(self, stream, offset, length, flags=0):
"""Download the content of the volume as a stream. If @length
is zero, then the remaining contents of the volume after
@offset will be downloaded.
If VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM is set in @flags
effective transmission of holes is enabled. This assumes using
the @stream with combination of virStreamSparseRecvAll() or
virStreamRecvFlags(stream, ..., flags =
VIR_STREAM_RECV_STOP_AT_HOLE) for honouring holes sent by
server.
This call sets up an asynchronous stream; subsequent use of
stream APIs is necessary to transfer the actual data,
determine how much data is successfully transferred, and
detect any errors. The results will be unpredictable if
another active stream is writing to the storage volume. """
if stream is None: stream__o = None
else: stream__o = stream._o
ret = libvirtmod.virStorageVolDownload(self._o, stream__o, offset, length, flags)
if ret == -1: raise libvirtError ('virStorageVolDownload() failed', vol=self)
return ret
#
# virStorageVol functions from module python
#
def info(self):
"""Extract information about a storage volume. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted. """
ret = libvirtmod.virStorageVolGetInfo(self._o)
if ret is None: raise libvirtError ('virStorageVolGetInfo() failed', vol=self)
return ret
def infoFlags(self, flags=0):
"""Extract information about a storage volume. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted. """
ret = libvirtmod.virStorageVolGetInfoFlags(self._o, flags)
if ret is None: raise libvirtError ('virStorageVolGetInfoFlags() failed', vol=self)
return ret
#
# virStorageVol functions from module libvirt-storage
#
def key(self):
"""Fetch the storage volume key. This is globally
unique, so the same volume will have the same
key no matter what host it is accessed from """
ret = libvirtmod.virStorageVolGetKey(self._o)
if ret is None: raise libvirtError ('virStorageVolGetKey() failed', vol=self)
return ret
def name(self):
"""Fetch the storage volume name. This is unique
within the scope of a pool """
ret = libvirtmod.virStorageVolGetName(self._o)
return ret
def path(self):
"""Fetch the storage volume path. Depending on the pool
configuration this is either persistent across hosts,
or dynamically assigned at pool startup. Consult
pool documentation for information on getting the
persistent naming """
ret = libvirtmod.virStorageVolGetPath(self._o)
if ret is None: raise libvirtError ('virStorageVolGetPath() failed', vol=self)
return ret
def resize(self, capacity, flags=0):
"""Changes the capacity of the storage volume @vol to @capacity. The
operation will fail if the new capacity requires allocation that would
exceed the remaining free space in the parent pool. The contents of
the new capacity will appear as all zero bytes. The capacity value will
be rounded to the granularity supported by the hypervisor.
Normally, the operation will attempt to affect capacity with a minimum
impact on allocation (that is, the default operation favors a sparse
resize). If @flags contains VIR_STORAGE_VOL_RESIZE_ALLOCATE, then the
operation will ensure that allocation is sufficient for the new
capacity; this may make the operation take noticeably longer.
Normally, the operation treats @capacity as the new size in bytes;
but if @flags contains VIR_STORAGE_VOL_RESIZE_DELTA, then @capacity
represents the size difference to add to the current size. It is
up to the storage pool implementation whether unaligned requests are
rounded up to the next valid boundary, or rejected.
Normally, this operation should only be used to enlarge capacity;
but if @flags contains VIR_STORAGE_VOL_RESIZE_SHRINK, it is possible to
attempt a reduction in capacity even though it might cause data loss.
If VIR_STORAGE_VOL_RESIZE_DELTA is also present, then @capacity is
subtracted from the current size; without it, @capacity represents
the absolute new size regardless of whether it is larger or smaller
than the current size. """
ret = libvirtmod.virStorageVolResize(self._o, capacity, flags)
if ret == -1: raise libvirtError ('virStorageVolResize() failed', vol=self)
return ret
def storagePoolLookupByVolume(self):
"""Fetch a storage pool which contains a particular volume
virStoragePoolFree should be used to free the resources after the
storage pool object is no longer needed. """
ret = libvirtmod.virStoragePoolLookupByVolume(self._o)
if ret is None:raise libvirtError('virStoragePoolLookupByVolume() failed', vol=self)
__tmp = virStoragePool(self, _obj=ret)
return __tmp
def upload(self, stream, offset, length, flags=0):
"""Upload new content to the volume from a stream. This call
will fail if @offset + @length exceeds the size of the
volume. Otherwise, if @length is non-zero, an error
will be raised if an attempt is made to upload greater
than @length bytes of data.
If VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM is set in @flags
effective transmission of holes is enabled. This assumes using
the @stream with combination of virStreamSparseSendAll() or
virStreamSendHole() to preserve source file sparseness.
This call sets up an asynchronous stream; subsequent use of
stream APIs is necessary to transfer the actual data,
determine how much data is successfully transferred, and
detect any errors. The results will be unpredictable if
another active stream is writing to the storage volume.
When the data stream is closed whether the upload is successful
or not the target storage pool will be refreshed to reflect pool
and volume changes as a result of the upload. Depending on
the target volume storage backend and the source stream type
for a successful upload, the target volume may take on the
characteristics from the source stream such as format type,
capacity, and allocation. """
if stream is None: stream__o = None
else: stream__o = stream._o
ret = libvirtmod.virStorageVolUpload(self._o, stream__o, offset, length, flags)
if ret == -1: raise libvirtError ('virStorageVolUpload() failed', vol=self)
return ret
def wipe(self, flags=0):
"""Ensure data previously on a volume is not accessible to future reads.
The data to be wiped may include the format and possibly size information,
so non-raw images might become raw with a different size. It is storage
backend dependent whether the format and size information is regenerated
once the initial volume wipe is completed.
Depending on the actual volume representation, this call may not
overwrite the physical location of the volume. For instance, files
stored journaled, log structured, copy-on-write, versioned, and
network file systems are known to be problematic. """
ret = libvirtmod.virStorageVolWipe(self._o, flags)
if ret == -1: raise libvirtError ('virStorageVolWipe() failed', vol=self)
return ret
def wipePattern(self, algorithm, flags=0):
"""Similar to virStorageVolWipe, but one can choose between
different wiping algorithms. Also note, that depending on the
actual volume representation, this call may not really
overwrite the physical location of the volume. For instance,
files stored journaled, log structured, copy-on-write,
versioned, and network file systems are known to be
problematic. """
ret = libvirtmod.virStorageVolWipePattern(self._o, algorithm, flags)
if ret == -1: raise libvirtError ('virStorageVolWipePattern() failed', vol=self)
return ret
class virConnect(object):
def __init__(self, _obj=None):
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virConnect_pointer(self._o)
#
# virConnect functions from module python
#
def allocPages(self, pages, startCell=0, cellCount=0, flags=0):
"""Allocate or free some pages in the huge pages pool """
ret = libvirtmod.virNodeAllocPages(self._o, pages, startCell, cellCount, flags)
if ret == -1: raise libvirtError ('virNodeAllocPages() failed', conn=self)
return ret
def baselineCPU(self, xmlCPUs, flags=0):
"""Computes the most feature-rich CPU which is compatible with all given host CPUs. """
ret = libvirtmod.virConnectBaselineCPU(self._o, xmlCPUs, flags)
if ret is None: raise libvirtError ('virConnectBaselineCPU() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-interface
#
def changeBegin(self, flags=0):
"""This function creates a restore point to which one can return
later by calling virInterfaceChangeRollback(). This function should
be called before any transaction with interface configuration.
Once it is known that a new configuration works, it can be committed via
virInterfaceChangeCommit(), which frees the restore point.
If virInterfaceChangeBegin() is called when a transaction is
already opened, this function will fail, and a
VIR_ERR_INVALID_OPERATION will be logged. """
ret = libvirtmod.virInterfaceChangeBegin(self._o, flags)
if ret == -1: raise libvirtError ('virInterfaceChangeBegin() failed', conn=self)
return ret
def changeCommit(self, flags=0):
"""This commits the changes made to interfaces and frees the restore point
created by virInterfaceChangeBegin().
If virInterfaceChangeCommit() is called when a transaction is not
opened, this function will fail, and a VIR_ERR_INVALID_OPERATION
will be logged. """
ret = libvirtmod.virInterfaceChangeCommit(self._o, flags)
if ret == -1: raise libvirtError ('virInterfaceChangeCommit() failed', conn=self)
return ret
def changeRollback(self, flags=0):
"""This cancels changes made to interfaces settings by restoring previous
state created by virInterfaceChangeBegin().
If virInterfaceChangeRollback() is called when a transaction is not
opened, this function will fail, and a VIR_ERR_INVALID_OPERATION
will be logged. """
ret = libvirtmod.virInterfaceChangeRollback(self._o, flags)
if ret == -1: raise libvirtError ('virInterfaceChangeRollback() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-host
#
def close(self):
"""This function closes the connection to the Hypervisor. This should
not be called if further interaction with the Hypervisor are needed
especially if there is running domain which need further monitoring by
the application.
Connections are reference counted; the count is explicitly
increased by the initial open (virConnectOpen, virConnectOpenAuth,
and the like) as well as virConnectRef; it is also temporarily
increased by other API that depend on the connection remaining
alive. The open and every virConnectRef call should have a
matching virConnectClose, and all other references will be released
after the corresponding operation completes. """
ret = libvirtmod.virConnectClose(self._o)
self._o = None
if ret == -1: raise libvirtError ('virConnectClose() failed', conn=self)
return ret
def compareCPU(self, xmlDesc, flags=0):
"""Compares the given CPU description with the host CPU """
ret = libvirtmod.virConnectCompareCPU(self._o, xmlDesc, flags)
if ret == -1: raise libvirtError ('virConnectCompareCPU() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-domain
#
def createLinux(self, xmlDesc, flags=0):
"""Deprecated after 0.4.6.
Renamed to virDomainCreateXML() providing identical functionality.
This existing name will be left indefinitely for API compatibility. """
ret = libvirtmod.virDomainCreateLinux(self._o, xmlDesc, flags)
if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
def createXML(self, xmlDesc, flags=0):
"""Launch a new guest domain, based on an XML description similar
to the one returned by virDomainGetXMLDesc()
This function may require privileged access to the hypervisor.
The domain is not persistent, so its definition will disappear when it
is destroyed, or if the host is restarted (see virDomainDefineXML() to
define persistent domains).
If the VIR_DOMAIN_START_PAUSED flag is set, the guest domain
will be started, but its CPUs will remain paused. The CPUs
can later be manually started using virDomainResume.
If the VIR_DOMAIN_START_AUTODESTROY flag is set, the guest
domain will be automatically destroyed when the virConnectPtr
object is finally released. This will also happen if the
client application crashes / loses its connection to the
libvirtd daemon. Any domains marked for auto destroy will
block attempts at migration, save-to-file, or snapshots.
virDomainFree should be used to free the resources after the
domain object is no longer needed. """
ret = libvirtmod.virDomainCreateXML(self._o, xmlDesc, flags)
if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
def defineXML(self, xml):
"""Define a domain, but does not start it.
This definition is persistent, until explicitly undefined with
virDomainUndefine(). A previous definition for this domain would be
overridden if it already exists.
Some hypervisors may prevent this operation if there is a current
block copy operation on a transient domain with the same id as the
domain being defined; in that case, use virDomainBlockJobAbort() to
stop the block copy first.
virDomainFree should be used to free the resources after the
domain object is no longer needed. """
ret = libvirtmod.virDomainDefineXML(self._o, xml)
if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
def defineXMLFlags(self, xml, flags=0):
"""Defines a domain, but does not start it.
This definition is persistent, until explicitly undefined with
virDomainUndefine(). A previous definition for this domain would be
overridden if it already exists.
Some hypervisors may prevent this operation if there is a current
block copy operation on a transient domain with the same id as the
domain being defined; in that case, use virDomainBlockJobAbort() to
stop the block copy first.
virDomainFree should be used to free the resources after the
domain object is no longer needed. """
ret = libvirtmod.virDomainDefineXMLFlags(self._o, xml, flags)
if ret is None:raise libvirtError('virDomainDefineXMLFlags() failed', conn=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
def domainXMLFromNative(self, nativeFormat, nativeConfig, flags=0):
"""Reads native configuration data describing a domain, and
generates libvirt domain XML. The format of the native
data is hypervisor dependent. """
ret = libvirtmod.virConnectDomainXMLFromNative(self._o, nativeFormat, nativeConfig, flags)
if ret is None: raise libvirtError ('virConnectDomainXMLFromNative() failed', conn=self)
return ret
def domainXMLToNative(self, nativeFormat, domainXml, flags=0):
"""Reads a domain XML configuration document, and generates
a native configuration file describing the domain.
The format of the native data is hypervisor dependent. """
ret = libvirtmod.virConnectDomainXMLToNative(self._o, nativeFormat, domainXml, flags)
if ret is None: raise libvirtError ('virConnectDomainXMLToNative() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-storage
#
def findStoragePoolSources(self, type, srcSpec, flags=0):
"""Talks to a storage backend and attempts to auto-discover the set of
available storage pool sources. e.g. For iSCSI this would be a set of
iSCSI targets. For NFS this would be a list of exported paths. The
srcSpec (optional for some storage pool types, e.g. local ones) is
an instance of the storage pool's source element specifying where
to look for the pools.
srcSpec is not required for some types (e.g., those querying
local storage resources only) """
ret = libvirtmod.virConnectFindStoragePoolSources(self._o, type, srcSpec, flags)
if ret is None: raise libvirtError ('virConnectFindStoragePoolSources() failed', conn=self)
return ret
#
# virConnect functions from module python
#
def getCPUMap(self, flags=0):
"""Get node CPU information """
ret = libvirtmod.virNodeGetCPUMap(self._o, flags)
if ret is None: raise libvirtError ('virNodeGetCPUMap() failed', conn=self)
return ret
def getCPUModelNames(self, arch, flags=0):
"""Get the list of supported CPU models. """
ret = libvirtmod.virConnectGetCPUModelNames(self._o, arch, flags)
if ret is None: raise libvirtError ('virConnectGetCPUModelNames() failed', conn=self)
return ret
def getCPUStats(self, cpuNum, flags=0):
"""Extract node's CPU statistics. """
ret = libvirtmod.virNodeGetCPUStats(self._o, cpuNum, flags)
if ret is None: raise libvirtError ('virNodeGetCPUStats() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-host
#
def getCapabilities(self):
"""Provides capabilities of the hypervisor / driver. """
ret = libvirtmod.virConnectGetCapabilities(self._o)
if ret is None: raise libvirtError ('virConnectGetCapabilities() failed', conn=self)
return ret
#
# virConnect functions from module python
#
def getCellsFreeMemory(self, startCell, maxCells):
"""Returns the available memory for a list of cells """
ret = libvirtmod.virNodeGetCellsFreeMemory(self._o, startCell, maxCells)
if ret is None: raise libvirtError ('virNodeGetCellsFreeMemory() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-domain
#
def getDomainCapabilities(self, emulatorbin, arch, machine, virttype, flags=0):
"""Prior creating a domain (for instance via virDomainCreateXML
or virDomainDefineXML) it may be suitable to know what the
underlying emulator and/or libvirt is capable of. For
instance, if host, libvirt and qemu is capable of VFIO
passthrough and so on. """
ret = libvirtmod.virConnectGetDomainCapabilities(self._o, emulatorbin, arch, machine, virttype, flags)
if ret is None: raise libvirtError ('virConnectGetDomainCapabilities() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-host
#
def getFreeMemory(self):
"""provides the free memory available on the Node
Note: most libvirt APIs provide memory sizes in kibibytes, but in this
function the returned value is in bytes. Divide by 1024 as necessary. """
ret = libvirtmod.virNodeGetFreeMemory(self._o)
return ret
#
# virConnect functions from module python
#
def getFreePages(self, pages, startCell, maxCells, flags=0):
"""Returns the number of available pages for a list of cells and page sizes """
ret = libvirtmod.virNodeGetFreePages(self._o, pages, startCell, maxCells, flags)
if ret is None: raise libvirtError ('virNodeGetFreePages() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-host
#
def getHostname(self):
"""This returns a system hostname on which the hypervisor is
running (based on the result of the gethostname system call, but
possibly expanded to a fully-qualified domain name via getaddrinfo).
If we are connected to a remote system, then this returns the
hostname of the remote system. """
ret = libvirtmod.virConnectGetHostname(self._o)
if ret is None: raise libvirtError ('virConnectGetHostname() failed', conn=self)
return ret
#
# virConnect functions from module python
#
def getInfo(self):
"""Extract hardware information about the Node. Note that the memory size is reported in MiB instead of KiB. """
ret = libvirtmod.virNodeGetInfo(self._o)
if ret is None: raise libvirtError ('virNodeGetInfo() failed', conn=self)
return ret
def getLibVersion(self):
"""Returns the libvirt version of the connection host """
ret = libvirtmod.virConnectGetLibVersion(self._o)
if ret == -1: raise libvirtError ('virConnectGetLibVersion() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-host
#
def getMaxVcpus(self, type):
"""Provides the maximum number of virtual CPUs supported for a guest VM of a
specific type. The 'type' parameter here corresponds to the 'type'
attribute in the <domain> element of the XML. This API doesn't take emulator
limits into consideration, hence the returned value is not guaranteed to be
usable. It is recommended to use virConnectGetDomainCapabilities() and look
for "<vcpu max='...'>" in its output instead. """
ret = libvirtmod.virConnectGetMaxVcpus(self._o, type)
if ret == -1: raise libvirtError ('virConnectGetMaxVcpus() failed', conn=self)
return ret
#
# virConnect functions from module python
#
def getMemoryParameters(self, flags=0):
"""Get the node memory parameters """
ret = libvirtmod.virNodeGetMemoryParameters(self._o, flags)
if ret is None: raise libvirtError ('virNodeGetMemoryParameters() failed', conn=self)
return ret
def getMemoryStats(self, cellNum, flags=0):
"""Extract node's memory statistics. """
ret = libvirtmod.virNodeGetMemoryStats(self._o, cellNum, flags)
if ret is None: raise libvirtError ('virNodeGetMemoryStats() failed', conn=self)
return ret
def getSecurityModel(self):
"""Extract information about the hypervisor security model """
ret = libvirtmod.virNodeGetSecurityModel(self._o)
if ret is None: raise libvirtError ('virNodeGetSecurityModel() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-host
#
def getSysinfo(self, flags=0):
"""This returns the XML description of the sysinfo details for the
host on which the hypervisor is running, in the same format as the
<sysinfo> element of a domain XML. This information is generally
available only for hypervisors running with root privileges. """
ret = libvirtmod.virConnectGetSysinfo(self._o, flags)
if ret is None: raise libvirtError ('virConnectGetSysinfo() failed', conn=self)
return ret
def getType(self):
"""Get the name of the Hypervisor driver used. This is merely the driver
name; for example, both KVM and QEMU guests are serviced by the
driver for the qemu:// URI, so a return of "QEMU" does not indicate
whether KVM acceleration is present. For more details about the
hypervisor, use virConnectGetCapabilities(). """
ret = libvirtmod.virConnectGetType(self._o)
if ret is None: raise libvirtError ('virConnectGetType() failed', conn=self)
return ret
def getURI(self):
"""This returns the URI (name) of the hypervisor connection.
Normally this is the same as or similar to the string passed
to the virConnectOpen/virConnectOpenReadOnly call, but
the driver may make the URI canonical. If name == None
was passed to virConnectOpen, then the driver will return
a non-None URI which can be used to connect to the same
hypervisor later. """
ret = libvirtmod.virConnectGetURI(self._o)
if ret is None: raise libvirtError ('virConnectGetURI() failed', conn=self)
return ret
#
# virConnect functions from module python
#
def getVersion(self):
"""Returns the running hypervisor version of the connection host """
ret = libvirtmod.virConnectGetVersion(self._o)
if ret == -1: raise libvirtError ('virConnectGetVersion() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-interface
#
def interfaceDefineXML(self, xml, flags=0):
"""Define an inactive persistent physical host interface or modify an existing
persistent one from the XML description.
Normally this change in the interface configuration is immediately
permanent/persistent, but if virInterfaceChangeBegin() has been
previously called (i.e. if an interface config transaction is
open), the new interface definition will only become permanent if
virInterfaceChangeCommit() is called prior to the next reboot of
the system running libvirtd. Prior to that time, it can be
explicitly removed using virInterfaceChangeRollback(), or will be
automatically removed during the next reboot of the system running
libvirtd.
virInterfaceFree should be used to free the resources after the
interface object is no longer needed. """
ret = libvirtmod.virInterfaceDefineXML(self._o, xml, flags)
if ret is None:raise libvirtError('virInterfaceDefineXML() failed', conn=self)
__tmp = virInterface(self, _obj=ret)
return __tmp
def interfaceLookupByMACString(self, macstr):
"""Try to lookup an interface on the given hypervisor based on its MAC.
virInterfaceFree should be used to free the resources after the
interface object is no longer needed. """
ret = libvirtmod.virInterfaceLookupByMACString(self._o, macstr)
if ret is None:raise libvirtError('virInterfaceLookupByMACString() failed', conn=self)
__tmp = virInterface(self, _obj=ret)
return __tmp
def interfaceLookupByName(self, name):
"""Try to lookup an interface on the given hypervisor based on its name.
virInterfaceFree should be used to free the resources after the
interface object is no longer needed. """
ret = libvirtmod.virInterfaceLookupByName(self._o, name)
if ret is None:raise libvirtError('virInterfaceLookupByName() failed', conn=self)
__tmp = virInterface(self, _obj=ret)
return __tmp
#
# virConnect functions from module libvirt-host
#
def isAlive(self):
"""Determine if the connection to the hypervisor is still alive
A connection will be classed as alive if it is either local, or running
over a channel (TCP or UNIX socket) which is not closed. """
ret = libvirtmod.virConnectIsAlive(self._o)
if ret == -1: raise libvirtError ('virConnectIsAlive() failed', conn=self)
return ret
def isEncrypted(self):
"""Determine if the connection to the hypervisor is encrypted """
ret = libvirtmod.virConnectIsEncrypted(self._o)
if ret == -1: raise libvirtError ('virConnectIsEncrypted() failed', conn=self)
return ret
def isSecure(self):
"""Determine if the connection to the hypervisor is secure
A connection will be classed as secure if it is either
encrypted, or running over a channel which is not exposed
to eavesdropping (eg a UNIX domain socket, or pipe) """
ret = libvirtmod.virConnectIsSecure(self._o)
if ret == -1: raise libvirtError ('virConnectIsSecure() failed', conn=self)
return ret
#
# virConnect functions from module python
#
def listDefinedDomains(self):
"""list the defined domains, stores the pointers to the names in @names """
ret = libvirtmod.virConnectListDefinedDomains(self._o)
if ret is None: raise libvirtError ('virConnectListDefinedDomains() failed', conn=self)
return ret
def listDefinedInterfaces(self):
"""list the defined interfaces, stores the pointers to the names in @names """
ret = libvirtmod.virConnectListDefinedInterfaces(self._o)
if ret is None: raise libvirtError ('virConnectListDefinedInterfaces() failed', conn=self)
return ret
def listDefinedNetworks(self):
"""list the defined networks, stores the pointers to the names in @names """
ret = libvirtmod.virConnectListDefinedNetworks(self._o)
if ret is None: raise libvirtError ('virConnectListDefinedNetworks() failed', conn=self)
return ret
def listDefinedStoragePools(self):
"""list the defined storage pool, stores the pointers to the names in @names """
ret = libvirtmod.virConnectListDefinedStoragePools(self._o)
if ret is None: raise libvirtError ('virConnectListDefinedStoragePools() failed', conn=self)
return ret
def listDevices(self, cap, flags=0):
"""list the node devices """
ret = libvirtmod.virNodeListDevices(self._o, cap, flags)
if ret is None: raise libvirtError ('virNodeListDevices() failed', conn=self)
return ret
def listDomainsID(self):
"""Returns the list of the ID of the domains on the hypervisor """
ret = libvirtmod.virConnectListDomainsID(self._o)
if ret is None: raise libvirtError ('virConnectListDomainsID() failed', conn=self)
return ret
def listInterfaces(self):
"""list the running interfaces, stores the pointers to the names in @names """
ret = libvirtmod.virConnectListInterfaces(self._o)
if ret is None: raise libvirtError ('virConnectListInterfaces() failed', conn=self)
return ret
#
# virConnect functions from module libvirt
#
def listNWFilters(self):
"""List the defined network filters """
ret = libvirtmod.virConnectListNWFilters(self._o)
if ret is None: raise libvirtError ('virConnectListNWFilters() failed', conn=self)
return ret
#
# virConnect functions from module python
#
def listNetworks(self):
"""list the networks, stores the pointers to the names in @names """
ret = libvirtmod.virConnectListNetworks(self._o)
if ret is None: raise libvirtError ('virConnectListNetworks() failed', conn=self)
return ret
#
# virConnect functions from module libvirt
#
def listSecrets(self):
"""List the defined secret IDs """
ret = libvirtmod.virConnectListSecrets(self._o)
if ret is None: raise libvirtError ('virConnectListSecrets() failed', conn=self)
return ret
#
# virConnect functions from module python
#
def listStoragePools(self):
"""list the storage pools, stores the pointers to the names in @names """
ret = libvirtmod.virConnectListStoragePools(self._o)
if ret is None: raise libvirtError ('virConnectListStoragePools() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-domain
#
def lookupByID(self, id):
"""Try to find a domain based on the hypervisor ID number
Note that this won't work for inactive domains which have an ID of -1,
in that case a lookup based on the Name or UUId need to be done instead.
virDomainFree should be used to free the resources after the
domain object is no longer needed. """
ret = libvirtmod.virDomainLookupByID(self._o, id)
if ret is None:raise libvirtError('virDomainLookupByID() failed', conn=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
def lookupByName(self, name):
"""Try to lookup a domain on the given hypervisor based on its name.
virDomainFree should be used to free the resources after the
domain object is no longer needed. """
ret = libvirtmod.virDomainLookupByName(self._o, name)
if ret is None:raise libvirtError('virDomainLookupByName() failed', conn=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
#
# virConnect functions from module python
#
def lookupByUUID(self, uuid):
"""Try to lookup a domain on the given hypervisor based on its UUID. """
ret = libvirtmod.virDomainLookupByUUID(self._o, uuid)
if ret is None:raise libvirtError('virDomainLookupByUUID() failed', conn=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
#
# virConnect functions from module libvirt-domain
#
def lookupByUUIDString(self, uuidstr):
"""Try to lookup a domain on the given hypervisor based on its UUID.
virDomainFree should be used to free the resources after the
domain object is no longer needed. """
ret = libvirtmod.virDomainLookupByUUIDString(self._o, uuidstr)
if ret is None:raise libvirtError('virDomainLookupByUUIDString() failed', conn=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
#
# virConnect functions from module libvirt-network
#
def networkCreateXML(self, xmlDesc):
"""Create and start a new virtual network, based on an XML description
similar to the one returned by virNetworkGetXMLDesc()
virNetworkFree should be used to free the resources after the
network object is no longer needed. """
ret = libvirtmod.virNetworkCreateXML(self._o, xmlDesc)
if ret is None:raise libvirtError('virNetworkCreateXML() failed', conn=self)
__tmp = virNetwork(self, _obj=ret)
return __tmp
def networkDefineXML(self, xml):
"""Define an inactive persistent virtual network or modify an existing
persistent one from the XML description.
virNetworkFree should be used to free the resources after the
network object is no longer needed. """
ret = libvirtmod.virNetworkDefineXML(self._o, xml)
if ret is None:raise libvirtError('virNetworkDefineXML() failed', conn=self)
__tmp = virNetwork(self, _obj=ret)
return __tmp
def networkLookupByName(self, name):
"""Try to lookup a network on the given hypervisor based on its name.
virNetworkFree should be used to free the resources after the
network object is no longer needed. """
ret = libvirtmod.virNetworkLookupByName(self._o, name)
if ret is None:raise libvirtError('virNetworkLookupByName() failed', conn=self)
__tmp = virNetwork(self, _obj=ret)
return __tmp
#
# virConnect functions from module python
#
def networkLookupByUUID(self, uuid):
"""Try to lookup a network on the given hypervisor based on its UUID. """
ret = libvirtmod.virNetworkLookupByUUID(self._o, uuid)
if ret is None:raise libvirtError('virNetworkLookupByUUID() failed', conn=self)
__tmp = virNetwork(self, _obj=ret)
return __tmp
#
# virConnect functions from module libvirt-network
#
def networkLookupByUUIDString(self, uuidstr):
"""Try to lookup a network on the given hypervisor based on its UUID. """
ret = libvirtmod.virNetworkLookupByUUIDString(self._o, uuidstr)
if ret is None:raise libvirtError('virNetworkLookupByUUIDString() failed', conn=self)
__tmp = virNetwork(self, _obj=ret)
return __tmp
#
# virConnect functions from module libvirt-stream
#
def newStream(self, flags=0):
"""Creates a new stream object which can be used to perform
streamed I/O with other public API function.
When no longer needed, a stream object must be released
with virStreamFree. If a data stream has been used,
then the application must call virStreamFinish or
virStreamAbort before free'ing to, in order to notify
the driver of termination.
If a non-blocking data stream is required passed
VIR_STREAM_NONBLOCK for flags, otherwise pass 0. """
ret = libvirtmod.virStreamNew(self._o, flags)
if ret is None:raise libvirtError('virStreamNew() failed', conn=self)
__tmp = virStream(self, _obj=ret)
return __tmp
#
# virConnect functions from module libvirt-nodedev
#
def nodeDeviceCreateXML(self, xmlDesc, flags=0):
"""Create a new device on the VM host machine, for example, virtual
HBAs created using vport_create.
virNodeDeviceFree should be used to free the resources after the
node device object is no longer needed. """
ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags)
if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self)
__tmp = virNodeDevice(self, _obj=ret)
return __tmp
def nodeDeviceLookupByName(self, name):
"""Lookup a node device by its name.
virNodeDeviceFree should be used to free the resources after the
node device object is no longer needed. """
ret = libvirtmod.virNodeDeviceLookupByName(self._o, name)
if ret is None:raise libvirtError('virNodeDeviceLookupByName() failed', conn=self)
__tmp = virNodeDevice(self, _obj=ret)
return __tmp
def nodeDeviceLookupSCSIHostByWWN(self, wwnn, wwpn, flags=0):
"""Lookup SCSI Host which is capable with 'fc_host' by its WWNN and WWPN.
virNodeDeviceFree should be used to free the resources after the
node device object is no longer needed. """
ret = libvirtmod.virNodeDeviceLookupSCSIHostByWWN(self._o, wwnn, wwpn, flags)
if ret is None:raise libvirtError('virNodeDeviceLookupSCSIHostByWWN() failed', conn=self)
__tmp = virNodeDevice(self, _obj=ret)
return __tmp
#
# virConnect functions from module libvirt-domain
#
def numOfDefinedDomains(self):
"""Provides the number of defined but inactive domains. """
ret = libvirtmod.virConnectNumOfDefinedDomains(self._o)
if ret == -1: raise libvirtError ('virConnectNumOfDefinedDomains() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-interface
#
def numOfDefinedInterfaces(self):
"""Provides the number of defined (inactive) interfaces on the physical host. """
ret = libvirtmod.virConnectNumOfDefinedInterfaces(self._o)
if ret == -1: raise libvirtError ('virConnectNumOfDefinedInterfaces() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-network
#
def numOfDefinedNetworks(self):
"""Provides the number of inactive networks. """
ret = libvirtmod.virConnectNumOfDefinedNetworks(self._o)
if ret == -1: raise libvirtError ('virConnectNumOfDefinedNetworks() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-storage
#
def numOfDefinedStoragePools(self):
"""Provides the number of inactive storage pools """
ret = libvirtmod.virConnectNumOfDefinedStoragePools(self._o)
if ret == -1: raise libvirtError ('virConnectNumOfDefinedStoragePools() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-nodedev
#
def numOfDevices(self, cap, flags=0):
"""Provides the number of node devices.
If the optional 'cap' argument is non-None, then the count
will be restricted to devices with the specified capability """
ret = libvirtmod.virNodeNumOfDevices(self._o, cap, flags)
if ret == -1: raise libvirtError ('virNodeNumOfDevices() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-domain
#
def numOfDomains(self):
"""Provides the number of active domains. """
ret = libvirtmod.virConnectNumOfDomains(self._o)
if ret == -1: raise libvirtError ('virConnectNumOfDomains() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-interface
#
def numOfInterfaces(self):
"""Provides the number of active interfaces on the physical host. """
ret = libvirtmod.virConnectNumOfInterfaces(self._o)
if ret == -1: raise libvirtError ('virConnectNumOfInterfaces() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-nwfilter
#
def numOfNWFilters(self):
"""Provides the number of nwfilters. """
ret = libvirtmod.virConnectNumOfNWFilters(self._o)
if ret == -1: raise libvirtError ('virConnectNumOfNWFilters() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-network
#
def numOfNetworks(self):
"""Provides the number of active networks. """
ret = libvirtmod.virConnectNumOfNetworks(self._o)
if ret == -1: raise libvirtError ('virConnectNumOfNetworks() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-secret
#
def numOfSecrets(self):
"""Fetch number of currently defined secrets. """
ret = libvirtmod.virConnectNumOfSecrets(self._o)
if ret == -1: raise libvirtError ('virConnectNumOfSecrets() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-storage
#
def numOfStoragePools(self):
"""Provides the number of active storage pools """
ret = libvirtmod.virConnectNumOfStoragePools(self._o)
if ret == -1: raise libvirtError ('virConnectNumOfStoragePools() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-nwfilter
#
def nwfilterDefineXML(self, xmlDesc):
"""Define a new network filter, based on an XML description
similar to the one returned by virNWFilterGetXMLDesc()
virNWFilterFree should be used to free the resources after the
nwfilter object is no longer needed. """
ret = libvirtmod.virNWFilterDefineXML(self._o, xmlDesc)
if ret is None:raise libvirtError('virNWFilterDefineXML() failed', conn=self)
__tmp = virNWFilter(self, _obj=ret)
return __tmp
def nwfilterLookupByName(self, name):
"""Try to lookup a network filter on the given hypervisor based on its name.
virNWFilterFree should be used to free the resources after the
nwfilter object is no longer needed. """
ret = libvirtmod.virNWFilterLookupByName(self._o, name)
if ret is None:raise libvirtError('virNWFilterLookupByName() failed', conn=self)
__tmp = virNWFilter(self, _obj=ret)
return __tmp
#
# virConnect functions from module python
#
def nwfilterLookupByUUID(self, uuid):
"""Try to lookup a network filter on the given hypervisor based on its UUID. """
ret = libvirtmod.virNWFilterLookupByUUID(self._o, uuid)
if ret is None:raise libvirtError('virNWFilterLookupByUUID() failed', conn=self)
__tmp = virNWFilter(self, _obj=ret)
return __tmp
#
# virConnect functions from module libvirt-nwfilter
#
def nwfilterLookupByUUIDString(self, uuidstr):
"""Try to lookup an nwfilter on the given hypervisor based on its UUID.
virNWFilterFree should be used to free the resources after the
nwfilter object is no longer needed. """
ret = libvirtmod.virNWFilterLookupByUUIDString(self._o, uuidstr)
if ret is None:raise libvirtError('virNWFilterLookupByUUIDString() failed', conn=self)
__tmp = virNWFilter(self, _obj=ret)
return __tmp
#
# virConnect functions from module libvirt-domain
#
def restore(self, frm):
"""This method will restore a domain saved to disk by virDomainSave().
See virDomainRestoreFlags() for more control. """
ret = libvirtmod.virDomainRestore(self._o, frm)
if ret == -1: raise libvirtError ('virDomainRestore() failed', conn=self)
return ret
def restoreFlags(self, frm, dxml=None, flags=0):
"""This method will restore a domain saved to disk by virDomainSave().
If the hypervisor supports it, @dxml can be used to alter
host-specific portions of the domain XML that will be used when
restoring an image. For example, it is possible to alter the
backing filename that is associated with a disk device, in order to
prepare for file renaming done as part of backing up the disk
device while the domain is stopped.
If @flags includes VIR_DOMAIN_SAVE_BYPASS_CACHE, then libvirt will
attempt to bypass the file system cache while restoring the file, or
fail if it cannot do so for the given system; this can allow less
pressure on file system cache, but also risks slowing restores from NFS.
Normally, the saved state file will remember whether the domain was
running or paused, and restore defaults to the same state.
Specifying VIR_DOMAIN_SAVE_RUNNING or VIR_DOMAIN_SAVE_PAUSED in
@flags will override the default read from the file. These two
flags are mutually exclusive. """
ret = libvirtmod.virDomainRestoreFlags(self._o, frm, dxml, flags)
if ret == -1: raise libvirtError ('virDomainRestoreFlags() failed', conn=self)
return ret
def saveImageDefineXML(self, file, dxml, flags=0):
"""This updates the definition of a domain stored in a saved state
file. @file must be a file created previously by virDomainSave()
or virDomainSaveFlags().
@dxml can be used to alter host-specific portions of the domain XML
that will be used when restoring an image. For example, it is
possible to alter the backing filename that is associated with a
disk device, to match renaming done as part of backing up the disk
device while the domain is stopped.
Normally, the saved state file will remember whether the domain was
running or paused, and restore defaults to the same state.
Specifying VIR_DOMAIN_SAVE_RUNNING or VIR_DOMAIN_SAVE_PAUSED in
@flags will override the default saved into the file; omitting both
leaves the file's default unchanged. These two flags are mutually
exclusive. """
ret = libvirtmod.virDomainSaveImageDefineXML(self._o, file, dxml, flags)
if ret == -1: raise libvirtError ('virDomainSaveImageDefineXML() failed', conn=self)
return ret
def saveImageGetXMLDesc(self, file, flags=0):
"""This method will extract the XML describing the domain at the time
a saved state file was created. @file must be a file created
previously by virDomainSave() or virDomainSaveFlags().
No security-sensitive data will be included unless @flags contains
VIR_DOMAIN_XML_SECURE; this flag is rejected on read-only
connections. For this API, @flags should not contain either
VIR_DOMAIN_XML_INACTIVE or VIR_DOMAIN_XML_UPDATE_CPU. """
ret = libvirtmod.virDomainSaveImageGetXMLDesc(self._o, file, flags)
if ret is None: raise libvirtError ('virDomainSaveImageGetXMLDesc() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-secret
#
def secretDefineXML(self, xml, flags=0):
"""If XML specifies a UUID, locates the specified secret and replaces all
attributes of the secret specified by UUID by attributes specified in xml
(any attributes not specified in xml are discarded).
Otherwise, creates a new secret with an automatically chosen UUID, and
initializes its attributes from xml.
virSecretFree should be used to free the resources after the
secret object is no longer needed. """
ret = libvirtmod.virSecretDefineXML(self._o, xml, flags)
if ret is None:raise libvirtError('virSecretDefineXML() failed', conn=self)
__tmp = virSecret(self, _obj=ret)
return __tmp
#
# virConnect functions from module python
#
def secretLookupByUUID(self, uuid):
"""Try to lookup a secret on the given hypervisor based on its UUID. """
ret = libvirtmod.virSecretLookupByUUID(self._o, uuid)
if ret is None:raise libvirtError('virSecretLookupByUUID() failed', conn=self)
__tmp = virSecret(self, _obj=ret)
return __tmp
#
# virConnect functions from module libvirt-secret
#
def secretLookupByUUIDString(self, uuidstr):
"""Try to lookup a secret on the given hypervisor based on its UUID.
Uses the printable string value to describe the UUID
virSecretFree should be used to free the resources after the
secret object is no longer needed. """
ret = libvirtmod.virSecretLookupByUUIDString(self._o, uuidstr)
if ret is None:raise libvirtError('virSecretLookupByUUIDString() failed', conn=self)
__tmp = virSecret(self, _obj=ret)
return __tmp
def secretLookupByUsage(self, usageType, usageID):
"""Try to lookup a secret on the given hypervisor based on its usage
The usageID is unique within the set of secrets sharing the
same usageType value.
virSecretFree should be used to free the resources after the
secret object is no longer needed. """
ret = libvirtmod.virSecretLookupByUsage(self._o, usageType, usageID)
if ret is None:raise libvirtError('virSecretLookupByUsage() failed', conn=self)
__tmp = virSecret(self, _obj=ret)
return __tmp
#
# virConnect functions from module libvirt-host
#
def setKeepAlive(self, interval, count):
"""Start sending keepalive messages after @interval seconds of inactivity and
consider the connection to be broken when no response is received after
@count keepalive messages sent in a row. In other words, sending count + 1
keepalive message results in closing the connection. When @interval is
<= 0, no keepalive messages will be sent. When @count is 0, the connection
will be automatically closed after @interval seconds of inactivity without
sending any keepalive messages.
Note: The client has to implement and run an event loop with
virEventRegisterImpl() or virEventRegisterDefaultImpl() to be able to
use keepalive messages. Failure to do so may result in connections
being closed unexpectedly.
Note: This API function controls only keepalive messages sent by the client.
If the server is configured to use keepalive you still need to run the event
loop to respond to them, even if you disable keepalives by this function. """
ret = libvirtmod.virConnectSetKeepAlive(self._o, interval, count)
if ret == -1: raise libvirtError ('virConnectSetKeepAlive() failed', conn=self)
return ret
#
# virConnect functions from module python
#
def setMemoryParameters(self, params, flags=0):
"""Change the node memory tunables """
ret = libvirtmod.virNodeSetMemoryParameters(self._o, params, flags)
if ret == -1: raise libvirtError ('virNodeSetMemoryParameters() failed', conn=self)
return ret
#
# virConnect functions from module libvirt-storage
#
def storagePoolCreateXML(self, xmlDesc, flags=0):
"""Create a new storage based on its XML description. The
pool is not persistent, so its definition will disappear
when it is destroyed, or if the host is restarted
virStoragePoolFree should be used to free the resources after the
storage pool object is no longer needed. """
ret = libvirtmod.virStoragePoolCreateXML(self._o, xmlDesc, flags)
if ret is None:raise libvirtError('virStoragePoolCreateXML() failed', conn=self)
__tmp = virStoragePool(self, _obj=ret)
return __tmp
def storagePoolDefineXML(self, xml, flags=0):
"""Define an inactive persistent storage pool or modify an existing persistent
one from the XML description.
virStoragePoolFree should be used to free the resources after the
storage pool object is no longer needed. """
ret = libvirtmod.virStoragePoolDefineXML(self._o, xml, flags)
if ret is None:raise libvirtError('virStoragePoolDefineXML() failed', conn=self)
__tmp = virStoragePool(self, _obj=ret)
return __tmp
def storagePoolLookupByName(self, name):
"""Fetch a storage pool based on its unique name
virStoragePoolFree should be used to free the resources after the
storage pool object is no longer needed. """
ret = libvirtmod.virStoragePoolLookupByName(self._o, name)
if ret is None:raise libvirtError('virStoragePoolLookupByName() failed', conn=self)
__tmp = virStoragePool(self, _obj=ret)
return __tmp
def storagePoolLookupByUUID(self, uuid):
"""Fetch a storage pool based on its globally unique id
virStoragePoolFree should be used to free the resources after the
storage pool object is no longer needed. """
ret = libvirtmod.virStoragePoolLookupByUUID(self._o, uuid)
if ret is None:raise libvirtError('virStoragePoolLookupByUUID() failed', conn=self)
__tmp = virStoragePool(self, _obj=ret)
return __tmp
def storagePoolLookupByUUIDString(self, uuidstr):
"""Fetch a storage pool based on its globally unique id
virStoragePoolFree should be used to free the resources after the
storage pool object is no longer needed. """
ret = libvirtmod.virStoragePoolLookupByUUIDString(self._o, uuidstr)
if ret is None:raise libvirtError('virStoragePoolLookupByUUIDString() failed', conn=self)
__tmp = virStoragePool(self, _obj=ret)
return __tmp
def storageVolLookupByKey(self, key):
"""Fetch a pointer to a storage volume based on its
globally unique key
virStorageVolFree should be used to free the resources after the
storage volume object is no longer needed. """
ret = libvirtmod.virStorageVolLookupByKey(self._o, key)
if ret is None:raise libvirtError('virStorageVolLookupByKey() failed', conn=self)
__tmp = virStorageVol(self, _obj=ret)
return __tmp
def storageVolLookupByPath(self, path):
"""Fetch a pointer to a storage volume based on its
locally (host) unique path
virStorageVolFree should be used to free the resources after the
storage volume object is no longer needed. """
ret = libvirtmod.virStorageVolLookupByPath(self._o, path)
if ret is None:raise libvirtError('virStorageVolLookupByPath() failed', conn=self)
__tmp = virStorageVol(self, _obj=ret)
return __tmp
#
# virConnect functions from module libvirt-host
#
def suspendForDuration(self, target, duration, flags=0):
"""Attempt to suspend the node (host machine) for the given duration of
time in the specified state (Suspend-to-RAM, Suspend-to-Disk or
Hybrid-Suspend). Schedule the node's Real-Time-Clock interrupt to
resume the node after the duration is complete. """
ret = libvirtmod.virNodeSuspendForDuration(self._o, target, duration, flags)
if ret == -1: raise libvirtError ('virNodeSuspendForDuration() failed', conn=self)
return ret
#
# virConnect functions from module virterror
#
def virConnGetLastError(self):
"""Provide a pointer to the last error caught on that connection
This method is not protected against access from multiple
threads. In a multi-threaded application, always use the
global virGetLastError() API which is backed by thread
local storage.
If the connection object was discovered to be invalid by
an API call, then the error will be reported against the
global error object.
Since 0.6.0, all errors reported in the per-connection object
are also duplicated in the global error object. As such an
application can always use virGetLastError(). This method
remains for backwards compatibility. """
ret = libvirtmod.virConnGetLastError(self._o)
return ret
def virConnResetLastError(self):
"""The error object is kept in thread local storage, so separate
threads can safely access this concurrently.
Reset the last error caught on that connection """
libvirtmod.virConnResetLastError(self._o)
#
# virConnect methods from virConnect.py (hand coded)
#
def __del__(self):
try:
for cb,opaque in self.domainEventCallbacks.items():
del self.domainEventCallbacks[cb]
del self.domainEventCallbacks
libvirtmod.virConnectDomainEventDeregister(self._o, self)
except AttributeError:
pass
if self._o is not None:
libvirtmod.virConnectClose(self._o)
self._o = None
def domainEventDeregister(self, cb):
"""Removes a Domain Event Callback. De-registering for a
domain callback will disable delivery of this event type """
try:
del self.domainEventCallbacks[cb]
if len(self.domainEventCallbacks) == 0:
del self.domainEventCallbacks
ret = libvirtmod.virConnectDomainEventDeregister(self._o, self)
if ret == -1: raise libvirtError ('virConnectDomainEventDeregister() failed', conn=self)
except AttributeError:
pass
def domainEventRegister(self, cb, opaque):
"""Adds a Domain Event Callback. Registering for a domain
callback will enable delivery of the events """
try:
self.domainEventCallbacks[cb] = opaque
except AttributeError:
self.domainEventCallbacks = {cb:opaque}
ret = libvirtmod.virConnectDomainEventRegister(self._o, self)
if ret == -1: raise libvirtError ('virConnectDomainEventRegister() failed', conn=self)
def _dispatchDomainEventCallbacks(self, dom, event, detail):
"""Dispatches events to python user domain event callbacks
"""
try:
for cb,opaque in self.domainEventCallbacks.items():
cb(self, virDomain(self, _obj=dom), event, detail, opaque)
return 0
except AttributeError:
pass
def _dispatchDomainEventLifecycleCallback(self, dom, event, detail, cbData):
"""Dispatches events to python user domain lifecycle event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), event, detail, opaque)
return 0
def _dispatchDomainEventGenericCallback(self, dom, cbData):
"""Dispatches events to python user domain generic event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), opaque)
return 0
def _dispatchDomainEventRTCChangeCallback(self, dom, offset, cbData):
"""Dispatches events to python user domain RTC change event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), offset ,opaque)
return 0
def _dispatchDomainEventWatchdogCallback(self, dom, action, cbData):
"""Dispatches events to python user domain watchdog event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), action, opaque)
return 0
def _dispatchDomainEventIOErrorCallback(self, dom, srcPath, devAlias,
action, cbData):
"""Dispatches events to python user domain IO error event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action, opaque)
return 0
def _dispatchDomainEventIOErrorReasonCallback(self, dom, srcPath,
devAlias, action, reason,
cbData):
"""Dispatches events to python user domain IO error event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), srcPath, devAlias, action,
reason, opaque)
return 0
def _dispatchDomainEventGraphicsCallback(self, dom, phase, localAddr,
remoteAddr, authScheme, subject,
cbData):
"""Dispatches events to python user domain graphics event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), phase, localAddr, remoteAddr,
authScheme, subject, opaque)
return 0
def _dispatchDomainEventBlockJobCallback(self, dom, disk, type, status, cbData):
"""Dispatches events to python user domain blockJob/blockJob2 event callbacks
"""
try:
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), disk, type, status, opaque)
return 0
except AttributeError:
pass
def _dispatchDomainEventDiskChangeCallback(self, dom, oldSrcPath, newSrcPath, devAlias, reason, cbData):
"""Dispatches event to python user domain diskChange event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), oldSrcPath, newSrcPath, devAlias, reason, opaque)
return 0
def _dispatchDomainEventTrayChangeCallback(self, dom, devAlias, reason, cbData):
"""Dispatches event to python user domain trayChange event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), devAlias, reason, opaque)
return 0
def _dispatchDomainEventPMWakeupCallback(self, dom, reason, cbData):
"""Dispatches event to python user domain pmwakeup event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), reason, opaque)
return 0
def _dispatchDomainEventPMSuspendCallback(self, dom, reason, cbData):
"""Dispatches event to python user domain pmsuspend event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), reason, opaque)
return 0
def _dispatchDomainEventBalloonChangeCallback(self, dom, actual, cbData):
"""Dispatches events to python user domain balloon change event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), actual, opaque)
return 0
def _dispatchDomainEventPMSuspendDiskCallback(self, dom, reason, cbData):
"""Dispatches event to python user domain pmsuspend-disk event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), reason, opaque)
return 0
def _dispatchDomainEventDeviceRemovedCallback(self, dom, devAlias, cbData):
"""Dispatches event to python user domain device removed event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), devAlias, opaque)
return 0
def _dispatchDomainEventTunableCallback(self, dom, params, cbData):
"""Dispatches event to python user domain tunable event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), params, opaque)
return 0
def _dispatchDomainEventAgentLifecycleCallback(self, dom, state, reason, cbData):
"""Dispatches event to python user domain agent lifecycle event callback
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), state, reason, opaque)
return 0
def _dispatchDomainEventDeviceAddedCallback(self, dom, devAlias, cbData):
"""Dispatches event to python user domain device added event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), devAlias, opaque)
return 0
def _dispatchDomainEventMigrationIterationCallback(self, dom, iteration, cbData):
"""Dispatches event to python user domain migration iteration event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), iteration, opaque)
return 0
def _dispatchDomainEventJobCompletedCallback(self, dom, params, cbData):
"""Dispatches event to python user domain job completed callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), params, opaque)
return 0
def _dispatchDomainEventDeviceRemovalFailedCallback(self, dom, devAlias, cbData):
"""Dispatches event to python user domain device removal failed event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), devAlias, opaque)
return 0
def _dispatchDomainEventMetadataChangeCallback(self, dom, mtype, nsuri, cbData):
"""Dispatches event to python user domain metadata change event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), mtype, nsuri, opaque)
return 0
def _dispatchDomainEventBlockThresholdCallback(self, dom, dev, path, threshold, excess, cbData):
"""Dispatches event to python user domain block device threshold event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virDomain(self, _obj=dom), dev, path, threshold, excess, opaque)
return 0
def domainEventDeregisterAny(self, callbackID):
"""Removes a Domain Event Callback. De-registering for a
domain callback will disable delivery of this event type """
try:
ret = libvirtmod.virConnectDomainEventDeregisterAny(self._o, callbackID)
if ret == -1: raise libvirtError ('virConnectDomainEventDeregisterAny() failed', conn=self)
del self.domainEventCallbackID[callbackID]
except AttributeError:
pass
def _dispatchNetworkEventLifecycleCallback(self, net, event, detail, cbData):
"""Dispatches events to python user network lifecycle event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virNetwork(self, _obj=net), event, detail, opaque)
return 0
def networkEventDeregisterAny(self, callbackID):
"""Removes a Network Event Callback. De-registering for a
network callback will disable delivery of this event type"""
try:
ret = libvirtmod.virConnectNetworkEventDeregisterAny(self._o, callbackID)
if ret == -1: raise libvirtError ('virConnectNetworkEventDeregisterAny() failed', conn=self)
del self.networkEventCallbackID[callbackID]
except AttributeError:
pass
def networkEventRegisterAny(self, net, eventID, cb, opaque):
"""Adds a Network Event Callback. Registering for a network
callback will enable delivery of the events"""
if not hasattr(self, 'networkEventCallbackID'):
self.networkEventCallbackID = {}
cbData = { "cb": cb, "conn": self, "opaque": opaque }
if net is None:
ret = libvirtmod.virConnectNetworkEventRegisterAny(self._o, None, eventID, cbData)
else:
ret = libvirtmod.virConnectNetworkEventRegisterAny(self._o, net._o, eventID, cbData)
if ret == -1:
raise libvirtError ('virConnectNetworkEventRegisterAny() failed', conn=self)
self.networkEventCallbackID[ret] = opaque
return ret
def domainEventRegisterAny(self, dom, eventID, cb, opaque):
"""Adds a Domain Event Callback. Registering for a domain
callback will enable delivery of the events """
if not hasattr(self, 'domainEventCallbackID'):
self.domainEventCallbackID = {}
cbData = { "cb": cb, "conn": self, "opaque": opaque }
if dom is None:
ret = libvirtmod.virConnectDomainEventRegisterAny(self._o, None, eventID, cbData)
else:
ret = libvirtmod.virConnectDomainEventRegisterAny(self._o, dom._o, eventID, cbData)
if ret == -1:
raise libvirtError ('virConnectDomainEventRegisterAny() failed', conn=self)
self.domainEventCallbackID[ret] = opaque
return ret
def _dispatchStoragePoolEventLifecycleCallback(self, pool, event, detail, cbData):
"""Dispatches events to python user storage pool
lifecycle event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virStoragePool(self, _obj=pool), event, detail, opaque)
return 0
def _dispatchStoragePoolEventGenericCallback(self, pool, cbData):
"""Dispatches events to python user storage pool
generic event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virStoragePool(self, _obj=pool), opaque)
return 0
def storagePoolEventDeregisterAny(self, callbackID):
"""Removes a Storage Pool Event Callback. De-registering for a
storage pool callback will disable delivery of this event type"""
try:
ret = libvirtmod.virConnectStoragePoolEventDeregisterAny(self._o, callbackID)
if ret == -1: raise libvirtError ('virConnectStoragePoolEventDeregisterAny() failed', conn=self)
del self.storagePoolEventCallbackID[callbackID]
except AttributeError:
pass
def storagePoolEventRegisterAny(self, pool, eventID, cb, opaque):
"""Adds a Storage Pool Event Callback. Registering for a storage pool
callback will enable delivery of the events"""
if not hasattr(self, 'storagePoolEventCallbackID'):
self.storagePoolEventCallbackID = {}
cbData = { "cb": cb, "conn": self, "opaque": opaque }
if pool is None:
ret = libvirtmod.virConnectStoragePoolEventRegisterAny(self._o, None, eventID, cbData)
else:
ret = libvirtmod.virConnectStoragePoolEventRegisterAny(self._o, pool._o, eventID, cbData)
if ret == -1:
raise libvirtError ('virConnectStoragePoolEventRegisterAny() failed', conn=self)
self.storagePoolEventCallbackID[ret] = opaque
return ret
def _dispatchNodeDeviceEventLifecycleCallback(self, dev, event, detail, cbData):
"""Dispatches events to python user node device
lifecycle event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virNodeDevice(self, _obj=dev), event, detail, opaque)
return 0
def _dispatchNodeDeviceEventGenericCallback(self, dev, cbData):
"""Dispatches events to python user node device
generic event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virNodeDevice(self, _obj=dev), opaque)
return 0
def nodeDeviceEventDeregisterAny(self, callbackID):
"""Removes a Node Device Event Callback. De-registering for a
node device callback will disable delivery of this event type"""
try:
ret = libvirtmod.virConnectNodeDeviceEventDeregisterAny(self._o, callbackID)
if ret == -1: raise libvirtError ('virConnectNodeDeviceEventDeregisterAny() failed', conn=self)
del self.nodeDeviceEventCallbackID[callbackID]
except AttributeError:
pass
def nodeDeviceEventRegisterAny(self, dev, eventID, cb, opaque):
"""Adds a Node Device Event Callback. Registering for a node device
callback will enable delivery of the events"""
if not hasattr(self, 'nodeDeviceEventCallbackID'):
self.nodeDeviceEventCallbackID = {}
cbData = { "cb": cb, "conn": self, "opaque": opaque }
if dev is None:
ret = libvirtmod.virConnectNodeDeviceEventRegisterAny(self._o, None, eventID, cbData)
else:
ret = libvirtmod.virConnectNodeDeviceEventRegisterAny(self._o, dev._o, eventID, cbData)
if ret == -1:
raise libvirtError ('virConnectNodeDeviceEventRegisterAny() failed', conn=self)
self.nodeDeviceEventCallbackID[ret] = opaque
return ret
def _dispatchSecretEventLifecycleCallback(self, secret, event, detail, cbData):
"""Dispatches events to python user secret lifecycle event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virSecret(self, _obj=secret), event, detail, opaque)
return 0
def _dispatchSecretEventGenericCallback(self, secret, cbData):
"""Dispatches events to python user secret generic event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, virSecret(self, _obj=secret), opaque)
return 0
def secretEventDeregisterAny(self, callbackID):
"""Removes a Secret Event Callback. De-registering for a
secret callback will disable delivery of this event type"""
try:
ret = libvirtmod.virConnectSecretEventDeregisterAny(self._o, callbackID)
if ret == -1: raise libvirtError ('virConnectSecretEventDeregisterAny() failed', conn=self)
del self.secretEventCallbackID[callbackID]
except AttributeError:
pass
def secretEventRegisterAny(self, secret, eventID, cb, opaque):
"""Adds a Secret Event Callback. Registering for a secret
callback will enable delivery of the events"""
if not hasattr(self, 'secretEventCallbackID'):
self.secretEventCallbackID = {}
cbData = { "cb": cb, "conn": self, "opaque": opaque }
if secret is None:
ret = libvirtmod.virConnectSecretEventRegisterAny(self._o, None, eventID, cbData)
else:
ret = libvirtmod.virConnectSecretEventRegisterAny(self._o, secret._o, eventID, cbData)
if ret == -1:
raise libvirtError ('virConnectSecretEventRegisterAny() failed', conn=self)
self.secretEventCallbackID[ret] = opaque
return ret
def listAllDomains(self, flags=0):
"""List all domains and returns a list of domain objects"""
ret = libvirtmod.virConnectListAllDomains(self._o, flags)
if ret is None:
raise libvirtError("virConnectListAllDomains() failed", conn=self)
retlist = list()
for domptr in ret:
retlist.append(virDomain(self, _obj=domptr))
return retlist
def listAllStoragePools(self, flags=0):
"""Returns a list of storage pool objects"""
ret = libvirtmod.virConnectListAllStoragePools(self._o, flags)
if ret is None:
raise libvirtError("virConnectListAllStoragePools() failed", conn=self)
retlist = list()
for poolptr in ret:
retlist.append(virStoragePool(self, _obj=poolptr))
return retlist
def listAllNetworks(self, flags=0):
"""Returns a list of network objects"""
ret = libvirtmod.virConnectListAllNetworks(self._o, flags)
if ret is None:
raise libvirtError("virConnectListAllNetworks() failed", conn=self)
retlist = list()
for netptr in ret:
retlist.append(virNetwork(self, _obj=netptr))
return retlist
def listAllInterfaces(self, flags=0):
"""Returns a list of interface objects"""
ret = libvirtmod.virConnectListAllInterfaces(self._o, flags)
if ret is None:
raise libvirtError("virConnectListAllInterfaces() failed", conn=self)
retlist = list()
for ifaceptr in ret:
retlist.append(virInterface(self, _obj=ifaceptr))
return retlist
def listAllDevices(self, flags=0):
"""Returns a list of host node device objects"""
ret = libvirtmod.virConnectListAllNodeDevices(self._o, flags)
if ret is None:
raise libvirtError("virConnectListAllNodeDevices() failed", conn=self)
retlist = list()
for devptr in ret:
retlist.append(virNodeDevice(self, _obj=devptr))
return retlist
def listAllNWFilters(self, flags=0):
"""Returns a list of network filter objects"""
ret = libvirtmod.virConnectListAllNWFilters(self._o, flags)
if ret is None:
raise libvirtError("virConnectListAllNWFilters() failed", conn=self)
retlist = list()
for filter_ptr in ret:
retlist.append(virNWFilter(self, _obj=filter_ptr))
return retlist
def listAllSecrets(self, flags=0):
"""Returns a list of secret objects"""
ret = libvirtmod.virConnectListAllSecrets(self._o, flags)
if ret is None:
raise libvirtError("virConnectListAllSecrets() failed", conn=self)
retlist = list()
for secret_ptr in ret:
retlist.append(virSecret(self, _obj=secret_ptr))
return retlist
def _dispatchCloseCallback(self, reason, cbData):
"""Dispatches events to python user close callback"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, reason, opaque)
return 0
def unregisterCloseCallback(self):
"""Removes a close event callback"""
ret = libvirtmod.virConnectUnregisterCloseCallback(self._o)
if ret == -1: raise libvirtError ('virConnectUnregisterCloseCallback() failed', conn=self)
def registerCloseCallback(self, cb, opaque):
"""Adds a close event callback, providing a notification
when a connection fails / closes"""
cbData = { "cb": cb, "conn": self, "opaque": opaque }
ret = libvirtmod.virConnectRegisterCloseCallback(self._o, cbData)
if ret == -1:
raise libvirtError ('virConnectRegisterCloseCallback() failed', conn=self)
return ret
def createXMLWithFiles(self, xmlDesc, files, flags=0):
"""Launch a new guest domain, based on an XML description similar
to the one returned by virDomainGetXMLDesc()
This function may require privileged access to the hypervisor.
The domain is not persistent, so its definition will disappear when it
is destroyed, or if the host is restarted (see virDomainDefineXML() to
define persistent domains).
@files provides an array of file descriptors which will be
made available to the 'init' process of the guest. The file
handles exposed to the guest will be renumbered to start
from 3 (ie immediately following stderr). This is only
supported for guests which use container based virtualization
technology.
If the VIR_DOMAIN_START_PAUSED flag is set, the guest domain
will be started, but its CPUs will remain paused. The CPUs
can later be manually started using virDomainResume.
If the VIR_DOMAIN_START_AUTODESTROY flag is set, the guest
domain will be automatically destroyed when the virConnectPtr
object is finally released. This will also happen if the
client application crashes / loses its connection to the
libvirtd daemon. Any domains marked for auto destroy will
block attempts at migration, save-to-file, or snapshots. """
ret = libvirtmod.virDomainCreateXMLWithFiles(self._o, xmlDesc, files, flags)
if ret is None:raise libvirtError('virDomainCreateXMLWithFiles() failed', conn=self)
__tmp = virDomain(self,_obj=ret)
return __tmp
def getAllDomainStats(self, stats = 0, flags=0):
"""Query statistics for all domains on a given connection.
Report statistics of various parameters for a running VM according to @stats
field. The statistics are returned as an array of structures for each queried
domain. The structure contains an array of typed parameters containing the
individual statistics. The typed parameter name for each statistic field
consists of a dot-separated string containing name of the requested group
followed by a group specific description of the statistic value.
The statistic groups are enabled using the @stats parameter which is a
binary-OR of enum virDomainStatsTypes. The following groups are available
(although not necessarily implemented for each hypervisor):
VIR_DOMAIN_STATS_STATE: Return domain state and reason for entering that
state. The typed parameter keys are in this format:
"state.state" - state of the VM, returned as int from virDomainState enum
"state.reason" - reason for entering given state, returned as int from
virDomain*Reason enum corresponding to given state.
Using 0 for @stats returns all stats groups supported by the given
hypervisor.
Specifying VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS as @flags makes
the function return error in case some of the stat types in @stats were
not recognized by the daemon.
Similarly to virConnectListAllDomains, @flags can contain various flags to
filter the list of domains to provide stats for.
VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE selects online domains while
VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE selects offline ones.
VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT and
VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT allow to filter the list
according to their persistence.
To filter the list of VMs by domain state @flags can contain
VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING,
VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED,
VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF and/or
VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER for all other states. """
ret = libvirtmod.virConnectGetAllDomainStats(self._o, stats, flags)
if ret is None:
raise libvirtError("virConnectGetAllDomainStats() failed", conn=self)
retlist = list()
for elem in ret:
record = (virDomain(self, _obj=elem[0]) , elem[1])
retlist.append(record)
return retlist
def domainListGetStats(self, doms, stats=0, flags=0):
""" Query statistics for given domains.
Report statistics of various parameters for a running VM according to @stats
field. The statistics are returned as an array of structures for each queried
domain. The structure contains an array of typed parameters containing the
individual statistics. The typed parameter name for each statistic field
consists of a dot-separated string containing name of the requested group
followed by a group specific description of the statistic value.
The statistic groups are enabled using the @stats parameter which is a
binary-OR of enum virDomainStatsTypes. The following groups are available
(although not necessarily implemented for each hypervisor):
VIR_DOMAIN_STATS_STATE: Return domain state and reason for entering that
state. The typed parameter keys are in this format:
"state.state" - state of the VM, returned as int from virDomainState enum
"state.reason" - reason for entering given state, returned as int from
virDomain*Reason enum corresponding to given state.
Using 0 for @stats returns all stats groups supported by the given
hypervisor.
Specifying VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS as @flags makes
the function return error in case some of the stat types in @stats were
not recognized by the daemon.
Get statistics about domains provided as a list in @doms. @stats is
a bit field selecting requested statistics types."""
domlist = list()
for dom in doms:
if not isinstance(dom, virDomain):
raise libvirtError("domain list contains non-domain elements", conn=self)
domlist.append(dom._o)
ret = libvirtmod.virDomainListGetStats(self._o, domlist, stats, flags)
if ret is None:
raise libvirtError("virDomainListGetStats() failed", conn=self)
retlist = list()
for elem in ret:
record = (virDomain(self, _obj=elem[0]) , elem[1])
retlist.append(record)
return retlist
class virNodeDevice(object):
def __init__(self, conn, _obj=None):
self._conn = conn
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def __del__(self):
if self._o is not None:
libvirtmod.virNodeDeviceFree(self._o)
self._o = None
def connect(self):
return self._conn
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virNodeDevice_pointer(self._o)
#
# virNodeDevice functions from module libvirt-nodedev
#
def XMLDesc(self, flags=0):
"""Fetch an XML document describing all aspects of
the device. """
ret = libvirtmod.virNodeDeviceGetXMLDesc(self._o, flags)
if ret is None: raise libvirtError ('virNodeDeviceGetXMLDesc() failed')
return ret
def destroy(self):
"""Destroy the device object. The virtual device (only works for vHBA
currently) is removed from the host operating system. This function
may require privileged access. """
ret = libvirtmod.virNodeDeviceDestroy(self._o)
if ret == -1: raise libvirtError ('virNodeDeviceDestroy() failed')
return ret
def detachFlags(self, driverName, flags=0):
"""Detach the node device from the node itself so that it may be
assigned to a guest domain.
Depending on the hypervisor, this may involve operations such as
unbinding any device drivers from the device, binding the device to
a dummy device driver and resetting the device. Different backend
drivers expect the device to be bound to different dummy
devices. For example, QEMU's "kvm" backend driver (the default)
expects the device to be bound to "pci-stub", but its "vfio"
backend driver expects the device to be bound to "vfio-pci".
If the device is currently in use by the node, this method may
fail.
Once the device is not assigned to any guest, it may be re-attached
to the node using the virNodeDeviceReAttach() method. """
ret = libvirtmod.virNodeDeviceDetachFlags(self._o, driverName, flags)
if ret == -1: raise libvirtError ('virNodeDeviceDetachFlags() failed')
return ret
def dettach(self):
"""Dettach the node device from the node itself so that it may be
assigned to a guest domain.
Depending on the hypervisor, this may involve operations such
as unbinding any device drivers from the device, binding the
device to a dummy device driver and resetting the device.
If the device is currently in use by the node, this method may
fail.
Once the device is not assigned to any guest, it may be re-attached
to the node using the virNodeDeviceReattach() method.
If the caller needs control over which backend driver will be used
during PCI device assignment (to use something other than the
default, for example VFIO), the newer virNodeDeviceDetachFlags()
API should be used instead. """
ret = libvirtmod.virNodeDeviceDettach(self._o)
if ret == -1: raise libvirtError ('virNodeDeviceDettach() failed')
return ret
#
# virNodeDevice functions from module python
#
def listCaps(self):
"""list the node device's capabilities """
ret = libvirtmod.virNodeDeviceListCaps(self._o)
if ret is None: raise libvirtError ('virNodeDeviceListCaps() failed')
return ret
#
# virNodeDevice functions from module libvirt-nodedev
#
def name(self):
"""Just return the device name """
ret = libvirtmod.virNodeDeviceGetName(self._o)
return ret
def numOfCaps(self):
"""Accessor for the number of capabilities supported by the device. """
ret = libvirtmod.virNodeDeviceNumOfCaps(self._o)
if ret == -1: raise libvirtError ('virNodeDeviceNumOfCaps() failed')
return ret
def parent(self):
"""Accessor for the parent of the device """
ret = libvirtmod.virNodeDeviceGetParent(self._o)
return ret
def reAttach(self):
"""Re-attach a previously detached node device to the node so that it
may be used by the node again.
Depending on the hypervisor, this may involve operations such
as resetting the device, unbinding it from a dummy device driver
and binding it to its appropriate driver.
If the device is currently in use by a guest, this method may fail. """
ret = libvirtmod.virNodeDeviceReAttach(self._o)
if ret == -1: raise libvirtError ('virNodeDeviceReAttach() failed')
return ret
def reset(self):
"""Reset a previously detached node device to the node before or
after assigning it to a guest.
The exact reset semantics depends on the hypervisor and device
type but, for example, KVM will attempt to reset PCI devices with
a Function Level Reset, Secondary Bus Reset or a Power Management
D-State reset.
If the reset will affect other devices which are currently in use,
this function may fail. """
ret = libvirtmod.virNodeDeviceReset(self._o)
if ret == -1: raise libvirtError ('virNodeDeviceReset() failed')
return ret
class virSecret(object):
def __init__(self, conn, _obj=None):
self._conn = conn
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def __del__(self):
if self._o is not None:
libvirtmod.virSecretFree(self._o)
self._o = None
def connect(self):
return self._conn
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virSecret_pointer(self._o)
#
# virSecret functions from module python
#
def UUID(self):
"""Extract the UUID unique Identifier of a secret. """
ret = libvirtmod.virSecretGetUUID(self._o)
if ret is None: raise libvirtError ('virSecretGetUUID() failed')
return ret
def UUIDString(self):
"""Fetch globally unique ID of the secret as a string. """
ret = libvirtmod.virSecretGetUUIDString(self._o)
if ret is None: raise libvirtError ('virSecretGetUUIDString() failed')
return ret
#
# virSecret functions from module libvirt-secret
#
def XMLDesc(self, flags=0):
"""Fetches an XML document describing attributes of the secret. """
ret = libvirtmod.virSecretGetXMLDesc(self._o, flags)
if ret is None: raise libvirtError ('virSecretGetXMLDesc() failed')
return ret
#
# virSecret functions from module libvirt
#
def setValue(self, value, flags=0):
"""Associates a value with a secret. """
ret = libvirtmod.virSecretSetValue(self._o, value, flags)
if ret == -1: raise libvirtError ('virSecretSetValue() failed')
return ret
#
# virSecret functions from module libvirt-secret
#
def undefine(self):
"""Deletes the specified secret. This does not free the associated
virSecretPtr object. """
ret = libvirtmod.virSecretUndefine(self._o)
if ret == -1: raise libvirtError ('virSecretUndefine() failed')
return ret
def usageID(self):
"""Get the unique identifier of the object with which this
secret is to be used. The format of the identifier is
dependent on the usage type of the secret. For a secret
with a usage type of VIR_SECRET_USAGE_TYPE_VOLUME the
identifier will be a fully qualified path name. The
identifiers are intended to be unique within the set of
all secrets sharing the same usage type. ie, there shall
only ever be one secret for each volume path. """
ret = libvirtmod.virSecretGetUsageID(self._o)
return ret
def usageType(self):
"""Get the type of object which uses this secret. The returned
value is one of the constants defined in the virSecretUsageType
enumeration. More values may be added to this enumeration in
the future, so callers should expect to see usage types they
do not explicitly know about. """
ret = libvirtmod.virSecretGetUsageType(self._o)
return ret
#
# virSecret functions from module libvirt
#
def value(self, flags=0):
"""Fetches the value associated with a secret. """
ret = libvirtmod.virSecretGetValue(self._o, flags)
if ret is None: raise libvirtError ('virSecretGetValue() failed')
return ret
class virNWFilter(object):
def __init__(self, conn, _obj=None):
self._conn = conn
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def __del__(self):
if self._o is not None:
libvirtmod.virNWFilterFree(self._o)
self._o = None
def connect(self):
return self._conn
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virNWFilter_pointer(self._o)
#
# virNWFilter functions from module python
#
def UUID(self):
"""Extract the UUID unique Identifier of a network filter. """
ret = libvirtmod.virNWFilterGetUUID(self._o)
if ret is None: raise libvirtError ('virNWFilterGetUUID() failed')
return ret
def UUIDString(self):
"""Fetch globally unique ID of the network filter as a string. """
ret = libvirtmod.virNWFilterGetUUIDString(self._o)
if ret is None: raise libvirtError ('virNWFilterGetUUIDString() failed')
return ret
#
# virNWFilter functions from module libvirt-nwfilter
#
def XMLDesc(self, flags=0):
"""Provide an XML description of the network filter. The description may be
reused later to redefine the network filter with virNWFilterCreateXML(). """
ret = libvirtmod.virNWFilterGetXMLDesc(self._o, flags)
if ret is None: raise libvirtError ('virNWFilterGetXMLDesc() failed')
return ret
def name(self):
"""Get the public name for the network filter """
ret = libvirtmod.virNWFilterGetName(self._o)
return ret
def undefine(self):
"""Undefine the nwfilter object. This call will not succeed if
a running VM is referencing the filter. This does not free the
associated virNWFilterPtr object. """
ret = libvirtmod.virNWFilterUndefine(self._o)
if ret == -1: raise libvirtError ('virNWFilterUndefine() failed')
return ret
class virStream(object):
def __init__(self, conn, _obj=None):
self._conn = conn
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def connect(self):
return self._conn
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virStream_pointer(self._o)
#
# virStream functions from module libvirt-stream
#
def abort(self):
"""Request that the in progress data transfer be cancelled
abnormally before the end of the stream has been reached.
For output streams this can be used to inform the driver
that the stream is being terminated early. For input
streams this can be used to inform the driver that it
should stop sending data.
If the stream is non-blocking, any callback must be removed
beforehand. """
ret = libvirtmod.virStreamAbort(self._o)
if ret == -1: raise libvirtError ('virStreamAbort() failed')
return ret
def eventRemoveCallback(self):
"""Remove an event callback from the stream """
ret = libvirtmod.virStreamEventRemoveCallback(self._o)
if ret == -1: raise libvirtError ('virStreamEventRemoveCallback() failed')
return ret
def eventUpdateCallback(self, events):
"""Changes the set of events to monitor for a stream. This allows
for event notification to be changed without having to
unregister & register the callback completely. This method
is guaranteed to succeed if a callback is already registered """
ret = libvirtmod.virStreamEventUpdateCallback(self._o, events)
if ret == -1: raise libvirtError ('virStreamEventUpdateCallback() failed')
return ret
def finish(self):
"""Indicate that there is no further data to be transmitted
on the stream. For output streams this should be called once
all data has been written. For input streams this should be
called once virStreamRecv returns end-of-file.
This method is a synchronization point for all asynchronous
errors, so if this returns a success code the application can
be sure that all data has been successfully processed.
If the stream is non-blocking, any callback must be removed
beforehand. """
ret = libvirtmod.virStreamFinish(self._o)
if ret == -1: raise libvirtError ('virStreamFinish() failed')
return ret
#
# virStream methods from virStream.py (hand coded)
#
def __del__(self):
try:
if self.cb:
libvirtmod.virStreamEventRemoveCallback(self._o)
except AttributeError:
pass
if self._o is not None:
libvirtmod.virStreamFree(self._o)
self._o = None
def _dispatchStreamEventCallback(self, events, cbData):
"""
Dispatches events to python user's stream event callbacks
"""
cb = cbData["cb"]
opaque = cbData["opaque"]
cb(self, events, opaque)
return 0
def eventAddCallback(self, events, cb, opaque):
self.cb = cb
cbData = {"stream": self, "cb" : cb, "opaque" : opaque}
ret = libvirtmod.virStreamEventAddCallback(self._o, events, cbData)
if ret == -1: raise libvirtError ('virStreamEventAddCallback() failed')
def recvAll(self, handler, opaque):
"""Receive the entire data stream, sending the data to the
requested data sink. This is simply a convenient alternative
to virStreamRecv, for apps that do blocking-I/O.
A hypothetical handler function looks like:
def handler(stream, # virStream instance
buf, # string containing received data
opaque): # extra data passed to recvAll as opaque
fd = opaque
return os.write(fd, buf)
"""
while True:
got = self.recv(1024*64)
if got == -2:
raise libvirtError("cannot use recvAll with "
"nonblocking stream")
if len(got) == 0:
break
try:
ret = handler(self, got, opaque)
if type(ret) is int and ret < 0:
raise RuntimeError("recvAll handler returned %d" % ret)
except Exception:
e = sys.exc_info()[1]
try:
self.abort()
except:
pass
raise e
def sendAll(self, handler, opaque):
"""
Send the entire data stream, reading the data from the
requested data source. This is simply a convenient alternative
to virStreamSend, for apps that do blocking-I/O.
A hypothetical handler function looks like:
def handler(stream, # virStream instance
nbytes, # int amt of data to read
opaque): # extra data passed to recvAll as opaque
fd = opaque
return os.read(fd, nbytes)
"""
while True:
try:
got = handler(self, 1024*64, opaque)
except:
e = sys.exc_info()[1]
try:
self.abort()
except:
pass
raise e
if not got:
break
ret = self.send(got)
if ret == -2:
raise libvirtError("cannot use sendAll with "
"nonblocking stream")
def recv(self, nbytes):
"""Reads a series of bytes from the stream. This method may
block the calling application for an arbitrary amount
of time.
Errors are not guaranteed to be reported synchronously
with the call, but may instead be delayed until a
subsequent call.
On success, the received data is returned. On failure, an
exception is raised. If the stream is a NONBLOCK stream and
the request would block, integer -2 is returned.
"""
ret = libvirtmod.virStreamRecv(self._o, nbytes)
if ret is None: raise libvirtError ('virStreamRecv() failed')
return ret
def send(self, data):
"""Write a series of bytes to the stream. This method may
block the calling application for an arbitrary amount
of time. Once an application has finished sending data
it should call virStreamFinish to wait for successful
confirmation from the driver, or detect any error
This method may not be used if a stream source has been
registered
Errors are not guaranteed to be reported synchronously
with the call, but may instead be delayed until a
subsequent call.
"""
ret = libvirtmod.virStreamSend(self._o, data)
if ret == -1: raise libvirtError ('virStreamSend() failed')
return ret
def recvHole(self, flags = 0):
"""This method is used to determine the length in bytes
of the empty space to be created in a stream's target
file when uploading or downloading sparsely populated
files. This is the counterpart to sendHole.
"""
ret = libvirtmod.virStreamRecvHole(self._o, flags)
if ret is None: raise libvirtError ('virStreamRecvHole() failed')
return ret
def sendHole(self, length, flags = 0):
"""Rather than transmitting empty file space, this method
directs the stream target to create length bytes of empty
space. This method would be used when uploading or
downloading sparsely populated files to avoid the
needless copy of empty file space.
"""
ret = libvirtmod.virStreamSendHole(self._o, length, flags)
if ret == -1: raise libvirtError('virStreamSendHole() failed')
return ret
def recvFlags(self, nbytes, flags = 0):
"""Reads a series of bytes from the stream. This method may
block the calling application for an arbitrary amount
of time. This is just like recv except it has flags
argument.
Errors are not guaranteed to be reported synchronously
with the call, but may instead be delayed until a
subsequent call.
On success, the received data is returned. On failure, an
exception is raised. If the stream is a NONBLOCK stream and
the request would block, integer -2 is returned.
"""
ret = libvirtmod.virStreamRecvFlags(self._o, nbytes, flags)
if ret is None: raise libvirtError ('virStreamRecvFlags() failed')
return ret
def sparseRecvAll(self, handler, holeHandler, opaque):
"""Receive the entire data stream, sending the data to
the requested data sink handler and calling the skip
holeHandler to generate holes for sparse stream targets.
This is simply a convenient alternative to recvFlags, for
apps that do blocking-I/O and want to preserve sparseness.
Hypothetical callbacks can look like this:
def handler(stream, # virStream instance
buf, # string containing received data
opaque): # extra data passed to sparseRecvAll as opaque
fd = opaque
return os.write(fd, buf)
def holeHandler(stream, # virStream instance
length, # number of bytes to skip
opaque): # extra data passed to sparseRecvAll as opaque
fd = opaque
cur = os.lseek(fd, length, os.SEEK_CUR)
return os.ftruncate(fd, cur) # take this extra step to
# actually allocate the hole
"""
while True:
want = 64 * 1024
got = self.recvFlags(want, VIR_STREAM_RECV_STOP_AT_HOLE)
if got == -2:
raise libvirtError("cannot use sparseRecvAll with "
"nonblocking stream")
if got == -3:
length = self.recvHole()
if length is None:
self.abort()
raise RuntimeError("recvHole handler failed")
ret = holeHandler(self, length, opaque)
if type(ret) is int and ret < 0:
self.abort()
raise RuntimeError("holeHandler handler returned %d" % ret)
continue
if len(got) == 0:
break
ret = handler(self, got, opaque)
if type(ret) is int and ret < 0:
self.abort()
raise RuntimeError("sparseRecvAll handler returned %d" % ret)
def sparseSendAll(self, handler, holeHandler, skipHandler, opaque):
"""Send the entire data stream, reading the data from the
requested data source. This is simply a convenient
alternative to virStreamSend, for apps that do
blocking-I/O and want to preserve sparseness.
Hypothetical callbacks can look like this:
def handler(stream, # virStream instance
nbytes, # int amt of data to read
opaque): # extra data passed to sparseSendAll as opaque
fd = opaque
return os.read(fd, nbytes)
def holeHandler(stream, # virStream instance
opaque): # extra data passed to sparseSendAll as opaque
fd = opaque
cur = os.lseek(fd, 0, os.SEEK_CUR)
# ... find out current section and its boundaries
# and set inData = True/False and sectionLen correspondingly
os.lseek(fd, cur, os.SEEK_SET)
return [inData, sectionLen]
def skipHandler(stream, # virStream instance
length, # number of bytes to skip
opaque): # extra data passed to sparseSendAll as opaque
fd = opaque
return os.lseek(fd, length, os.SEEK_CUR)
"""
while True:
[inData, sectionLen] = holeHandler(self, opaque)
if (inData == False and sectionLen > 0):
if (self.sendHole(sectionLen) < 0 or
skipHandler(self, sectionLen, opaque) < 0):
self.abort()
continue
want = 64 * 1024
if (want > sectionLen):
want = sectionLen
got = handler(self, want, opaque)
if type(got) is int and got < 0:
self.abort()
raise RuntimeError("sparseSendAll handler returned %d" % ret)
if not got:
break
ret = self.send(got)
if ret == -2:
raise libvirtError("cannot use sparseSendAll with "
"nonblocking stream")
class virDomainSnapshot(object):
def __init__(self, dom, _obj=None):
self._dom = dom
self._conn = dom.connect()
if type(_obj).__name__ not in ["PyCapsule", "PyCObject"]:
raise Exception("Expected a wrapped C Object but got %s" % type(_obj))
self._o = _obj
def __del__(self):
if self._o is not None:
libvirtmod.virDomainSnapshotFree(self._o)
self._o = None
def connect(self):
return self._conn
def domain(self):
return self._dom
def c_pointer(self):
"""Get C pointer to underlying object"""
return libvirtmod.virDomainSnapshot_pointer(self._o)
#
# virDomainSnapshot functions from module libvirt-domain-snapshot
#
def delete(self, flags=0):
"""Delete the snapshot.
If @flags is 0, then just this snapshot is deleted, and changes
from this snapshot are automatically merged into children
snapshots. If @flags includes VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN,
then this snapshot and any descendant snapshots are deleted. If
@flags includes VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, then any
descendant snapshots are deleted, but this snapshot remains. These
two flags are mutually exclusive.
If @flags includes VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY, then
any snapshot metadata tracked by libvirt is removed while keeping
the snapshot contents intact; if a hypervisor does not require any
libvirt metadata to track snapshots, then this flag is silently
ignored. """
ret = libvirtmod.virDomainSnapshotDelete(self._o, flags)
if ret == -1: raise libvirtError ('virDomainSnapshotDelete() failed')
return ret
def getName(self):
"""Get the public name for that snapshot """
ret = libvirtmod.virDomainSnapshotGetName(self._o)
if ret is None: raise libvirtError ('virDomainSnapshotGetName() failed')
return ret
def getParent(self, flags=0):
"""Get the parent snapshot for @snapshot, if any.
virDomainSnapshotFree should be used to free the resources after the
snapshot object is no longer needed. """
ret = libvirtmod.virDomainSnapshotGetParent(self._o, flags)
if ret is None:raise libvirtError('virDomainSnapshotGetParent() failed', dom=self._dom)
__tmp = virDomainSnapshot(self,_obj=ret)
return __tmp
def getXMLDesc(self, flags=0):
"""Provide an XML description of the domain snapshot.
No security-sensitive data will be included unless @flags contains
VIR_DOMAIN_XML_SECURE; this flag is rejected on read-only
connections. For this API, @flags should not contain either
VIR_DOMAIN_XML_INACTIVE or VIR_DOMAIN_XML_UPDATE_CPU. """
ret = libvirtmod.virDomainSnapshotGetXMLDesc(self._o, flags)
if ret is None: raise libvirtError ('virDomainSnapshotGetXMLDesc() failed')
return ret
def hasMetadata(self, flags=0):
"""Determine if the given snapshot is associated with libvirt metadata
that would prevent the deletion of the domain. """
ret = libvirtmod.virDomainSnapshotHasMetadata(self._o, flags)
if ret == -1: raise libvirtError ('virDomainSnapshotHasMetadata() failed')
return ret
def isCurrent(self, flags=0):
"""Determine if the given snapshot is the domain's current snapshot. See
also virDomainHasCurrentSnapshot(). """
ret = libvirtmod.virDomainSnapshotIsCurrent(self._o, flags)
if ret == -1: raise libvirtError ('virDomainSnapshotIsCurrent() failed')
return ret
#
# virDomainSnapshot functions from module python
#
def listChildrenNames(self, flags=0):
"""collect the list of child snapshot names for the given snapshot """
ret = libvirtmod.virDomainSnapshotListChildrenNames(self._o, flags)
if ret is None: raise libvirtError ('virDomainSnapshotListChildrenNames() failed')
return ret
#
# virDomainSnapshot functions from module libvirt-domain-snapshot
#
def numChildren(self, flags=0):
"""Provides the number of child snapshots for this domain snapshot.
By default, this command covers only direct children; it is also possible
to expand things to cover all descendants, when @flags includes
VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS. Also, some filters are provided in
groups, where each group contains bits that describe mutually exclusive
attributes of a snapshot, and where all bits within a group describe
all possible snapshots. Some hypervisors might reject explicit bits
from a group where the hypervisor cannot make a distinction. For a
group supported by a given hypervisor, the behavior when no bits of a
group are set is identical to the behavior when all bits in that group
are set. When setting bits from more than one group, it is possible to
select an impossible combination, in that case a hypervisor may return
either 0 or an error.
The first group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_LEAVES and
VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES, to filter based on snapshots that
have no further children (a leaf snapshot).
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_METADATA and
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA, for filtering snapshots based on
whether they have metadata that would prevent the removal of the last
reference to a domain.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE,
VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE, and VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY,
for filtering snapshots based on what domain state is tracked by the
snapshot.
The next group of @flags is VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL and
VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL, for filtering snapshots based on
whether the snapshot is stored inside the disk images or as
additional files. """
ret = libvirtmod.virDomainSnapshotNumChildren(self._o, flags)
if ret == -1: raise libvirtError ('virDomainSnapshotNumChildren() failed')
return ret
#
# virDomainSnapshot methods from virDomainSnapshot.py (hand coded)
#
def getConnect(self):
"""Get the connection that owns the domain that a snapshot was created for"""
return self.connect()
def getDomain(self):
"""Get the domain that a snapshot was created for"""
return self.domain()
def listAllChildren(self, flags=0):
"""List all child snapshots and returns a list of snapshot objects"""
ret = libvirtmod.virDomainSnapshotListAllChildren(self._o, flags)
if ret is None:
raise libvirtError("virDomainSnapshotListAllChildren() failed", conn=self)
retlist = list()
for snapptr in ret:
retlist.append(virDomainSnapshot(self, _obj=snapptr))
return retlist
# virBlkioParameterType
VIR_DOMAIN_BLKIO_PARAM_INT = 1
VIR_DOMAIN_BLKIO_PARAM_UINT = 2
VIR_DOMAIN_BLKIO_PARAM_LLONG = 3
VIR_DOMAIN_BLKIO_PARAM_ULLONG = 4
VIR_DOMAIN_BLKIO_PARAM_DOUBLE = 5
VIR_DOMAIN_BLKIO_PARAM_BOOLEAN = 6
# virCPUCompareResult
VIR_CPU_COMPARE_ERROR = -1
VIR_CPU_COMPARE_INCOMPATIBLE = 0
VIR_CPU_COMPARE_IDENTICAL = 1
VIR_CPU_COMPARE_SUPERSET = 2
# virConnectBaselineCPUFlags
VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES = 1
VIR_CONNECT_BASELINE_CPU_MIGRATABLE = 2
# virConnectCompareCPUFlags
VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE = 1
# virConnectCredentialType
VIR_CRED_USERNAME = 1
VIR_CRED_AUTHNAME = 2
VIR_CRED_LANGUAGE = 3
VIR_CRED_CNONCE = 4
VIR_CRED_PASSPHRASE = 5
VIR_CRED_ECHOPROMPT = 6
VIR_CRED_NOECHOPROMPT = 7
VIR_CRED_REALM = 8
VIR_CRED_EXTERNAL = 9
# virConnectDomainEventAgentLifecycleReason
VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN = 0
VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED = 1
VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL = 2
# virConnectDomainEventAgentLifecycleState
VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED = 1
VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED = 2
# virConnectDomainEventBlockJobStatus
VIR_DOMAIN_BLOCK_JOB_COMPLETED = 0
VIR_DOMAIN_BLOCK_JOB_FAILED = 1
VIR_DOMAIN_BLOCK_JOB_CANCELED = 2
VIR_DOMAIN_BLOCK_JOB_READY = 3
# virConnectDomainEventDiskChangeReason
VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START = 0
VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START = 1
# virConnectFlags
VIR_CONNECT_RO = 1
VIR_CONNECT_NO_ALIASES = 2
# virConnectGetAllDomainStatsFlags
VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE = 1
VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE = 2
VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT = 4
VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT = 8
VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING = 16
VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED = 32
VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF = 64
VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER = 128
VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING = 1073741824
VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = 2147483648
# virConnectListAllDomainsFlags
VIR_CONNECT_LIST_DOMAINS_ACTIVE = 1
VIR_CONNECT_LIST_DOMAINS_INACTIVE = 2
VIR_CONNECT_LIST_DOMAINS_PERSISTENT = 4
VIR_CONNECT_LIST_DOMAINS_TRANSIENT = 8
VIR_CONNECT_LIST_DOMAINS_RUNNING = 16
VIR_CONNECT_LIST_DOMAINS_PAUSED = 32
VIR_CONNECT_LIST_DOMAINS_SHUTOFF = 64
VIR_CONNECT_LIST_DOMAINS_OTHER = 128
VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE = 256
VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE = 512
VIR_CONNECT_LIST_DOMAINS_AUTOSTART = 1024
VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART = 2048
VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT = 4096
VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT = 8192
# virConnectListAllInterfacesFlags
VIR_CONNECT_LIST_INTERFACES_INACTIVE = 1
VIR_CONNECT_LIST_INTERFACES_ACTIVE = 2
# virConnectListAllNetworksFlags
VIR_CONNECT_LIST_NETWORKS_INACTIVE = 1
VIR_CONNECT_LIST_NETWORKS_ACTIVE = 2
VIR_CONNECT_LIST_NETWORKS_PERSISTENT = 4
VIR_CONNECT_LIST_NETWORKS_TRANSIENT = 8
VIR_CONNECT_LIST_NETWORKS_AUTOSTART = 16
VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART = 32
# virConnectListAllNodeDeviceFlags
VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM = 1
VIR_CONNECT_LIST_NODE_DEVICES_CAP_PCI_DEV = 2
VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV = 4
VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_INTERFACE = 8
VIR_CONNECT_LIST_NODE_DEVICES_CAP_NET = 16
VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_HOST = 32
VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_TARGET = 64
VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI = 128
VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE = 256
VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST = 512
VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS = 1024
VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC = 2048
VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM = 4096
VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV_TYPES = 8192
VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV = 16384
VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV = 32768
# virConnectListAllSecretsFlags
VIR_CONNECT_LIST_SECRETS_EPHEMERAL = 1
VIR_CONNECT_LIST_SECRETS_NO_EPHEMERAL = 2
VIR_CONNECT_LIST_SECRETS_PRIVATE = 4
VIR_CONNECT_LIST_SECRETS_NO_PRIVATE = 8
# virConnectListAllStoragePoolsFlags
VIR_CONNECT_LIST_STORAGE_POOLS_INACTIVE = 1
VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE = 2
VIR_CONNECT_LIST_STORAGE_POOLS_PERSISTENT = 4
VIR_CONNECT_LIST_STORAGE_POOLS_TRANSIENT = 8
VIR_CONNECT_LIST_STORAGE_POOLS_AUTOSTART = 16
VIR_CONNECT_LIST_STORAGE_POOLS_NO_AUTOSTART = 32
VIR_CONNECT_LIST_STORAGE_POOLS_DIR = 64
VIR_CONNECT_LIST_STORAGE_POOLS_FS = 128
VIR_CONNECT_LIST_STORAGE_POOLS_NETFS = 256
VIR_CONNECT_LIST_STORAGE_POOLS_LOGICAL = 512
VIR_CONNECT_LIST_STORAGE_POOLS_DISK = 1024
VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI = 2048
VIR_CONNECT_LIST_STORAGE_POOLS_SCSI = 4096
VIR_CONNECT_LIST_STORAGE_POOLS_MPATH = 8192
VIR_CONNECT_LIST_STORAGE_POOLS_RBD = 16384
VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG = 32768
VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER = 65536
VIR_CONNECT_LIST_STORAGE_POOLS_ZFS = 131072
VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE = 262144
# virDomainBlockCommitFlags
VIR_DOMAIN_BLOCK_COMMIT_SHALLOW = 1
VIR_DOMAIN_BLOCK_COMMIT_DELETE = 2
VIR_DOMAIN_BLOCK_COMMIT_ACTIVE = 4
VIR_DOMAIN_BLOCK_COMMIT_RELATIVE = 8
VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES = 16
# virDomainBlockCopyFlags
VIR_DOMAIN_BLOCK_COPY_SHALLOW = 1
VIR_DOMAIN_BLOCK_COPY_REUSE_EXT = 2
VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB = 4
# virDomainBlockJobAbortFlags
VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC = 1
VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT = 2
# virDomainBlockJobInfoFlags
VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES = 1
# virDomainBlockJobSetSpeedFlags
VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES = 1
# virDomainBlockJobType
VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN = 0
VIR_DOMAIN_BLOCK_JOB_TYPE_PULL = 1
VIR_DOMAIN_BLOCK_JOB_TYPE_COPY = 2
VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT = 3
VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT = 4
# virDomainBlockPullFlags
VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES = 64
# virDomainBlockRebaseFlags
VIR_DOMAIN_BLOCK_REBASE_SHALLOW = 1
VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT = 2
VIR_DOMAIN_BLOCK_REBASE_COPY_RAW = 4
VIR_DOMAIN_BLOCK_REBASE_COPY = 8
VIR_DOMAIN_BLOCK_REBASE_RELATIVE = 16
VIR_DOMAIN_BLOCK_REBASE_COPY_DEV = 32
VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES = 64
# virDomainBlockResizeFlags
VIR_DOMAIN_BLOCK_RESIZE_BYTES = 1
# virDomainBlockedReason
VIR_DOMAIN_BLOCKED_UNKNOWN = 0
# virDomainChannelFlags
VIR_DOMAIN_CHANNEL_FORCE = 1
# virDomainConsoleFlags
VIR_DOMAIN_CONSOLE_FORCE = 1
VIR_DOMAIN_CONSOLE_SAFE = 2
# virDomainControlErrorReason
VIR_DOMAIN_CONTROL_ERROR_REASON_NONE = 0
VIR_DOMAIN_CONTROL_ERROR_REASON_UNKNOWN = 1
VIR_DOMAIN_CONTROL_ERROR_REASON_MONITOR = 2
VIR_DOMAIN_CONTROL_ERROR_REASON_INTERNAL = 3
# virDomainControlState
VIR_DOMAIN_CONTROL_OK = 0
VIR_DOMAIN_CONTROL_JOB = 1
VIR_DOMAIN_CONTROL_OCCUPIED = 2
VIR_DOMAIN_CONTROL_ERROR = 3
# virDomainCoreDumpFlags
VIR_DUMP_CRASH = 1
VIR_DUMP_LIVE = 2
VIR_DUMP_BYPASS_CACHE = 4
VIR_DUMP_RESET = 8
VIR_DUMP_MEMORY_ONLY = 16
# virDomainCoreDumpFormat
VIR_DOMAIN_CORE_DUMP_FORMAT_RAW = 0
VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB = 1
VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO = 2
VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY = 3
# virDomainCrashedReason
VIR_DOMAIN_CRASHED_UNKNOWN = 0
VIR_DOMAIN_CRASHED_PANICKED = 1
# virDomainCreateFlags
VIR_DOMAIN_NONE = 0
VIR_DOMAIN_START_PAUSED = 1
VIR_DOMAIN_START_AUTODESTROY = 2
VIR_DOMAIN_START_BYPASS_CACHE = 4
VIR_DOMAIN_START_FORCE_BOOT = 8
VIR_DOMAIN_START_VALIDATE = 16
# virDomainDefineFlags
VIR_DOMAIN_DEFINE_VALIDATE = 1
# virDomainDestroyFlagsValues
VIR_DOMAIN_DESTROY_DEFAULT = 0
VIR_DOMAIN_DESTROY_GRACEFUL = 1
# virDomainDeviceModifyFlags
VIR_DOMAIN_DEVICE_MODIFY_CURRENT = 0
VIR_DOMAIN_DEVICE_MODIFY_LIVE = 1
VIR_DOMAIN_DEVICE_MODIFY_CONFIG = 2
VIR_DOMAIN_DEVICE_MODIFY_FORCE = 4
# virDomainDiskErrorCode
VIR_DOMAIN_DISK_ERROR_NONE = 0
VIR_DOMAIN_DISK_ERROR_UNSPEC = 1
VIR_DOMAIN_DISK_ERROR_NO_SPACE = 2
# virDomainEventCrashedDetailType
VIR_DOMAIN_EVENT_CRASHED_PANICKED = 0
# virDomainEventDefinedDetailType
VIR_DOMAIN_EVENT_DEFINED_ADDED = 0
VIR_DOMAIN_EVENT_DEFINED_UPDATED = 1
VIR_DOMAIN_EVENT_DEFINED_RENAMED = 2
VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT = 3
# virDomainEventGraphicsAddressType
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4 = 0
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6 = 1
VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX = 2
# virDomainEventGraphicsPhase
VIR_DOMAIN_EVENT_GRAPHICS_CONNECT = 0
VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE = 1
VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT = 2
# virDomainEventID
VIR_DOMAIN_EVENT_ID_LIFECYCLE = 0
VIR_DOMAIN_EVENT_ID_REBOOT = 1
VIR_DOMAIN_EVENT_ID_RTC_CHANGE = 2
VIR_DOMAIN_EVENT_ID_WATCHDOG = 3
VIR_DOMAIN_EVENT_ID_IO_ERROR = 4
VIR_DOMAIN_EVENT_ID_GRAPHICS = 5
VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON = 6
VIR_DOMAIN_EVENT_ID_CONTROL_ERROR = 7
VIR_DOMAIN_EVENT_ID_BLOCK_JOB = 8
VIR_DOMAIN_EVENT_ID_DISK_CHANGE = 9
VIR_DOMAIN_EVENT_ID_TRAY_CHANGE = 10
VIR_DOMAIN_EVENT_ID_PMWAKEUP = 11
VIR_DOMAIN_EVENT_ID_PMSUSPEND = 12
VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE = 13
VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK = 14
VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED = 15
VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 = 16
VIR_DOMAIN_EVENT_ID_TUNABLE = 17
VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE = 18
VIR_DOMAIN_EVENT_ID_DEVICE_ADDED = 19
VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION = 20
VIR_DOMAIN_EVENT_ID_JOB_COMPLETED = 21
VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED = 22
VIR_DOMAIN_EVENT_ID_METADATA_CHANGE = 23
VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD = 24
# virDomainEventIOErrorAction
VIR_DOMAIN_EVENT_IO_ERROR_NONE = 0
VIR_DOMAIN_EVENT_IO_ERROR_PAUSE = 1
VIR_DOMAIN_EVENT_IO_ERROR_REPORT = 2
# virDomainEventPMSuspendedDetailType
VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY = 0
VIR_DOMAIN_EVENT_PMSUSPENDED_DISK = 1
# virDomainEventResumedDetailType
VIR_DOMAIN_EVENT_RESUMED_UNPAUSED = 0
VIR_DOMAIN_EVENT_RESUMED_MIGRATED = 1
VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT = 2
VIR_DOMAIN_EVENT_RESUMED_POSTCOPY = 3
# virDomainEventShutdownDetailType
VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED = 0
VIR_DOMAIN_EVENT_SHUTDOWN_GUEST = 1
VIR_DOMAIN_EVENT_SHUTDOWN_HOST = 2
# virDomainEventStartedDetailType
VIR_DOMAIN_EVENT_STARTED_BOOTED = 0
VIR_DOMAIN_EVENT_STARTED_MIGRATED = 1
VIR_DOMAIN_EVENT_STARTED_RESTORED = 2
VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT = 3
VIR_DOMAIN_EVENT_STARTED_WAKEUP = 4
# virDomainEventStoppedDetailType
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN = 0
VIR_DOMAIN_EVENT_STOPPED_DESTROYED = 1
VIR_DOMAIN_EVENT_STOPPED_CRASHED = 2
VIR_DOMAIN_EVENT_STOPPED_MIGRATED = 3
VIR_DOMAIN_EVENT_STOPPED_SAVED = 4
VIR_DOMAIN_EVENT_STOPPED_FAILED = 5
VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT = 6
# virDomainEventSuspendedDetailType
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED = 0
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED = 1
VIR_DOMAIN_EVENT_SUSPENDED_IOERROR = 2
VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG = 3
VIR_DOMAIN_EVENT_SUSPENDED_RESTORED = 4
VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT = 5
VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR = 6
VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY = 7
VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED = 8
# virDomainEventTrayChangeReason
VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN = 0
VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE = 1
# virDomainEventType
VIR_DOMAIN_EVENT_DEFINED = 0
VIR_DOMAIN_EVENT_UNDEFINED = 1
VIR_DOMAIN_EVENT_STARTED = 2
VIR_DOMAIN_EVENT_SUSPENDED = 3
VIR_DOMAIN_EVENT_RESUMED = 4
VIR_DOMAIN_EVENT_STOPPED = 5
VIR_DOMAIN_EVENT_SHUTDOWN = 6
VIR_DOMAIN_EVENT_PMSUSPENDED = 7
VIR_DOMAIN_EVENT_CRASHED = 8
# virDomainEventUndefinedDetailType
VIR_DOMAIN_EVENT_UNDEFINED_REMOVED = 0
VIR_DOMAIN_EVENT_UNDEFINED_RENAMED = 1
# virDomainEventWatchdogAction
VIR_DOMAIN_EVENT_WATCHDOG_NONE = 0
VIR_DOMAIN_EVENT_WATCHDOG_PAUSE = 1
VIR_DOMAIN_EVENT_WATCHDOG_RESET = 2
VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF = 3
VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN = 4
VIR_DOMAIN_EVENT_WATCHDOG_DEBUG = 5
VIR_DOMAIN_EVENT_WATCHDOG_INJECTNMI = 6
# virDomainGetJobStatsFlags
VIR_DOMAIN_JOB_STATS_COMPLETED = 1
# virDomainInterfaceAddressesSource
VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE = 0
VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT = 1
# virDomainJobOperation
VIR_DOMAIN_JOB_OPERATION_UNKNOWN = 0
VIR_DOMAIN_JOB_OPERATION_START = 1
VIR_DOMAIN_JOB_OPERATION_SAVE = 2
VIR_DOMAIN_JOB_OPERATION_RESTORE = 3
VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN = 4
VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT = 5
VIR_DOMAIN_JOB_OPERATION_SNAPSHOT = 6
VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT = 7
VIR_DOMAIN_JOB_OPERATION_DUMP = 8
# virDomainJobType
VIR_DOMAIN_JOB_NONE = 0
VIR_DOMAIN_JOB_BOUNDED = 1
VIR_DOMAIN_JOB_UNBOUNDED = 2
VIR_DOMAIN_JOB_COMPLETED = 3
VIR_DOMAIN_JOB_FAILED = 4
VIR_DOMAIN_JOB_CANCELLED = 5
# virDomainMemoryFlags
VIR_MEMORY_VIRTUAL = 1
VIR_MEMORY_PHYSICAL = 2
# virDomainMemoryModFlags
VIR_DOMAIN_MEM_CURRENT = 0
VIR_DOMAIN_MEM_LIVE = 1
VIR_DOMAIN_MEM_CONFIG = 2
VIR_DOMAIN_MEM_MAXIMUM = 4
# virDomainMemoryStatTags
VIR_DOMAIN_MEMORY_STAT_SWAP_IN = 0
VIR_DOMAIN_MEMORY_STAT_SWAP_OUT = 1
VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT = 2
VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT = 3
VIR_DOMAIN_MEMORY_STAT_UNUSED = 4
VIR_DOMAIN_MEMORY_STAT_AVAILABLE = 5
VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON = 6
VIR_DOMAIN_MEMORY_STAT_RSS = 7
VIR_DOMAIN_MEMORY_STAT_USABLE = 8
VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE = 9
VIR_DOMAIN_MEMORY_STAT_LAST = 10
VIR_DOMAIN_MEMORY_STAT_NR = 10
# virDomainMetadataType
VIR_DOMAIN_METADATA_DESCRIPTION = 0
VIR_DOMAIN_METADATA_TITLE = 1
VIR_DOMAIN_METADATA_ELEMENT = 2
# virDomainMigrateFlags
VIR_MIGRATE_LIVE = 1
VIR_MIGRATE_PEER2PEER = 2
VIR_MIGRATE_TUNNELLED = 4
VIR_MIGRATE_PERSIST_DEST = 8
VIR_MIGRATE_UNDEFINE_SOURCE = 16
VIR_MIGRATE_PAUSED = 32
VIR_MIGRATE_NON_SHARED_DISK = 64
VIR_MIGRATE_NON_SHARED_INC = 128
VIR_MIGRATE_CHANGE_PROTECTION = 256
VIR_MIGRATE_UNSAFE = 512
VIR_MIGRATE_OFFLINE = 1024
VIR_MIGRATE_COMPRESSED = 2048
VIR_MIGRATE_ABORT_ON_ERROR = 4096
VIR_MIGRATE_AUTO_CONVERGE = 8192
VIR_MIGRATE_RDMA_PIN_ALL = 16384
VIR_MIGRATE_POSTCOPY = 32768
VIR_MIGRATE_TLS = 65536
# virDomainModificationImpact
VIR_DOMAIN_AFFECT_CURRENT = 0
VIR_DOMAIN_AFFECT_LIVE = 1
VIR_DOMAIN_AFFECT_CONFIG = 2
# virDomainNostateReason
VIR_DOMAIN_NOSTATE_UNKNOWN = 0
# virDomainNumatuneMemMode
VIR_DOMAIN_NUMATUNE_MEM_STRICT = 0
VIR_DOMAIN_NUMATUNE_MEM_PREFERRED = 1
VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE = 2
# virDomainOpenGraphicsFlags
VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH = 1
# virDomainPMSuspendedDiskReason
VIR_DOMAIN_PMSUSPENDED_DISK_UNKNOWN = 0
# virDomainPMSuspendedReason
VIR_DOMAIN_PMSUSPENDED_UNKNOWN = 0
# virDomainPausedReason
VIR_DOMAIN_PAUSED_UNKNOWN = 0
VIR_DOMAIN_PAUSED_USER = 1
VIR_DOMAIN_PAUSED_MIGRATION = 2
VIR_DOMAIN_PAUSED_SAVE = 3
VIR_DOMAIN_PAUSED_DUMP = 4
VIR_DOMAIN_PAUSED_IOERROR = 5
VIR_DOMAIN_PAUSED_WATCHDOG = 6
VIR_DOMAIN_PAUSED_FROM_SNAPSHOT = 7
VIR_DOMAIN_PAUSED_SHUTTING_DOWN = 8
VIR_DOMAIN_PAUSED_SNAPSHOT = 9
VIR_DOMAIN_PAUSED_CRASHED = 10
VIR_DOMAIN_PAUSED_STARTING_UP = 11
VIR_DOMAIN_PAUSED_POSTCOPY = 12
VIR_DOMAIN_PAUSED_POSTCOPY_FAILED = 13
# virDomainProcessSignal
VIR_DOMAIN_PROCESS_SIGNAL_NOP = 0
VIR_DOMAIN_PROCESS_SIGNAL_HUP = 1
VIR_DOMAIN_PROCESS_SIGNAL_INT = 2
VIR_DOMAIN_PROCESS_SIGNAL_QUIT = 3
VIR_DOMAIN_PROCESS_SIGNAL_ILL = 4
VIR_DOMAIN_PROCESS_SIGNAL_TRAP = 5
VIR_DOMAIN_PROCESS_SIGNAL_ABRT = 6
VIR_DOMAIN_PROCESS_SIGNAL_BUS = 7
VIR_DOMAIN_PROCESS_SIGNAL_FPE = 8
VIR_DOMAIN_PROCESS_SIGNAL_KILL = 9
VIR_DOMAIN_PROCESS_SIGNAL_USR1 = 10
VIR_DOMAIN_PROCESS_SIGNAL_SEGV = 11
VIR_DOMAIN_PROCESS_SIGNAL_USR2 = 12
VIR_DOMAIN_PROCESS_SIGNAL_PIPE = 13
VIR_DOMAIN_PROCESS_SIGNAL_ALRM = 14
VIR_DOMAIN_PROCESS_SIGNAL_TERM = 15
VIR_DOMAIN_PROCESS_SIGNAL_STKFLT = 16
VIR_DOMAIN_PROCESS_SIGNAL_CHLD = 17
VIR_DOMAIN_PROCESS_SIGNAL_CONT = 18
VIR_DOMAIN_PROCESS_SIGNAL_STOP = 19
VIR_DOMAIN_PROCESS_SIGNAL_TSTP = 20
VIR_DOMAIN_PROCESS_SIGNAL_TTIN = 21
VIR_DOMAIN_PROCESS_SIGNAL_TTOU = 22
VIR_DOMAIN_PROCESS_SIGNAL_URG = 23
VIR_DOMAIN_PROCESS_SIGNAL_XCPU = 24
VIR_DOMAIN_PROCESS_SIGNAL_XFSZ = 25
VIR_DOMAIN_PROCESS_SIGNAL_VTALRM = 26
VIR_DOMAIN_PROCESS_SIGNAL_PROF = 27
VIR_DOMAIN_PROCESS_SIGNAL_WINCH = 28
VIR_DOMAIN_PROCESS_SIGNAL_POLL = 29
VIR_DOMAIN_PROCESS_SIGNAL_PWR = 30
VIR_DOMAIN_PROCESS_SIGNAL_SYS = 31
VIR_DOMAIN_PROCESS_SIGNAL_RT0 = 32
VIR_DOMAIN_PROCESS_SIGNAL_RT1 = 33
VIR_DOMAIN_PROCESS_SIGNAL_RT2 = 34
VIR_DOMAIN_PROCESS_SIGNAL_RT3 = 35
VIR_DOMAIN_PROCESS_SIGNAL_RT4 = 36
VIR_DOMAIN_PROCESS_SIGNAL_RT5 = 37
VIR_DOMAIN_PROCESS_SIGNAL_RT6 = 38
VIR_DOMAIN_PROCESS_SIGNAL_RT7 = 39
VIR_DOMAIN_PROCESS_SIGNAL_RT8 = 40
VIR_DOMAIN_PROCESS_SIGNAL_RT9 = 41
VIR_DOMAIN_PROCESS_SIGNAL_RT10 = 42
VIR_DOMAIN_PROCESS_SIGNAL_RT11 = 43
VIR_DOMAIN_PROCESS_SIGNAL_RT12 = 44
VIR_DOMAIN_PROCESS_SIGNAL_RT13 = 45
VIR_DOMAIN_PROCESS_SIGNAL_RT14 = 46
VIR_DOMAIN_PROCESS_SIGNAL_RT15 = 47
VIR_DOMAIN_PROCESS_SIGNAL_RT16 = 48
VIR_DOMAIN_PROCESS_SIGNAL_RT17 = 49
VIR_DOMAIN_PROCESS_SIGNAL_RT18 = 50
VIR_DOMAIN_PROCESS_SIGNAL_RT19 = 51
VIR_DOMAIN_PROCESS_SIGNAL_RT20 = 52
VIR_DOMAIN_PROCESS_SIGNAL_RT21 = 53
VIR_DOMAIN_PROCESS_SIGNAL_RT22 = 54
VIR_DOMAIN_PROCESS_SIGNAL_RT23 = 55
VIR_DOMAIN_PROCESS_SIGNAL_RT24 = 56
VIR_DOMAIN_PROCESS_SIGNAL_RT25 = 57
VIR_DOMAIN_PROCESS_SIGNAL_RT26 = 58
VIR_DOMAIN_PROCESS_SIGNAL_RT27 = 59
VIR_DOMAIN_PROCESS_SIGNAL_RT28 = 60
VIR_DOMAIN_PROCESS_SIGNAL_RT29 = 61
VIR_DOMAIN_PROCESS_SIGNAL_RT30 = 62
VIR_DOMAIN_PROCESS_SIGNAL_RT31 = 63
VIR_DOMAIN_PROCESS_SIGNAL_RT32 = 64
# virDomainRebootFlagValues
VIR_DOMAIN_REBOOT_DEFAULT = 0
VIR_DOMAIN_REBOOT_ACPI_POWER_BTN = 1
VIR_DOMAIN_REBOOT_GUEST_AGENT = 2
VIR_DOMAIN_REBOOT_INITCTL = 4
VIR_DOMAIN_REBOOT_SIGNAL = 8
VIR_DOMAIN_REBOOT_PARAVIRT = 16
# virDomainRunningReason
VIR_DOMAIN_RUNNING_UNKNOWN = 0
VIR_DOMAIN_RUNNING_BOOTED = 1
VIR_DOMAIN_RUNNING_MIGRATED = 2
VIR_DOMAIN_RUNNING_RESTORED = 3
VIR_DOMAIN_RUNNING_FROM_SNAPSHOT = 4
VIR_DOMAIN_RUNNING_UNPAUSED = 5
VIR_DOMAIN_RUNNING_MIGRATION_CANCELED = 6
VIR_DOMAIN_RUNNING_SAVE_CANCELED = 7
VIR_DOMAIN_RUNNING_WAKEUP = 8
VIR_DOMAIN_RUNNING_CRASHED = 9
VIR_DOMAIN_RUNNING_POSTCOPY = 10
# virDomainSaveRestoreFlags
VIR_DOMAIN_SAVE_BYPASS_CACHE = 1
VIR_DOMAIN_SAVE_RUNNING = 2
VIR_DOMAIN_SAVE_PAUSED = 4
# virDomainSetTimeFlags
VIR_DOMAIN_TIME_SYNC = 1
# virDomainSetUserPasswordFlags
VIR_DOMAIN_PASSWORD_ENCRYPTED = 1
# virDomainShutdownFlagValues
VIR_DOMAIN_SHUTDOWN_DEFAULT = 0
VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN = 1
VIR_DOMAIN_SHUTDOWN_GUEST_AGENT = 2
VIR_DOMAIN_SHUTDOWN_INITCTL = 4
VIR_DOMAIN_SHUTDOWN_SIGNAL = 8
VIR_DOMAIN_SHUTDOWN_PARAVIRT = 16
# virDomainShutdownReason
VIR_DOMAIN_SHUTDOWN_UNKNOWN = 0
VIR_DOMAIN_SHUTDOWN_USER = 1
# virDomainShutoffReason
VIR_DOMAIN_SHUTOFF_UNKNOWN = 0
VIR_DOMAIN_SHUTOFF_SHUTDOWN = 1
VIR_DOMAIN_SHUTOFF_DESTROYED = 2
VIR_DOMAIN_SHUTOFF_CRASHED = 3
VIR_DOMAIN_SHUTOFF_MIGRATED = 4
VIR_DOMAIN_SHUTOFF_SAVED = 5
VIR_DOMAIN_SHUTOFF_FAILED = 6
VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT = 7
# virDomainSnapshotCreateFlags
VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE = 1
VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT = 2
VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA = 4
VIR_DOMAIN_SNAPSHOT_CREATE_HALT = 8
VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY = 16
VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT = 32
VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE = 64
VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC = 128
VIR_DOMAIN_SNAPSHOT_CREATE_LIVE = 256
# virDomainSnapshotDeleteFlags
VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN = 1
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY = 2
VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY = 4
# virDomainSnapshotListFlags
VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS = 1
VIR_DOMAIN_SNAPSHOT_LIST_ROOTS = 1
VIR_DOMAIN_SNAPSHOT_LIST_METADATA = 2
VIR_DOMAIN_SNAPSHOT_LIST_LEAVES = 4
VIR_DOMAIN_SNAPSHOT_LIST_NO_LEAVES = 8
VIR_DOMAIN_SNAPSHOT_LIST_NO_METADATA = 16
VIR_DOMAIN_SNAPSHOT_LIST_INACTIVE = 32
VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE = 64
VIR_DOMAIN_SNAPSHOT_LIST_DISK_ONLY = 128
VIR_DOMAIN_SNAPSHOT_LIST_INTERNAL = 256
VIR_DOMAIN_SNAPSHOT_LIST_EXTERNAL = 512
# virDomainSnapshotRevertFlags
VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING = 1
VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED = 2
VIR_DOMAIN_SNAPSHOT_REVERT_FORCE = 4
# virDomainState
VIR_DOMAIN_NOSTATE = 0
VIR_DOMAIN_RUNNING = 1
VIR_DOMAIN_BLOCKED = 2
VIR_DOMAIN_PAUSED = 3
VIR_DOMAIN_SHUTDOWN = 4
VIR_DOMAIN_SHUTOFF = 5
VIR_DOMAIN_CRASHED = 6
VIR_DOMAIN_PMSUSPENDED = 7
# virDomainStatsTypes
VIR_DOMAIN_STATS_STATE = 1
VIR_DOMAIN_STATS_CPU_TOTAL = 2
VIR_DOMAIN_STATS_BALLOON = 4
VIR_DOMAIN_STATS_VCPU = 8
VIR_DOMAIN_STATS_INTERFACE = 16
VIR_DOMAIN_STATS_BLOCK = 32
VIR_DOMAIN_STATS_PERF = 64
# virDomainUndefineFlagsValues
VIR_DOMAIN_UNDEFINE_MANAGED_SAVE = 1
VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA = 2
VIR_DOMAIN_UNDEFINE_NVRAM = 4
VIR_DOMAIN_UNDEFINE_KEEP_NVRAM = 8
# virDomainVcpuFlags
VIR_DOMAIN_VCPU_CURRENT = 0
VIR_DOMAIN_VCPU_LIVE = 1
VIR_DOMAIN_VCPU_CONFIG = 2
VIR_DOMAIN_VCPU_MAXIMUM = 4
VIR_DOMAIN_VCPU_GUEST = 8
VIR_DOMAIN_VCPU_HOTPLUGGABLE = 16
# virDomainXMLFlags
VIR_DOMAIN_XML_SECURE = 1
VIR_DOMAIN_XML_INACTIVE = 2
VIR_DOMAIN_XML_UPDATE_CPU = 4
VIR_DOMAIN_XML_MIGRATABLE = 8
# virErrorDomain
VIR_FROM_NONE = 0
VIR_FROM_XEN = 1
VIR_FROM_XEND = 2
VIR_FROM_XENSTORE = 3
VIR_FROM_SEXPR = 4
VIR_FROM_XML = 5
VIR_FROM_DOM = 6
VIR_FROM_RPC = 7
VIR_FROM_PROXY = 8
VIR_FROM_CONF = 9
VIR_FROM_QEMU = 10
VIR_FROM_NET = 11
VIR_FROM_TEST = 12
VIR_FROM_REMOTE = 13
VIR_FROM_OPENVZ = 14
VIR_FROM_XENXM = 15
VIR_FROM_STATS_LINUX = 16
VIR_FROM_LXC = 17
VIR_FROM_STORAGE = 18
VIR_FROM_NETWORK = 19
VIR_FROM_DOMAIN = 20
VIR_FROM_UML = 21
VIR_FROM_NODEDEV = 22
VIR_FROM_XEN_INOTIFY = 23
VIR_FROM_SECURITY = 24
VIR_FROM_VBOX = 25
VIR_FROM_INTERFACE = 26
VIR_FROM_ONE = 27
VIR_FROM_ESX = 28
VIR_FROM_PHYP = 29
VIR_FROM_SECRET = 30
VIR_FROM_CPU = 31
VIR_FROM_XENAPI = 32
VIR_FROM_NWFILTER = 33
VIR_FROM_HOOK = 34
VIR_FROM_DOMAIN_SNAPSHOT = 35
VIR_FROM_AUDIT = 36
VIR_FROM_SYSINFO = 37
VIR_FROM_STREAMS = 38
VIR_FROM_VMWARE = 39
VIR_FROM_EVENT = 40
VIR_FROM_LIBXL = 41
VIR_FROM_LOCKING = 42
VIR_FROM_HYPERV = 43
VIR_FROM_CAPABILITIES = 44
VIR_FROM_URI = 45
VIR_FROM_AUTH = 46
VIR_FROM_DBUS = 47
VIR_FROM_PARALLELS = 48
VIR_FROM_DEVICE = 49
VIR_FROM_SSH = 50
VIR_FROM_LOCKSPACE = 51
VIR_FROM_INITCTL = 52
VIR_FROM_IDENTITY = 53
VIR_FROM_CGROUP = 54
VIR_FROM_ACCESS = 55
VIR_FROM_SYSTEMD = 56
VIR_FROM_BHYVE = 57
VIR_FROM_CRYPTO = 58
VIR_FROM_FIREWALL = 59
VIR_FROM_POLKIT = 60
VIR_FROM_THREAD = 61
VIR_FROM_ADMIN = 62
VIR_FROM_LOGGING = 63
VIR_FROM_XENXL = 64
VIR_FROM_PERF = 65
VIR_FROM_LIBSSH = 66
# virErrorLevel
VIR_ERR_NONE = 0
VIR_ERR_WARNING = 1
VIR_ERR_ERROR = 2
# virErrorNumber
VIR_ERR_OK = 0
VIR_ERR_INTERNAL_ERROR = 1
VIR_ERR_NO_MEMORY = 2
VIR_ERR_NO_SUPPORT = 3
VIR_ERR_UNKNOWN_HOST = 4
VIR_ERR_NO_CONNECT = 5
VIR_ERR_INVALID_CONN = 6
VIR_ERR_INVALID_DOMAIN = 7
VIR_ERR_INVALID_ARG = 8
VIR_ERR_OPERATION_FAILED = 9
VIR_ERR_GET_FAILED = 10
VIR_ERR_POST_FAILED = 11
VIR_ERR_HTTP_ERROR = 12
VIR_ERR_SEXPR_SERIAL = 13
VIR_ERR_NO_XEN = 14
VIR_ERR_XEN_CALL = 15
VIR_ERR_OS_TYPE = 16
VIR_ERR_NO_KERNEL = 17
VIR_ERR_NO_ROOT = 18
VIR_ERR_NO_SOURCE = 19
VIR_ERR_NO_TARGET = 20
VIR_ERR_NO_NAME = 21
VIR_ERR_NO_OS = 22
VIR_ERR_NO_DEVICE = 23
VIR_ERR_NO_XENSTORE = 24
VIR_ERR_DRIVER_FULL = 25
VIR_ERR_CALL_FAILED = 26
VIR_ERR_XML_ERROR = 27
VIR_ERR_DOM_EXIST = 28
VIR_ERR_OPERATION_DENIED = 29
VIR_ERR_OPEN_FAILED = 30
VIR_ERR_READ_FAILED = 31
VIR_ERR_PARSE_FAILED = 32
VIR_ERR_CONF_SYNTAX = 33
VIR_ERR_WRITE_FAILED = 34
VIR_ERR_XML_DETAIL = 35
VIR_ERR_INVALID_NETWORK = 36
VIR_ERR_NETWORK_EXIST = 37
VIR_ERR_SYSTEM_ERROR = 38
VIR_ERR_RPC = 39
VIR_ERR_GNUTLS_ERROR = 40
VIR_WAR_NO_NETWORK = 41
VIR_ERR_NO_DOMAIN = 42
VIR_ERR_NO_NETWORK = 43
VIR_ERR_INVALID_MAC = 44
VIR_ERR_AUTH_FAILED = 45
VIR_ERR_INVALID_STORAGE_POOL = 46
VIR_ERR_INVALID_STORAGE_VOL = 47
VIR_WAR_NO_STORAGE = 48
VIR_ERR_NO_STORAGE_POOL = 49
VIR_ERR_NO_STORAGE_VOL = 50
VIR_WAR_NO_NODE = 51
VIR_ERR_INVALID_NODE_DEVICE = 52
VIR_ERR_NO_NODE_DEVICE = 53
VIR_ERR_NO_SECURITY_MODEL = 54
VIR_ERR_OPERATION_INVALID = 55
VIR_WAR_NO_INTERFACE = 56
VIR_ERR_NO_INTERFACE = 57
VIR_ERR_INVALID_INTERFACE = 58
VIR_ERR_MULTIPLE_INTERFACES = 59
VIR_WAR_NO_NWFILTER = 60
VIR_ERR_INVALID_NWFILTER = 61
VIR_ERR_NO_NWFILTER = 62
VIR_ERR_BUILD_FIREWALL = 63
VIR_WAR_NO_SECRET = 64
VIR_ERR_INVALID_SECRET = 65
VIR_ERR_NO_SECRET = 66
VIR_ERR_CONFIG_UNSUPPORTED = 67
VIR_ERR_OPERATION_TIMEOUT = 68
VIR_ERR_MIGRATE_PERSIST_FAILED = 69
VIR_ERR_HOOK_SCRIPT_FAILED = 70
VIR_ERR_INVALID_DOMAIN_SNAPSHOT = 71
VIR_ERR_NO_DOMAIN_SNAPSHOT = 72
VIR_ERR_INVALID_STREAM = 73
VIR_ERR_ARGUMENT_UNSUPPORTED = 74
VIR_ERR_STORAGE_PROBE_FAILED = 75
VIR_ERR_STORAGE_POOL_BUILT = 76
VIR_ERR_SNAPSHOT_REVERT_RISKY = 77
VIR_ERR_OPERATION_ABORTED = 78
VIR_ERR_AUTH_CANCELLED = 79
VIR_ERR_NO_DOMAIN_METADATA = 80
VIR_ERR_MIGRATE_UNSAFE = 81
VIR_ERR_OVERFLOW = 82
VIR_ERR_BLOCK_COPY_ACTIVE = 83
VIR_ERR_OPERATION_UNSUPPORTED = 84
VIR_ERR_SSH = 85
VIR_ERR_AGENT_UNRESPONSIVE = 86
VIR_ERR_RESOURCE_BUSY = 87
VIR_ERR_ACCESS_DENIED = 88
VIR_ERR_DBUS_SERVICE = 89
VIR_ERR_STORAGE_VOL_EXIST = 90
VIR_ERR_CPU_INCOMPATIBLE = 91
VIR_ERR_XML_INVALID_SCHEMA = 92
VIR_ERR_MIGRATE_FINISH_OK = 93
VIR_ERR_AUTH_UNAVAILABLE = 94
VIR_ERR_NO_SERVER = 95
VIR_ERR_NO_CLIENT = 96
VIR_ERR_AGENT_UNSYNCED = 97
VIR_ERR_LIBSSH = 98
# virEventHandleType
VIR_EVENT_HANDLE_READABLE = 1
VIR_EVENT_HANDLE_WRITABLE = 2
VIR_EVENT_HANDLE_ERROR = 4
VIR_EVENT_HANDLE_HANGUP = 8
# virIPAddrType
VIR_IP_ADDR_TYPE_IPV4 = 0
VIR_IP_ADDR_TYPE_IPV6 = 1
# virInterfaceXMLFlags
VIR_INTERFACE_XML_INACTIVE = 1
# virKeycodeSet
VIR_KEYCODE_SET_LINUX = 0
VIR_KEYCODE_SET_XT = 1
VIR_KEYCODE_SET_ATSET1 = 2
VIR_KEYCODE_SET_ATSET2 = 3
VIR_KEYCODE_SET_ATSET3 = 4
VIR_KEYCODE_SET_OSX = 5
VIR_KEYCODE_SET_XT_KBD = 6
VIR_KEYCODE_SET_USB = 7
VIR_KEYCODE_SET_WIN32 = 8
VIR_KEYCODE_SET_RFB = 9
# virMemoryParameterType
VIR_DOMAIN_MEMORY_PARAM_INT = 1
VIR_DOMAIN_MEMORY_PARAM_UINT = 2
VIR_DOMAIN_MEMORY_PARAM_LLONG = 3
VIR_DOMAIN_MEMORY_PARAM_ULLONG = 4
VIR_DOMAIN_MEMORY_PARAM_DOUBLE = 5
VIR_DOMAIN_MEMORY_PARAM_BOOLEAN = 6
# virNetworkEventID
VIR_NETWORK_EVENT_ID_LIFECYCLE = 0
# virNetworkEventLifecycleType
VIR_NETWORK_EVENT_DEFINED = 0
VIR_NETWORK_EVENT_UNDEFINED = 1
VIR_NETWORK_EVENT_STARTED = 2
VIR_NETWORK_EVENT_STOPPED = 3
# virNetworkUpdateCommand
VIR_NETWORK_UPDATE_COMMAND_NONE = 0
VIR_NETWORK_UPDATE_COMMAND_MODIFY = 1
VIR_NETWORK_UPDATE_COMMAND_DELETE = 2
VIR_NETWORK_UPDATE_COMMAND_ADD_LAST = 3
VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST = 4
# virNetworkUpdateFlags
VIR_NETWORK_UPDATE_AFFECT_CURRENT = 0
VIR_NETWORK_UPDATE_AFFECT_LIVE = 1
VIR_NETWORK_UPDATE_AFFECT_CONFIG = 2
# virNetworkUpdateSection
VIR_NETWORK_SECTION_NONE = 0
VIR_NETWORK_SECTION_BRIDGE = 1
VIR_NETWORK_SECTION_DOMAIN = 2
VIR_NETWORK_SECTION_IP = 3
VIR_NETWORK_SECTION_IP_DHCP_HOST = 4
VIR_NETWORK_SECTION_IP_DHCP_RANGE = 5
VIR_NETWORK_SECTION_FORWARD = 6
VIR_NETWORK_SECTION_FORWARD_INTERFACE = 7
VIR_NETWORK_SECTION_FORWARD_PF = 8
VIR_NETWORK_SECTION_PORTGROUP = 9
VIR_NETWORK_SECTION_DNS_HOST = 10
VIR_NETWORK_SECTION_DNS_TXT = 11
VIR_NETWORK_SECTION_DNS_SRV = 12
# virNetworkXMLFlags
VIR_NETWORK_XML_INACTIVE = 1
# virNodeAllocPagesFlags
VIR_NODE_ALLOC_PAGES_ADD = 0
VIR_NODE_ALLOC_PAGES_SET = 1
# virNodeDeviceEventID
VIR_NODE_DEVICE_EVENT_ID_LIFECYCLE = 0
VIR_NODE_DEVICE_EVENT_ID_UPDATE = 1
# virNodeDeviceEventLifecycleType
VIR_NODE_DEVICE_EVENT_CREATED = 0
VIR_NODE_DEVICE_EVENT_DELETED = 1
# virNodeGetCPUStatsAllCPUs
VIR_NODE_CPU_STATS_ALL_CPUS = -1
# virNodeGetMemoryStatsAllCells
VIR_NODE_MEMORY_STATS_ALL_CELLS = -1
# virNodeSuspendTarget
VIR_NODE_SUSPEND_TARGET_MEM = 0
VIR_NODE_SUSPEND_TARGET_DISK = 1
VIR_NODE_SUSPEND_TARGET_HYBRID = 2
# virSchedParameterType
VIR_DOMAIN_SCHED_FIELD_INT = 1
VIR_DOMAIN_SCHED_FIELD_UINT = 2
VIR_DOMAIN_SCHED_FIELD_LLONG = 3
VIR_DOMAIN_SCHED_FIELD_ULLONG = 4
VIR_DOMAIN_SCHED_FIELD_DOUBLE = 5
VIR_DOMAIN_SCHED_FIELD_BOOLEAN = 6
# virSecretEventID
VIR_SECRET_EVENT_ID_LIFECYCLE = 0
VIR_SECRET_EVENT_ID_VALUE_CHANGED = 1
# virSecretEventLifecycleType
VIR_SECRET_EVENT_DEFINED = 0
VIR_SECRET_EVENT_UNDEFINED = 1
# virSecretUsageType
VIR_SECRET_USAGE_TYPE_NONE = 0
VIR_SECRET_USAGE_TYPE_VOLUME = 1
VIR_SECRET_USAGE_TYPE_CEPH = 2
VIR_SECRET_USAGE_TYPE_ISCSI = 3
VIR_SECRET_USAGE_TYPE_TLS = 4
# virStoragePoolBuildFlags
VIR_STORAGE_POOL_BUILD_NEW = 0
VIR_STORAGE_POOL_BUILD_REPAIR = 1
VIR_STORAGE_POOL_BUILD_RESIZE = 2
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE = 4
VIR_STORAGE_POOL_BUILD_OVERWRITE = 8
# virStoragePoolCreateFlags
VIR_STORAGE_POOL_CREATE_NORMAL = 0
VIR_STORAGE_POOL_CREATE_WITH_BUILD = 1
VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE = 2
VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE = 4
# virStoragePoolDeleteFlags
VIR_STORAGE_POOL_DELETE_NORMAL = 0
VIR_STORAGE_POOL_DELETE_ZEROED = 1
# virStoragePoolEventID
VIR_STORAGE_POOL_EVENT_ID_LIFECYCLE = 0
VIR_STORAGE_POOL_EVENT_ID_REFRESH = 1
# virStoragePoolEventLifecycleType
VIR_STORAGE_POOL_EVENT_DEFINED = 0
VIR_STORAGE_POOL_EVENT_UNDEFINED = 1
VIR_STORAGE_POOL_EVENT_STARTED = 2
VIR_STORAGE_POOL_EVENT_STOPPED = 3
# virStoragePoolState
VIR_STORAGE_POOL_INACTIVE = 0
VIR_STORAGE_POOL_BUILDING = 1
VIR_STORAGE_POOL_RUNNING = 2
VIR_STORAGE_POOL_DEGRADED = 3
VIR_STORAGE_POOL_INACCESSIBLE = 4
# virStorageVolCreateFlags
VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA = 1
VIR_STORAGE_VOL_CREATE_REFLINK = 2
# virStorageVolDeleteFlags
VIR_STORAGE_VOL_DELETE_NORMAL = 0
VIR_STORAGE_VOL_DELETE_ZEROED = 1
VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS = 2
# virStorageVolDownloadFlags
VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM = 1
# virStorageVolInfoFlags
VIR_STORAGE_VOL_USE_ALLOCATION = 0
VIR_STORAGE_VOL_GET_PHYSICAL = 1
# virStorageVolResizeFlags
VIR_STORAGE_VOL_RESIZE_ALLOCATE = 1
VIR_STORAGE_VOL_RESIZE_DELTA = 2
VIR_STORAGE_VOL_RESIZE_SHRINK = 4
# virStorageVolType
VIR_STORAGE_VOL_FILE = 0
VIR_STORAGE_VOL_BLOCK = 1
VIR_STORAGE_VOL_DIR = 2
VIR_STORAGE_VOL_NETWORK = 3
VIR_STORAGE_VOL_NETDIR = 4
VIR_STORAGE_VOL_PLOOP = 5
# virStorageVolUploadFlags
VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM = 1
# virStorageVolWipeAlgorithm
VIR_STORAGE_VOL_WIPE_ALG_ZERO = 0
VIR_STORAGE_VOL_WIPE_ALG_NNSA = 1
VIR_STORAGE_VOL_WIPE_ALG_DOD = 2
VIR_STORAGE_VOL_WIPE_ALG_BSI = 3
VIR_STORAGE_VOL_WIPE_ALG_GUTMANN = 4
VIR_STORAGE_VOL_WIPE_ALG_SCHNEIER = 5
VIR_STORAGE_VOL_WIPE_ALG_PFITZNER7 = 6
VIR_STORAGE_VOL_WIPE_ALG_PFITZNER33 = 7
VIR_STORAGE_VOL_WIPE_ALG_RANDOM = 8
VIR_STORAGE_VOL_WIPE_ALG_TRIM = 9
# virStorageXMLFlags
VIR_STORAGE_XML_INACTIVE = 1
# virStreamEventType
VIR_STREAM_EVENT_READABLE = 1
VIR_STREAM_EVENT_WRITABLE = 2
VIR_STREAM_EVENT_ERROR = 4
VIR_STREAM_EVENT_HANGUP = 8
# virStreamFlags
VIR_STREAM_NONBLOCK = 1
# virStreamRecvFlagsValues
VIR_STREAM_RECV_STOP_AT_HOLE = 1
# virVcpuState
VIR_VCPU_OFFLINE = 0
VIR_VCPU_RUNNING = 1
VIR_VCPU_BLOCKED = 2
# typed parameter names
VIR_DOMAIN_BANDWIDTH_IN_AVERAGE = "inbound.average"
VIR_DOMAIN_BANDWIDTH_IN_BURST = "inbound.burst"
VIR_DOMAIN_BANDWIDTH_IN_FLOOR = "inbound.floor"
VIR_DOMAIN_BANDWIDTH_IN_PEAK = "inbound.peak"
VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE = "outbound.average"
VIR_DOMAIN_BANDWIDTH_OUT_BURST = "outbound.burst"
VIR_DOMAIN_BANDWIDTH_OUT_PEAK = "outbound.peak"
VIR_DOMAIN_BLKIO_DEVICE_READ_BPS = "device_read_bytes_sec"
VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS = "device_read_iops_sec"
VIR_DOMAIN_BLKIO_DEVICE_WEIGHT = "device_weight"
VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS = "device_write_bytes_sec"
VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS = "device_write_iops_sec"
VIR_DOMAIN_BLKIO_WEIGHT = "weight"
VIR_DOMAIN_BLOCK_COPY_BANDWIDTH = "bandwidth"
VIR_DOMAIN_BLOCK_COPY_BUF_SIZE = "buf-size"
VIR_DOMAIN_BLOCK_COPY_GRANULARITY = "granularity"
VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME = "group_name"
VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC = "read_bytes_sec"
VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX = "read_bytes_sec_max"
VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH = "read_bytes_sec_max_length"
VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC = "read_iops_sec"
VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX = "read_iops_sec_max"
VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH = "read_iops_sec_max_length"
VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC = "size_iops_sec"
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC = "total_bytes_sec"
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX = "total_bytes_sec_max"
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH = "total_bytes_sec_max_length"
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC = "total_iops_sec"
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX = "total_iops_sec_max"
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH = "total_iops_sec_max_length"
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC = "write_bytes_sec"
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX = "write_bytes_sec_max"
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH = "write_bytes_sec_max_length"
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC = "write_iops_sec"
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX = "write_iops_sec_max"
VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH = "write_iops_sec_max_length"
VIR_DOMAIN_BLOCK_STATS_ERRS = "errs"
VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ = "flush_operations"
VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES = "flush_total_times"
VIR_DOMAIN_BLOCK_STATS_READ_BYTES = "rd_bytes"
VIR_DOMAIN_BLOCK_STATS_READ_REQ = "rd_operations"
VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES = "rd_total_times"
VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES = "wr_bytes"
VIR_DOMAIN_BLOCK_STATS_WRITE_REQ = "wr_operations"
VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES = "wr_total_times"
VIR_DOMAIN_CPU_STATS_CPUTIME = "cpu_time"
VIR_DOMAIN_CPU_STATS_SYSTEMTIME = "system_time"
VIR_DOMAIN_CPU_STATS_USERTIME = "user_time"
VIR_DOMAIN_CPU_STATS_VCPUTIME = "vcpu_time"
VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE = "auto_converge_throttle"
VIR_DOMAIN_JOB_COMPRESSION_BYTES = "compression_bytes"
VIR_DOMAIN_JOB_COMPRESSION_CACHE = "compression_cache"
VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES = "compression_cache_misses"
VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW = "compression_overflow"
VIR_DOMAIN_JOB_COMPRESSION_PAGES = "compression_pages"
VIR_DOMAIN_JOB_DATA_PROCESSED = "data_processed"
VIR_DOMAIN_JOB_DATA_REMAINING = "data_remaining"
VIR_DOMAIN_JOB_DATA_TOTAL = "data_total"
VIR_DOMAIN_JOB_DISK_BPS = "disk_bps"
VIR_DOMAIN_JOB_DISK_PROCESSED = "disk_processed"
VIR_DOMAIN_JOB_DISK_REMAINING = "disk_remaining"
VIR_DOMAIN_JOB_DISK_TOTAL = "disk_total"
VIR_DOMAIN_JOB_DOWNTIME = "downtime"
VIR_DOMAIN_JOB_DOWNTIME_NET = "downtime_net"
VIR_DOMAIN_JOB_MEMORY_BPS = "memory_bps"
VIR_DOMAIN_JOB_MEMORY_CONSTANT = "memory_constant"
VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE = "memory_dirty_rate"
VIR_DOMAIN_JOB_MEMORY_ITERATION = "memory_iteration"
VIR_DOMAIN_JOB_MEMORY_NORMAL = "memory_normal"
VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES = "memory_normal_bytes"
VIR_DOMAIN_JOB_MEMORY_PROCESSED = "memory_processed"
VIR_DOMAIN_JOB_MEMORY_REMAINING = "memory_remaining"
VIR_DOMAIN_JOB_MEMORY_TOTAL = "memory_total"
VIR_DOMAIN_JOB_OPERATION = "operation"
VIR_DOMAIN_JOB_SETUP_TIME = "setup_time"
VIR_DOMAIN_JOB_TIME_ELAPSED = "time_elapsed"
VIR_DOMAIN_JOB_TIME_ELAPSED_NET = "time_elapsed_net"
VIR_DOMAIN_JOB_TIME_REMAINING = "time_remaining"
VIR_DOMAIN_MEMORY_HARD_LIMIT = "hard_limit"
VIR_DOMAIN_MEMORY_MIN_GUARANTEE = "min_guarantee"
VIR_DOMAIN_MEMORY_SOFT_LIMIT = "soft_limit"
VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT = "swap_hard_limit"
VIR_DOMAIN_NUMA_MODE = "numa_mode"
VIR_DOMAIN_NUMA_NODESET = "numa_nodeset"
VIR_DOMAIN_SCHEDULER_CAP = "cap"
VIR_DOMAIN_SCHEDULER_CPU_SHARES = "cpu_shares"
VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD = "emulator_period"
VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA = "emulator_quota"
VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD = "global_period"
VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA = "global_quota"
VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD = "iothread_period"
VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA = "iothread_quota"
VIR_DOMAIN_SCHEDULER_LIMIT = "limit"
VIR_DOMAIN_SCHEDULER_RESERVATION = "reservation"
VIR_DOMAIN_SCHEDULER_SHARES = "shares"
VIR_DOMAIN_SCHEDULER_VCPU_PERIOD = "vcpu_period"
VIR_DOMAIN_SCHEDULER_VCPU_QUOTA = "vcpu_quota"
VIR_DOMAIN_SCHEDULER_WEIGHT = "weight"
VIR_DOMAIN_TUNABLE_BLKDEV_DISK = "blkdeviotune.disk"
VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NAME = "blkdeviotune.group_name"
VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC = "blkdeviotune.read_bytes_sec"
VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX = "blkdeviotune.read_bytes_sec_max"
VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH = "blkdeviotune.read_bytes_sec_max_length"
VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC = "blkdeviotune.read_iops_sec"
VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX = "blkdeviotune.read_iops_sec_max"
VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH = "blkdeviotune.read_iops_sec_max_length"
VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC = "blkdeviotune.size_iops_sec"
VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC = "blkdeviotune.total_bytes_sec"
VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX = "blkdeviotune.total_bytes_sec_max"
VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH = "blkdeviotune.total_bytes_sec_max_length"
VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC = "blkdeviotune.total_iops_sec"
VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX = "blkdeviotune.total_iops_sec_max"
VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH = "blkdeviotune.total_iops_sec_max_length"
VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC = "blkdeviotune.write_bytes_sec"
VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX = "blkdeviotune.write_bytes_sec_max"
VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH = "blkdeviotune.write_bytes_sec_max_length"
VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC = "blkdeviotune.write_iops_sec"
VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX = "blkdeviotune.write_iops_sec_max"
VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH = "blkdeviotune.write_iops_sec_max_length"
VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES = "cputune.cpu_shares"
VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN = "cputune.emulatorpin"
VIR_DOMAIN_TUNABLE_CPU_EMULATOR_PERIOD = "cputune.emulator_period"
VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA = "cputune.emulator_quota"
VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD = "cputune.global_period"
VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA = "cputune.global_quota"
VIR_DOMAIN_TUNABLE_CPU_IOTHREADSPIN = "cputune.iothreadpin%u"
VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_PERIOD = "cputune.iothread_period"
VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_QUOTA = "cputune.iothread_quota"
VIR_DOMAIN_TUNABLE_CPU_VCPUPIN = "cputune.vcpupin%u"
VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD = "cputune.vcpu_period"
VIR_DOMAIN_TUNABLE_CPU_VCPU_QUOTA = "cputune.vcpu_quota"
VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT = "auto_converge.increment"
VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL = "auto_converge.initial"
VIR_MIGRATE_PARAM_BANDWIDTH = "bandwidth"
VIR_MIGRATE_PARAM_COMPRESSION = "compression"
VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS = "compression.mt.dthreads"
VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL = "compression.mt.level"
VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS = "compression.mt.threads"
VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE = "compression.xbzrle.cache"
VIR_MIGRATE_PARAM_DEST_NAME = "destination_name"
VIR_MIGRATE_PARAM_DEST_XML = "destination_xml"
VIR_MIGRATE_PARAM_DISKS_PORT = "disks_port"
VIR_MIGRATE_PARAM_GRAPHICS_URI = "graphics_uri"
VIR_MIGRATE_PARAM_LISTEN_ADDRESS = "listen_address"
VIR_MIGRATE_PARAM_MIGRATE_DISKS = "migrate_disks"
VIR_MIGRATE_PARAM_PERSIST_XML = "persistent_xml"
VIR_MIGRATE_PARAM_URI = "migrate_uri"
VIR_NODE_CPU_STATS_IDLE = "idle"
VIR_NODE_CPU_STATS_INTR = "intr"
VIR_NODE_CPU_STATS_IOWAIT = "iowait"
VIR_NODE_CPU_STATS_KERNEL = "kernel"
VIR_NODE_CPU_STATS_USER = "user"
VIR_NODE_CPU_STATS_UTILIZATION = "utilization"
VIR_NODE_MEMORY_SHARED_FULL_SCANS = "shm_full_scans"
VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES = "shm_merge_across_nodes"
VIR_NODE_MEMORY_SHARED_PAGES_SHARED = "shm_pages_shared"
VIR_NODE_MEMORY_SHARED_PAGES_SHARING = "shm_pages_sharing"
VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN = "shm_pages_to_scan"
VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED = "shm_pages_unshared"
VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE = "shm_pages_volatile"
VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS = "shm_sleep_millisecs"
VIR_NODE_MEMORY_STATS_BUFFERS = "buffers"
VIR_NODE_MEMORY_STATS_CACHED = "cached"
VIR_NODE_MEMORY_STATS_FREE = "free"
VIR_NODE_MEMORY_STATS_TOTAL = "total"
VIR_PERF_PARAM_ALIGNMENT_FAULTS = "alignment_faults"
VIR_PERF_PARAM_BRANCH_INSTRUCTIONS = "branch_instructions"
VIR_PERF_PARAM_BRANCH_MISSES = "branch_misses"
VIR_PERF_PARAM_BUS_CYCLES = "bus_cycles"
VIR_PERF_PARAM_CACHE_MISSES = "cache_misses"
VIR_PERF_PARAM_CACHE_REFERENCES = "cache_references"
VIR_PERF_PARAM_CMT = "cmt"
VIR_PERF_PARAM_CONTEXT_SWITCHES = "context_switches"
VIR_PERF_PARAM_CPU_CLOCK = "cpu_clock"
VIR_PERF_PARAM_CPU_CYCLES = "cpu_cycles"
VIR_PERF_PARAM_CPU_MIGRATIONS = "cpu_migrations"
VIR_PERF_PARAM_EMULATION_FAULTS = "emulation_faults"
VIR_PERF_PARAM_INSTRUCTIONS = "instructions"
VIR_PERF_PARAM_MBML = "mbml"
VIR_PERF_PARAM_MBMT = "mbmt"
VIR_PERF_PARAM_PAGE_FAULTS = "page_faults"
VIR_PERF_PARAM_PAGE_FAULTS_MAJ = "page_faults_maj"
VIR_PERF_PARAM_PAGE_FAULTS_MIN = "page_faults_min"
VIR_PERF_PARAM_REF_CPU_CYCLES = "ref_cpu_cycles"
VIR_PERF_PARAM_STALLED_CYCLES_BACKEND = "stalled_cycles_backend"
VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND = "stalled_cycles_frontend"
VIR_PERF_PARAM_TASK_CLOCK = "task_clock"
|