Upload
erica-brianne-floyd
View
229
Download
0
Tags:
Embed Size (px)
Citation preview
How To Use The WMI How To Use The WMI Interfaces With Windows Interfaces With Windows Virtualization Virtualization
Pierre JacometPierre JacometSenior Program ManagerSenior Program ManagerWindows VirtualizationWindows VirtualizationMicrosoft CorporationMicrosoft Corporation
GoalsGoals
After this presentation you willAfter this presentation you willHave a clear idea of Microsoft’s management Have a clear idea of Microsoft’s management approach to virtualization servicesapproach to virtualization services
Have a high level understanding on the Have a high level understanding on the virtualization services WMI interfacevirtualization services WMI interface
Have a better idea of how you can integrate Have a better idea of how you can integrate your product with virtualization servicesyour product with virtualization services
For managing purposesFor managing purposes
To integrate your hardwareTo integrate your hardware
AgendaAgenda
IntroductionIntroduction
Computer systemsComputer systems
Management serviceManagement service
Resources and resource poolsResources and resource pools
Virtual system settingsVirtual system settings
Runtime instance of a VMRuntime instance of a VM
SnapshotsSnapshots
Code examplesCode examples
Introduction To WMIIntroduction To WMI
WMI – Windows Management Interface is WMI – Windows Management Interface is Microsoft’s implementation of DMTF WBEMMicrosoft’s implementation of DMTF WBEM
DMTF = Distributed Management Task ForceDMTF = Distributed Management Task ForceWBEM = Web Based Enterprise ManagementWBEM = Web Based Enterprise Management
Object oriented approach to systems Object oriented approach to systems manageabilitymanageability
Uses DMTF CIM – Common Information ModelUses DMTF CIM – Common Information Model
Microsoft is working in the DMTFMicrosoft is working in the DMTFDefining virtualization management profileDefining virtualization management profile
WMI interface is subject to changeWMI interface is subject to changeDMTF changesDMTF changesOngoing Microsoft development workOngoing Microsoft development work
WMI Value PropositionWMI Value Proposition
WMI is the interface that applications use to WMI is the interface that applications use to manage all aspects of Windows virtualization manage all aspects of Windows virtualization servicesservices
WMI is consumer agnosticWMI is consumer agnosticCan be accessed remotely by WS-Management, Can be accessed remotely by WS-Management,
Programmable via C++, WSH, .NET Programmable via C++, WSH, .NET
Hardware manufacturers benefit from Hardware manufacturers benefit from understanding WMIunderstanding WMI
Understand how their hardware can participate within Understand how their hardware can participate within overall Windows virtualization services manageability overall Windows virtualization services manageability
Introduction To CIMIntroduction To CIMCommon Information ModelCommon Information Model
Object-oriented information modelObject-oriented information modelProvides a conceptual framework for describing Provides a conceptual framework for describing management data management data
For computing and business entitiesFor computing and business entities
In Internet, enterprise and service provider environmentsIn Internet, enterprise and service provider environments
FormalismFormalismUML – Universal Modeling LanguageUML – Universal Modeling Language
MOF – Managed Object FormatMOF – Managed Object Format
CIMOM – CIM object managerCIMOM – CIM object managerImplements CIMImplements CIM
WMI includes a CIMOM componentWMI includes a CIMOM component
CIM SchemaCIM Schema
Schemas are building blocks of CIMSchemas are building blocks of CIMDescribe and represent manageabilityDescribe and represent manageability
Core modelCore modelCapture notions applicable to all Capture notions applicable to all management areasmanagement areas
Common modelsCommon modelsCapture notions common to particular Capture notions common to particular management areasmanagement areas
Independent of any particular implementationIndependent of any particular implementation
CIM CIM Common modelsCommon models
AppsApps
DatabaseDatabase
DeviceDevice
EventEvent
InteropInterop
MetricsMetrics
NetworkNetwork
PhysicalPhysical
PolicyPolicy
SupportSupport
SystemSystem
UserUser
VirtualizationVirtualization
DMTF Management ProfileDMTF Management Profile
Specification that defines the CIM model Specification that defines the CIM model and associated behavior for a and associated behavior for a management domainmanagement domain
Use small subset of full CIM schemaUse small subset of full CIM schema
Within management domain definesWithin management domain definesClasses, associations, etc.Classes, associations, etc.
Requirements regarding above classesRequirements regarding above classesand associationsand associations
CIM Virtualization ProfileCIM Virtualization Profile
Specification that defines the CIM model Specification that defines the CIM model and behavior for virtualization and behavior for virtualization management domainmanagement domainDepends on CIM core modelDepends on CIM core model
Core includes basic classes, associations, Core includes basic classes, associations, indications, methods and propertiesindications, methods and properties
Implemented by Windows virtualization Implemented by Windows virtualization WMI providerWMI provider
CIM Virtualization ProfileCIM Virtualization Profile General Design ApproachGeneral Design Approach
Model interoperable with other Model interoperable with other virtualization platformsvirtualization platforms
Virtual resources modeled in the same Virtual resources modeled in the same way as their physical counterpartsway as their physical counterparts
Virtual aspects abstracted into Virtual aspects abstracted into associated classesassociated classes
CIM Virtualization ProfileCIM Virtualization ProfileNote on name differencesNote on name differences
Throughout this presentation please Throughout this presentation please note the followingnote the following
Usage of word “Host” or “Physical” maps to Usage of word “Host” or “Physical” maps to parent partition or the computer system parent partition or the computer system running in the parent partitionrunning in the parent partition
Main Virtualization ObjectsMain Virtualization Objects
Computer systemsComputer systemsDescribe both physical and virtual computersDescribe both physical and virtual computers
Management serviceManagement serviceControls all aspects of the lifecycle of a VMControls all aspects of the lifecycle of a VM
Virtual system settingsVirtual system settingsRepresent a VM or a snapshotRepresent a VM or a snapshot
Resources and resource poolsResources and resource poolsRepresent resourcesRepresent resources
AgendaAgenda
IntroductionIntroduction
Computer systemsComputer systems
Management serviceManagement service
Resources and resource poolsResources and resource pools
Virtual system settingsVirtual system settings
Runtime instance of a VMRuntime instance of a VM
SnapshotsSnapshots
Code examplesCode examples
Computer SystemsComputer Systems
Physical or virtualPhysical or virtualVM is a computer systemVM is a computer system
Host is a computer systemHost is a computer system
CIM_ComputerSystem
(Physical)
CIM_ComputerSystem
(Virtual)
Computer SystemsComputer SystemsLinking Physical to VirtualLinking Physical to Virtual
Hosted Dependency association Hosted Dependency association links VM computer system to Host links VM computer system to Host computer systemcomputer system
Host
Computer System
VM-1
Computer System
VM-2
Computer System
VM-3
Computer System
Hosted DependencyHosted Dependency
Computer SystemsComputer SystemsVirtual SystemsVirtual Systems
All virtual aspects abstracted into a All virtual aspects abstracted into a virtualization specific objectvirtualization specific object
Virtual
Computer System
Virtual System
Setting Data
Element Setting DataElement Setting Data
Host
Computer System
Hosted DependencyHosted Dependency
Virtual System LifecycleVirtual System Lifecycle(Or possible states a VM can be in)(Or possible states a VM can be in)
DefinedDefinedInitial state, resource usage described by Initial state, resource usage described by configuration, resources not allocated except for disksconfiguration, resources not allocated except for disks
ActiveActiveVM is running, all resources are allocatedVM is running, all resources are allocated
PausedPausedVM is paused, all resources remain allocatedVM is paused, all resources remain allocated
SuspendedSuspendedVM resources are de-allocated, state is persistedVM resources are de-allocated, state is persisted
Virtual SystemVirtual SystemState transitionsState transitions
VM defined
VM active
VM paused
VM suspended
Starting
state
End
state
AgendaAgenda
IntroductionIntroduction
Computer systemsComputer systems
Management serviceManagement service
Resources and resource poolsResources and resource pools
Virtual system settingsVirtual system settings
Runtime instance of a VMRuntime instance of a VM
SnapshotsSnapshots
Code examplesCode examples
Management ServiceManagement Service
Full name: Virtual System Management Full name: Virtual System Management Service (VSMS)Service (VSMS)Central object in virtualization profileCentral object in virtualization profile
Needed to access and manage virtualization Needed to access and manage virtualization services exposed by a host systemservices exposed by a host system
Exposes operations to manage Exposes operations to manage VM lifecycleVM lifecycle
Define virtual systemDefine virtual systemModify virtual systemModify virtual systemRequest State ChangeRequest State ChangeOthersOthers
Management ServiceManagement ServiceRelationship to hostRelationship to host
VSMS is just another serviceVSMS is just another serviceScoped by Hosting computer systemScoped by Hosting computer system
Associated to host via Hosted ServiceAssociated to host via Hosted Service
VSMS is specialVSMS is specialAssociated to host via Associated Virtual System Associated to host via Associated Virtual System Management Service Management Service
Host
Computer System
Virtual System
Management Service
Associated Virtual System Management ServiceAssociated Virtual System Management Service
Hosted ServiceHosted Service
VSMS Discovering VSMS Discovering CapabilitiesCapabilities
Virtual System Management Capabilities class Virtual System Management Capabilities class describes VSMS implementation leveldescribes VSMS implementation level
Optional methodsOptional methods
Indication supportIndication support
Asynchronous operations supportAsynchronous operations support
Virtual System
Management Service
Virtual System
Management CapabilitiesElement CapabilitiesElement Capabilities
AgendaAgenda
IntroductionIntroduction
Computer systemsComputer systems
Management serviceManagement service
Resources and resource poolsResources and resource pools
Virtual system settingsVirtual system settings
Runtime instance of a VMRuntime instance of a VM
SnapshotsSnapshots
Code examplesCode examples
ResourcesResources
Physical or virtual resources Physical or virtual resources have the same representationhave the same representation
Include items likeInclude items likeMemoryMemory
NetworkNetwork
PortsPorts
Allocated from resource poolsAllocated from resource pools
Resource PoolsResource Pools
Managed by resource pool Managed by resource pool configuration serviceconfiguration service
One allocated for a each device typeOne allocated for a each device type
May be hierarchicalMay be hierarchical
Central class for virtual device allocationsCentral class for virtual device allocationsVirtual resources are allocated from Virtual resources are allocated from resource poolsresource pools
Resource PoolsResource PoolsResource pool configuration serviceResource pool configuration service
Host System
Resource Pool
Configuration Service
Resource Pool
Configuration Capabilities
Resource Pool
Virtual ResourceHost Resource
Hosted ServiceHosted Service
Element Element CapabilitiesCapabilities
Service Affects Service Affects ElementElement
Concrete Concrete ComponentComponent
Allocated From Allocated From PoolPool
System DeviceSystem Device
Hosted Hosted Resource PoolResource Pool
Host Computer SystemHost Computer SystemInstance diagramInstance diagram
Host has resourcesHost has resourcesProcessor, memoryProcessor, memory
Host resources Host resources go into poolsgo into pools
Host
Computer System
Processor
Resource Pool
NIC
Resource Pool
Memory
Resource Pool
Hosted Resource PoolHosted Resource Pool
Concrete Comp.Concrete Comp.
Processor
Memory
NIC
System System
DeviceDevice
AgendaAgenda
WMI introductionWMI introduction
Computer systemsComputer systems
Management serviceManagement service
Resources and resource poolsResources and resource pools
Virtual system settingsVirtual system settings
Runtime instance of a VMRuntime instance of a VM
SnapshotsSnapshots
Code examplesCode examples
Virtual System SettingsVirtual System Settings
Virtual aspects of a Computer systemVirtual aspects of a Computer system
One instance for each different One instance for each different configuration settings for a VMconfiguration settings for a VM
Active stateActive state
Snapshots – 0 or moreSnapshots – 0 or more
Associated with resource allocation Associated with resource allocation settings for VMsettings for VM
Resource Allocation Resource Allocation Setting DataSetting Data
Represents settings of a single resourceRepresents settings of a single resource
One instance for each different One instance for each different device settingsdevice settings
ActiveActive
Snapshots – 0 or moreSnapshots – 0 or more
Virtual Computer SystemVirtual Computer SystemInstance diagramInstance diagram
Virtual Virtual System has System has virtual virtual devicesdevicesVirtual Virtual system system settings and settings and Resource Resource allocation allocation settings track settings track allocationsallocations
VirtualComputer System
Processor
Memory
NIC
Element Setting DataElement Setting Data
Virtual System Settings(Active)
Element Setting DataElement Setting Data
ResourceAllocation
Setting
ResourceAllocation
Setting
ResourceAllocation
Setting
Vir
tua
l S
ys
tem
Se
ttin
g D
ata
Co
mp
on
en
tV
irtu
al
Sy
ste
m S
ett
ing
Da
ta C
om
po
ne
nt
System System DeviceDevice
AgendaAgenda
WMI introductionWMI introduction
Computer systemsComputer systems
Management serviceManagement service
Resources and resource poolsResources and resource pools
Virtual system settingsVirtual system settings
Runtime instance of a VMRuntime instance of a VM
SnapshotsSnapshots
Code examplesCode examples
Running VM InstanceRunning VM InstanceDiagramDiagram
Host
Computer System
Processor
Memory
NIC
VirtualComputer System
Virtual System Settings(Active)
NIC
ProcessorResource pool
NICResource pool
MemoryResource pool
ResourceAllocation
Setting
ResourceAllocation
Setting
ResourceAllocation
Setting
Allocated from PoolAllocated from Pool
Hosted DependencyHosted Dependency
Processor
Memory
AgendaAgenda
IntroductionIntroduction
Computer systemsComputer systems
Management serviceManagement service
Resources and resource poolsResources and resource pools
Virtual system settingsVirtual system settings
Runtime instance of a VMRuntime instance of a VM
SnapshotsSnapshots
Code examplesCode examples
SnapshotsSnapshotsDefinitionDefinition
Represents point in time configurationRepresents point in time configurationof a VM including it’s resourcesof a VM including it’s resources
In CIM termsIn CIM termsA Virtual System Settings Data structureA Virtual System Settings Data structure
All of the associated Resource Allocation All of the associated Resource Allocation Setting Data elementsSetting Data elements
Virtual System Settings(Snapshot @ t-2)
ResourceAllocation
Setting
ResourceAllocation
Setting
ResourceAllocation
Setting
Snapshots CreationSnapshots CreationSimplified instance diagramSimplified instance diagram
VirtualComputer System
Processor
Memory
NIC
Element Setting DataElement Setting Data
Virtual System Settings(Active)
ResourceAllocation
Setting
ResourceAllocation
Setting
ResourceAllocation
Setting
Virtual System Settings(Snapshot @ t-1)
ResourceAllocation
Setting
ResourceAllocation
Setting
ResourceAllocation
Setting
Applying A SnapshotApplying A Snapshot
Client enumerates snapshots using Client enumerates snapshots using Element Setting Data aggregationElement Setting Data aggregation
Selects snapshot that she/he wants Selects snapshot that she/he wants to applyto apply
Invokes ApplySnapshot() method Invokes ApplySnapshot() method of VSMSof VSMS
Snapshot recorded values become Snapshot recorded values become current valuescurrent values
Virtual System SettingsSnapshot (t-2)
ResourceAllocation
Setting
ResourceAllocation
Setting
ResourceAllocation
Setting
Virtual System Settings(Snapshot @ t-2)
ResourceAllocation
Setting
ResourceAllocation
Setting
ResourceAllocation
Setting
Applying A SnapshotApplying A SnapshotSimplified instance diagramSimplified instance diagram
VirtualComputer System
Processor
Memory
NIC
Element Setting DataElement Setting Data
Virtual System Settings(Active)
ResourceAllocation
Setting
ResourceAllocation
Setting
ResourceAllocation
Setting
Apply Snapshot
AgendaAgenda
IntroductionIntroduction
Computer systemsComputer systems
Management serviceManagement service
Resources and resource poolsResources and resource pools
Virtual system settingsVirtual system settings
Runtime instance of a VMRuntime instance of a VM
SnapshotsSnapshots
Code examplesCode examples
Common Code SequenceCommon Code Sequence
Locate Windows virtualization servicesLocate Windows virtualization services
Connect to WMI CIMOM inConnect to WMI CIMOM invirtualization namespacevirtualization namespace
Connect to VSMSConnect to VSMS
Issue WQL – WMI Query Language toIssue WQL – WMI Query Language toLocate instances of classesLocate instances of classes
Subscribe to eventsSubscribe to events
Connecting To VSMSConnecting To VSMS
Dim WMIServiceDim VMHostVMHost = ".“
‘ ‘ Connect to the CIMOM in the destination machineConnect to the CIMOM in the destination machine‘ ‘ we use the \virtualization namespace.we use the \virtualization namespace.Set WMIService = GetObject( "winmgmts:\\" & VMHost _
& "\root\Virtualization")‘ Connect to WMI class that represents VSMSSet VMService = WMIService.Get("Msvm_VirtualSystemManagementService")
Enumerate VMsEnumerate VMs
Dim WMIServiceDim VMListDim VMDim VMHost
VMHost = "."' Get instance of the WMI Service in the virtualization namespace.' Get instance of the WMI Service in the virtualization namespace.Set WMIService = GetObject("winmgmts:\\" & VMHost & _
"\root\virtualization")
' Enumerate all Msvm_VirtualComputerSystem objects.' Enumerate all Msvm_VirtualComputerSystem objects.Set VMList = WMIService.InstancesOf("Msvm_VirtualComputerSystem") For Each VM In VMList WScript.Echo "VM Name: " & VM.ElementNameNext
Activate A VMActivate A VM
Const wbemFlagForwardOnly = 32Const wbemFlagReturnImmediately = 16Dim VMListDim VM……'' Use a WQL query to Find the VM passed in as argument in VMName Use a WQL query to Find the VM passed in as argument in VMNameSet VMList = WMIService.ExecQuery ( _
"SELECT * FROM Msvm_VirtualComputerSystem " & _ "WHERE ElementName='" & VMName & "'",
"WQL", _wbemFlagForwardOnly + wbemFlagReturnImmediately _
)
' Activate the specified VM.' Activate the specified VM.For Each VM In VMList WScript.Echo "Activating VM " & VM.Name VMService.ActivateVirtualSystem (VM)Next
Deactivate A VMDeactivate A VM
Const wbemFlagForwardOnly = 32Const wbemFlagReturnImmediately = 16Dim VMListDim VM……'' Use a WQL query to Find the VM passed in as argument in VMName Use a WQL query to Find the VM passed in as argument in VMNameSet VMList = WMIService.ExecQuery ( _
"SELECT * FROM Msvm_VirtualComputerSystem " & _ "WHERE ElementName='" & VMName & "'",
"WQL", _wbemFlagForwardOnly + wbemFlagReturnImmediately _
)
' Deactivate the specified VM.' Deactivate the specified VM.For Each VM In VMList WScript.Echo “Deactivating VM " & VM.Name VMService.DeActivateVirtualSystem (VM)Next
Call To ActionCall To Action
If you are interested to have your software If you are interested to have your software or hardware product participate in or hardware product participate in virtualized environment manageabilityvirtualized environment manageability
Stay in touch with our WMI interfaceStay in touch with our WMI interface
Engage in Beta programEngage in Beta program
Send feedback and questions Send feedback and questions toto MSVirtEx @ microsoft.comMSVirtEx @ microsoft.com
Additional ResourcesAdditional ResourcesRelated SessionsRelated Sessions
BUS126BUS126 Windows Virtualization Strategy and Roadmap Windows Virtualization Strategy and Roadmap
VIR065VIR065 Microsoft Operating System Virtualization Strategy Microsoft Operating System Virtualization Strategyand Virtual Hard Disk Directionsand Virtual Hard Disk Directions
VIR047VIR047 Hypervisor, Virtualization Stack, Hypervisor, Virtualization Stack,and Device Virtualization Architecturesand Device Virtualization Architectures
VIR040VIR040 Device Virtualization Architecture Device Virtualization Architecture
VIR043VIR043 How to Use WMI Interfaces with Windows Virtualization How to Use WMI Interfaces with Windows Virtualization
VIR049VIR049 Inside Microsoft’s Network and Storage VSP/VSC Inside Microsoft’s Network and Storage VSP/VSC
VIR124VIR124 Windows Virtualization Best Practices Windows Virtualization Best Practicesand Future Hardware Directionsand Future Hardware Directions
VIR046VIR046 Hypercall APIs Explained Hypercall APIs Explained
Additional ResourcesAdditional ResourcesPublications and Contact InformationPublications and Contact Information
PublicationsPublicationsPresentations and future papers Presentations and future papers http://www.microsoft.com/whdc/system/platform/virtual/default.mspxhttp://www.microsoft.com/whdc/system/platform/virtual/default.mspx
Preview papers and specs Preview papers and specs WinHEC Proceedings DVDWinHEC Proceedings DVD
Windows Hypervisor Top Level Functional SpecificationWindows Hypervisor Top Level Functional Specification
Windows Virtualization GlossaryWindows Virtualization Glossary
Web resourcesWeb resourcesWindows Virtualization Team BlogWindows Virtualization Team Bloghttp://http://blogs.technet.comblogs.technet.com/virtualization/virtualization
AMD I/O Virtualization Technology (IOMMU) SpecificationAMD I/O Virtualization Technology (IOMMU) Specificationhttp://http://developer.amd.com/documentation.aspxdeveloper.amd.com/documentation.aspx
Intel® Virtualization Technology for Directed I/O Architecture SpecificationIntel® Virtualization Technology for Directed I/O Architecture Specificationftp://download.intel.com/technology/computing/vptech/Intel(r)_VT_for_Direct_IO.pdfftp://download.intel.com/technology/computing/vptech/Intel(r)_VT_for_Direct_IO.pdf
LaGrande Technology Preliminary Architecture SpecificationLaGrande Technology Preliminary Architecture Specificationhttp://www.intel.com/technology/security/http://www.intel.com/technology/security/
Trusted Computing GroupTrusted Computing Grouphttp://www.trustedcomputinggroup.org/homehttp://www.trustedcomputinggroup.org/home
Email comments toEmail comments to msvirtex @ microsoft.commsvirtex @ microsoft.com
© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions,
it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.