Francesco Romani has uploaded a new change for review.

Change subject: schema: fix VM.create return value
......................................................................

schema: fix VM.create return value

Fix the return value of this verb to match what Engine 4.0.0 actually expects

Change-Id: I751da2f0b2148c208975ed0e022141b2f19ec60a
Signed-off-by: Francesco Romani <from...@redhat.com>
---
M lib/api/vdsm-api.yml
M lib/api/vdsmapi.py
M tests/vdsmapi_test.py
A tests/vmcreate_retval.out
4 files changed, 256 insertions(+), 51 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/60279/1

diff --git a/lib/api/vdsm-api.yml b/lib/api/vdsm-api.yml
index 19d05e7..23db06f 100644
--- a/lib/api/vdsm-api.yml
+++ b/lib/api/vdsm-api.yml
@@ -139,7 +139,7 @@
             added: '3.6'
 
         -   description: The type of path (BlockDeviceType)
-            name: deviceType
+            name: type
             type: *BlockDeviceType
 
         -   description: The current state of this path
@@ -2235,25 +2235,29 @@
         properties:
         -   description: The slot number on the PCI bus
             name: slot
-            type: uint
+            type: string
+            datatype: uint
 
         -   description: The PCI domain
             name: domain
-            type: uint
+            type: string
+            datatype: uint
 
         -   description: The PCI bus number
             name: bus
-            type: uint
+            type: string
+            datatype: uint
 
         -   description: The device address type (always
                 pci)
-            name: addressType
+            name: type
             type: *VmDeviceAddressType
 
         -   description: Function number on the PCI card
                 that implements the device
             name: function
-            type: uint
+            type: string
+            datatype: uint
         type: object
 
     VmDeviceIdeAddress: &VmDeviceIdeAddress
@@ -2366,37 +2370,44 @@
         description: Properties of a VM disk device.
         name: VmDiskDevice
         properties:
-        -   description: Indicates if writes are prohibited for the
+        -   defaultvalue: none
+            description: Indicates if writes are prohibited for the
                 device
             name: readonly
-            type: boolean
+            type: string
+            datatype: boolean
 
-        -   description: The size of the disk (in bytes)
+        -   defaultvalue: none
+            description: The size of the disk (in bytes)
             name: apparentsize
-            type: uint
+            type: string
+            datatype: uint
 
-        -   defaultvalue: needs updating
+        -   defaultvalue: none
             description: The UUID of the underlying Volume object
             name: volumeID
             type: *UUID
 
-        -   description: The drive index
+        -   defaultvalue: none
+            description: The drive index
             name: index
-            type: int
+            type: string
+            datatype: int
 
-        -   defaultvalue: needs updating
+        -   defaultvalue: none
             description: The filesystem path to the drive's volume
             name: path
             type: string
 
-        -   defaultvalue: needs updating
+        -   defaultvalue: none
             description: List of network disk host info objects. At
                 least one host is required if diskType is set to "network"
             name: hosts
             type:
             - *NetworkDiskHostInfo
 
-        -   description: The sequence of Volume objects needed to
+        -   defaultvalue: none
+            description: The sequence of Volume objects needed to
                 construct the disk
             name: volumeChain
             type:
@@ -2416,7 +2427,8 @@
             description: If specified, this device is part of the
                 boot sequence at the specified position
             name: bootOrder
-            type: uint
+            type: string
+            datatype: uint
 
         -   description: The format used to store data on the backing
                 storage
@@ -2426,7 +2438,8 @@
         -   description: The amount of underlying storage allocated
                 (in bytes)
             name: truesize
-            type: uint
+            type: string
+            datatype: uint
 
         -   defaultvalue: needs updating
             description: Indicates the device connection method exposed
@@ -2444,14 +2457,16 @@
                 to vdsm for possible resolution (eg. allocating more
                 space)
             name: propagateErrors
-            type: boolean
+            type: string
+            datatype: boolean
 
         -   defaultvalue: needs updating
             description: Additional device parameters
             name: specParams
             type: *VmDiskDeviceSpecParams
 
-        -   description: Alias used to identify this device in commands
+        -   defaultvalue: none
+            description: Alias used to identify this device in commands
             name: alias
             type: string
 
@@ -2494,7 +2509,7 @@
             type: *UUID
 
         -   description: The device type (always disk)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   defaultvalue: needs updating
@@ -2554,7 +2569,7 @@
             type: *UUID
 
         -   description: The device type (always memory)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   description: Alias used to identify this device in commands
@@ -2681,7 +2696,7 @@
             type: *UUID
 
         -   description: The device type (always interface)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   defaultvalue: ''
@@ -3074,32 +3089,36 @@
         description: Additional parameters for VM video devices.
         name: VmVideoDeviceSpecParams
         properties:
-        -   defaultvalue: needs updating
+        -   defaultvalue: none
             description: size of the primary bar for qxl
                 in KB, rejected by libvirt for 'cirrus' or
                 'vga'
             name: ram
-            type: uint
+            type: string
+            datatype: uint
 
-        -   defaultvalue: needs updating
+        -   defaultvalue: none
             description: framebuffer size for qxl in KB,
                 rejected by libvirt for 'cirrus' or 'vga'
             name: vgamem
-            type: uint
+            type: string
+            datatype: uint
             added: '3.6'
 
         -   description: value of virtual ram in KB, for 'cirrus'
                 the default is '9216' for qxl is the size
                 of the secondary bar,
             name: vram
-            type: uint
+            type: string
+            datatype: uint
 
-        -   defaultvalue: needs updating
+        -   defaultvalue: 1
             description: Specify the amount of monitors that
                 will use single pci device.  Currently relevant
                 for qxl devices only
             name: heads
-            type: uint
+            type: string
+            datatype: uint
         type: object
 
     VmVideoDeviceType: &VmVideoDeviceType
@@ -3136,10 +3155,11 @@
             type: *UUID
 
         -   description: The device type (always video)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
-        -   description: Alias used to identify this device in commands
+        -   defaultvalue: none
+            description: Alias used to identify this device in commands
             name: alias
             type: string
 
@@ -3189,7 +3209,7 @@
             type: *UUID
 
         -   description: The device type (always sound)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   description: Alias used to identify this device in commands
@@ -3234,7 +3254,7 @@
             type: *UUID
 
         -   description: The device type (always controller)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   description: Alias used to identify this device in commands
@@ -3295,7 +3315,7 @@
             type: *VmBalloonDeviceSpecParams
 
         -   description: The device type (always balloon)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   description: Alias used to identify this device in commands
@@ -3336,7 +3356,7 @@
             type: string
 
         -   description: The device type (always channel)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   description: Device hardware address
@@ -3414,7 +3434,7 @@
             type: *VmWatchdogDeviceSpecParams
 
         -   description: The device type (always watchdog)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   description: Alias used to identify this device in commands
@@ -3471,7 +3491,7 @@
             added: '3.6'
 
         -   description: The device type (always console)
-            name: deviceType
+            name: type
             type: *VmDeviceType
         type: object
 
@@ -3537,7 +3557,7 @@
             type: string
 
         -   description: The device type (always smartcard)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   description: Device hardware address
@@ -3575,14 +3595,21 @@
             description: Specify if copy and paste is enabled.
                 Currently relevant for spice devices only.
             name: copyPasteEnable
-            type: boolean
+            type: string
+            datatype: boolean
 
         -   defaultvalue: true
             description: Specify if file transfer is enabled.
                 Currently relevant for qxl devices only.
             name: fileTransferEnable
-            type: boolean
+            type: string
+            datatype: boolean
             added: '3.6'
+
+        -   description: ''
+            name: spiceSslCipherSuite
+            type: string
+
         type: object
 
     VmGraphicsDeviceType: &VmGraphicsDeviceType
@@ -3613,7 +3640,7 @@
             type: uint
 
         -   description: The device type (always graphics)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   defaultvalue: -1
@@ -3651,7 +3678,7 @@
             type: string
 
         -   description: The device type (always hostdev)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   description: A unique ID for this device
@@ -3739,7 +3766,7 @@
             type: *VmRngDeviceModel
 
         -   description: The device type (always rng)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   description: The type of rng device
@@ -3801,7 +3828,7 @@
             type: *VmTpmDeviceSpecParams
 
         -   description: The device type (always tpm)
-            name: deviceType
+            name: type
             type: *VmDeviceType
 
         -   description: The type of tpm device
@@ -3815,7 +3842,7 @@
         name: VmDevice
         properties:
         -   description: Indicates the specific device type
-            name: deviceType
+            name: type
             type: *VmDeviceType
         type: union
         values:
@@ -3854,13 +3881,13 @@
             type: boolean
             added: '3.5'
 
-        -   defaultvalue: needs updating
+        -   defaultvalue: none
             description: The type of display
             name: display
             type: *VmDisplayType
             modified: '3.6'
 
-        -   defaultvalue: needs updating
+        -   defaultvalue: none
             description: A dictionary of custom, free-form properties
             name: custom
             type: *StringMap
@@ -3871,7 +3898,8 @@
 
         -   description: The number of CPUs presented to the VM
             name: smp
-            type: uint
+            type: string
+            datatype: uint
 
         -   defaultvalue: 16
             description: Maximum number of memory slots available This is
@@ -3880,7 +3908,7 @@
             name: maxMemSlots
             type: uint
 
-        -   defaultvalue: needs updating
+        -   defaultvalue: none
             description: An array of VM devices present
             name: devices
             type:
@@ -3918,7 +3946,8 @@
 
         -   description: The time difference from host to the VM in seconds
             name: timeOffset
-            type: uint
+            type: string
+            datatype: uint
 
         -   defaultvalue: needs updating
             description: The port in use for unencrypted display data
@@ -4042,6 +4071,48 @@
         -   description: The type of VM
             name: vmType
             type: *VmType
+
+        -   defaultvalue: no-default
+            description: Indicates the guest numa topology.
+            name: guestNumaNodes
+            type:
+            - *GuestNumaNode
+
+        -   defaultvalue: false
+            description: enable the BIOS boot menu
+            name: bootMenuEnable
+            type: string
+            datatype: boolean
+            added: '3.4'
+
+        -   description: Indicates if the smartcard support is enablerd for 
this VM.
+            name: smartcardEnable
+            type: string
+            datatype: boolean
+
+        -   description: Indicates if the PIT reinjection is enablerd for this 
VM.
+                         DEPRECATED.
+            name: pitReinjection
+            type: string
+            datatype: boolean
+
+        -   description: The network this VM should use for the graphic 
display connections.
+                         DEPRECATED.
+            name: displayNetwork
+            type: string
+
+        -   description: Timestamp of the message. FIXME figure out unit
+            name: statusTime
+            type: string
+            datatype: uint
+
+        -   description: A dictionary containing information about the disk
+                mapping within the guest. The key is the device serial and the
+                value is the mapping information.
+            added: '3.5'
+            name: guestDiskMapping
+            type: *GuestDisksMappingMap
+
         type: object
 
     MigrationCreateState: &MigrationCreateState
diff --git a/lib/api/vdsmapi.py b/lib/api/vdsmapi.py
index 0814337..d17f75c 100755
--- a/lib/api/vdsmapi.py
+++ b/lib/api/vdsmapi.py
@@ -256,6 +256,7 @@
         This method verify whether argument value align with different
         types we support such as: alias, map, union, enum and object.
         """
+        print t_type, name, identifier
         if t_type == 'alias':
             # if alias we need to check sourcetype
             self._check_primitive_type(t.get('sourcetype'), arg, name)
diff --git a/tests/vdsmapi_test.py b/tests/vdsmapi_test.py
index a1a1583..fafc59b 100644
--- a/tests/vdsmapi_test.py
+++ b/tests/vdsmapi_test.py
@@ -451,6 +451,11 @@
         _schema.schema().verify_args(
             vdsmapi.MethodRep('VM', 'create'), params)
 
+    def test_vm_create_retval(self):
+        params = eval(read_data('vmcreate_retval.out'))
+        _schema.schema().verify_retval(
+            vdsmapi.MethodRep('VM', 'create'), params)
+
     def test_missing_method(self):
         with self.assertRaises(vdsmapi.MethodNotFound):
             _schema.schema().get_method(
diff --git a/tests/vmcreate_retval.out b/tests/vmcreate_retval.out
new file mode 100644
index 0000000..9d7bb0f
--- /dev/null
+++ b/tests/vmcreate_retval.out
@@ -0,0 +1,128 @@
+{u'acpiEnable': u'true',
+ u'bootMenuEnable': u'false',
+ 'clientIp': '',
+ u'cpuType': u'Haswell-noTSX',
+ u'custom': {u'device_25179864-36e8-4c08-80c5-a7438bb71bd1': 
u"VmDevice:{id='VmDeviceId:{deviceId='25179864-36e8-4c08-80c5-a7438bb71bd1', 
vmId='31b26cb4-c171-4999-ac33-985a78968ddf'}', device='virtio-serial', 
type='CONTROLLER', bootOrder='0', specParams='[]', address='{slot=0x05, 
bus=0x00, domain=0x0000, type=pci, function=0x0}', managed='false', 
plugged='true', readOnly='false', deviceAlias='virtio-serial0', 
customProperties='[]', snapshotId='null', logicalName='null', 
usingScsiReservation='false', hostDevice=''}",
+             
u'device_25179864-36e8-4c08-80c5-a7438bb71bd1device_218ff1c1-487e-4cde-bf1b-d032f8f1f4fd':
 u"VmDevice:{id='VmDeviceId:{deviceId='218ff1c1-487e-4cde-bf1b-d032f8f1f4fd', 
vmId='31b26cb4-c171-4999-ac33-985a78968ddf'}', device='unix', type='CHANNEL', 
bootOrder='0', specParams='[]', address='{bus=0, controller=0, 
type=virtio-serial, port=1}', managed='false', plugged='true', 
readOnly='false', deviceAlias='channel0', customProperties='[]', 
snapshotId='null', logicalName='null', usingScsiReservation='false', 
hostDevice='null'}",
+             
u'device_25179864-36e8-4c08-80c5-a7438bb71bd1device_218ff1c1-487e-4cde-bf1b-d032f8f1f4fddevice_98923f4e-81e1-403d-a366-10b23dbf83e0':
 u"VmDevice:{id='VmDeviceId:{deviceId='98923f4e-81e1-403d-a366-10b23dbf83e0', 
vmId='31b26cb4-c171-4999-ac33-985a78968ddf'}', device='unix', type='CHANNEL', 
bootOrder='0', specParams='[]', address='{bus=0, controller=0, 
type=virtio-serial, port=2}', managed='false', plugged='true', 
readOnly='false', deviceAlias='channel1', customProperties='[]', 
snapshotId='null', logicalName='null', usingScsiReservation='false', 
hostDevice='null'}",
+             
u'device_25179864-36e8-4c08-80c5-a7438bb71bd1device_218ff1c1-487e-4cde-bf1b-d032f8f1f4fddevice_98923f4e-81e1-403d-a366-10b23dbf83e0device_a73ca40b-574b-4026-9454-384dbe0063a3':
 u"VmDevice:{id='VmDeviceId:{deviceId='a73ca40b-574b-4026-9454-384dbe0063a3', 
vmId='31b26cb4-c171-4999-ac33-985a78968ddf'}', device='spicevmc', 
type='CHANNEL', bootOrder='0', specParams='[]', address='{bus=0, controller=0, 
type=virtio-serial, port=3}', managed='false', plugged='true', 
readOnly='false', deviceAlias='channel2', customProperties='[]', 
snapshotId='null', logicalName='null', usingScsiReservation='false', 
hostDevice='null'}",
+             
u'device_25179864-36e8-4c08-80c5-a7438bb71bd1device_218ff1c1-487e-4cde-bf1b-d032f8f1f4fddevice_98923f4e-81e1-403d-a366-10b23dbf83e0device_a73ca40b-574b-4026-9454-384dbe0063a3device_0fc8dc79-fc35-4cdd-a098-b4a69473bae1':
 u"VmDevice:{id='VmDeviceId:{deviceId='0fc8dc79-fc35-4cdd-a098-b4a69473bae1', 
vmId='31b26cb4-c171-4999-ac33-985a78968ddf'}', device='ide', type='CONTROLLER', 
bootOrder='0', specParams='[]', address='{slot=0x01, bus=0x00, domain=0x0000, 
type=pci, function=0x1}', managed='false', plugged='true', readOnly='false', 
deviceAlias='ide', customProperties='[]', snapshotId='null', 
logicalName='null', usingScsiReservation='false', hostDevice='null'}"},
+ u'devices': [{u'address': {u'bus': u'0x00',
+                            u'domain': u'0x0000',
+                            u'function': u'0x0',
+                            u'slot': u'0x02',
+                            u'type': u'pci'},
+               u'device': u'qxl',
+               u'deviceId': u'6312a2ab-0159-4d40-ad68-9c569cc73492',
+               u'specParams': {u'heads': u'1',
+                               u'ram': u'65536',
+                               u'vgamem': u'16384',
+                               u'vram': u'32768'},
+               u'type': u'video'},
+              {u'device': u'spice',
+               u'deviceId': u'21b40929-3947-4eb9-a0a3-336119519b96',
+               u'specParams': {u'copyPasteEnable': u'true',
+                               u'fileTransferEnable': u'true',
+                               u'spiceSecureChannels': 
u'smain,sinputs,scursor,splayback,srecord,sdisplay,ssmartcard,susbredir',
+                               u'spiceSslCipherSuite': u'DEFAULT'},
+               u'type': u'graphics'},
+              {u'address': {u'bus': u'1',
+                            u'controller': u'0',
+                            u'target': u'0',
+                            u'type': u'drive',
+                            u'unit': u'0'},
+               u'bootOrder': u'1',
+               u'device': u'cdrom',
+               u'deviceId': u'896967e8-7287-49aa-a98a-b5d5030ebe2c',
+               u'iface': u'ide',
+               u'index': u'2',
+               u'path': 
u'/rhev/data-center/mnt/192.168.1.20:_srv_virtstore_nfs_generic_iso/b0390d9e-2f1d-43c0-a56c-a20af032e934/images/11111111-1111-1111-1111-111111111111/Fedora-Live-Workstation-x86_64-23-10.iso',
+               u'readonly': u'true',
+               u'shared': u'false',
+               u'specParams': {u'path': 
u'Fedora-Live-Workstation-x86_64-23-10.iso'},
+               u'type': u'disk'},
+              {u'address': {u'bus': u'0x00',
+                            u'domain': u'0x0000',
+                            u'function': u'0x0',
+                            u'slot': u'0x06',
+                            u'type': u'pci'},
+               u'device': u'disk',
+               u'deviceId': u'270e12ca-09aa-4ef4-8c4f-17f402b796ec',
+               u'domainID': u'c17ac7f2-bec0-4ed1-a04e-790799e65d7c',
+               u'format': u'raw',
+               u'iface': u'virtio',
+               u'imageID': u'270e12ca-09aa-4ef4-8c4f-17f402b796ec',
+               u'optional': u'false',
+               u'poolID': u'00000001-0001-0001-0001-0000000000ca',
+               u'propagateErrors': u'off',
+               u'readonly': u'false',
+               u'shared': u'false',
+               u'specParams': {},
+               u'type': u'disk',
+               u'volumeID': u'4198f8de-7bd0-4c8c-8977-ed5d529c2548'},
+              {u'address': {u'bus': u'0x00',
+                            u'domain': u'0x0000',
+                            u'function': u'0x0',
+                            u'slot': u'0x03',
+                            u'type': u'pci'},
+               u'device': u'bridge',
+               u'deviceId': u'54b2cdd7-3079-4ffc-ba6d-4f7cfd5885d8',
+               u'filter': u'vdsm-no-mac-spoofing',
+               u'linkActive': u'true',
+               u'macAddr': u'00:1a:4a:16:01:51',
+               u'network': u'ovirtmgmt',
+               u'nicModel': u'pv',
+               u'specParams': {u'inbound': {}, u'outbound': {}},
+               u'type': u'interface'},
+              {u'address': {u'bus': u'0x00',
+                            u'domain': u'0x0000',
+                            u'function': u'0x0',
+                            u'slot': u'0x04',
+                            u'type': u'pci'},
+               u'device': u'ich6',
+               u'deviceId': u'34858b2d-3605-4383-9bda-9cbe39153ab8',
+               u'specParams': {},
+               u'type': u'sound'},
+              {u'device': u'console',
+               u'deviceId': u'9da353a7-58fc-4595-92f7-2f5977fc16fa',
+               u'specParams': {u'consoleType': u'serial',
+                               u'enableSocket': u'true'},
+               u'type': u'console'},
+              {u'address': {u'bus': u'0x00',
+                            u'domain': u'0x0000',
+                            u'function': u'0x0',
+                            u'slot': u'0x05',
+                            u'type': u'pci'},
+               u'device': u'virtio-serial',
+               u'deviceId': u'25179864-36e8-4c08-80c5-a7438bb71bd1',
+               u'specParams': {},
+               u'type': u'controller'}],
+ u'display': 'qxl',
+ 'displayIp': '192.168.1.53',
+ u'displayNetwork': u'ovirtmgmt',
+ 'displayPort': '-1',
+ 'displaySecurePort': '-1',
+ u'emulatedMachine': u'pc-i440fx-rhel7.2.0',
+ 'guestDiskMapping': {},
+ u'guestNumaNodes': [{u'cpus': u'0,1', u'memory': u'4096', u'nodeIndex': 0}],
+ u'kvmEnable': u'true',
+ u'maxMemSize': 4194304,
+ u'maxMemSlots': 16,
+ u'maxVCpus': u'16',
+ u'memGuaranteedSize': 4096,
+ u'memSize': 4096,
+ 'nicModel': 'rtl8139,pv',
+ u'nice': u'0',
+ 'pid': '0',
+ u'pitReinjection': u'false',
+ u'smartcardEnable': u'false',
+ u'smp': u'2',
+ u'smpCoresPerSocket': u'1',
+ u'smpThreadsPerCore': u'1',
+ 'status': 'WaitForLaunch',
+ 'statusTime': '4299269080',
+ u'timeOffset': u'0',
+ u'transparentHugePages': u'true',
+ u'vmId': u'31b26cb4-c171-4999-ac33-985a78968ddf',
+ u'vmName': u'a0',
+ u'vmType': u'kvm'}
\ No newline at end of file


-- 
To view, visit https://gerrit.ovirt.org/60279
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I751da2f0b2148c208975ed0e022141b2f19ec60a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <from...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to