Re: [PATCHv2 4/5] hyperv: Add basic driver for Microsoft Hyper-V

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/8/20 Eric Blake <eblake@xxxxxxxxxx>:
> On 08/03/2011 09:00 AM, Matthias Bolte wrote:
>>
>> Domain listing, basic information retrieval and domain life cycle
>> management is implemented. But currently the domian XML output
>
> s/domian/domain/
>
>> lacks the complete devices section.
>>
>> The driver uses OpenWSMAN to directly communicate with an Hyper-V
>
> s/an Hyper/a Hyper/
>
> Since the H in Hyper is aspirated, we use 'a' instead of 'an'.  Blame
> English for being stupid.
>
>> server over its WS-Management interface exposed via Microsoft WinRM.
>>
>> The driver is based on the work of Michael Sievers. This started in
>> the same master program project group at the University of Paderborn
>> as the ESX driver.
>>
>> See Michael's blog for details: http://hyperv4libvirt.wordpress.com/
>> ---

>> +    /* Strip the string to fit more relevant information in 32 chars */
>> +    tmp = processorList->data->Name;
>> +
>> +    while (*tmp != '\0') {
>> +        if (STRPREFIX(tmp, "  ")) {
>> +            memmove(tmp, tmp + 1, strlen(tmp + 1) + 1);
>> +            continue;
>> +        } else if (STRPREFIX(tmp, "(R)") || STRPREFIX(tmp, "(C)")) {
>> +            memmove(tmp, tmp + 3, strlen(tmp + 3) + 1);
>> +            continue;
>> +        } else if (STRPREFIX(tmp, "(TM)")) {
>
> Cute.  Hopefully no one complains about stripping copyright and trademark
> notations in our compressed strings.  I think you're okay, but IANAL.

This is the same logic as in the ESX driver.

> Conditional ACK - I pointed out a couple more flag-variant functions that
> are trivially implemented.  I'm okay if you post a delta patch for review,
> then squash it in before pushing, since that would be shorter than a
> full-blown v3.

Here's an interdiff for v3.

-- 
Matthias Bolte
http://photron.blogspot.com
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 5301ec5..b022fee 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -164,7 +164,7 @@ hypervOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
 
     /* Check if the connection can be established and if the server has the
      * Hyper-V role installed. If the call to hypervGetMsvmComputerSystemList
-     * succeeds than the connection has be established. If the returned list
+     * succeeds than the connection has been established. If the returned list
      * is empty than the server isn't a Hyper-V server. */
     virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_SELECT);
     virBufferAddLit(&query, "where ");
@@ -594,13 +594,15 @@ hypervDomainResume(virDomainPtr domain)
 
 
 static int
-hypervDomainDestroy(virDomainPtr domain)
+hypervDomainDestroyFlags(virDomainPtr domain, unsigned int flags)
 {
     int result = -1;
     hypervPrivate *priv = domain->conn->privateData;
     Msvm_ComputerSystem *computerSystem = NULL;
     bool in_transition = false;
 
+    virCheckFlags(0, -1);
+
     if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
         goto cleanup;
     }
@@ -623,6 +625,14 @@ hypervDomainDestroy(virDomainPtr domain)
 
 
 
+static int
+hypervDomainDestroy(virDomainPtr domain)
+{
+    return hypervDomainDestroyFlags(domain, 0);
+}
+
+
+
 static char *
 hypervDomainGetOSType(virDomainPtr domain ATTRIBUTE_UNUSED)
 {
@@ -787,6 +797,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
     Msvm_ProcessorSettingData *processorSettingData = NULL;
     Msvm_MemorySettingData *memorySettingData = NULL;
 
+    /* Flags checked by virDomainDefFormat */
+
     if (VIR_ALLOC(def) < 0) {
         virReportOOMError();
         goto cleanup;
@@ -1022,12 +1034,14 @@ hypervNumberOfDefinedDomains(virConnectPtr conn)
 
 
 static int
-hypervDomainCreate(virDomainPtr domain)
+hypervDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
 {
     int result = -1;
     hypervPrivate *priv = domain->conn->privateData;
     Msvm_ComputerSystem *computerSystem = NULL;
 
+    virCheckFlags(0, -1);
+
     if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
         goto cleanup;
     }
@@ -1050,6 +1064,14 @@ hypervDomainCreate(virDomainPtr domain)
 
 
 static int
+hypervDomainCreate(virDomainPtr domain)
+{
+    return hypervDomainCreateWithFlags(domain, 0);
+}
+
+
+
+static int
 hypervIsEncrypted(virConnectPtr conn)
 {
     hypervPrivate *priv = conn->privateData;
@@ -1218,6 +1240,7 @@ static virDriver hypervDriver = {
     .domainSuspend = hypervDomainSuspend, /* 0.9.5 */
     .domainResume = hypervDomainResume, /* 0.9.5 */
     .domainDestroy = hypervDomainDestroy, /* 0.9.5 */
+    .domainDestroyFlags = hypervDomainDestroyFlags, /* 0.9.5 */
     .domainGetOSType = hypervDomainGetOSType, /* 0.9.5 */
     .domainGetInfo = hypervDomainGetInfo, /* 0.9.5 */
     .domainGetState = hypervDomainGetState, /* 0.9.5 */
@@ -1225,6 +1248,7 @@ static virDriver hypervDriver = {
     .listDefinedDomains = hypervListDefinedDomains, /* 0.9.5 */
     .numOfDefinedDomains = hypervNumberOfDefinedDomains, /* 0.9.5 */
     .domainCreate = hypervDomainCreate, /* 0.9.5 */
+    .domainCreateWithFlags = hypervDomainCreateWithFlags, /* 0.9.5 */
     .isEncrypted = hypervIsEncrypted, /* 0.9.5 */
     .isSecure = hypervIsSecure, /* 0.9.5 */
     .domainIsActive = hypervDomainIsActive, /* 0.9.5 */
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]