Intelligent snapshot process for virtual machines with heterogeneous disks
An in-guest agent receives a command to conduct a backup of a virtual machine (VM) having a copy service. A discovery is initiated of disk types attached to the VM. Based on the discovery, at least first and second disks are identified. The first disk is identified as a virtual machine disk (VMDK) and the second disk is identified as a raw device mapping (RDM) disk. After the identification, a request is issued to the copy service to prepare the applications for a snapshot operation. A first request for a snapshot of the VMDK disk is issued over a socket communication channel. A second request for a snapshot of the RDM disk is issued over a TCP network to a controller of a storage array responsible for presenting the second disk to the VM. Responses to the first and second requests are managed to conduct the backup.
1 . A method comprising:
receiving, at a data protection agent running in a virtual machine, a command to conduct a backup of the virtual machine, the virtual machine being hosted by a host and comprising a copy service having writers responsible for quiescing applications running in the virtual machine;
initiating a discovery of disk types attached to the virtual machine;
based on the discovery, identifying a first disk attached to the virtual machine as being a virtual machine disk (VMDK) formatted disk, and a second disk attached to the virtual machine as being a raw device mapping (RDM) formatted disk;
after the discovery and identification, requesting, via the copy service, that the writers prepare the applications for a snapshot operation, the requesting thereby triggering a time window, prescribed by the copy service, within which the applications and a file system of the virtual machine will be frozen;
issuing, within the time window by the data protection agent and over a socket communication channel, a first request for a snapshot of the VMDK formatted disk to a snapshot data mover running on the host and outside of the virtual machine;
passing, by the snapshot data mover, the first request for the snapshot of the VMDK formatted disk to a virtual machine management center, the virtual machine management center being responsible for management of multiple hosts, including the host, connected to the virtual machine management center and generation of snapshots of VMDK formatted disks;
issuing, within the time window by the data protection agent and in conjunction with the first request and over a Transmission Control Protocol (TCP) network, a second request for a snapshot of the RDM formatted disk to a controller of a storage array responsible for presenting the second disk to the virtual machine;
managing responses to the first request for a snapshot of the VMDK formatted disk and the second request for a snapshot of the RDM formatted disk to conduct the backup, the managing comprising waiting, by the data protection agent, for a first response from the snapshot data mover about the first request for the snapshot of the VMDK formatted disk, and for a second response from the storage array about the second request for the snapshot of the RDM formatted disk; and
upon a threshold time being reached while waiting and without having received one or more of the first response from the snapshot data mover about the first request for the snapshot of the VMDK formatted disk, or the second response from the storage array about the second request for the snapshot of the RDM formatted disk, notifying the copy service that the snapshot operation has been successful.
2 . The method of claim 1 wherein the first and second requests are issued during the same time window within which the applications will be frozen.
3 . The method of claim 1 further comprising:
manipulating the time window within which the applications and the file system of the virtual machine will be frozen for a first snapshot to be generated responsive to the first request and a second snapshot to be generated responsive to the second request, wherein the notifying causes the copy service to thaw the file system and call a post commit snapshots method during which cleanup work associated with the snapshot operation can proceed, wherein the applications remain frozen until a response to the post commit snapshots method is returned, and wherein the manipulating comprises:
holding returning the response to the post commit snapshots method to provide additional time for the first snapshot and the second snapshot to be generated.
4 . The method of claim 1 wherein the managing responses to the first and second snapshot requests comprises:
determining that an error has occurred with at least one of generating a first snapshot in response to the first snapshot request or generating a second snapshot in response to the second snapshot request; and
based on the determination, notifying the copy service of the error.
5 . The method of claim 1 further comprising:
receiving, in response to the first request, an identifier of a first snapshot for the VMDK formatted disk;
not receiving, in response to the second request, an identifier of a second snapshot for the RDM formatted disk;
determining that the backup failed; and
retrying the backup.
6 . The method of claim 1 further comprising:
not receiving, in response to the first request, an identifier of a first snapshot for the VMDK formatted disk;
receiving, in response to the second request, an identifier of a second snapshot for the RDM formatted disk;
determining that the backup failed; and
retrying the backup.
7 . The method of claim 1 further comprising:
before the requesting, via the copy service, that the writers prepare the applications for a snapshot operation, establishing the socket communication channel, the socket communication channel thereby being established before a start of the time window.
8 . The method of claim 7 further comprising:
validating, by the snapshot data mover, that the virtual machine is valid before establishing the socket communication channel.
9 . A system comprising: a processor; and memory configured to store one or more sequences of instructions which, when executed by the processor, cause the processor to carry out the steps of:
receiving, at a data protection agent running in a virtual machine, a command to conduct a backup of the virtual machine, the virtual machine being hosted by a host and comprising a copy service having writers responsible for quiescing applications running in the virtual machine;
initiating a discovery of disk types attached to the virtual machine;
based on the discovery, identifying a first disk attached to the virtual machine as being a virtual machine disk (VMDK) formatted disk, and a second disk attached to the virtual machine as being a raw device mapping (RDM) formatted disk;
after the discovery and identification, requesting, via the copy service, that the writers prepare the applications for a snapshot operation, the requesting thereby triggering a time window, prescribed by the copy service, within which the applications and a file system of the virtual machine will be frozen;
issuing, within the time window by the data protection agent and over a socket communication channel, a first request for a snapshot of the VMDK formatted disk to a snapshot data mover running on the host and outside of the virtual machine;
passing, by the snapshot data mover, the first request for the snapshot of the VMDK formatted disk to a virtual machine management center, the virtual machine management center being responsible for management of multiple hosts, including the host, connected to the virtual machine management center and generation of snapshots of VMDK formatted disks;
issuing, within the time window by the data protection agent and in conjunction with the first request and over a Transmission Control Protocol (TCP) network, a second request for a snapshot of the RDM formatted disk to a controller of a storage array responsible for presenting the second disk to the virtual machine;
managing responses to the first request for a snapshot of the VMDK formatted disk and the second request for a snapshot of the RDM formatted disk to conduct the backup, the managing comprising waiting, by the data protection agent, for a first response from the snapshot data mover about the first request for the snapshot of the VMDK formatted disk, and for a second response from the storage array about the second request for the snapshot of the RDM formatted disk; and
upon a threshold time being reached while waiting and without having received one or more of the first response from the snapshot data mover about the first request for the snapshot of the VMDK formatted disk, or the second response from the storage array about the second request for the snapshot of the RDM formatted disk, notifying the copy service that the snapshot operation has been successful.
10 . The system of claim 9 wherein the first and second requests are issued during the same time window within which the applications will be frozen.
11 . The system of claim 9 wherein the processor further carries out the steps of:
manipulating the time window within which the applications and the file system of the virtual machine will be frozen for a first snapshot to be generated responsive to the first request and a second snapshot to be generated responsive to the second request, wherein the notifying causes the copy service to thaw the file system and call a post commit snapshots method during which cleanup work associated with the snapshot operation can proceed, wherein the applications remain frozen until a response to the post commit snapshots method is returned, and wherein the manipulating comprises:
holding returning the response to the post commit snapshots method to provide additional time for the first snapshot and the second snapshot to be generated.
12 . The system of claim 9 wherein the managing responses to the first and second snapshot requests comprises:
determining that an error has occurred with at least one of generating a first snapshot in response to the first snapshot request or generating a second snapshot in response to the second snapshot request; and
based on the determination, notifying the copy service of the error.
13 . The system of claim 9 wherein the processor further carries out the steps of:
receiving, in response to the first request, an identifier of a first snapshot for the VMDK formatted disk;
not receiving, in response to the second request, an identifier of a second snapshot for the RDM formatted disk;
determining that the backup failed; and
retrying the backup.
14 . The system of claim 9 wherein the processor further carries out the steps of:
not receiving, in response to the first request, an identifier of a first snapshot for the VMDK formatted disk;
receiving, in response to the second request, an identifier of a second snapshot for the RDM formatted disk;
determining that the backup failed; and
retrying the backup.
15 . A computer program product, comprising a non-transitory computer-readable medium having a computer-readable program code embodied therein, the computer-readable program code adapted to be executed by one or more processors to implement a method comprising:
receiving, at a data protection agent running in a virtual machine, a command to conduct a backup of the virtual machine, the virtual machine being hosted by a host and comprising a copy service having writers responsible for quiescing applications running in the virtual machine;
initiating a discovery of disk types attached to the virtual machine;
based on the discovery, identifying a first disk attached to the virtual machine as being a virtual machine disk (VMDK) formatted disk, and a second disk attached to the virtual machine as being a raw device mapping (RDM) formatted disk;
after the discovery and identification, requesting, via the copy service, that the writers prepare the applications for a snapshot operation, the requesting thereby triggering a time window, prescribed by the copy service, within which the applications and a file system of the virtual machine will be frozen;
issuing, within the time window by the data protection agent and over a socket communication channel, a first request for a snapshot of the VMDK formatted disk to a snapshot data mover running on the host and outside of the virtual machine;
passing, by the snapshot data mover, the first request for the snapshot of the VMDK formatted disk to a virtual machine management center, the virtual machine management center being responsible for management of multiple hosts, including the host, connected to the virtual machine management center and generation of snapshots of VMDK formatted disks;
issuing, within the time window by the data protection agent and in conjunction with the first request and over a Transmission Control Protocol (TCP) network, a second request for a snapshot of the RDM formatted disk to a controller of a storage array responsible for presenting the second disk to the virtual machine;
managing responses to the first request for a snapshot of the VMDK formatted disk and the second request for a snapshot of the RDM formatted disk to conduct the backup, the managing comprising waiting, by the data protection agent, for a first response from the snapshot data mover about the first request for the snapshot of the VMDK formatted disk, and for a second response from the storage array about the second request for the snapshot of the RDM formatted disk; and
upon a threshold time being reached while waiting and without having received one or more of the first response from the snapshot data mover about the first request for the snapshot of the VMDK formatted disk, or the second response from the storage array about the second request for the snapshot of the RDM formatted disk, notifying the copy service that the snapshot operation has been successful.
16 . The computer program product of claim 15 wherein the first and second requests are issued during the same time window within which the applications will be frozen.
17 . The computer program product of claim 15 wherein the method further comprises:
manipulating the time window within which the applications and the file system of the virtual machine will be frozen for a first snapshot to be generated responsive to the first request and a second snapshot to be generated responsive to the second request, wherein the notifying causes the copy service to thaw the file system and call a post commit snapshots method during which cleanup work associated with the snapshot operation can proceed, wherein the applications remain frozen until a response to the post commit snapshots method is returned, and wherein the manipulating comprises:
holding returning the response to the post commit snapshots method to provide additional time for the first snapshot and the second snapshot to be generated.
18 . The computer program product of claim 15 wherein the managing responses to the first and second snapshot requests comprises:
determining that an error has occurred with at least one of generating a first snapshot in response to the first snapshot request or generating a second snapshot in response to the second snapshot request; and
based on the determination, notifying the copy service of the error.
19 . The computer program product of claim 15 wherein the method further comprises:
receiving, in response to the first request, an identifier of a first snapshot for the VMDK formatted disk;
not receiving, in response to the second request, an identifier of a second snapshot for the RDM formatted disk;
determining that the backup failed; and
retrying the backup.
20 . The computer program product of claim 15 wherein the method further comprises:
not receiving, in response to the first request, an identifier of a first snapshot for the VMDK formatted disk;
receiving, in response to the second request, an identifier of a second snapshot for the RDM formatted disk;
determining that the backup failed; and
retrying the backup.