@attr(tags=['advanced', 'eip', 'advancedns', 'basic', 'sg'])
def test_upload_attach_volume(self):
    'Test Upload volume and attach to VM in stopped state\n        '
    self.debug(('Uploading the volume: %s' % self.services['volume']['diskname']))
    try:
        volume = Volume.upload(self.apiclient, self.services['volume'], zoneid=self.zone.id, account=self.account.name, domainid=self.account.domainid)
        self.debug(('Uploading the volume: %s' % volume.name))
        volume.wait_for_upload(self.apiclient)
        self.debug('Volume: %s uploaded successfully')
    except Exception as e:
        self.fail(('Failed to upload the volume: %s' % e))
    self.debug(('Deploying VM instance in account: %s' % self.account.name))
    virtual_machine = VirtualMachine.create(self.apiclient, self.services['virtual_machine'], templateid=self.template.id, accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, startvm=False)
    self.assertEqual(virtual_machine.state, 'Stopped', 'Check VM state is Running or not')
    virtual_machine.attach_volume(self.apiclient, volume)
    return
Test Upload volume and attach to VM in stopped state
@attr(tags=['advanced', 'eip', 'advancedns', 'basic', 'sg'])
def test_upload_attach_volume(self):
    '\n        '
    self.debug(('Uploading the volume: %s' % self.services['volume']['diskname']))
    try:
        volume = Volume.upload(self.apiclient, self.services['volume'], zoneid=self.zone.id, account=self.account.name, domainid=self.account.domainid)
        self.debug(('Uploading the volume: %s' % volume.name))
        volume.wait_for_upload(self.apiclient)
        self.debug('Volume: %s uploaded successfully')
    except Exception as e:
        self.fail(('Failed to upload the volume: %s' % e))
    self.debug(('Deploying VM instance in account: %s' % self.account.name))
    virtual_machine = VirtualMachine.create(self.apiclient, self.services['virtual_machine'], templateid=self.template.id, accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, startvm=False)
    self.assertEqual(virtual_machine.state, 'Stopped', 'Check VM state is Running or not')
    virtual_machine.attach_volume(self.apiclient, volume)
    return