File: VirtualDiskManager.rst

package info (click to toggle)
python-pyvmomi 6.7.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,984 kB
  • sloc: python: 9,206; xml: 77; makefile: 9
file content (581 lines) | stat: -rw-r--r-- 19,603 bytes parent folder | download | duplicates (5)
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
.. _int: https://docs.python.org/2/library/stdtypes.html

.. _str: https://docs.python.org/2/library/stdtypes.html

.. _long: https://docs.python.org/2/library/stdtypes.html

.. _bool: https://docs.python.org/2/library/stdtypes.html

.. _vim.Task: ../vim/Task.rst

.. _VI API 2.5: ../vim/version.rst#vimversionversion2

.. _vim.Datacenter: ../vim/Datacenter.rst

.. _vSphere API 4.0: ../vim/version.rst#vimversionversion5

.. _vim.vm.ProfileSpec: ../vim/vm/ProfileSpec.rst

.. _vim.fault.FileFault: ../vim/fault/FileFault.rst

.. _vim.fault.InvalidDatastore: ../vim/fault/InvalidDatastore.rst

.. _vim.fault.InvalidDiskFormat: ../vim/fault/InvalidDiskFormat.rst

.. _vim.host.DiskDimensions.Chs: ../vim/host/DiskDimensions/Chs.rst

.. _vim.VirtualDiskManager.VirtualDiskSpec: ../vim/VirtualDiskManager/VirtualDiskSpec.rst


vim.VirtualDiskManager
======================
  This managed object type provides a way to manage and manipulate virtual disks on datastores. The source and the destination names are in the form of a URL or a datastore path.A URL has the formscheme://authority/folder/path?dcPath=dcPath=dsNamewhere
   * scheme
   * is
   * http
   * or
   * https
   * .
   * authority
   * specifies the hostname or IP address of the VirtualCenter or ESX server and optionally the port.
   * dcPath
   * is the inventory path to the Datacenter containing the Datastore.
   * dsName
   * is the name of the Datastore.
   * path
   * is a slash-delimited path from the root of the datastore.A datastore path has the form[datastore]pathwhere
   * datastore
   * is the datastore name.
   * path
   * is a slash-delimited path from the root of the datastore.An example datastore path is "[storage] path/to/file.extension". A listing of all the files, disks and folders on a datastore can be obtained from the datastore browser.See `HostDatastoreBrowser`_ 


:since: `VI API 2.5`_


Attributes
----------


Methods
-------


CreateVirtualDisk(name, datacenter, spec):
   Create a virtual disk.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk is created.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk to be created.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.


    spec (`vim.VirtualDiskManager.VirtualDiskSpec`_):
       The specification of the virtual disk to be created.




  Returns:
     `vim.Task`_:
         a datastore path referring to the created virtual disk.

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs creating the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


DeleteVirtualDisk(name, datacenter):
   Delete a virtual disk. All files relating to the disk will be deleted.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk is removed.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk to be deleted.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.




  Returns:
     `vim.Task`_:
         

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs deleting the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


MoveVirtualDisk(sourceName, sourceDatacenter, destName, destDatacenter, force, profile):
   Move a virtual disk and all related files from the source location specified bysourceNameandsourceDatacenterto the destination location specified bydestNameanddestDatacenter.If source (or destination) name is specified as a URL, then the corresponding datacenter parameter may be omitted.If source and destination resolve to the same file system location, the call has no effect.Requires Datastore.FileManagement privilege on both source and destination datastores.


  Privilege:
               System.View



  Args:
    sourceName (`str`_):
       The name of the source, either a datastore path or a URL referring to the virtual disk to be moved.


    sourceDatacenter (`vim.Datacenter`_, optional):
       IfsourceNameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,sourceNamemust be a URL.


    destName (`str`_):
       The name of the destination, either a datastore path or a URL referring to the destination virtual disk.


    destDatacenter (`vim.Datacenter`_, optional):
       IfdestNameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter, it is assumed that the destination path belongs to the source datacenter.


    force (`bool`_, optional):
       If true, overwrite any indentically named disk at the destination. If not specified, it is assumed to be false


    profile (`vim.vm.ProfileSpec`_, optional, since `vSphere API 5.5`_ ):
       User can specify new set of profile when moving virtual disk.




  Returns:
     `vim.Task`_:
         a datastore path referring to the destination virtual disk.

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs renaming the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the source or destination datastore.


CopyVirtualDisk(sourceName, sourceDatacenter, destName, destDatacenter, destSpec, force):
   Copy a virtual disk, performing conversions as specified in the spec.If source (or destination) name is specified as a URL, then the corresponding datacenter parameter may be omitted.If source and destination resolve to the same file system location, the call has no effect, regardless of destSpec content.Requires Datastore.FileManagement privilege on both source and destination datastores.


  Privilege:
               System.View



  Args:
    sourceName (`str`_):
       The name of the source, either a datastore path or a URL referring to the virtual disk to be copied.


    sourceDatacenter (`vim.Datacenter`_, optional):
       IfsourceNameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,sourceNamemust be a URL.


    destName (`str`_):
       The name of the destination, either a datastore path or a URL referring to the virtual disk to be created.


    destDatacenter (`vim.Datacenter`_, optional):
       IfdestNameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter, it is assumed that the destination path belongs to the source datacenter.


    destSpec (`vim.VirtualDiskManager.VirtualDiskSpec`_, optional):
       The specification of the virtual disk to be created. If not specified, a preallocated format and busLogic adapter type is assumed.


    force (`bool`_, optional):
       The force flag is currently ignored. The FileAlreadyExists fault is thrown if the destination file already exists.




  Returns:
     `vim.Task`_:
         a datastore path referring to the copied virtual disk.

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs cloning the virtual disk.

    `vim.fault.InvalidDiskFormat`_: 
       if the destination's format is not supported.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the source or destination datastore.


ExtendVirtualDisk(name, datacenter, newCapacityKb, eagerZero):
   Expand the capacity of a virtual disk to the new capacity. If the eagerZero flag is not specified, - the extended disk region of a zerothick disk will be zeroedthick - the extended disk region of a eagerzerothick disk will be eagerzeroedthick - a thin-provisioned disk will always be extended as a thin-provisioned disk. If the eagerZero flag TRUE, the extended region of the disk will always be eagerly zeroed. If the eagerZero flag FALSE, the extended region of a zeroedthick or eagerzeroedthick the disk will not be eagerly zeroed. This condition has no effect on a thin source disk.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk resides.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk whose capacity should be expanded.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.


    newCapacityKb (`long`_):
       The new capacty of the virtual disk in Kb.


    eagerZero (`bool`_, optional, since `vSphere API 4.0`_ ):
       If true, the extended part of the disk will be explicitly filled with zeroes.




  Returns:
     `vim.Task`_:
         

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs extending the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


QueryVirtualDiskFragmentation(name, datacenter):
   Return the percentage of fragmentation of the sparse virtual disk. This is the fragmentation of virtual disk file(s) in the host operating system, not the fragmentation of the guest operating systemS filesystem inside the virtual disk.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk resides.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk for which to return the percentage of fragmentation.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.




  Returns:
    `int`_:
         the percentage of fragmentation (as an integer between 0 and 100) of the sparse virtual disk.

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs reading the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


DefragmentVirtualDisk(name, datacenter):
   Defragment a sparse virtual disk. This is defragmentation of the virtual disk file(s) in the host operating system, not defragmentation of the guest operating system filesystem inside the virtual disk.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk resides.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk that should be defragmented.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.




  Returns:
     `vim.Task`_:
         

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs defragmenting the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


ShrinkVirtualDisk(name, datacenter, copy):
   Shrink a sparse virtual disk.The datacenter parameter may be omitted if a URL is used to name the disk.The optional parametercopyspecifies whether to shrink the disk in copy-shrink mode or in-place mode. In copy-shrink mode, additional space is required, but will result in a shrunk disk that is also defragmented. In-place shrink does not require additional space, but will increase fragmentation. The default behavior is to perform copy-shrink if the parameter is not specified.Requires Datastore.FileManagement privilege on the datastore where the virtual disk resides.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk that should be shrink.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.


    copy (`bool`_, optional):
       If true or omitted, performs shrink in copy-shrink mode, otherwise shrink in in-place mode.




  Returns:
     `vim.Task`_:
         

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs shrinking the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


InflateVirtualDisk(name, datacenter):
   Inflate a sparse or thin-provisioned virtual disk up to the full size. Additional space allocated to the disk as a result of this operation will be filled with zeroes.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk resides.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk that should be inflated.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.




  Returns:
     `vim.Task`_:
         

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs inflating the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


EagerZeroVirtualDisk(name, datacenter):
   Explicitly zero out unaccessed parts zeroedthick disk. Effectively a no-op if the disk is already eagerZeroedThick. Unlike zeroFillVirtualDisk, which wipes the entire disk, this operation only affects previously unaccessed parts of the disk.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk resides.
  since: `vSphere API 4.0`_


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk that should be inflated.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.




  Returns:
     `vim.Task`_:
         

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs while eager-zeroing the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


ZeroFillVirtualDisk(name, datacenter):
   Overwrite all blocks of the virtual disk with zeros. All data will be lost.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk resides.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk whose blocks should be overwritten with zeroes.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.




  Returns:
     `vim.Task`_:
         

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs zero filling the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


SetVirtualDiskUuid(name, datacenter, uuid):
   Set the virtual disk SCSI inquiry page 0x83 data.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk resides.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk whose SCSI inquiry page 0x83 data should be set.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.


    uuid (`str`_):
       The hex representation of the unique ID for this virtual disk.




  Returns:
    None
         

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs updating the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


QueryVirtualDiskUuid(name, datacenter):
   Get the virtual disk SCSI inquiry page 0x83 data.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk resides.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk from which to get SCSI inquiry page 0x83 data.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.




  Returns:
    `str`_:
         The hex representation of the unique ID for this virtual disk.

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs reading the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.


QueryVirtualDiskGeometry(name, datacenter):
   Get the disk geometry information for the virtual disk.The datacenter parameter may be omitted if a URL is used to name the disk.Requires Datastore.FileManagement privilege on the datastore where the virtual disk resides.


  Privilege:
               System.View



  Args:
    name (`str`_):
       The name of the disk, either a datastore path or a URL referring to the virtual disk from which to get geometry information.


    datacenter (`vim.Datacenter`_, optional):
       Ifnameis a datastore path, the datacenter for that datastore path. Not needed when invoked directly on ESX. If not specified on a call to VirtualCenter,namemust be a URL.




  Returns:
    `vim.host.DiskDimensions.Chs`_:
         The geometry information for this virtual disk.

  Raises:

    `vim.fault.FileFault`_: 
       if an error occurs reading the virtual disk.

    `vim.fault.InvalidDatastore`_: 
       if the operation cannot be performed on the datastore.